From a845f5b48d18b01aaa393ba14e7a3084d074b6c4 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 26 Aug 2021 09:46:46 +0300 Subject: [PATCH] fix add prescription --- lib/config/config.dart | 4 ++-- lib/screens/prescription/add_prescription_form.dart | 12 +++++++----- .../prescription/prescription_text_filed.dart | 9 ++++----- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index d0ff0df9..d5086b5b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -// const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 6d1609be..9cd5121a 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -424,7 +424,9 @@ class _PrescriptionFormWidgetState extends State { ), PrescriptionTextFiled( width: MediaQuery.of(context).size.width * 0.517, - element: units, + element: model.itemMedicineListUnit.length == 1 + ? model.itemMedicineListUnit[0] + : units, elementError: unitError, keyName: 'description', keyId: 'parameterCode', @@ -443,7 +445,9 @@ class _PrescriptionFormWidgetState extends State { SizedBox(height: spaceBetweenTextFileds), PrescriptionTextFiled( elementList: model.itemMedicineListRoute, - element: route, + element: model.itemMedicineListRoute.length == 1 + ? model.itemMedicineListRoute[0] + : route, elementError: routeError, keyId: 'parameterCode', keyName: 'description', @@ -644,11 +648,9 @@ class _PrescriptionFormWidgetState extends State { eventCategory: "Add Prescription Form", eventAction: "Add Prescription", ); - if (route != null && - duration != null && + if (duration != null && doseTime != null && frequency != null && - units != null && selectedDate != null && strengthController.text != "") { if (_selectedMedication.isNarcotic == true) { diff --git a/lib/screens/prescription/prescription_text_filed.dart b/lib/screens/prescription/prescription_text_filed.dart index dd9428fd..c63ccd1e 100644 --- a/lib/screens/prescription/prescription_text_filed.dart +++ b/lib/screens/prescription/prescription_text_filed.dart @@ -43,10 +43,10 @@ class _PrescriptionTextFiledState extends State { ListSelectDialog dialog = ListSelectDialog( list: widget.elementList, attributeName: '${widget.keyName}', - attributeValueId: '${widget.keyId}', + attributeValueId: + widget.elementList.length == 1 ? widget.elementList[0]['${widget.keyId}'] : '${widget.keyId}', okText: TranslationBase.of(context).ok, - okFunction: (selectedValue) => - widget.okFunction(selectedValue), + okFunction: (selectedValue) => widget.okFunction(selectedValue), ); showDialog( barrierDismissible: false, @@ -65,8 +65,7 @@ class _PrescriptionTextFiledState extends State { ? widget.element['${widget.keyName}'] : null, isTextFieldHasSuffix: true, - validationError: - widget.elementList.length != 1 ? widget.elementError : null, + validationError: widget.elementList.length != 1 ? widget.elementError : null, enabled: false, ), ),