|
|
|
|
@ -128,6 +128,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
dynamic doseTime;
|
|
|
|
|
dynamic indication;
|
|
|
|
|
dynamic units;
|
|
|
|
|
dynamic uom;
|
|
|
|
|
dynamic box;
|
|
|
|
|
dynamic x;
|
|
|
|
|
|
|
|
|
|
List<dynamic> indicationList;
|
|
|
|
|
@ -222,7 +224,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
(BuildContext context, ScrollController scrollController) {
|
|
|
|
|
return SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: 1010,
|
|
|
|
|
height: MediaQuery.of(context).size.height * 1.45,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 12.0, vertical: 10.0),
|
|
|
|
|
@ -262,12 +264,35 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
? AutoCompleteTextField<
|
|
|
|
|
GetMedicationResponseModel>(
|
|
|
|
|
onFocusChanged: (__) {
|
|
|
|
|
_selectedMedication != null
|
|
|
|
|
? model.getItem(
|
|
|
|
|
itemID:
|
|
|
|
|
_selectedMedication
|
|
|
|
|
.itemId)
|
|
|
|
|
: null;
|
|
|
|
|
if (_selectedMedication !=
|
|
|
|
|
null) {
|
|
|
|
|
model.getItem(
|
|
|
|
|
itemID:
|
|
|
|
|
_selectedMedication
|
|
|
|
|
.itemId);
|
|
|
|
|
uom = _selectedMedication.uom;
|
|
|
|
|
} else {
|
|
|
|
|
null;
|
|
|
|
|
}
|
|
|
|
|
if (_selectedMedication !=
|
|
|
|
|
null &&
|
|
|
|
|
duration != null &&
|
|
|
|
|
frequency != null &&
|
|
|
|
|
strengthController.text !=
|
|
|
|
|
null) {
|
|
|
|
|
model.getBoxQuantity(
|
|
|
|
|
freq: frequency[
|
|
|
|
|
'parameterCode'],
|
|
|
|
|
duration: duration['id'],
|
|
|
|
|
itemCode:
|
|
|
|
|
_selectedMedication
|
|
|
|
|
.itemId,
|
|
|
|
|
strength: double.parse(
|
|
|
|
|
strengthController
|
|
|
|
|
.text));
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
decoration:
|
|
|
|
|
textFieldSelectorDecoration(
|
|
|
|
|
@ -383,6 +408,26 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
"Only 5 Digits allowed for strength");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onSubmit: (_) {
|
|
|
|
|
if (_selectedMedication != null &&
|
|
|
|
|
duration != null &&
|
|
|
|
|
frequency != null &&
|
|
|
|
|
strengthController.text !=
|
|
|
|
|
null) {
|
|
|
|
|
model.getBoxQuantity(
|
|
|
|
|
freq: frequency[
|
|
|
|
|
'parameterCode'],
|
|
|
|
|
duration: duration['id'],
|
|
|
|
|
itemCode:
|
|
|
|
|
_selectedMedication
|
|
|
|
|
.itemId,
|
|
|
|
|
strength: double.parse(
|
|
|
|
|
strengthController
|
|
|
|
|
.text));
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// validator: (value) {
|
|
|
|
|
// if (value.isEmpty &&
|
|
|
|
|
// strengthController.text.length >
|
|
|
|
|
@ -524,6 +569,27 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
frequency = selectedValue;
|
|
|
|
|
frequency['isDefault'] =
|
|
|
|
|
true;
|
|
|
|
|
if (_selectedMedication !=
|
|
|
|
|
null &&
|
|
|
|
|
duration != null &&
|
|
|
|
|
frequency != null &&
|
|
|
|
|
strengthController
|
|
|
|
|
.text !=
|
|
|
|
|
null) {
|
|
|
|
|
model.getBoxQuantity(
|
|
|
|
|
freq: frequency[
|
|
|
|
|
'parameterCode'],
|
|
|
|
|
duration:
|
|
|
|
|
duration['id'],
|
|
|
|
|
itemCode:
|
|
|
|
|
_selectedMedication
|
|
|
|
|
.itemId,
|
|
|
|
|
strength: double.parse(
|
|
|
|
|
strengthController
|
|
|
|
|
.text));
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@ -706,6 +772,29 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
duration = selectedValue;
|
|
|
|
|
if (_selectedMedication !=
|
|
|
|
|
null &&
|
|
|
|
|
duration != null &&
|
|
|
|
|
frequency != null &&
|
|
|
|
|
strengthController
|
|
|
|
|
.text !=
|
|
|
|
|
null) {
|
|
|
|
|
model.getBoxQuantity(
|
|
|
|
|
freq: frequency[
|
|
|
|
|
'parameterCode'],
|
|
|
|
|
duration:
|
|
|
|
|
duration['id'],
|
|
|
|
|
itemCode:
|
|
|
|
|
_selectedMedication
|
|
|
|
|
.itemId,
|
|
|
|
|
strength: double.parse(
|
|
|
|
|
strengthController
|
|
|
|
|
.text),
|
|
|
|
|
);
|
|
|
|
|
box = model.boxQuintity;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
@ -732,6 +821,90 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.allMedicationList != null
|
|
|
|
|
? () {
|
|
|
|
|
Helpers.hideKeyboard(context);
|
|
|
|
|
ListSelectDialog dialog =
|
|
|
|
|
ListSelectDialog(
|
|
|
|
|
list: model.allMedicationList,
|
|
|
|
|
attributeName: 'nameEn',
|
|
|
|
|
attributeValueId: 'id',
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
duration = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
"UOM",
|
|
|
|
|
uom != null ? uom : null,
|
|
|
|
|
true),
|
|
|
|
|
//enabled: false,
|
|
|
|
|
readOnly: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.allMedicationList != null
|
|
|
|
|
? () {
|
|
|
|
|
Helpers.hideKeyboard(context);
|
|
|
|
|
ListSelectDialog dialog =
|
|
|
|
|
ListSelectDialog(
|
|
|
|
|
list: model.allMedicationList,
|
|
|
|
|
attributeName: 'nameEn',
|
|
|
|
|
attributeValueId: 'id',
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
duration = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
"Box Quantity",
|
|
|
|
|
box != null
|
|
|
|
|
? "Box Quantity: " +
|
|
|
|
|
model.boxQuintity.toString()
|
|
|
|
|
: null,
|
|
|
|
|
true),
|
|
|
|
|
//enabled: false,
|
|
|
|
|
readOnly: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
|