From 62d45d4e1c3a77e70e2c9d0c40155dbee2134cd0 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Thu, 11 Feb 2021 14:02:15 +0200 Subject: [PATCH 01/11] hide the keyboard when the user click on background --- lib/widgets/shared/app_scaffold_widget.dart | 97 +++++++++++---------- 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index d60edb9f..e337b72d 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -29,53 +29,58 @@ class AppScaffold extends StatelessWidget { Widget build(BuildContext context) { AppGlobal.CONTEX = context; ProjectViewModel projectProvider = Provider.of(context); - return Scaffold( - backgroundColor: Colors.white, - appBar: isShowAppBar - ? AppBar( - elevation: 0, - backgroundColor: HexColor('#515B5D'), - textTheme: TextTheme(headline6: TextStyle(color: Colors.white)), - title: Text(appBarTitle.toUpperCase()), - leading: Builder(builder: (BuildContext context) { - return IconButton( - icon: Icon(Icons.arrow_back_ios), - color: Colors.white, //Colors.black, - onPressed: () => Navigator.pop(context), - ); - }), - centerTitle: true, - actions: [ - IconButton( - icon: Icon(DoctorApp.home_icon_active), - color: Colors.white, //Colors.black, - onPressed: () => Navigator.pushNamedAndRemoveUntil( - context, HOME, (r) => false), - ), - ], - ) - : null, - body: projectProvider.isInternetConnection - ? baseViewModel != null - ? NetworkBaseView( - baseViewModel: baseViewModel, - child: body, - ) - : Stack( - children: [body, buildAppLoaderWidget(isLoading)]) - : Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/images/undraw_connected_world_wuay.png", - height: 250, - ), - AppText('No Internet Connection') - ], + return GestureDetector( + onTap: (){ + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: Scaffold( + backgroundColor: Colors.white, + appBar: isShowAppBar + ? AppBar( + elevation: 0, + backgroundColor: HexColor('#515B5D'), + textTheme: TextTheme(headline6: TextStyle(color: Colors.white)), + title: Text(appBarTitle.toUpperCase()), + leading: Builder(builder: (BuildContext context) { + return IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.white, //Colors.black, + onPressed: () => Navigator.pop(context), + ); + }), + centerTitle: true, + actions: [ + IconButton( + icon: Icon(DoctorApp.home_icon_active), + color: Colors.white, //Colors.black, + onPressed: () => Navigator.pushNamedAndRemoveUntil( + context, HOME, (r) => false), + ), + ], + ) + : null, + body: projectProvider.isInternetConnection + ? baseViewModel != null + ? NetworkBaseView( + baseViewModel: baseViewModel, + child: body, + ) + : Stack( + children: [body, buildAppLoaderWidget(isLoading)]) + : Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/images/undraw_connected_world_wuay.png", + height: 250, + ), + AppText('No Internet Connection') + ], + ), ), - ), + ), ); } From cd94b835b54e74bc200dd3de260e29e8a26ee28a Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 11 Feb 2021 17:32:30 +0200 Subject: [PATCH 02/11] bug fixing --- lib/screens/medical-file/medical_file_details.dart | 4 ++-- lib/screens/prescription/add_prescription_form.dart | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/screens/medical-file/medical_file_details.dart b/lib/screens/medical-file/medical_file_details.dart index a148610b..431342eb 100644 --- a/lib/screens/medical-file/medical_file_details.dart +++ b/lib/screens/medical-file/medical_file_details.dart @@ -589,7 +589,7 @@ class _MedicalFileDetailsState extends State { ], ), bodyWidget: ListView.builder( - //physics: , + physics: NeverScrollableScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model @@ -763,7 +763,7 @@ class _MedicalFileDetailsState extends State { ], ), bodyWidget: ListView.builder( - //physics: , + physics: NeverScrollableScrollPhysics(), scrollDirection: Axis.vertical, shrinkWrap: true, itemCount: model diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 0b9750fc..1a6c6e26 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -752,6 +752,13 @@ class _PrescriptionFormWidgetState extends State { "Please Fill All Fields"); return; } + if (int.parse( + strengthController.text) > + 1000) { + DrAppToastMsg.showErrorToast( + "1000 is the MAX for the strength"); + return; + } if (formKey.currentState.validate()) { Navigator.pop(context); From 8bf578082b17cf8915796b9b51653a97807a4916 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Thu, 11 Feb 2021 17:46:42 +0200 Subject: [PATCH 03/11] bug fixing --- .../prescription/add_prescription_form.dart | 368 ++++++++++-------- 1 file changed, 198 insertions(+), 170 deletions(-) diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index efbdcfd5..6ecf37d3 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -210,20 +210,21 @@ class _PrescriptionFormWidgetState extends State { NetworkBaseView( baseViewModel: model, child: GestureDetector( - onTap: (){ + onTap: () { FocusScope.of(context).requestFocus(new FocusNode()); }, child: DraggableScrollableSheet( initialChildSize: 0.90, maxChildSize: 0.90, minChildSize: 0.9, - builder: (BuildContext context, ScrollController scrollController) { + builder: + (BuildContext context, ScrollController scrollController) { return SingleChildScrollView( child: Container( height: 1010, child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), + padding: EdgeInsets.symmetric( + horizontal: 12.0, vertical: 10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, //mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -247,8 +248,8 @@ class _PrescriptionFormWidgetState extends State { child: InkWell( onTap: model.allMedicationList != null ? () { - Helpers.hideKeyboard(context); - setState(() { + Helpers.hideKeyboard(context); + setState(() { _selectedMedication = null; }); } @@ -267,8 +268,8 @@ class _PrescriptionFormWidgetState extends State { true, ), itemSubmitted: (item) => setState( - () => - _selectedMedication = item), + () => _selectedMedication = + item), key: key, suggestions: model.allMedicationList, @@ -278,19 +279,18 @@ class _PrescriptionFormWidgetState extends State { child: Texts(suggestion .description + '/' + - suggestion.genericName), + suggestion + .genericName), padding: EdgeInsets.all(8.0)), itemSorter: (a, b) => 1, itemFilter: (suggestion, input) => - suggestion.genericName - .toLowerCase() - .startsWith( - input.toLowerCase()) || + suggestion.genericName.toLowerCase().startsWith( + input.toLowerCase()) || suggestion.description .toLowerCase() - .startsWith( - input.toLowerCase()) || + .startsWith(input + .toLowerCase()) || suggestion.keywords .toLowerCase() .startsWith( @@ -338,17 +338,20 @@ class _PrescriptionFormWidgetState extends State { child: Row( children: [ Container( - width: - MediaQuery.of(context).size.width * - 0.550, + width: MediaQuery.of(context) + .size + .width * + 0.550, child: TextFields( inputFormatters: [ - LengthLimitingTextInputFormatter(4), + LengthLimitingTextInputFormatter( + 4), WhitelistingTextInputFormatter .digitsOnly ], - hintText: TranslationBase.of(context) - .strength, + hintText: + TranslationBase.of(context) + .strength, controller: strengthController, keyboardType: TextInputType.number, onChanged: (String value) { @@ -375,40 +378,49 @@ class _PrescriptionFormWidgetState extends State { width: 10.0, ), Container( - width: - MediaQuery.of(context).size.width * - 0.350, + width: MediaQuery.of(context) + .size + .width * + 0.350, child: InkWell( - onTap: model.medicationStrengthList != - null - ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .medicationStrengthList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - units = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, + onTap: + model.medicationStrengthList != + null + ? () { + Helpers.hideKeyboard( + context); + ListSelectDialog + dialog = + ListSelectDialog( + list: model + .medicationStrengthList, + attributeName: + 'nameEn', + attributeValueId: + 'id', + okText: + TranslationBase.of( + context) + .ok, + okFunction: + (selectedValue) { + setState(() { + units = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: + false, + context: context, + builder: (BuildContext + context) { + return dialog; + }, + ); + } + : null, child: TextField( decoration: textFieldSelectorDecoration( @@ -430,8 +442,8 @@ class _PrescriptionFormWidgetState extends State { child: InkWell( onTap: model.medicationRouteList != null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( list: model.medicationRouteList, attributeName: 'nameEn', @@ -452,7 +464,8 @@ class _PrescriptionFormWidgetState extends State { showDialog( barrierDismissible: false, context: context, - builder: (BuildContext context) { + builder: + (BuildContext context) { return dialog; }, ); @@ -473,13 +486,14 @@ class _PrescriptionFormWidgetState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: model.medicationFrequencyList != null + onTap: model.medicationFrequencyList != + null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( - list: - model.medicationFrequencyList, + list: model + .medicationFrequencyList, attributeName: 'nameEn', attributeValueId: 'id', okText: @@ -494,7 +508,8 @@ class _PrescriptionFormWidgetState extends State { showDialog( barrierDismissible: false, context: context, - builder: (BuildContext context) { + builder: + (BuildContext context) { return dialog; }, ); @@ -502,7 +517,8 @@ class _PrescriptionFormWidgetState extends State { : null, child: TextField( decoration: textFieldSelectorDecoration( - TranslationBase.of(context).frequency, + TranslationBase.of(context) + .frequency, frequency != null ? frequency['nameEn'] : null, @@ -515,13 +531,14 @@ class _PrescriptionFormWidgetState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: model.medicationDoseTimeList != null + onTap: model.medicationDoseTimeList != + null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( - list: - model.medicationDoseTimeList, + list: model + .medicationDoseTimeList, attributeName: 'nameEn', attributeValueId: 'id', okText: @@ -536,7 +553,8 @@ class _PrescriptionFormWidgetState extends State { showDialog( barrierDismissible: false, context: context, - builder: (BuildContext context) { + builder: + (BuildContext context) { return dialog; }, ); @@ -544,7 +562,8 @@ class _PrescriptionFormWidgetState extends State { : null, child: TextField( decoration: textFieldSelectorDecoration( - TranslationBase.of(context).doseTime, + TranslationBase.of(context) + .doseTime, doseTime != null ? doseTime['nameEn'] : null, @@ -561,18 +580,19 @@ class _PrescriptionFormWidgetState extends State { child: InkWell( onTap: indicationList != null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( list: indicationList, attributeName: 'name', attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, + okText: TranslationBase.of( + context) + .ok, okFunction: (selectedValue) { setState(() { - indication = selectedValue; + indication = + selectedValue; }); }, ); @@ -587,14 +607,15 @@ class _PrescriptionFormWidgetState extends State { } : null, child: TextField( - decoration: textFieldSelectorDecoration( - model.patientAssessmentList[0] - .icdCode10ID - .toString(), - indication != null - ? indication['name'] - : null, - true), + decoration: + textFieldSelectorDecoration( + model.patientAssessmentList[0] + .icdCode10ID + .toString(), + indication != null + ? indication['name'] + : null, + true), enabled: true, readOnly: true, ), @@ -660,7 +681,8 @@ class _PrescriptionFormWidgetState extends State { child: TextField( decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).date, + TranslationBase.of(context) + .date, selectedDate != null ? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" : null, @@ -677,13 +699,14 @@ class _PrescriptionFormWidgetState extends State { Container( height: screenSize.height * 0.070, child: InkWell( - onTap: model.medicationDurationList != null + onTap: model.medicationDurationList != + null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( - list: - model.medicationDurationList, + list: model + .medicationDurationList, attributeName: 'nameEn', attributeValueId: 'id', okText: @@ -698,7 +721,8 @@ class _PrescriptionFormWidgetState extends State { showDialog( barrierDismissible: false, context: context, - builder: (BuildContext context) { + builder: + (BuildContext context) { return dialog; }, ); @@ -706,7 +730,8 @@ class _PrescriptionFormWidgetState extends State { : null, child: TextField( decoration: textFieldSelectorDecoration( - TranslationBase.of(context).duration, + TranslationBase.of(context) + .duration, duration != null ? duration['nameEn'] : null, @@ -726,8 +751,8 @@ class _PrescriptionFormWidgetState extends State { child: TextFields( maxLines: 6, minLines: 4, - hintText: - TranslationBase.of(context).instruction, + hintText: TranslationBase.of(context) + .instruction, controller: instructionController, //keyboardType: TextInputType.number, validator: (value) { @@ -763,90 +788,93 @@ class _PrescriptionFormWidgetState extends State { "Please Fill All Fields"); return; } - if (int.parse( - strengthController.text) > - 1000) { - DrAppToastMsg.showErrorToast( - "1000 is the MAX for the strength"); - return; - } + if (int.parse( + strengthController.text) > + 1000) { + DrAppToastMsg.showErrorToast( + "1000 is the MAX for the strength"); + return; + } - if (formKey.currentState.validate()) { - Navigator.pop(context); - { - // var x = model - // .patientAssessmentList - // .map((value) => - // value.icdCode10ID) - // .toList() - // .join(','); - postProcedure( - icdCode: model - .patientAssessmentList[ - 0] - .icdCode10ID - .isEmpty - ? "test" - : model - .patientAssessmentList[ - 0] - .icdCode10ID - .toString(), - // icdCode: model + if (formKey.currentState + .validate()) { + Navigator.pop(context); + { + // var x = model // .patientAssessmentList - // .map((value) => value - // .icdCode10ID - // .trim()) + // .map((value) => + // value.icdCode10ID) // .toList() - // .join(' '), - dose: strengthController.text, - doseUnit: - units['id'].toString(), - patient: widget.patient, - doseTimeIn: - doseTime['id'].toString(), - model: widget.model, - duration: - duration['id'].toString(), - frequency: - frequency['id'].toString(), - route: route['id'].toString(), - drugId: _selectedMedication - .itemId - .toString(), - strength: - strengthController.text, - indication: - indicationController.text, - instruction: - instructionController.text, - doseTime: selectedDate, - ); + // .join(','); + postProcedure( + icdCode: model + .patientAssessmentList[ + 0] + .icdCode10ID + .isEmpty + ? "test" + : model + .patientAssessmentList[ + 0] + .icdCode10ID + .toString(), + // icdCode: model + // .patientAssessmentList + // .map((value) => value + // .icdCode10ID + // .trim()) + // .toList() + // .join(' '), + dose: strengthController.text, + doseUnit: + units['id'].toString(), + patient: widget.patient, + doseTimeIn: + doseTime['id'].toString(), + model: widget.model, + duration: + duration['id'].toString(), + frequency: frequency['id'] + .toString(), + route: route['id'].toString(), + drugId: _selectedMedication + .itemId + .toString(), + strength: + strengthController.text, + indication: + indicationController.text, + instruction: + instructionController + .text, + doseTime: selectedDate, + ); + } } - } - { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // NewPrescriptionScreen()), - // ); - } - }, - ), - ], + { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => + // NewPrescriptionScreen()), + // ); + } + }, + ), + ], + ), ), - ), - ], + ], + ), ), ), - ), - ], + ], + ), ), ), - ), - ); - }), + ); + }), + ), ), ); } From d20e83faa5823f1abd41ff12a9f94d66e827bf9a Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sat, 13 Feb 2021 23:40:05 +0200 Subject: [PATCH 04/11] bug fixing --- .../prescription/add_prescription_form.dart | 171 ++++----- .../update_prescription_form.dart | 329 +++++++++++++----- 2 files changed, 320 insertions(+), 180 deletions(-) diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 6ecf37d3..f262a0f6 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -573,105 +573,74 @@ class _PrescriptionFormWidgetState extends State { ), ), SizedBox(height: spaceBetweenTextFileds), - if (model.patientAssessmentList.isNotEmpty) Container( height: screenSize.height * 0.070, - child: InkWell( - onTap: indicationList != null - ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: indicationList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase.of( - context) - .ok, - okFunction: (selectedValue) { - setState(() { - indication = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - model.patientAssessmentList[0] - .icdCode10ID - .toString(), - indication != null - ? indication['name'] - : null, - true), - enabled: true, - readOnly: true, - ), + 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[ + 0] + .icdCode10ID + .toString(), + indication != null + ? indication['name'] + : null, + true), + enabled: true, + readOnly: true, + ), + ), + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.65, + child: InkWell( + onTap: indicationList != null + ? () { + Helpers.hideKeyboard( + context); + } + : null, + child: TextField( + maxLines: 5, + decoration: + textFieldSelectorDecoration( + model + .patientAssessmentList[ + 0] + .asciiDesc + .toString(), + indication != null + ? indication['name'] + : null, + true), + enabled: true, + readOnly: true, + ), + ), + ), + ], ), ), - //model.patientAssessmentList.forEach((element) { }). - // Column( - // children: model.patientAssessmentList - // .map((element) { - // return Container( - // height: screenSize.height * 0.070, - // child: InkWell( - // onTap: indicationList != null - // ? () { - // ListSelectDialog dialog = - // ListSelectDialog( - // list: indicationList, - // attributeName: 'name', - // attributeValueId: 'id', - // okText: TranslationBase.of( - // context) - // .ok, - // okFunction: (selectedValue) { - // setState(() { - // indication = - // selectedValue; - // }); - // }, - // ); - // showDialog( - // barrierDismissible: false, - // context: context, - // builder: - // (BuildContext context) { - // return dialog; - // }, - // ); - // } - // : null, - // child: TextField( - // decoration: - // textFieldSelectorDecoration( - // element.icdCode10ID - // .toString(), - // indication != null - // ? indication['name'] - // : null, - // true), - // enabled: true, - // readOnly: true, - // ), - // ), - // ); - // }).toList(), - // ), - SizedBox(height: spaceBetweenTextFileds), Container( height: screenSize.height * 0.070, @@ -755,13 +724,6 @@ class _PrescriptionFormWidgetState extends State { .instruction, controller: instructionController, //keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, ), ), SizedBox(height: spaceBetweenTextFileds), @@ -795,6 +757,13 @@ class _PrescriptionFormWidgetState extends State { "1000 is the MAX for the strength"); return; } + if (int.parse( + strengthController.text) == + 0) { + DrAppToastMsg.showErrorToast( + "Streangth can't be zero"); + return; + } if (formKey.currentState .validate()) { diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 0f48f5c1..af1fbb07 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -36,6 +37,7 @@ class UpdatePrescriptionForm extends StatefulWidget { final String startDate; final String frequency; final String drugNameGeneric; + final PrescriptionViewModel model; UpdatePrescriptionForm( @@ -71,14 +73,44 @@ class _UpdatePrescriptionFormState extends State { GetMedicationResponseModel newSelectedMedication; GlobalKey key = new GlobalKey>(); - + List indicationList; + dynamic indication; + DateTime selectedDate; @override void initState() { super.initState(); + + indicationList = List(); + + dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"}; + dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"}; + dynamic indication3 = {"id": 547, "name": "Hypertrichosis"}; + dynamic indication4 = {"id": 548, "name": "Mild Dizziness"}; + dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"}; + dynamic indication6 = { + "id": 550, + "name": "Phenytoin Hypersensitivity Syndrome" + }; + dynamic indication7 = {"id": 551, "name": "Asterixis"}; + dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"}; + dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"}; + dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"}; + + indicationList.add(indication1); + indicationList.add(indication2); + indicationList.add(indication3); + indicationList.add(indication4); + indicationList.add(indication5); + indicationList.add(indication6); + indicationList.add(indication7); + indicationList.add(indication8); + indicationList.add(indication9); + indicationList.add(indication10); } @override Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; return StatefulBuilder(builder: (BuildContext context, StateSetter setState /*You can rename this!*/) { return BaseView( @@ -105,17 +137,17 @@ class _UpdatePrescriptionFormState extends State { NetworkBaseView( baseViewModel: model, child: GestureDetector( - onTap: (){ + onTap: () { FocusScope.of(context).requestFocus(new FocusNode()); }, child: DraggableScrollableSheet( - initialChildSize: 0.95, + initialChildSize: 0.98, maxChildSize: 0.99, minChildSize: 0.6, builder: (BuildContext context, ScrollController scrollController) { return Container( - height: MediaQuery.of(context).size.height * 1.3, + height: MediaQuery.of(context).size.height * 2.5, child: Form( child: Padding( padding: EdgeInsets.symmetric( @@ -211,15 +243,18 @@ class _UpdatePrescriptionFormState extends State { child: Row( children: [ Container( - width: - MediaQuery.of(context).size.width * - 0.4900, - height: - MediaQuery.of(context).size.height * - 0.55, + width: MediaQuery.of(context) + .size + .width * + 0.4900, + height: MediaQuery.of(context) + .size + .height * + 0.55, child: TextFields( inputFormatters: [ - LengthLimitingTextInputFormatter(4), + LengthLimitingTextInputFormatter( + 4), WhitelistingTextInputFormatter .digitsOnly ], @@ -251,40 +286,49 @@ class _UpdatePrescriptionFormState extends State { width: 10.0, ), Container( - width: - MediaQuery.of(context).size.width * - 0.3700, + width: MediaQuery.of(context) + .size + .width * + 0.3700, child: InkWell( - onTap: model.medicationStrengthList != - null - ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .medicationStrengthList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - units = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, + onTap: + model.medicationStrengthList != + null + ? () { + Helpers.hideKeyboard( + context); + ListSelectDialog + dialog = + ListSelectDialog( + list: model + .medicationStrengthList, + attributeName: + 'nameEn', + attributeValueId: + 'id', + okText: + TranslationBase.of( + context) + .ok, + okFunction: + (selectedValue) { + setState(() { + units = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: + false, + context: context, + builder: (BuildContext + context) { + return dialog; + }, + ); + } + : null, child: TextField( decoration: textFieldSelectorDecoration( @@ -309,8 +353,8 @@ class _UpdatePrescriptionFormState extends State { child: InkWell( onTap: model.medicationRouteList != null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( list: model.medicationRouteList, attributeName: 'nameEn', @@ -330,7 +374,8 @@ class _UpdatePrescriptionFormState extends State { showDialog( barrierDismissible: false, context: context, - builder: (BuildContext context) { + builder: + (BuildContext context) { return dialog; }, ); @@ -354,13 +399,14 @@ class _UpdatePrescriptionFormState extends State { height: MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.medicationDoseTimeList != null + onTap: model.medicationDoseTimeList != + null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( - list: - model.medicationDoseTimeList, + list: model + .medicationDoseTimeList, attributeName: 'nameEn', attributeValueId: 'id', okText: @@ -375,7 +421,8 @@ class _UpdatePrescriptionFormState extends State { showDialog( barrierDismissible: false, context: context, - builder: (BuildContext context) { + builder: + (BuildContext context) { return dialog; }, ); @@ -383,7 +430,8 @@ class _UpdatePrescriptionFormState extends State { : null, child: TextField( decoration: textFieldSelectorDecoration( - TranslationBase.of(context).doseTime, + TranslationBase.of(context) + .doseTime, doseTime != null ? doseTime['nameEn'] : null, @@ -399,13 +447,14 @@ class _UpdatePrescriptionFormState extends State { height: MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.medicationFrequencyList != null + onTap: model.medicationFrequencyList != + null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( - list: - model.medicationFrequencyList, + list: model + .medicationFrequencyList, attributeName: 'nameEn', attributeValueId: 'id', okText: @@ -421,7 +470,8 @@ class _UpdatePrescriptionFormState extends State { showDialog( barrierDismissible: false, context: context, - builder: (BuildContext context) { + builder: + (BuildContext context) { return dialog; }, ); @@ -429,7 +479,8 @@ class _UpdatePrescriptionFormState extends State { : null, child: TextField( decoration: textFieldSelectorDecoration( - TranslationBase.of(context).frequency, + TranslationBase.of(context) + .frequency, frequencyUpdate != null ? frequencyUpdate['nameEn'] : null, @@ -445,13 +496,14 @@ class _UpdatePrescriptionFormState extends State { height: MediaQuery.of(context).size.height * 0.070, child: InkWell( - onTap: model.medicationDurationList != null + onTap: model.medicationDurationList != + null ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = + Helpers.hideKeyboard(context); + ListSelectDialog dialog = ListSelectDialog( - list: - model.medicationDurationList, + list: model + .medicationDurationList, attributeName: 'nameEn', attributeValueId: 'id', okText: @@ -467,7 +519,8 @@ class _UpdatePrescriptionFormState extends State { showDialog( barrierDismissible: false, context: context, - builder: (BuildContext context) { + builder: + (BuildContext context) { return dialog; }, ); @@ -475,7 +528,8 @@ class _UpdatePrescriptionFormState extends State { : null, child: TextField( decoration: textFieldSelectorDecoration( - TranslationBase.of(context).duration, + TranslationBase.of(context) + .duration, updatedDuration != null ? updatedDuration['nameEn'] .toString() @@ -488,6 +542,100 @@ class _UpdatePrescriptionFormState extends State { SizedBox( 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[ + 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[ + 0] + .asciiDesc + .toString(), + indication != null + ? indication['name'] + : null, + true), + enabled: true, + readOnly: true, + ), + ), + ), + ], + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () => + selectDate(context, widget.model), + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + widget.startDate, + selectedDate != null + ? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 12.0, + ), Container( decoration: BoxDecoration( borderRadius: BorderRadius.all( @@ -503,11 +651,11 @@ class _UpdatePrescriptionFormState extends State { ), ), SizedBox( - height: 12.0, + height: 10.0, ), SizedBox( - height: - MediaQuery.of(context).size.height * 0.12, + height: MediaQuery.of(context).size.height * + 0.08, ), Container( margin: EdgeInsets.all( @@ -516,19 +664,22 @@ class _UpdatePrescriptionFormState extends State { alignment: WrapAlignment.center, children: [ AppButton( - title: - 'update prescription'.toUpperCase(), + title: 'update prescription' + .toUpperCase(), onPressed: () { updatePrescription( + newStartDate: selectedDate, newDoseStreangth: strengthController .text.isNotEmpty - ? strengthController.text + ? strengthController + .text : widget.doseStreangth, - newUnit: units != - null - ? units['id'].toString() - : widget.doseUnit, + newUnit: + units != + null + ? units['id'].toString() + : widget.doseUnit, doseUnit: widget.doseUnit, doseStreangth: widget .doseStreangth, @@ -582,6 +733,24 @@ class _UpdatePrescriptionFormState extends State { }); } + selectDate(BuildContext context, PrescriptionViewModel model) async { + Helpers.hideKeyboard(context); + DateTime selectedDate; + selectedDate = DateTime.now(); + final DateTime picked = await showDatePicker( + context: context, + initialDate: selectedDate, + firstDate: DateTime.now(), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != selectedDate) { + setState(() { + this.selectedDate = picked; + }); + } + } + InputDecoration textFieldSelectorDecoration( String hintText, String selectedText, bool isDropDown, {Icon suffixIcon}) { @@ -626,6 +795,7 @@ class _UpdatePrescriptionFormState extends State { String route, String routeId, String startDate, + DateTime newStartDate, String doseUnit, String doseStreangth, String newDoseStreangth, @@ -664,7 +834,8 @@ class _UpdatePrescriptionFormState extends State { duration: newDuration.isNotEmpty ? int.parse(newDuration) : int.parse(duration), - doseStartDate: startDate)); + doseStartDate: + newStartDate != null ? newStartDate.toIso8601String() : startDate)); updatePrescriptionReqModel.prescriptionRequestModel = sss; //postProcedureReqModel.procedures = controlsProcedure; From a047255f2ce917a4657155852bd2ddf1f2653bb8 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 14 Feb 2021 09:47:54 +0200 Subject: [PATCH 05/11] add referral get facilties --- lib/config/config.dart | 3 ++- .../patient-doctor-referral-service.dart | 14 ++++++++++++ .../viewModel/patient-referral-viewmodel.dart | 6 ++--- .../referral/refer-patient-screen.dart | 22 ++++++++++++++----- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 6c4da7b1..6afcb64f 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -27,7 +27,8 @@ const PATIENT_GET_CLINIC_BY_PROJECT_URL = const PROJECT_GET_INFO = "Services/DoctorApplication.svc/REST/GetProjectInfo"; const GET_CLINICS = "Services/DoctorApplication.svc/REST/GetClinics"; -//const GET_PROJECTS = 'Services/Lists.svc/REST/GetProjectForDoctorAPP'; +const GET_REFERRAL_FACILITIES = 'Services/DoctorApplication.svc/REST/GetReferralFacilities'; + const GET_PROJECTS = 'Services/DoctorApplication.svc/REST/GetProjectInfo'; const GET_PATIENT_VITAL_SIGN = diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart index 813fef35..3136b549 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -49,6 +49,20 @@ class PatientReferralService extends LookupService { }, body: info); } + Future getReferralFacilities() async { + hasError = false; + + Map body = Map(); + body['isSameBranch'] = false; + + await baseAppClient.post(GET_REFERRAL_FACILITIES, onSuccess: (response, statusCode) async { + projectsList = response['ProjectInfo']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future getProjectInfo(int projectId) async { Map body = Map(); body['ProjectID'] = projectId; diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 5771d1db..00ef09f6 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -62,7 +62,7 @@ class PatientReferralViewModel extends BaseViewModel { Future getBranches() async { setState(ViewState.BusyLocal); - await _referralPatientService.getProjectsList(); + await _referralPatientService.getReferralFacilities(); if (_referralPatientService.hasError) { error = _referralPatientService.error; setState(ViewState.Error); @@ -77,7 +77,7 @@ class PatientReferralViewModel extends BaseViewModel { await _referralPatientService.getProjectInfo(projectId); if (_referralPatientService.hasError) { error = _referralPatientService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } @@ -87,7 +87,7 @@ class PatientReferralViewModel extends BaseViewModel { await _referralPatientService.getDoctorsList(clinicId); if (_referralPatientService.hasError) { error = _referralPatientService.error; - setState(ViewState.Error); + setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index b2a71f4b..6f053089 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -177,15 +178,18 @@ class _PatientMakeReferralScreenState extends State { _selectedBranch = null; _selectedClinic = null; _selectedDoctor = null; - model.getDoctorBranch().then((value) { + model.getDoctorBranch().then((value) async { _selectedBranch = value; if (_referTo['id'] == 1) { GifLoaderDialogUtils.showMyDialog(context); - model + await model .getClinics(_selectedBranch['facilityId']) .then((_) => GifLoaderDialogUtils.hideDialog( context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } } }); }); @@ -226,15 +230,18 @@ class _PatientMakeReferralScreenState extends State { attributeValueId: 'facilityId', okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { - setState(() { + setState(() async { _selectedBranch = selectedValue; _selectedClinic = null; _selectedDoctor = null; GifLoaderDialogUtils.showMyDialog(context); - model + await model .getClinics(_selectedBranch['facilityId']) .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } }); }, ); @@ -277,15 +284,18 @@ class _PatientMakeReferralScreenState extends State { TranslationBase.of(context).clinicSearch, okText: TranslationBase.of(context).ok, okFunction: (selectedValue) { - setState(() { + setState(() async { _selectedDoctor = null; _selectedClinic = selectedValue; GifLoaderDialogUtils.showMyDialog(context); - model + await model .getClinicDoctors( _selectedClinic['ClinicID'].toString()) .then((_) => GifLoaderDialogUtils.hideDialog(context)); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } }); }, ); From d8d2e7f1d649c88ef8db297eaaf74ffcb7154b00 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Sun, 14 Feb 2021 11:19:30 +0200 Subject: [PATCH 06/11] fix ios issues --- .../prescription/add_prescription_form.dart | 14 +++++++------- .../prescription/update_prescription_form.dart | 12 ++---------- lib/widgets/auth/verification_methods.dart | 13 ++++--------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index f262a0f6..f00bfe72 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -343,17 +343,17 @@ class _PrescriptionFormWidgetState extends State { .width * 0.550, child: TextFields( - inputFormatters: [ - LengthLimitingTextInputFormatter( - 4), - WhitelistingTextInputFormatter - .digitsOnly - ], + // inputFormatters: [ + // LengthLimitingTextInputFormatter( + // 4), + // WhitelistingTextInputFormatter + // .digitsOnly + // ], hintText: TranslationBase.of(context) .strength, controller: strengthController, - keyboardType: TextInputType.number, + keyboardType: TextInputType.numberWithOptions(decimal: true,), onChanged: (String value) { setState(() { strengthChar = value.length; diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index af1fbb07..938f24bc 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -562,11 +562,7 @@ class _UpdatePrescriptionFormState extends State { child: TextField( decoration: textFieldSelectorDecoration( - model - .patientAssessmentList[ - 0] - .icdCode10ID - .toString(), + model.patientAssessmentList.isNotEmpty? model.patientAssessmentList[0].icdCode10ID.toString():'', indication != null ? indication['name'] : null, @@ -592,11 +588,7 @@ class _UpdatePrescriptionFormState extends State { maxLines: 3, decoration: textFieldSelectorDecoration( - model - .patientAssessmentList[ - 0] - .asciiDesc - .toString(), + model.patientAssessmentList.isNotEmpty? model.patientAssessmentList[0].asciiDesc.toString():'', indication != null ? indication['name'] : null, diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 04a82a80..adb0aef0 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -233,11 +233,7 @@ class _VerificationMethodsState extends State { Expanded( child: InkWell( onTap: () => { - authenticateUser( - 3, - BiometricType - .face.index, - authProv) + authenticateUser(3, true, authProv) }, child: getButton( user.logInTypeID, @@ -488,8 +484,7 @@ class _VerificationMethodsState extends State { onTap: () => { if (checkIfBiometricAvailable(BiometricType.fingerprint)) { - authenticateUser( - 3, BiometricType.fingerprint.index, authProv) + authenticateUser(3, true, authProv) } }, child: RoundedContainer( @@ -524,7 +519,7 @@ class _VerificationMethodsState extends State { return InkWell( onTap: () { if (checkIfBiometricAvailable(BiometricType.face)) { - authenticateUser(4, BiometricType.face.index, authProv); + authenticateUser(4, true, authProv); } }, child: RoundedContainer( @@ -706,7 +701,7 @@ class _VerificationMethodsState extends State { } loginWithFingurePrintFace(type, isActive, authProv) async { - if (isActive == 1) { + if (isActive) { // this.startBiometricLoginIfAvailable(); authenticated = await auth.authenticateWithBiometrics( localizedReason: 'Scan your fingerprint to authenticate', From 39d2fe879c03140ceb3761e5a348e0764b8d72bc Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 14 Feb 2021 16:44:47 +0200 Subject: [PATCH 07/11] jira bug fixing --- .../prescription/prescription_screen.dart | 16 +- .../update_prescription_form.dart | 1129 +++++++++-------- 2 files changed, 581 insertions(+), 564 deletions(-) diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index 9cc208c5..f7012f1d 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -214,16 +214,16 @@ class _NewPrescriptionScreenState extends State { 0] .entityList[ index] - .startDate) + .createdOn) .day .toString(), color: Colors .green, ), AppText( - Helpers.getMonth(model.prescriptionList[0].entityList[index].startDate != + Helpers.getMonth(model.prescriptionList[0].entityList[index].createdOn != null - ? (DateTime.parse(model.prescriptionList[0].entityList[index].startDate) + ? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) .month) : DateTime.now() .month) @@ -261,9 +261,13 @@ class _NewPrescriptionScreenState extends State { child: AppText( model - .prescriptionList[0] - .entityList[index] - .startDate, + .prescriptionList[ + 0] + .entityList[ + index] + .startDate + .replaceAll("-", + "/"), fontSize: 12.0, ), diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index af1fbb07..6efc5900 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -79,7 +79,7 @@ class _UpdatePrescriptionFormState extends State { @override void initState() { super.initState(); - + remarksController.text = widget.remarks; indicationList = List(); dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"}; @@ -146,586 +146,599 @@ class _UpdatePrescriptionFormState extends State { minChildSize: 0.6, builder: (BuildContext context, ScrollController scrollController) { - return Container( - height: MediaQuery.of(context).size.height * 2.5, - child: Form( - child: Padding( - padding: EdgeInsets.symmetric( - horizontal: 20.0, vertical: 12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - widget.drugName.toUpperCase(), - fontWeight: FontWeight.w900, - ), - SizedBox( - height: 10.0, - ), - Column( - 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: Texts(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( - height: MediaQuery.of(context).size.height * - 0.060, - width: double.infinity, - child: Row( - children: [ - Container( - width: MediaQuery.of(context) - .size - .width * - 0.4900, - height: MediaQuery.of(context) - .size - .height * - 0.55, - child: TextFields( - inputFormatters: [ - LengthLimitingTextInputFormatter( - 4), - WhitelistingTextInputFormatter - .digitsOnly - ], - hintText: widget.doseStreangth, - fontSize: 15.0, - controller: strengthController, - keyboardType: TextInputType.number, - onChanged: (String value) { - setState(() { - strengthChar = value.length; - }); - if (strengthChar >= 4) { - DrAppToastMsg.showErrorToast( - "Only 4 Digits allowed for strength"); - } - }, - // validator: (value) { - // if (value.isEmpty && - // strengthController.text.length > - // 4) - // return TranslationBase.of(context) - // .emptyMessage; - // else - // return null; - // }, + return SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 2.0, + child: Form( + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.0, vertical: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + widget.drugName.toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: 10.0, + ), + Column( + 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: Texts(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( + height: + MediaQuery.of(context).size.height * + 0.060, + width: double.infinity, + child: Row( + children: [ + Container( + width: MediaQuery.of(context) + .size + .width * + 0.4900, + height: MediaQuery.of(context) + .size + .height * + 0.55, + child: TextFields( + inputFormatters: [ + LengthLimitingTextInputFormatter( + 4), + WhitelistingTextInputFormatter + .digitsOnly + ], + hintText: widget.doseStreangth, + fontSize: 15.0, + controller: strengthController, + keyboardType: + TextInputType.number, + onChanged: (String value) { + setState(() { + strengthChar = value.length; + }); + if (strengthChar >= 4) { + DrAppToastMsg.showErrorToast( + "Only 4 Digits allowed for strength"); + } + }, + // validator: (value) { + // if (value.isEmpty && + // strengthController.text.length > + // 4) + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }, + ), ), - ), - SizedBox( - width: 10.0, - ), - Container( - width: MediaQuery.of(context) - .size - .width * - 0.3700, - child: InkWell( - onTap: - model.medicationStrengthList != - null - ? () { - Helpers.hideKeyboard( - context); - ListSelectDialog - dialog = - ListSelectDialog( - list: model - .medicationStrengthList, - attributeName: - 'nameEn', - attributeValueId: - 'id', - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - units = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: (BuildContext - context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: - textFieldSelectorDecoration( - 'UNIT Type', - units != null - ? units['nameEn'] - : null, - true), - enabled: false, + SizedBox( + width: 10.0, + ), + Container( + width: MediaQuery.of(context) + .size + .width * + 0.3700, + child: InkWell( + onTap: + model.medicationStrengthList != + null + ? () { + Helpers.hideKeyboard( + context); + ListSelectDialog + dialog = + ListSelectDialog( + list: model + .medicationStrengthList, + attributeName: + 'nameEn', + attributeValueId: + 'id', + okText: + TranslationBase.of( + context) + .ok, + okFunction: + (selectedValue) { + setState(() { + units = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: + false, + context: context, + builder: + (BuildContext + context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + 'UNIT Type', + units != null + ? units['nameEn'] + : null, + true), + enabled: false, + ), ), ), - ), - ], + ], + ), ), - ), - SizedBox( - height: 12, - ), - Container( - height: MediaQuery.of(context).size.height * - 0.070, - child: InkWell( - onTap: model.medicationRouteList != null - ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model.medicationRouteList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - route = selectedValue; - }); - if (route == null) { - route = route['id']; - } - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - 'Route', - route != null - ? route['nameEn'] - : null, - true), - enabled: false, + SizedBox( + height: 12, + ), + Container( + height: + MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.medicationRouteList != null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: + model.medicationRouteList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of( + context) + .ok, + okFunction: (selectedValue) { + setState(() { + route = selectedValue; + }); + if (route == null) { + route = route['id']; + } + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + 'Route', + route != null + ? route['nameEn'] + : null, + true), + enabled: false, + ), ), ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: MediaQuery.of(context).size.height * - 0.070, - child: InkWell( - onTap: model.medicationDoseTimeList != - null - ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .medicationDoseTimeList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - doseTime = selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .doseTime, - doseTime != null - ? doseTime['nameEn'] - : null, - true), - enabled: false, + SizedBox( + height: 12.0, + ), + Container( + height: + MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.medicationDoseTimeList != + null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model + .medicationDoseTimeList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of( + context) + .ok, + okFunction: (selectedValue) { + setState(() { + doseTime = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + TranslationBase.of(context) + .doseTime, + doseTime != null + ? doseTime['nameEn'] + : null, + true), + enabled: false, + ), ), ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: MediaQuery.of(context).size.height * - 0.070, - child: InkWell( - onTap: model.medicationFrequencyList != - null - ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .medicationFrequencyList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - frequencyUpdate = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .frequency, - frequencyUpdate != null - ? frequencyUpdate['nameEn'] - : null, - true), - enabled: false, + SizedBox( + height: 12.0, + ), + Container( + height: + MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.medicationFrequencyList != + null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model + .medicationFrequencyList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of( + context) + .ok, + okFunction: (selectedValue) { + setState(() { + frequencyUpdate = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + TranslationBase.of(context) + .frequency, + frequencyUpdate != null + ? frequencyUpdate[ + 'nameEn'] + : null, + true), + enabled: false, + ), ), ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: MediaQuery.of(context).size.height * - 0.070, - child: InkWell( - onTap: model.medicationDurationList != - null - ? () { - Helpers.hideKeyboard(context); - ListSelectDialog dialog = - ListSelectDialog( - list: model - .medicationDurationList, - attributeName: 'nameEn', - attributeValueId: 'id', - okText: - TranslationBase.of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - updatedDuration = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: - (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context) - .duration, - updatedDuration != null - ? updatedDuration['nameEn'] - .toString() - : null, - true), - enabled: false, + SizedBox( + height: 12.0, + ), + Container( + height: + MediaQuery.of(context).size.height * + 0.070, + child: InkWell( + onTap: model.medicationDurationList != + null + ? () { + Helpers.hideKeyboard(context); + ListSelectDialog dialog = + ListSelectDialog( + list: model + .medicationDurationList, + attributeName: 'nameEn', + attributeValueId: 'id', + okText: TranslationBase.of( + context) + .ok, + okFunction: (selectedValue) { + setState(() { + updatedDuration = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: + textFieldSelectorDecoration( + TranslationBase.of(context) + .duration, + updatedDuration != null + ? updatedDuration[ + 'nameEn'] + .toString() + : null, + true), + enabled: false, + ), ), ), - ), - SizedBox( - 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[ - 0] - .icdCode10ID - .toString(), - indication != null - ? indication['name'] - : null, - true), - enabled: true, - readOnly: true, + SizedBox( + 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[ + 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[ - 0] - .asciiDesc - .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[ + 0] + .asciiDesc + .toString(), + indication != null + ? indication['name'] + : null, + true), + enabled: true, + readOnly: true, + ), ), ), + ], + ), + ), + SizedBox( + height: 12.0, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () => + selectDate(context, widget.model), + child: TextField( + decoration: Helpers + .textFieldSelectorDecoration( + widget.startDate, + selectedDate != null + ? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, ), - ], + ), ), - ), - SizedBox( - height: 12.0, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: () => - selectDate(context, widget.model), - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - widget.startDate, - selectedDate != null - ? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), - enabled: false, + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + controller: remarksController, + maxLines: 7, + minLines: 4, ), ), - ), - SizedBox( - height: 12.0, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: widget.remarks, - controller: remarksController, - maxLines: 7, - minLines: 4, + SizedBox( + height: 10.0, ), - ), - SizedBox( - height: 10.0, - ), - SizedBox( - height: MediaQuery.of(context).size.height * - 0.08, - ), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 2), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: 'update prescription' - .toUpperCase(), - onPressed: () { - updatePrescription( - newStartDate: selectedDate, - newDoseStreangth: - strengthController - .text.isNotEmpty - ? strengthController - .text - : widget.doseStreangth, - newUnit: - units != - null - ? units['id'].toString() - : widget.doseUnit, - doseUnit: widget.doseUnit, - doseStreangth: widget - .doseStreangth, - duration: widget.duration, - startDate: widget.startDate, - doseId: widget.dose, - frequencyId: widget.frequency, - routeId: widget.route, - patient: widget.patient, - model: widget.model, - newDuration: - updatedDuration != - null - ? updatedDuration[ - 'id'] - .toString() - : widget.duration, - drugId: widget.drugId, - remarks: remarksController.text, - route: route != - null - ? route['id'].toString() - : widget.route, - frequency: - frequencyUpdate != - null - ? frequencyUpdate['id'] - .toString() - : widget.frequency, - dose: doseTime != null - ? doseTime['id'].toString() - : widget.dose, - enteredRemarks: - widget.enteredRemarks); - Navigator.pop(context); - }, - ), - ], + SizedBox( + height: + MediaQuery.of(context).size.height * + 0.08, + ), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 2), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: 'update prescription' + .toUpperCase(), + onPressed: () { + updatePrescription( + newStartDate: selectedDate, + newDoseStreangth: + strengthController + .text.isNotEmpty + ? strengthController + .text + : widget + .doseStreangth, + newUnit: units != null + ? units['id'].toString() + : widget.doseUnit, + doseUnit: widget.doseUnit, + doseStreangth: + widget.doseStreangth, + duration: widget.duration, + startDate: widget.startDate, + doseId: widget.dose, + frequencyId: widget.frequency, + routeId: widget.route, + patient: widget.patient, + model: widget.model, + newDuration: updatedDuration != + null + ? updatedDuration['id'] + .toString() + : widget.duration, + drugId: widget.drugId, + remarks: + remarksController.text, + route: route != null + ? route['id'].toString() + : widget.route, + frequency: frequencyUpdate != + null + ? frequencyUpdate['id'] + .toString() + : widget.frequency, + dose: doseTime != null + ? doseTime['id'] + .toString() + : widget.dose, + enteredRemarks: + widget.enteredRemarks); + Navigator.pop(context); + }, + ), + ], + ), ), - ), - ], - ), - ], + ], + ), + ], + ), ), - ), - )); + )), + ); }), ), ), From cb8b7a4ec4134171c8c225f2ab5fc76a7ade7500 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Sun, 14 Feb 2021 16:46:56 +0200 Subject: [PATCH 08/11] jira bug fixing --- .../update_prescription_form.dart | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/screens/prescription/update_prescription_form.dart b/lib/screens/prescription/update_prescription_form.dart index 70ff06c2..6086c278 100644 --- a/lib/screens/prescription/update_prescription_form.dart +++ b/lib/screens/prescription/update_prescription_form.dart @@ -577,11 +577,14 @@ class _UpdatePrescriptionFormState extends State { child: TextField( decoration: textFieldSelectorDecoration( - model - .patientAssessmentList.isNotEmpty? model.patientAssessmentList[ - 0] - .icdCode10ID - .toString():'', + model.patientAssessmentList + .isNotEmpty + ? model + .patientAssessmentList[ + 0] + .icdCode10ID + .toString() + : '', indication != null ? indication['name'] : null, @@ -607,11 +610,14 @@ class _UpdatePrescriptionFormState extends State { maxLines: 3, decoration: textFieldSelectorDecoration( - model - .patientAssessmentList.isNotEmpty? model.patientAssessmentList[ - 0] - .asciiDesc - .toString():'', + model.patientAssessmentList + .isNotEmpty + ? model + .patientAssessmentList[ + 0] + .asciiDesc + .toString() + : '', indication != null ? indication['name'] : null, From 344d70793c95010b2fa3ddc8b3fb71798f89ee60 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 14 Feb 2021 19:04:59 +0200 Subject: [PATCH 09/11] fix DA-421 --- lib/screens/QR_reader_screen.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/screens/QR_reader_screen.dart b/lib/screens/QR_reader_screen.dart index 42278d40..43492149 100644 --- a/lib/screens/QR_reader_screen.dart +++ b/lib/screens/QR_reader_screen.dart @@ -209,7 +209,7 @@ class _QrReaderScreenState extends State { setState(() { isLoading = false; }); - helpers.showErrorToast(error); + helpers.showErrorToast(error.message); //DrAppToastMsg.showErrorToast(error); }); } From 083b49aa0a07ef90255ac1c0f15de380ee7f2289 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 14 Feb 2021 19:30:50 +0200 Subject: [PATCH 10/11] fix DA-341 --- lib/config/localized_values.dart | 3 +- .../list_gt_my_patients_question_model.dart | 19 ++++++- lib/util/translations_delegate_base.dart | 2 + lib/widgets/doctor/doctor_reply_widget.dart | 56 +++++++++++++++++-- 4 files changed, 72 insertions(+), 8 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c25d8fae..c5fe1a9b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -709,6 +709,7 @@ const Map> localizedValues = { 'otherDepartmentsInterventions': {'en': "Other departments interventions", 'ar': "تدخلات الأقسام الأخرى"}, 'otherProcedure': {'en': "Other procedure", 'ar': "إجراء آخر"}, 'admissionRequestSuccessMsg': {'en': "Admission Request Created Successfully", 'ar': "تم إنشاء طلب القبول بنجاح"}, - // 'icd': {'en': "ICD", 'ar': " "}, 'orderNo': {'en': "Order No : ", 'ar': "رقم الطلب"}, + 'infoStatus': {'en': "Info Status", 'ar': "حالة المعلومات"}, + 'doctorResponse': {'en': "Doctor Response", 'ar': "استجابة الطبيب"}, }; diff --git a/lib/models/doctor/list_gt_my_patients_question_model.dart b/lib/models/doctor/list_gt_my_patients_question_model.dart index b743ade6..0d2cff9a 100644 --- a/lib/models/doctor/list_gt_my_patients_question_model.dart +++ b/lib/models/doctor/list_gt_my_patients_question_model.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/util/helpers.dart'; + + class ListGtMyPatientsQuestions { String setupID; int projectID; @@ -17,11 +19,14 @@ class ListGtMyPatientsQuestions { int editedBy; String editedOn; String patientName; - String patientNameN; + Null patientNameN; int gender; String dateofBirth; String mobileNumber; String emailAddress; + String doctorResponse; + String infoStatus; + Null clinicID; String age; String genderDescription; bool isVidaCall; @@ -48,6 +53,9 @@ class ListGtMyPatientsQuestions { this.dateofBirth, this.mobileNumber, this.emailAddress, + this.doctorResponse, + this.infoStatus, + this.clinicID, this.age, this.genderDescription, this.isVidaCall}); @@ -61,6 +69,7 @@ class ListGtMyPatientsQuestions { doctorID = json['DoctorID']; requestType = json['RequestType']; requestDate = Helpers.convertStringToDate(json['RequestDate']) ; + requestTime = json['RequestTime']; remarks = json['Remarks']; status = json['Status']; @@ -74,6 +83,9 @@ class ListGtMyPatientsQuestions { dateofBirth = json['DateofBirth']; mobileNumber = json['MobileNumber']; emailAddress = json['EmailAddress']; + doctorResponse = json['DoctorResponse']; + infoStatus = json['InfoStatus']; + clinicID = json['ClinicID']; age = json['Age']; genderDescription = json['GenderDescription']; isVidaCall = json['IsVidaCall']; @@ -102,9 +114,12 @@ class ListGtMyPatientsQuestions { data['DateofBirth'] = this.dateofBirth; data['MobileNumber'] = this.mobileNumber; data['EmailAddress'] = this.emailAddress; + data['DoctorResponse'] = this.doctorResponse; + data['InfoStatus'] = this.infoStatus; + data['ClinicID'] = this.clinicID; data['Age'] = this.age; data['GenderDescription'] = this.genderDescription; data['IsVidaCall'] = this.isVidaCall; return data; } -} \ No newline at end of file +} diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 813d7064..499cade9 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1104,6 +1104,8 @@ class TranslationBase { String get otherDepartmentsInterventions => localizedValues['otherDepartmentsInterventions'][locale.languageCode]; String get otherProcedure => localizedValues['otherProcedure'][locale.languageCode]; String get admissionRequestSuccessMsg => localizedValues['admissionRequestSuccessMsg'][locale.languageCode]; + String get infoStatus => localizedValues['infoStatus'][locale.languageCode]; + String get doctorResponse => localizedValues['doctorResponse'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index e9126ba3..f3882e23 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -167,12 +167,58 @@ class _DoctorReplyWidgetState extends State { children: [ Divider(color: Colors.grey), SizedBox(height: 5,), - AppText( - widget.reply.remarks, - fontSize: 2.5 * SizeConfig.textMultiplier, - //fontWeight: FontWeight.bold, + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).remarks + " : ", + fontSize: 2.5 * SizeConfig.textMultiplier, + //fontWeight: FontWeight.bold, + ),Expanded( + child: AppText( + widget.reply.remarks, + fontSize: 2.5 * SizeConfig.textMultiplier, + //fontWeight: FontWeight.bold, + ), + ), + ], ), - SizedBox(height: 10,) + SizedBox(height: 10,), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).doctorResponse + " : ", + fontSize: 2.5 * SizeConfig.textMultiplier, + //fontWeight: FontWeight.bold, + ),Expanded( + child: AppText( + widget.reply.doctorResponse, + fontSize: 2.5 * SizeConfig.textMultiplier, + //fontWeight: FontWeight.bold, + ), + ), + ], + ),SizedBox(height: 10,), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).infoStatus + " : ", + fontSize: 2.5 * SizeConfig.textMultiplier, + //fontWeight: FontWeight.bold, + ),Expanded( + child: AppText( + widget.reply.infoStatus, + fontSize: 2.5 * SizeConfig.textMultiplier, + //fontWeight: FontWeight.bold, + ), + ), + ], + ) ], ), ), From 2563b102168fc519865701a251a6d3b4c777d356 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 15 Feb 2021 13:31:58 +0200 Subject: [PATCH 11/11] DA-367 --- .../model/procedure/categories_procedure.dart | 6 +- lib/core/service/procedure_service.dart | 2 +- .../procedures/add-procedure-form.dart | 82 ++++++------- .../entity_list_checkbox_search_widget.dart | 113 +++++++++++++----- lib/screens/procedures/update-procedure.dart | 90 +++++++------- 5 files changed, 178 insertions(+), 115 deletions(-) diff --git a/lib/core/model/procedure/categories_procedure.dart b/lib/core/model/procedure/categories_procedure.dart index 074d8a1b..9e6f847f 100644 --- a/lib/core/model/procedure/categories_procedure.dart +++ b/lib/core/model/procedure/categories_procedure.dart @@ -41,6 +41,8 @@ class EntityList { String specialPermission; String subGroup; String template; + String remarks; + String type; EntityList( {this.allowedClinic, @@ -54,7 +56,9 @@ class EntityList { this.procedureName, this.specialPermission, this.subGroup, - this.template}); + this.template, + this.remarks, + this.type}); EntityList.fromJson(Map json) { allowedClinic = json['allowedClinic']; diff --git a/lib/core/service/procedure_service.dart b/lib/core/service/procedure_service.dart index 1ec996fb..98b1f36d 100644 --- a/lib/core/service/procedure_service.dart +++ b/lib/core/service/procedure_service.dart @@ -75,7 +75,7 @@ class ProcedureService extends BaseService { Future getProcedureCategory({String categoryName, String categoryID}) async { _getProcedureCategoriseReqModel = GetProcedureReqModel( - search: [""], + search: [categoryName], patientMRN: 0, pageIndex: 0, clinicId: 0, diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index 11eadbb0..2fa0c428 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -34,13 +34,12 @@ postProcedure( postProcedureReqModel.patientMRN = patient.patientMRN; entityList.forEach((element) { controls.add( - Controls(code: "remarks", controlValue: remarks.isEmpty ? '' : remarks), + Controls( + code: "remarks", + controlValue: element.remarks.isNotEmpty ? element.remarks : ""), ); controls.add( - Controls( - code: "ordertype", - controlValue: - orderType.toString().isNotEmpty ? orderType.toString() : '1'), + Controls(code: "ordertype", controlValue: element.type), ); }); @@ -218,43 +217,43 @@ class _AddSelectedProcedureState extends State { Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Container( - child: Row( - children: [ - AppText( - TranslationBase.of(context).orderType), - Radio( - activeColor: Color(0xFFB9382C), - value: 1, - groupValue: selectedType, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text('routine'), - Radio( - activeColor: Color(0xFFB9382C), - groupValue: selectedType, - value: 0, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text(TranslationBase.of(context).urgent), - ], - ), - ), - SizedBox( - height: 15.0, - ), - TextFields( - hintText: TranslationBase.of(context).remarks, - controller: remarksController, - minLines: 3, - maxLines: 5, - ), + // Container( + // child: Row( + // children: [ + // AppText( + // TranslationBase.of(context).orderType), + // Radio( + // activeColor: Color(0xFFB9382C), + // value: 1, + // groupValue: selectedType, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text('routine'), + // Radio( + // activeColor: Color(0xFFB9382C), + // groupValue: selectedType, + // value: 0, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text(TranslationBase.of(context).urgent), + // ], + // ), + // ), + // SizedBox( + // height: 15.0, + // ), + // TextFields( + // hintText: TranslationBase.of(context).remarks, + // controller: remarksController, + // minLines: 3, + // maxLines: 5, + // ), SizedBox( - height: 50.0, + height: 100.0, ), Container( margin: EdgeInsets.all( @@ -266,6 +265,7 @@ class _AddSelectedProcedureState extends State { title: TranslationBase.of(context) .addSelectedProcedures, onPressed: () { + //print(entityList.toString()); Navigator.pop(context); postProcedure( orderType: selectedType.toString(), diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index a29100f5..73cf0115 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -17,6 +17,8 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { final Function addSelectedHistories; final Function(EntityList) removeHistory; final Function(EntityList) addHistory; + final Function(EntityList) addRemarks; + final bool Function(EntityList) isEntityListSelected; final List masterList; @@ -27,7 +29,8 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { this.removeHistory, this.masterList, this.addHistory, - this.isEntityListSelected}) + this.isEntityListSelected, + this.addRemarks}) : super(key: key); @override @@ -37,7 +40,7 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { class _EntityListCheckboxSearchWidgetState extends State { - int selectedType; + int selectedType = 1; setSelectedType(int val) { setState(() { selectedType = val; @@ -45,6 +48,8 @@ class _EntityListCheckboxSearchWidgetState } List items = List(); + List remarksList = List(); + List typeList = List(); @override void initState() { @@ -52,6 +57,7 @@ class _EntityListCheckboxSearchWidgetState super.initState(); } + TextEditingController remarksController = TextEditingController(); @override Widget build(BuildContext context) { return Container( @@ -84,34 +90,87 @@ class _EntityListCheckboxSearchWidgetState children: items.map((historyInfo) { return Column( children: [ - Row( + ExpansionTile( + title: Row( + children: [ + Checkbox( + value: widget.isEntityListSelected( + historyInfo), + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() { + if (widget.isEntityListSelected( + historyInfo)) { + widget.removeHistory( + historyInfo); + } else { + widget + .addHistory(historyInfo); + } + }); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts( + historyInfo.procedureName, + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), children: [ - Checkbox( - value: widget.isEntityListSelected( - historyInfo), - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() { - if (widget.isEntityListSelected( - historyInfo)) { - widget - .removeHistory(historyInfo); - } else { - widget.addHistory(historyInfo); - } - }); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts( - historyInfo.procedureName, - variant: "bodyText", - bold: true, - color: Colors.black), + Container( + child: Row( + children: [ + AppText(TranslationBase.of(context) + .orderType), + Radio( + activeColor: Color(0xFFB9382C), + value: 1, + groupValue: selectedType, + onChanged: (value) { + historyInfo.type = + setSelectedType(value) + .toString(); + // historyInfo.type = + // value.toString(); + }, + ), + Text('routine'), + Radio( + activeColor: Color(0xFFB9382C), + groupValue: selectedType, + value: 0, + onChanged: (value) { + historyInfo.type = + setSelectedType(value) + .toString(); + // historyInfo.type = + // value.toString(); + }, + ), + Text(TranslationBase.of(context) + .urgent), + ], ), ), + SizedBox( + height: 15.0, + ), + TextFields( + hintText: + TranslationBase.of(context).remarks, + //controller: remarksController, + onChanged: (value) { + historyInfo.remarks = value; + }, + minLines: 3, + maxLines: 5, + ), ], ), DividerWithSpacesAround(), diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index 2c502334..038b5d59 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -200,51 +200,51 @@ class _UpdateProcedureWidgetState extends State { isEntityListSelected(master), ), ), - Container( - child: Row( - children: [ - AppText( - TranslationBase.of(context).orderType), - Radio( - activeColor: Color(0xFFB9382C), - value: 0, - groupValue: selectedType, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text(TranslationBase.of(context).urgent), - Radio( - activeColor: Color(0xFFB9382C), - groupValue: selectedType, - value: 1, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text('routine'), - ], - ), - ), - SizedBox( - height: 12.0, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: widget.remarks, - fontSize: 15.0, - controller: widget.remarksController, - maxLines: 3, - minLines: 2, - onChanged: (value) {}, - ), - ), + // Container( + // child: Row( + // children: [ + // AppText( + // TranslationBase.of(context).orderType), + // Radio( + // activeColor: Color(0xFFB9382C), + // value: 0, + // groupValue: selectedType, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text(TranslationBase.of(context).urgent), + // Radio( + // activeColor: Color(0xFFB9382C), + // groupValue: selectedType, + // value: 1, + // onChanged: (value) { + // setSelectedType(value); + // }, + // ), + // Text('routine'), + // ], + // ), + // ), + // SizedBox( + // height: 12.0, + // ), + // Container( + // decoration: BoxDecoration( + // borderRadius: + // BorderRadius.all(Radius.circular(6.0)), + // border: Border.all( + // width: 1.0, + // color: HexColor("#CCCCCC"))), + // child: TextFields( + // hintText: widget.remarks, + // fontSize: 15.0, + // controller: widget.remarksController, + // maxLines: 3, + // minLines: 2, + // onChanged: (value) {}, + // ), + // ), SizedBox( height: 50.0, ),