diff --git a/lib/core/model/get_medication_response_model.dart b/lib/core/model/get_medication_response_model.dart index f9df77a3..1f9597f5 100644 --- a/lib/core/model/get_medication_response_model.dart +++ b/lib/core/model/get_medication_response_model.dart @@ -5,14 +5,16 @@ class GetMedicationResponseModel { String keywords; dynamic price; dynamic quantity; + bool isNarcotic; GetMedicationResponseModel( {this.description, - this.genericName, - this.itemId, - this.keywords, - this.price, - this.quantity}); + this.genericName, + this.itemId, + this.keywords, + this.price, + this.quantity, + this.isNarcotic}); GetMedicationResponseModel.fromJson(Map json) { description = json['Description']; @@ -21,6 +23,7 @@ class GetMedicationResponseModel { keywords = json['Keywords']; price = json['Price']; quantity = json['Quantity']; + isNarcotic = json['isNarcotic']; } Map toJson() { @@ -31,6 +34,7 @@ class GetMedicationResponseModel { data['Keywords'] = this.keywords; data['Price'] = this.price; data['Quantity'] = this.quantity; + data['isNarcotic'] = this.isNarcotic; return data; } } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 5ec6e240..b3398cb3 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -361,8 +361,8 @@ class _PrescriptionFormWidgetState extends State { 0.550, child: TextFields( inputFormatters: [ - // LengthLimitingTextInputFormatter( - // 4), + LengthLimitingTextInputFormatter( + 5), // WhitelistingTextInputFormatter // .digitsOnly ], @@ -378,9 +378,9 @@ class _PrescriptionFormWidgetState extends State { setState(() { strengthChar = value.length; }); - if (strengthChar >= 4) { + if (strengthChar >= 5) { DrAppToastMsg.showErrorToast( - "Only 4 Digits allowed for strength"); + "Only 5 Digits allowed for strength"); } }, // validator: (value) { @@ -757,6 +757,14 @@ class _PrescriptionFormWidgetState extends State { // formKey.currentState.save(); // Navigator.pop(context); // openDrugToDrug(); + if (_selectedMedication + .isNarcotic == + true) { + DrAppToastMsg.showErrorToast( + "Narcotic medicine can only be prescribed from VIDA"); + Navigator.pop(context); + return; + } if (route == null || frequency == null || doseTime == null || @@ -775,10 +783,10 @@ class _PrescriptionFormWidgetState extends State { return; } if (double.parse( - strengthController.text) == + strengthController.text) < 0.0) { DrAppToastMsg.showErrorToast( - "Streangth can't be zero"); + "strength can't be zero"); return; } @@ -794,16 +802,20 @@ class _PrescriptionFormWidgetState extends State { // .join(','); postProcedure( icdCode: model - .patientAssessmentList[ - 0] - .icdCode10ID - .isEmpty - ? "test" - : model - .patientAssessmentList[ - 0] - .icdCode10ID - .toString(), + .patientAssessmentList + .isNotEmpty + ? model + .patientAssessmentList[ + 0] + .icdCode10ID + .isEmpty + ? "test" + : model + .patientAssessmentList[ + 0] + .icdCode10ID + .toString() + : "TEST", // icdCode: model // .patientAssessmentList // .map((value) => value diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 8ed5c79b..3420783e 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -256,7 +256,7 @@ class _UpdatePrescriptionFormState extends State { child: TextFields( inputFormatters: [ LengthLimitingTextInputFormatter( - 4), + 5), // WhitelistingTextInputFormatter // .digitsOnly ], @@ -272,9 +272,9 @@ class _UpdatePrescriptionFormState extends State { setState(() { strengthChar = value.length; }); - if (strengthChar >= 4) { + if (strengthChar >= 5) { DrAppToastMsg.showErrorToast( - "Only 4 Digits allowed for strength"); + "Only 5 Digits allowed for strength"); } }, // validator: (value) { @@ -715,14 +715,14 @@ class _UpdatePrescriptionFormState extends State { .text) == 0.0) { DrAppToastMsg.showErrorToast( - "Streangth can't be zero"); + "strength can't be zero"); return; } if (strengthController .text.length > 4) { DrAppToastMsg.showErrorToast( - "Streangth can't be zero"); + "strength can't be more then 4 digits "); return; } updatePrescription(