merge-requests/329/head
hussam al-habibeh 4 years ago
parent eb88bea880
commit dc941b709f

@ -5,14 +5,16 @@ class GetMedicationResponseModel {
String keywords; String keywords;
dynamic price; dynamic price;
dynamic quantity; dynamic quantity;
bool isNarcotic;
GetMedicationResponseModel( GetMedicationResponseModel(
{this.description, {this.description,
this.genericName, this.genericName,
this.itemId, this.itemId,
this.keywords, this.keywords,
this.price, this.price,
this.quantity}); this.quantity,
this.isNarcotic});
GetMedicationResponseModel.fromJson(Map<String, dynamic> json) { GetMedicationResponseModel.fromJson(Map<String, dynamic> json) {
description = json['Description']; description = json['Description'];
@ -21,6 +23,7 @@ class GetMedicationResponseModel {
keywords = json['Keywords']; keywords = json['Keywords'];
price = json['Price']; price = json['Price'];
quantity = json['Quantity']; quantity = json['Quantity'];
isNarcotic = json['isNarcotic'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -31,6 +34,7 @@ class GetMedicationResponseModel {
data['Keywords'] = this.keywords; data['Keywords'] = this.keywords;
data['Price'] = this.price; data['Price'] = this.price;
data['Quantity'] = this.quantity; data['Quantity'] = this.quantity;
data['isNarcotic'] = this.isNarcotic;
return data; return data;
} }
} }

@ -361,8 +361,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
0.550, 0.550,
child: TextFields( child: TextFields(
inputFormatters: [ inputFormatters: [
// LengthLimitingTextInputFormatter( LengthLimitingTextInputFormatter(
// 4), 5),
// WhitelistingTextInputFormatter // WhitelistingTextInputFormatter
// .digitsOnly // .digitsOnly
], ],
@ -378,9 +378,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
setState(() { setState(() {
strengthChar = value.length; strengthChar = value.length;
}); });
if (strengthChar >= 4) { if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Only 4 Digits allowed for strength"); "Only 5 Digits allowed for strength");
} }
}, },
// validator: (value) { // validator: (value) {
@ -757,6 +757,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
// formKey.currentState.save(); // formKey.currentState.save();
// Navigator.pop(context); // Navigator.pop(context);
// openDrugToDrug(); // openDrugToDrug();
if (_selectedMedication
.isNarcotic ==
true) {
DrAppToastMsg.showErrorToast(
"Narcotic medicine can only be prescribed from VIDA");
Navigator.pop(context);
return;
}
if (route == null || if (route == null ||
frequency == null || frequency == null ||
doseTime == null || doseTime == null ||
@ -775,10 +783,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
return; return;
} }
if (double.parse( if (double.parse(
strengthController.text) == strengthController.text) <
0.0) { 0.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Streangth can't be zero"); "strength can't be zero");
return; return;
} }
@ -794,16 +802,20 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
// .join(','); // .join(',');
postProcedure( postProcedure(
icdCode: model icdCode: model
.patientAssessmentList[ .patientAssessmentList
0] .isNotEmpty
.icdCode10ID ? model
.isEmpty .patientAssessmentList[
? "test" 0]
: model .icdCode10ID
.patientAssessmentList[ .isEmpty
0] ? "test"
.icdCode10ID : model
.toString(), .patientAssessmentList[
0]
.icdCode10ID
.toString()
: "TEST",
// icdCode: model // icdCode: model
// .patientAssessmentList // .patientAssessmentList
// .map((value) => value // .map((value) => value

@ -256,7 +256,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
child: TextFields( child: TextFields(
inputFormatters: [ inputFormatters: [
LengthLimitingTextInputFormatter( LengthLimitingTextInputFormatter(
4), 5),
// WhitelistingTextInputFormatter // WhitelistingTextInputFormatter
// .digitsOnly // .digitsOnly
], ],
@ -272,9 +272,9 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
setState(() { setState(() {
strengthChar = value.length; strengthChar = value.length;
}); });
if (strengthChar >= 4) { if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Only 4 Digits allowed for strength"); "Only 5 Digits allowed for strength");
} }
}, },
// validator: (value) { // validator: (value) {
@ -715,14 +715,14 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
.text) == .text) ==
0.0) { 0.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Streangth can't be zero"); "strength can't be zero");
return; return;
} }
if (strengthController if (strengthController
.text.length > .text.length >
4) { 4) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
"Streangth can't be zero"); "strength can't be more then 4 digits ");
return; return;
} }
updatePrescription( updatePrescription(

Loading…
Cancel
Save