Explorar o código

New ticket type "other"

Vijayakrishnan %!s(int64=4) %!d(string=hai) anos
pai
achega
a9e56c9454

+ 26 - 22
resources/views/app/patient/tickets.blade.php

@@ -3,7 +3,7 @@
 
     <?php
 
-    $categories = ['erx', 'lab', 'imaging', 'equipment'];
+    $categories = ['erx', 'lab', 'imaging', 'other'];
 
     function adjustBrightness($hex, $steps) {
         $steps = max(-255, min(255, $steps));
@@ -60,6 +60,7 @@
                 <option value="erx" {{$type === 'erx' ? 'selected' : ''}}>ERx</option>
                 <option value="lab" {{$type === 'lab' ? 'selected' : ''}}>Lab Orders</option>
                 <option value="imaging" {{$type === 'imaging' ? 'selected' : ''}}>Imaging Orders</option>
+                <option value="other" {{$type === 'other' ? 'selected' : ''}}>Other Orders</option>
             </select>
             <select class="hide-inside-ticket-popup ml-2 max-width-200px form-control form-control-sm pr-2"
                     v-model="statusFilter">
@@ -78,6 +79,9 @@
         @if($type === '' || $type === 'imaging')
             @include('app.patient.tickets.imaging')
         @endif
+        @if($type === '' || $type === 'other')
+            @include('app.patient.tickets.other')
+        @endif
 
         @include('app.patient.tickets.ticket_send_fax_form')
     </div>
@@ -103,7 +107,7 @@
                 "erx" => [],
                 "lab" => [],
                 "imaging" => [],
-                "equipment" => [],
+                "other" => []
             ];
 
             $ticketsArray = [];
@@ -162,7 +166,7 @@
                         @include('app.patient.tickets.erx-data')
                         @include('app.patient.tickets.lab-data')
                         @include('app.patient.tickets.imaging-data')
-                        @include('app.patient.tickets.equipment-data')
+                        @include('app.patient.tickets.other-data')
 
                         // common
                         currentCategory: '',
@@ -335,12 +339,12 @@
                                 this.postShowPopup('imaging', _item);
                             });
                         },
-                        equipmentShowPopup: function(_item) {
-                            this.preparePopup('equipment', _item);
+                        otherShowPopup: function(_item) {
+                            this.preparePopup('other', _item);
                             Vue.nextTick(() => {
-                                showStagPopup('equipment-popup', true);
+                                showStagPopup('other-popup', true);
                                 this.reinitProSuggest();
-                                this.postShowPopup('equipment', _item);
+                                this.postShowPopup('other', _item);
                             });
                         },
 
@@ -525,8 +529,8 @@
                             this.imagingSavePopupItem(true);
                         },
 
