Merge branch 'jan_fix_bugs' into 'development'

plan for refactor prescriptions

See merge request Cloud_Solution/doctor_app_flutter!956
merge-requests/953/merge
Elham Ali 4 years ago
commit 74501dbf07

@ -229,6 +229,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<MedicineViewModel>( return BaseView<MedicineViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
/// TODO Elham* Move this to view model
x = model.patientAssessmentList.map((element) { x = model.patientAssessmentList.map((element) {
return element.icdCode10ID; return element.icdCode10ID;
}); });
@ -331,7 +332,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: Wrap( child: Wrap(
alignment: WrapAlignment.center, alignment: WrapAlignment.center,
children: <Widget>[ children: <Widget>[
// TODO change it secondary button and add loading
AppButton( AppButton(
title: TranslationBase.of( title: TranslationBase.of(
context) context)
@ -647,6 +647,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: InkWell( child: InkWell(
onTap: () => selectDate( onTap: () => selectDate(
context, widget.model), context, widget.model),
/// TODO Elham* Use customTextFields for all TextFields here
child: TextField( child: TextField(
decoration: decoration:
textFieldSelectorDecoration( textFieldSelectorDecoration(
@ -667,6 +668,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
), ),
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
/// TODO Elham* Use customTextFields for all
PrescriptionTextFiled( PrescriptionTextFiled(
element: duration, element: duration,
elementError: durationError, elementError: durationError,
@ -787,6 +789,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.addMedication, .addMedication,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
onPressed: () async { onPressed: () async {
/// TODO Elham* Use it to separate function
await locator< await locator<
AnalyticsService>() AnalyticsService>()
.logEvent( .logEvent(
@ -1016,7 +1019,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
}); });
} }
} }
/// TODO Elham* Use it from the textfeild utils
InputDecoration textFieldSelectorDecoration( InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown, String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) { {Icon suffixIcon}) {
@ -1062,6 +1065,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
builder: (context) { builder: (context) {
/// TODO Elham* Move this to widget
return Container( return Container(
height: SizeConfig.realScreenHeight * .8, height: SizeConfig.realScreenHeight * .8,
width: SizeConfig.realScreenWidth, width: SizeConfig.realScreenWidth,
@ -1122,6 +1126,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
}); });
} }
/// TODO Elham* Move this to view model
getPriscriptionforDrug( getPriscriptionforDrug(
List<PrescriptionModel> prescriptionList, MedicineViewModel model) { List<PrescriptionModel> prescriptionList, MedicineViewModel model) {
var prescriptionDetails = []; var prescriptionDetails = [];

@ -114,6 +114,9 @@ class _DrugToDrug extends State<DrugToDrug> {
} }
getRequestedData() async { getRequestedData() async {
/// TODO Elham* rename model to meaning full not just modle with number
await model.getPatientVitalSign(widget.patient); await model.getPatientVitalSign(widget.patient);
await model2.getPatientAllergy(generalGetReqForSOAP); await model2.getPatientAllergy(generalGetReqForSOAP);
await model2.getMasterLookup(MasterKeysService.DiagnosisType); await model2.getMasterLookup(MasterKeysService.DiagnosisType);

@ -862,6 +862,8 @@ class _PrescriptionCheckOutScreenState
} }
} }
/// TODO Elham* Use it from the textfeild utils
InputDecoration textFieldSelectorDecoration( InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown, String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) { {Icon suffixIcon}) {

@ -44,7 +44,7 @@ class _PrescriptionTextFiledState extends State<PrescriptionTextFiled> {
list: widget.elementList, list: widget.elementList,
attributeName: '${widget.keyName}', attributeName: '${widget.keyName}',
attributeValueId: widget.elementList.length == 1 attributeValueId: widget.elementList.length == 1
? widget.elementList[0]['${widget.keyId}'] ? widget.elementList[0]['${widget.keyId}'].toString()
: '${widget.keyId}', : '${widget.keyId}',
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) => okFunction: (selectedValue) =>

@ -68,6 +68,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
int testNum = 0; int testNum = 0;
int strengthChar; int strengthChar;
PatiantInformtion patient; PatiantInformtion patient;
/// TODO Elham* add type
dynamic route; dynamic route;
dynamic doseTime; dynamic doseTime;
dynamic frequencyUpdate; dynamic frequencyUpdate;
@ -86,6 +87,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
strengthController.text = widget.doseStreangth; strengthController.text = widget.doseStreangth;
remarksController.text = widget.remarks; remarksController.text = widget.remarks;
indicationList = List(); indicationList = List();
/// TODO Elham* create model and try to have them form service and add translation
dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"}; dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"};
dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"}; dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"};
@ -112,6 +114,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
indicationList.add(indication9); indicationList.add(indication9);
indicationList.add(indication10); indicationList.add(indication10);
} }
/// TODO Elham* Add Translation
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -120,6 +123,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
(BuildContext context, StateSetter setState /*You can rename this!*/) { (BuildContext context, StateSetter setState /*You can rename this!*/) {
return BaseView<MedicineViewModel>( return BaseView<MedicineViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
/// TODO Elham* Move this to view model and remove unused data
await model.getMedicationList(); await model.getMedicationList();
await model.getMedicationStrength(); await model.getMedicationStrength();
await model.getMedicationDuration(); await model.getMedicationDuration();
@ -172,78 +177,6 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
), ),
Column( Column(
children: [ children: [
// Container(
// height: MediaQuery.of(context).size.height *
// 0.070,
// child: InkWell(
// onTap: model.allMedicationList != null
// ? () {
// setState(() {
// newSelectedMedication = null;
// });
// }
// : null,
// child: newSelectedMedication == null
// ? AutoCompleteTextField<
// GetMedicationResponseModel>(
// decoration:
// textFieldSelectorDecoration(
// widget.drugNameGeneric,
// newSelectedMedication != null
// ? newSelectedMedication
// .genericName
// : null,
// true,
// ),
// itemSubmitted: (item) => setState(
// () => newSelectedMedication =
// item),
// key: key,
// suggestions:
// model.allMedicationList,
// itemBuilder: (context,
// suggestion) =>
// new Padding(
// child: AppText(suggestion
// .description +
// '/' +
// suggestion.genericName),
// padding:
// EdgeInsets.all(8.0)),
// itemSorter: (a, b) => 1,
// itemFilter: (suggestion, input) =>
// suggestion.genericName
// .toLowerCase()
// .startsWith(
// input.toLowerCase()) ||
// suggestion.description
// .toLowerCase()
// .startsWith(
// input.toLowerCase()) ||
// suggestion.keywords
// .toLowerCase()
// .startsWith(
// input.toLowerCase()),
// )
// : TextField(
// decoration:
// textFieldSelectorDecoration(
// TranslationBase.of(context)
// .searchMedicineNameHere,
// newSelectedMedication != null
// ? newSelectedMedication
// .description +
// ('${newSelectedMedication.genericName}')
// : null,
// true,
// ),
// enabled: false,
// ),
// ),
// ),
// SizedBox(
// height: 12,
// ),
Container( Container(
height: height:
MediaQuery.of(context).size.height * MediaQuery.of(context).size.height *
@ -284,15 +217,6 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
"Only 5 Digits allowed for strength"); "Only 5 Digits allowed for strength");
} }
}, },
// validator: (value) {
// if (value.isEmpty &&
// strengthController.text.length >
// 4)
// return TranslationBase.of(context)
// .emptyMessage;
// else
// return null;
// },
), ),
), ),
SizedBox( SizedBox(
@ -805,6 +729,9 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
title: 'update prescription' title: 'update prescription'
.toUpperCase(), .toUpperCase(),
onPressed: () { onPressed: () {
/// TODO Elham* Move this to function
if (double.parse( if (double.parse(
strengthController.text) > strengthController.text) >
1000.0) { 1000.0) {
@ -912,7 +839,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
}); });
} }
} }
// /// TODO Elham* Use it from the textfeild utils
InputDecoration textFieldSelectorDecoration( InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown, String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) { {Icon suffixIcon}) {
@ -945,6 +872,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
); );
} }
/// TODO Elham* Move this to view model and pass all data as model
updatePrescription( updatePrescription(
{PrescriptionViewModel model, {PrescriptionViewModel model,
int drugId, int drugId,
@ -1030,6 +958,9 @@ void updatePrescriptionForm(
String uom, String uom,
int box, int box,
String startDate}) { String startDate}) {
/// TODO Elham* remove unused code.
TextEditingController remarksController = TextEditingController(); TextEditingController remarksController = TextEditingController();
TextEditingController doseController = TextEditingController(); TextEditingController doseController = TextEditingController();
TextEditingController frequencyController = TextEditingController(); TextEditingController frequencyController = TextEditingController();

Loading…
Cancel
Save