Prechádzať zdrojové kódy

Require "dispense" and "refills"

Vijayakrishnan 3 rokov pred
rodič
commit
43f70811f3

+ 17 - 5
resources/views/app/patient/prescriptions-popup/list-popup.blade.php

@@ -995,17 +995,29 @@ GROUP BY erx_category");
                         return true;
                     },
                     addExistingDrugToERx: function(_uid) {
+                        let existing = this.existingDrugs.filter(_x => {
+                            return _x.uid === _uid;
+                        });
+                        if(!existing || !existing.length) return false;
+                        existing = existing[0];
+
+                        // require dispense and refills
+                        if(!existing.data.dispense) {
+                            toastr.error('Dispense cannot be blank');
+                            return false;
+                        }
+                        if(!existing.data.refills) {
+                            toastr.error('Refills cannot be blank');
+                            return false;
+                        }
+
                         if(!this.currentPrescription.clinical_detail_json) {
                             this.currentPrescription.clinical_detail_json = {};
                         }
                         if(!this.currentPrescription.clinical_detail_json.items) {
                             this.currentPrescription.clinical_detail_json.items = [];
                         }
-                        let existing = this.existingDrugs.filter(_x => {
-                            return _x.uid === _uid;
-                        });
-                        if(!existing || !existing.length) return false;
-                        existing = existing[0];
+
                         this.currentPrescription.clinical_detail_json.items.push({
                             medication: existing.data.name,
                             dispense: existing.data.dispense,

+ 16 - 5
resources/views/app/patient/prescriptions/list.blade.php

@@ -1013,17 +1013,28 @@ GROUP BY erx_category");
                         return true;
                     },
                     addExistingDrugToERx: function(_uid) {
+                        let existing = this.existingDrugs.filter(_x => {
+                            return _x.uid === _uid;
+                        });
+                        if(!existing || !existing.length) return false;
+                        existing = existing[0];
+
+                        // require dispense and refills
+                        if(!existing.data.dispense) {
+                            toastr.error('Dispense cannot be blank');
+                            return false;
+                        }
+                        if(!existing.data.refills) {
+                            toastr.error('Refills cannot be blank');
+                            return false;
+                        }
+
                         if(!this.currentPrescription.clinical_detail_json) {
                             this.currentPrescription.clinical_detail_json = {};
                         }
                         if(!this.currentPrescription.clinical_detail_json.items) {
                             this.currentPrescription.clinical_detail_json.items = [];
                         }
-                        let existing = this.existingDrugs.filter(_x => {
-                            return _x.uid === _uid;
-                        });
-                        if(!existing || !existing.length) return false;
-                        existing = existing[0];
                         this.currentPrescription.clinical_detail_json.items.push({
                             medication: existing.data.name,
                             dispense: existing.data.dispense,