From 963fe42cd856509dbf54b553a04f70601c46d34b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 16 Feb 2021 14:30:50 +0200 Subject: [PATCH 1/6] new changes --- lib/core/viewModel/medicine_view_model.dart | 4 ++-- lib/screens/prescription/add_prescription_form.dart | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index 272c5228..ecb0a48a 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -43,11 +43,11 @@ class MedicineViewModel extends BaseViewModel { Future getItem({int itemID}) async { //hasError = false; //_insuranceCardService.clearInsuranceCard(); - setState(ViewState.BusyLocal); + setState(ViewState.Busy); await _prescriptionService.getItem(itemID: itemID); if (_prescriptionService.hasError) { error = _prescriptionService.error; - setState(ViewState.ErrorLocal); + setState(ViewState.Error); } else setState(ViewState.Idle); } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 881dc2de..68d4e633 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -201,7 +201,7 @@ class _PrescriptionFormWidgetState extends State { await model.getMedicationDoseTime(); //await model.getMedicationIndications(); await model.getPatientAssessment(getAssessmentReqModel); - await model.getItem(); + //await model.getItem(); }, builder: ( BuildContext context, From 57aea2ba4fa4cc45604c97482b7b8d1aefe78b4b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 16 Feb 2021 15:44:47 +0200 Subject: [PATCH 2/6] pharmacy remarks --- lib/core/viewModel/medicine_view_model.dart | 4 ++-- lib/screens/prescription/add_prescription_form.dart | 2 +- lib/screens/prescription/prescription_screen.dart | 9 +++------ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index ecb0a48a..272c5228 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -43,11 +43,11 @@ class MedicineViewModel extends BaseViewModel { Future getItem({int itemID}) async { //hasError = false; //_insuranceCardService.clearInsuranceCard(); - setState(ViewState.Busy); + setState(ViewState.BusyLocal); await _prescriptionService.getItem(itemID: itemID); if (_prescriptionService.hasError) { error = _prescriptionService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 68d4e633..881dc2de 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -201,7 +201,7 @@ class _PrescriptionFormWidgetState extends State { await model.getMedicationDoseTime(); //await model.getMedicationIndications(); await model.getPatientAssessment(getAssessmentReqModel); - //await model.getItem(); + await model.getItem(); }, builder: ( BuildContext context, diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index f7012f1d..3e62d6e0 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -383,12 +383,9 @@ class _NewPrescriptionScreenState extends State { ), Expanded( child: AppText( - "", // commening below code because there is an error coming in the model please fix it before pushing it - // model.prescriptionList[0].entityList[index].pharmacistRemarks == null - // ? "" - // : model.prescriptionList[0].entityList[index].pharmacistRemarks, - fontSize: - 15.0), + // commening below code because there is an error coming in the model please fix it before pushing it + model.prescriptionList[0].entityList[index].pharmacistRemarks == null ? "" : model.prescriptionList[0].entityList[index].pharmacistRemarks, + fontSize: 15.0), ) ], ), From 2ee2429c70bf096feeae6bf5a5570d4240080f50 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 16 Feb 2021 16:09:32 +0200 Subject: [PATCH 3/6] Date Formate change --- .../prescription/add_prescription_form.dart | 2 +- .../prescription/prescription_screen.dart | 29 ++++++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 881dc2de..68d4e633 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -201,7 +201,7 @@ class _PrescriptionFormWidgetState extends State { await model.getMedicationDoseTime(); //await model.getMedicationIndications(); await model.getPatientAssessment(getAssessmentReqModel); - await model.getItem(); + //await model.getItem(); }, builder: ( BuildContext context, diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 3e62d6e0..4800c361 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -209,16 +209,17 @@ class _NewPrescriptionScreenState extends State { child: Column( children: [ AppText( - DateTime.parse(model - .prescriptionList[ - 0] - .entityList[ - index] - .createdOn) - .day + (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) != + null + ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn).year) + .toString() + : DateTime.now() + .year) .toString(), color: Colors .green, + fontSize: + 13.5, ), AppText( Helpers.getMonth(model.prescriptionList[0].entityList[index].createdOn != @@ -230,7 +231,19 @@ class _NewPrescriptionScreenState extends State { .toUpperCase(), color: Colors .green, - ) + ), + AppText( + DateTime.parse(model + .prescriptionList[ + 0] + .entityList[ + index] + .createdOn) + .day + .toString(), + color: Colors + .green, + ), ], ), ), From 54ad8bde0b658041db1db80cb9895d581b64e1de Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 17 Feb 2021 15:39:17 +0200 Subject: [PATCH 4/6] design inhancment --- .../update_prescription_form.dart | 156 ++++++++++-------- lib/screens/procedures/procedure_screen.dart | 116 +++++++------ 2 files changed, 152 insertions(+), 120 deletions(-) diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 6086c278..c50059f2 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -558,78 +558,90 @@ class _UpdatePrescriptionFormState extends State { height: 12.0, ), Container( - height: screenSize.height * 0.070, - width: double.infinity, - child: Row( - children: [ - Container( - width: MediaQuery.of(context) - .size - .width * - 0.29, - child: InkWell( - onTap: indicationList != null - ? () { - Helpers.hideKeyboard( - context); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - model.patientAssessmentList - .isNotEmpty - ? model - .patientAssessmentList[ - 0] - .icdCode10ID - .toString() - : '', - indication != null - ? indication['name'] - : null, - true), - enabled: true, - readOnly: true, - ), - ), - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.61, - child: InkWell( - onTap: indicationList != null - ? () { - Helpers.hideKeyboard( - context); - } - : null, - child: TextField( - maxLines: 3, - decoration: - textFieldSelectorDecoration( - model.patientAssessmentList - .isNotEmpty - ? model - .patientAssessmentList[ - 0] - .asciiDesc - .toString() - : '', - indication != null - ? indication['name'] - : null, - true), - enabled: true, - readOnly: true, - ), - ), - ), - ], - ), - ), + height: model.patientAssessmentList + .isNotEmpty + ? screenSize.height * 0.070 + : 0.0, + width: model.patientAssessmentList + .isNotEmpty + ? double.infinity + : 0.0, + child: model.patientAssessmentList + .isNotEmpty + ? Row( + children: [ + Container( + width: + MediaQuery.of(context) + .size + .width * + 0.29, + child: InkWell( + onTap: + indicationList != null + ? () { + Helpers.hideKeyboard( + context); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + model.patientAssessmentList + .isNotEmpty + ? model + .patientAssessmentList[ + 0] + .icdCode10ID + .toString() + : '', + indication != null + ? indication[ + 'name'] + : null, + true), + enabled: true, + readOnly: true, + ), + ), + ), + Container( + width: + MediaQuery.of(context) + .size + .width * + 0.61, + child: InkWell( + onTap: + indicationList != null + ? () { + Helpers.hideKeyboard( + context); + } + : null, + child: TextField( + maxLines: 3, + decoration: textFieldSelectorDecoration( + model.patientAssessmentList + .isNotEmpty + ? model + .patientAssessmentList[ + 0] + .asciiDesc + .toString() + : '', + indication != null + ? indication[ + 'name'] + : null, + true), + enabled: true, + readOnly: true, + ), + ), + ), + ], + ) + : null), SizedBox( height: 12.0, ), diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 1e225ce9..afe8a63e 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -221,49 +221,69 @@ class _ProcedureScreenState extends State { child: Column( children: [ AppText( - DateTime.parse(model - .procedureList[ - 0] - .entityList[ - index] - .orderDate) - .day - .toString(), - color: - Colors.green, - ), + DateTime.parse(model + .procedureList[ + 0] + .entityList[ + index] + .orderDate) + .year + .toString(), + color: model + .procedureList[ + 0] + .entityList[ + index] + .orderType == + 0 + ? Color( + 0xFFB9382C) + : Colors + .green), AppText( - Helpers.getMonth(model - .procedureList[ - 0] - .entityList[ - index] - .orderDate != - null - ? (DateTime.parse(model - .procedureList[ - 0] - .entityList[ - index] - .orderDate) - .month) - : DateTime - .now() - .month) - .toUpperCase(), - color: - Colors.green, - ) + Helpers.getMonth(model.procedureList[0].entityList[index].orderDate != + null + ? (DateTime.parse(model.procedureList[0].entityList[index].orderDate) + .month) + : DateTime.now() + .month) + .toUpperCase(), + color: model + .procedureList[ + 0] + .entityList[ + index] + .orderType == + 0 + ? Color( + 0xFFB9382C) + : Colors + .green), + AppText( + DateTime.parse(model + .procedureList[ + 0] + .entityList[ + index] + .orderDate) + .day + .toString(), + color: model + .procedureList[ + 0] + .entityList[ + index] + .orderType == + 0 + ? Color( + 0xFFB9382C) + : Colors + .green), ], ), ), Expanded( child: Container( - // height: MediaQuery.of( - // context) - // .size - // .height * - // 0.21, width: MediaQuery.of( context) .size @@ -308,17 +328,17 @@ class _ProcedureScreenState extends State { 13.0, ), Expanded( - child: - AppText( - model.procedureList[0].entityList[index].orderType == - 1 - ? 'Routine' - : 'Urgent', - fontSize: - 11.5, - color: Color( - 0xFFB9382C), - ), + child: AppText( + model.procedureList[0].entityList[index].orderType == + 1 + ? 'Routine' + : 'Urgent', + fontSize: + 13.5, + color: model.procedureList[0].entityList[index].orderType == + 0 + ? Color(0xFFB9382C) + : Colors.green), ), ], ), From 0f15732728a27b62fbc16f8a0f753a49184e052f Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 17 Feb 2021 15:44:15 +0200 Subject: [PATCH 5/6] design inhancment --- lib/core/viewModel/medicine_view_model.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core/viewModel/medicine_view_model.dart b/lib/core/viewModel/medicine_view_model.dart index 272c5228..ecb0a48a 100644 --- a/lib/core/viewModel/medicine_view_model.dart +++ b/lib/core/viewModel/medicine_view_model.dart @@ -43,11 +43,11 @@ class MedicineViewModel extends BaseViewModel { Future getItem({int itemID}) async { //hasError = false; //_insuranceCardService.clearInsuranceCard(); - setState(ViewState.BusyLocal); + setState(ViewState.Busy); await _prescriptionService.getItem(itemID: itemID); if (_prescriptionService.hasError) { error = _prescriptionService.error; - setState(ViewState.ErrorLocal); + setState(ViewState.Error); } else setState(ViewState.Idle); } From ae17998e0ae4a87cef20078048274cba0bcddeb2 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 17 Feb 2021 20:56:00 +0200 Subject: [PATCH 6/6] Design inhancment --- .../prescription/add_prescription_form.dart | 12 +++---- .../update_prescription_form.dart | 34 ++++++++++++++++--- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 68d4e633..b25d3928 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -360,12 +360,12 @@ class _PrescriptionFormWidgetState extends State { .width * 0.550, child: TextFields( - // inputFormatters: [ - // LengthLimitingTextInputFormatter( - // 4), - // WhitelistingTextInputFormatter - // .digitsOnly - // ], + inputFormatters: [ + LengthLimitingTextInputFormatter( + 4), + // WhitelistingTextInputFormatter + // .digitsOnly + ], hintText: TranslationBase.of(context) .strength, diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index c50059f2..ace71350 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -115,7 +115,7 @@ class _UpdatePrescriptionFormState extends State { (BuildContext context, StateSetter setState /*You can rename this!*/) { return BaseView( onModelReady: (model) async { - await model.getMedicationList(); + //await model.getMedicationList(); await model.getMedicationStrength(); await model.getMedicationDuration(); await model.getMedicationRoute(); @@ -257,14 +257,17 @@ class _UpdatePrescriptionFormState extends State { inputFormatters: [ LengthLimitingTextInputFormatter( 4), - WhitelistingTextInputFormatter - .digitsOnly + // WhitelistingTextInputFormatter + // .digitsOnly ], + hintText: widget.doseStreangth, fontSize: 15.0, controller: strengthController, - keyboardType: - TextInputType.number, + keyboardType: TextInputType + .numberWithOptions( + decimal: true, + ), onChanged: (String value) { setState(() { strengthChar = value.length; @@ -700,6 +703,27 @@ class _UpdatePrescriptionFormState extends State { title: 'update prescription' .toUpperCase(), onPressed: () { + if (int.parse( + strengthController.text) > + 1000) { + DrAppToastMsg.showErrorToast( + "1000 is the MAX for the strength"); + return; + } + if (int.parse(strengthController + .text) == + 0) { + DrAppToastMsg.showErrorToast( + "Streangth can't be zero"); + return; + } + if (strengthController + .text.length > + 4) { + DrAppToastMsg.showErrorToast( + "Streangth can't be zero"); + return; + } updatePrescription( newStartDate: selectedDate, newDoseStreangth: