From 34d5ac7d43338338eacb1ef0fefb0ced0570858f Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 4 Feb 2021 14:12:54 +0200 Subject: [PATCH 1/3] add label on assessment and fix DA-333 --- .../patients/patient_search_screen.dart | 87 ------ .../soap_update/update_assessment_page.dart | 285 +++++++++++++----- pubspec.lock | 6 +- 3 files changed, 206 insertions(+), 172 deletions(-) diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 1e68d196..0b13bd2d 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -419,93 +419,6 @@ class _PatientSearchScreenState extends State { SizedBox( height: 10, ), - Container( - height: 40.0, - decoration: ShapeDecoration( - shape: RoundedRectangleBorder( - side: BorderSide( - width: 1.0, - style: BorderStyle.solid, - color: HexColor("#CCCCCC")), - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - ), - ), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: DropdownButton( - isExpanded: true, - value: _selectedLocation, - iconSize: 25, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return LOCATIONS.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - !projectsProvider.isArabic - ? AppText( - item['text'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ) - : AppText( - item['text-ar'], - fontSize: SizeConfig - .textMultiplier * - 2.1, - ) - ], - ); - }).toList(); - }, - onChanged: (String newValue) { - setState(() { - _selectedLocation = newValue; - }); - if (newValue == '1') - { - _patientSearchFormValues - .PatientOutSA = false; - } - else - { - _patientSearchFormValues - .PatientOutSA = true; - } - - }, - items: LOCATIONS.map((item) { - !projectsProvider.isArabic - ? itemText2 = item['text'] - : itemText2 = item['text-ar']; - return DropdownMenuItem( - child: Text( - itemText2, - textAlign: TextAlign.end, - ), - value: item['val'], - ); - }).toList(), - )), - ), - ], - ), - ), - ), SizedBox( height: 10, ), diff --git a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart index 542d4196..ddb7b9d6 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -491,6 +491,10 @@ class AddAssessmentDetails extends StatefulWidget { class _AddAssessmentDetailsState extends State { TextEditingController remarkController = TextEditingController(); TextEditingController appointmentIdController = TextEditingController(); + TextEditingController conditionController = TextEditingController(); + TextEditingController typeController = TextEditingController(); + TextEditingController icdNameController = TextEditingController(); + GlobalKey key = new GlobalKey>(); bool isFormSubmitted = false; @@ -501,31 +505,52 @@ class _AddAssessmentDetailsState extends State { remarkController.text = widget.mySelectedAssessment.remark ?? ""; appointmentIdController.text = widget.mySelectedAssessment.appointmentId.toString(); - final screenSize = MediaQuery - .of(context) - .size; - InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown, {IconData icon}) { - //TODO: make one Input InputDecoration for all + if(widget.isUpdate){ + if(widget.mySelectedAssessment + .selectedDiagnosisCondition != null) + conditionController.text = projectViewModel.isArabic + ? widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameAr + : widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameEn; + if(widget.mySelectedAssessment + .selectedDiagnosisType !=null) + typeController.text = projectViewModel.isArabic + ? widget.mySelectedAssessment + .selectedDiagnosisType + .nameAr + : widget.mySelectedAssessment + .selectedDiagnosisType + .nameEn; + if(widget.mySelectedAssessment.selectedICD !=null) + icdNameController.text = widget.mySelectedAssessment.selectedICD.code; + } + final screenSize = MediaQuery.of(context).size; + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {IconData icon}) { return InputDecoration( + contentPadding: EdgeInsets.symmetric(vertical: 10, horizontal: 10), focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderSide: BorderSide(color: Colors.grey, width: 1.0), borderRadius: BorderRadius.circular(8), ), enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderSide: BorderSide(color: Colors.grey, width: 1.0), borderRadius: BorderRadius.circular(8), ), disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderSide: BorderSide(color: Colors.grey, width: 1.0), borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(icon??Icons.arrow_drop_down) : null, + suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null, hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), + fontSize: 10, + color: Theme.of(context).hintColor, + fontWeight: FontWeight.w700), ); } return FractionallySizedBox( @@ -590,46 +615,109 @@ class _AddAssessmentDetailsState extends State { height: 10, ), Container( - height: screenSize.height * 0.070, + height: screenSize.height * 0.080, child: InkWell( - onTap: model.listOfDiagnosisType != null - ? () { - setState(() { - widget.mySelectedAssessment.selectedICD = null; - }); - } - : null, + onTap: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment + .selectedICD = null; + icdNameController.text = null; + }); + } + : null, child: widget.mySelectedAssessment.selectedICD == null ? AutoCompleteTextField( - decoration: textFieldSelectorDecoration(TranslationBase.of(context).nameOrICD, widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), - itemSubmitted: (item) => setState(() => widget.mySelectedAssessment.selectedICD = item), + decoration: textFieldSelectorDecoration( + TranslationBase + .of(context) + .nameOrICD, + widget.mySelectedAssessment.selectedICD != + null ? widget.mySelectedAssessment + .selectedICD.nameEn : null, true, + icon: EvaIcons.search), + itemSubmitted: (item) => + setState(() + { + widget.mySelectedAssessment + .selectedICD = item; + icdNameController.text =item.code; + }), key: key, suggestions: model.listOfICD10, - itemBuilder: (context, suggestion) => new Padding( - child:Texts( suggestion.description +" / "+ suggestion.code.toString()), + itemBuilder: (context, suggestion) => + new Padding( + child: Texts( + suggestion.description + " / " + + suggestion.code.toString()), padding: EdgeInsets.all(8.0)), itemSorter: (a, b) => 1, itemFilter: (suggestion, input) => - suggestion.description.toLowerCase().startsWith(input.toLowerCase()) ||suggestion.description.toLowerCase().startsWith(input.toLowerCase()) - ||suggestion.code.toLowerCase().startsWith(input.toLowerCase()) + suggestion.description.toLowerCase().startsWith( + input.toLowerCase()) || + suggestion.description.toLowerCase() + .startsWith(input.toLowerCase()) + || suggestion.code.toLowerCase().startsWith( + input.toLowerCase()) , - ): TextField( - decoration: textFieldSelectorDecoration( - widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.code :"Name or ICD", - widget.mySelectedAssessment.selectedICD != null ? projectViewModel.isArabic?widget.mySelectedAssessment.selectedICD.nameAr:widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), - enabled: false, - ), - ), + ) + : TextFields( + onTapTextFields: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment.selectedICD = + null; + icdNameController.text = null; + }); + } + : null, + hasLabelText: icdNameController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .nameOrICD, + fontSize: 13.5, + readOnly: true, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: icdNameController, + suffixIcon: EvaIcons.search, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }) + + // TextField( + // decoration: textFieldSelectorDecoration( + // widget.mySelectedAssessment.selectedICD != + // null ? widget.mySelectedAssessment + // .selectedICD.code : "Name or ICD", + // widget.mySelectedAssessment.selectedICD != + // null ? projectViewModel.isArabic + // ? widget.mySelectedAssessment + // .selectedICD.nameAr + // : widget.mySelectedAssessment + // .selectedICD.nameEn : null, true, + // icon: EvaIcons.search), + // enabled: false, + // ), + ), ), - if(isFormSubmitted && widget.mySelectedAssessment - .selectedICD == null) + if(isFormSubmitted && + widget.mySelectedAssessment + .selectedICD == null) CustomValidationError(), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.listOfDiagnosisCondition != + TextFields( + onTapTextFields: model + .listOfDiagnosisCondition != null ? () { MasterKeyDailog dialog = MasterKeyDailog( @@ -643,6 +731,14 @@ class _AddAssessmentDetailsState extends State { widget.mySelectedAssessment .selectedDiagnosisCondition = selectedValue; + conditionController.text = + projectViewModel.isArabic + ? widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameAr + : widget.mySelectedAssessment + .selectedDiagnosisCondition + .nameEn; }); }, ); @@ -655,32 +751,39 @@ class _AddAssessmentDetailsState extends State { ); } : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).condition, - widget.mySelectedAssessment - .selectedDiagnosisCondition != null - ? projectViewModel.isArabic?widget.mySelectedAssessment - .selectedDiagnosisCondition - .nameAr:widget.mySelectedAssessment - .selectedDiagnosisCondition - .nameEn - : null, - true), - enabled: false, - ), - ), - ), - if(isFormSubmitted && widget.mySelectedAssessment - .selectedDiagnosisCondition == null) + hasLabelText: conditionController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .condition, + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: conditionController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + if(isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisCondition == null) CustomValidationError(), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.listOfDiagnosisType != null + + + TextFields( + onTapTextFields: model + .listOfDiagnosisType != null ? () { MasterKeyDailog dialog = MasterKeyDailog( list: model.listOfDiagnosisType, @@ -695,6 +798,12 @@ class _AddAssessmentDetailsState extends State { widget.mySelectedAssessment .selectedDiagnosisType = selectedValue; + typeController.text = + projectViewModel.isArabic + ? selectedValue + .nameAr + : selectedValue + .nameEn; }); }, ); @@ -707,22 +816,30 @@ class _AddAssessmentDetailsState extends State { ); } : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase.of(context).dType, - widget.mySelectedAssessment - .selectedDiagnosisType != null - ?projectViewModel.isArabic?widget.mySelectedAssessment - .selectedDiagnosisType.nameAr: widget.mySelectedAssessment - .selectedDiagnosisType.nameEn - : null, - true), - enabled: false, - ), - ), - ), - if(isFormSubmitted && widget.mySelectedAssessment - .selectedDiagnosisType == null) + hasLabelText: typeController.text != + '' ? true : false, + showLabelText: true, + hintText: TranslationBase + .of(context) + .dType, + fontSize: 13.5, + readOnly: true, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 2, + minLines: 1, + controller: typeController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + if(isFormSubmitted && + widget.mySelectedAssessment + .selectedDiagnosisType == null) CustomValidationError(), SizedBox( height: 10, @@ -731,17 +848,21 @@ class _AddAssessmentDetailsState extends State { margin: EdgeInsets.only( left: 0, right: 0, top: 15), child: TextFields( - hintText: TranslationBase.of(context).remarks, + hintText: TranslationBase + .of(context) + .remarks, fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, maxLines: 18, minLines: 5, - hasLabelText: remarkController.text != ''?true:false, + hasLabelText: remarkController.text != + '' ? true : false, showLabelText: true, controller: remarkController, - onChanged:(value) { - widget.mySelectedAssessment.remark = remarkController.text; + onChanged: (value) { + widget.mySelectedAssessment.remark = + remarkController.text; }, validator: (value) { if (value == null) diff --git a/pubspec.lock b/pubspec.lock index addef845..94f07eea 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -559,7 +559,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -830,7 +830,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: @@ -965,5 +965,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <=2.11.0-213.1.beta" + dart: ">=2.10.0 <2.11.0" flutter: ">=1.22.0 <2.0.0" From 1e84b73cf0298e2e3ab8ca5aefdf4f205566f69c Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 4 Feb 2021 15:09:07 +0200 Subject: [PATCH 2/3] fix DA-279 --- lib/client/base_app_client.dart | 3 ++- lib/screens/patients/profile/lab_result/lab_orders_screen.dart | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 604e6f30..f88d19b5 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -82,7 +82,8 @@ class BaseAppClient { print("URL : $url"); print("Body : ${json.encode(body)}"); - + var aa = "${json.encode(body)}"; + var ee; if (await Helpers.checkConnection()) { final response = await http.post(url, body: json.encode(body), diff --git a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart index 41f58564..3dff441c 100644 --- a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart +++ b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart @@ -49,7 +49,7 @@ class _LabOrdersScreenState extends State { patientID: patient.patientId, projectID: patient.projectId, tokenID: token, - patientTypeID: patient.patientType, + patientTypeID: patient.patientType??1, languageID: 2); model.getLabResultOrders(labOrdersReqModel.toJson()); From 98609b464bffcdd96866bc9dcc5a778b7fa3d0ab Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 4 Feb 2021 15:10:01 +0200 Subject: [PATCH 3/3] fix DA-279 --- lib/client/base_app_client.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index f88d19b5..604e6f30 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -82,8 +82,7 @@ class BaseAppClient { print("URL : $url"); print("Body : ${json.encode(body)}"); - var aa = "${json.encode(body)}"; - var ee; + if (await Helpers.checkConnection()) { final response = await http.post(url, body: json.encode(body),