瀏覽代碼

ERx preserve active/open erx item after add/edit ops

Vijayakrishnan 3 年之前
父節點
當前提交
d5f88205d3
共有 1 個文件被更改,包括 21 次插入4 次删除
  1. 21 4
      resources/views/app/patient/prescriptions/list.blade.php

+ 21 - 4
resources/views/app/patient/prescriptions/list.blade.php

@@ -38,7 +38,7 @@
                 <tbody>
                 <tr v-for="(prescription, index) in prescriptions" :class="currentPrescription && currentPrescription.id === prescription.id ? 'bg-aliceblue' : ''">
                     <td class="width-150px" :class="currentPrescription && currentPrescription.id === prescription.id ? 'row-selection-highlight' : ''">
-                        <a href="#" v-on:click.prevent="currentPrescription=prescription; setAddMode('')"
+                        <a href="#" v-on:click.prevent="setCurrentPrescription(prescription, '');"
                            class="text-nowrap"
                            :class="currentPrescription && currentPrescription.id === prescription.id ? 'font-weight-bold' : ''">
                             @{{prescription.created_at_friendly_short}}
@@ -105,7 +105,7 @@
                 <h3 class="font-size-16 m-0">
                     <b class="mr-1 font-size-16">@{{ currentPrescription.erx_category }} ERx <span class="ml-2">@{{ currentPrescription.created_at_friendly_short }}</span></b>
                 </h3>
-                <a class="ml-auto" href="#" v-on:click.prevent="currentPrescription=null">
+                <a class="ml-auto" href="#" v-on:click.prevent="setCurrentPrescription(null);">
                     <i class="fa fa-times-circle on-hover-opaque"></i>
                 </a>
             </div>
@@ -726,7 +726,6 @@ GROUP BY erx_category");
                         }, 'json');
                     },
 
-                    // new eRx (only for popup-list)
                     newERx: function(_type) {
                         if(!!this.numUnsigned[_type]) {
                             toastr.error('There is already an unsigned ERx of type ' + _type + ' in this note.');
@@ -1418,8 +1417,15 @@ GROUP BY erx_category");
                             }
                         }, 'json');
                     },
-                    setCurrentPrescription: function(_prescription) {
+                    setCurrentPrescription: function(_prescription, _addMode = false) {
                         this.currentPrescription = _prescription;
+                        if(_addMode !== false) {
+                            this.setAddMode(_addMode);
+                        }
+
+                        @if(@$note)
+                        localStorage['currentErx_{{$note->id}}'] = _prescription.id;
+                        @endif
                     },
                     setAddMode: function(_mode) {
                         let self = this;
@@ -1577,6 +1583,17 @@ GROUP BY erx_category");
                         }
                     });
 
+                    @if(@$note)
+                    if(!!localStorage['currentErx_{{$note->id}}']) {
+                        for(let x in this.prescriptions) {
+                            if(this.prescriptions[x].id === +(localStorage['currentErx_{{$note->id}}'])) {
+                                this.currentPrescription = this.prescriptions[x];
+                                break;
+                            }
+                        }
+                    }
+                    @endif
+
                     $('[stag-popup-key="logistics-popup"] .facility-search').off('stag-suggest-selected');
                     $('[stag-popup-key="logistics-popup"] .facility-search').on('stag-suggest-selected', (_e, _input, _data) => {
                         if(self.currentPrescriptionLogistics && self.currentPrescriptionLogistics.logisticsDetailJson) {