-                        equipmentSavePopupItem: function(_autoSave = false) {
-                            let form = $('#ticketsApp [stag-popup-key="equipment-popup"] form').first();
+                        otherSavePopupItem: function(_autoSave = false) {
+                            let form = $('#ticketsApp [stag-popup-key="other-popup"] form').first();
                             if(!_autoSave) {
                                 if(!form[0].checkValidity()) {
                                     form[0].reportValidity();
@@ -535,24 +539,24 @@
                             }
                             if(!_autoSave) showMask();
                             let payload = {};
-                            if(this.equipmentPopupMode === 'add') {
+                            if(this.otherPopupMode === 'add') {
                                 payload.clientUid = '{{ $patient->uid  }}';
-                                payload.category = 'equipment';
+                                payload.category = 'other';
                                 payload.assignedProUid = '{{ $pro->uid  }}';
                                 payload.managerProUid = '{{ $pro->uid  }}';
                                 payload.orderingProUid = '{{ $pro->uid  }}';
                                 payload.initiatingProUid = '{{ $pro->uid  }}';
-                                payload.data = JSON.stringify(this.equipmentPopupItem.data);
+                                payload.data = JSON.stringify(this.otherPopupItem.data);
                             }
                             else {
-                                payload.uid = this.equipmentPopupItem.uid;
-                                payload.newData = JSON.stringify(this.equipmentPopupItem.data);
+                                payload.uid = this.otherPopupItem.uid;
+                                payload.newData = JSON.stringify(this.otherPopupItem.data);
                             }
                             @if(request()->input('note-uid'))
                                 payload.noteUid = '{{request()->input('note-uid')}}';
                             @endif
                             $.post(
-                                '/api/ticket/' + (this.equipmentPopupMode === 'add' ? 'create' : 'updateData'),
+                                '/api/ticket/' + (this.otherPopupMode === 'add' ? 'create' : 'updateData'),
                                 payload,
                                 (_data) => {
                                     if(hasResponseError(_data)) {
@@ -561,29 +565,29 @@
                                     }
                                     if(!_autoSave) {
                                         if(_data.data) {
-                                            window.localStorage.autoOpen = 'equipment|' + _data.data;
+                                            window.localStorage.autoOpen = 'other|' + _data.data;
                                             fastReload();
                                         }
                                     }
                                     else {
-                                        this.reloadPopupItem('equipment');
+                                        this.reloadPopupItem('other');
                                     }
                                 },
                                 'json');
                             return false;
                         },
-                        equipmentSaveComment: function() {
+                        otherSaveComment: function() {
                             if(!this.comment) return;
                             let comment = {
                                 pro_id: this.own_pro_id,
                                 created_at: new Date().toLocaleString(),
                                 message: this.comment
                             };
-                            if(!this.equipmentPopupItem.data.comments) {
-                                this.equipmentPopupItem.data.comments = [];
+                            if(!this.otherPopupItem.data.comments) {
+                                this.otherPopupItem.data.comments = [];
                             }
-                            this.equipmentPopupItem.data.comments.push(comment);
-                            this.equipmentSavePopupItem(true);
+                            this.otherPopupItem.data.comments.push(comment);
+                            this.otherSavePopupItem(true);
                         },
 
                         // common

+ 37 - 0
resources/views/app/patient/tickets/other-data.blade.php

@@ -0,0 +1,37 @@
+// other
+otherCollapsed: false,
+otherPopupMode: 'add',
+otherModel: {
+    uid: '',
+    is_open: true,
+    assigned_pro_uid: '',
+    ordering_pro_uid: '',
+    data: {
+        due_date: '',
+        title: '',
+        description: '',
+        memo: '',
+        comments: [{
+            pro_id: '',
+            message: '',
+            created_at: '',
+        }],
+    }
+},
+otherPopupItem: {
+    uid: '',
+    is_open: true,
+    assigned_pro_uid: '',
+    ordering_pro_uid: '',
+    data: {
+        due_date: '',
+        title: '',
+        description: '',
+        memo: '',
+        comments: [{
+            pro_id: '',
+            message: '',
+            created_at: '',
+        }],
+    }
+},

+ 105 - 0
resources/views/app/patient/tickets/other.blade.php

@@ -0,0 +1,105 @@
+<div class="my-4">
+    <div class="d-flex align-items-end mb-3">
+        <h4 class="font-weight-bold m-0 text-secondary font-size-16">Other
+            <span v-if="statusFilter === 'open'" class="text-secondary font-weight-normal">(@{{ otherNumOpen }} open)</span>
+            <span v-if="statusFilter === 'closed'" class="text-secondary font-weight-normal">(@{{ otherNumClosed }} closed)</span>
+            <span v-if="statusFilter === 'all'" class="text-secondary font-weight-normal">(@{{ otherNumOpen }} open, @{{ otherNumClosed }} closed)</span>
+        </h4>
+        <a class="px-3 c-pointer font-weight-bold"
+           v-on:click.prevent="otherShowPopup()">+ New</a>
+        <a class="py-0 font-weight-normal c-pointer flex-grow-1 text-right pr-2"
+           v-if="!otherCollapsed"
+           v-on:click.prevent="otherCollapsed = true">
+            <i class="text-secondary fa fa-chevron-up"></i>
+        </a>
+        <a class="py-0 font-weight-normal c-pointer flex-grow-1 text-right pr-2"
+           v-if="otherCollapsed"
+           v-on:click.prevent="otherCollapsed = false">
+            <i class="text-secondary fa fa-chevron-down"></i>
+        </a>
+    </div>
+    <div class="ticket-section" :class="otherCollapsed ? 'ticket-section-collapsed' : ''">
+        <table class="table table-sm tickets-table mb-0 border-bottom">
+            <tbody>
+            <tr v-for="(item, index) in ticketsByType.other"
+                v-if="(statusFilter === 'all' || (statusFilter === 'open' && item.is_open) || (statusFilter === 'closed' && !item.is_open))"
+                :class="(item.is_open ? ' ' : 'opacity-60 bg-light ') + (currentItemUid === item.uid ? 'current' : '')">
+                <td class="px-2 py-2 c-pointer" v-on:click.prevent="otherShowPopup(item)">
+                    <div class="d-flex align-items-center">
+                        <div class="pro-initials text-uppercase"
+                             :title="allProsFlat['pro_' + item.assigned_pro_id].displayedName"
+                             :style="'background-color: ' + allProsFlat['pro_' + item.assigned_pro_id].colors.bc + '; color: ' + allProsFlat['pro_' + item.assigned_pro_id].colors.fc + ';'">
+                            @{{allProsFlat['pro_' + item.assigned_pro_id].displayedInitials}}
+                        </div>
+                        <div class="flex-grow-1 d-inline-flex ml-2 flex-wrap align-items-center">
+                            <span class="font-weight-bold text-dark font-size-13"
+                                  v-html="item.data.title"></span>
+                            <span class="ml-3 font-weight-bold" v-if="item.data.attachments && item.data.attachments.length">
+                                <i class="fa fa-paperclip"></i>
+                            </span>
+                            <span class="text-nowrap ml-auto text-sm" v-if="item.data.due_date">
+                                <div title="Due Date" class="pro-initials text-uppercase text-white bg-info"><i class="fa fa-calendar-day"></i></div>
+                                <span class="text-secondary ml-1">@{{ item.data.due_date }}</span>
+                            </span>
+                        </div>
+                    </div>
+                    <!--
+                    <div>
+                        <span class="text-secondary text-sm mt-1">Created:</span>
+                        @{{ item.created_at }}
+                    </div>
+                    -->
+                </td>
+
+            </tr>
+            </tbody>
+        </table>
+    </div>
+    <div v-if="!preparing" class="stag-popup stag-popup-sm stag-slide mcp-theme-1" stag-popup-key="other-popup">
+        <form method="POST" action="" class="p-0">
+            <h3 class="stag-popup-title mb-0 p-3 bg-light sticky-top">
+                <span v-if="otherPopupMode === 'add'" class="flex-grow-1 text-nowrap overflow-hidden text-ellipsis mr-3">Add Other Ticket</span>
+                <span v-if="otherPopupMode === 'edit'" class="flex-grow-1 text-nowrap overflow-hidden text-ellipsis mr-3"
+                      v-html="otherPopupItem.data.title ? otherPopupItem.data.title : 'Edit Other Ticket'"></span>
+                @include('app.patient.tickets.header-end', ['category' => 'other'])
+            </h3>
+
+            <!-- common - only applicable for edit -->
+            @include('app.patient.tickets.common-fields', ['category' => 'other'])
+
+            <!-- other specific -->
+            <div class="p-3 border-bottom">
+
+                <div class="row mb-2">
+                    <div class="col-12">
+                        <label class="text-secondary mb-0 font-weight-normal font-size-16">Other</label>
+                    </div>
+                </div>
+
+                <div class="mb-2">
+                    <label class="text-sm text-secondary mb-1">Title</label>
+                    <input required type="text" v-model="otherPopupItem.data.title" placeholder="Title" class="form-control form-control-sm">
+                </div>
+                <div class="mb-2">
+                    <label class="text-sm text-secondary mb-1">Description</label>
+                    <input type="text" v-model="otherPopupItem.data.description" placeholder="Description" class="form-control form-control-sm">
+                </div>
+                <div class="mb-2">
+                    <label class="text-sm text-secondary mb-1">Memo</label>
+                    <input type="text" v-model="otherPopupItem.data.memo" placeholder="Memo" class="form-control form-control-sm">
+                </div>
+            </div>
+
+            <div v-if="otherPopupMode === 'add'" class="d-flex align-items-center justify-content-start mt-3 p-3 border-bottom">
+                <button type="button" class="btn btn-sm btn-primary mr-2" v-on:click.prevent="otherSavePopupItem()">Submit</button>
+                <button type="button" class="btn btn-sm btn-default border" onclick="return closeStagPopup()">Cancel</button>
+            </div>
+
+            <!-- attachments -->
+            @include('app.patient.tickets.attachments', ['category' => 'other'])
+
+            <!-- comments -->
+            @include('app.patient.tickets.comments', ['category' => 'other'])
+        </form>
+    </div>
+</div>