ソースを参照

Prescriptions auto-open newest logic update

Vijayakrishnan 3 年 前
コミット
c34f529cf0
1 ファイル変更8 行追加4 行削除
  1. 8 4
      resources/views/app/patient/prescriptions/list.blade.php

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

@@ -741,6 +741,7 @@ GROUP BY erx_category");
                             };
                             $.post('/api/erx/create', payload, _data => {
                                 if(!hasResponseError(_data)) {
+                                    localStorage.autoOpenNewestPrescription = 1;
                                     fastReload();
                                 }
                             }, 'json');
@@ -1565,11 +1566,14 @@ GROUP BY erx_category");
 
                     // auto select latest prescription (if no current is set)
                     Vue.nextTick(() => {
-                        if(!this.currentPrescription) {
-                            for(let x in this.prescriptions) {
-                                this.currentPrescription = this.prescriptions[x];
-                                break;
+                        if(+localStorage.autoOpenNewestPrescription) {
+                            if(!this.currentPrescription) {
+                                for(let x in this.prescriptions) {
+                                    this.currentPrescription = this.prescriptions[x];
+                                    break;
+                                }
                             }
+                            localStorage.autoOpenNewestPrescription = 0;
                         }
                     });