From 9194d8a44b24a354041d26cca2efa2ae46ee55e0 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 3 Jan 2021 14:29:47 +0200 Subject: [PATCH 01/12] delete Allergy --- lib/models/SOAP/my_selected_allergy.dart | 5 +- .../profile/soap_update/steps_widget.dart | 14 ++-- .../subjective/update_allergies_widget.dart | 80 +++++++++++++------ .../subjective/update_subjective_page.dart | 5 ++ lib/widgets/shared/Text.dart | 7 +- 5 files changed, 78 insertions(+), 33 deletions(-) diff --git a/lib/models/SOAP/my_selected_allergy.dart b/lib/models/SOAP/my_selected_allergy.dart index 9996b65a..e5b45502 100644 --- a/lib/models/SOAP/my_selected_allergy.dart +++ b/lib/models/SOAP/my_selected_allergy.dart @@ -4,9 +4,10 @@ class MySelectedAllergy { MasterKeyModel selectedAllergySeverity; MasterKeyModel selectedAllergy; String remark; + bool isChecked; MySelectedAllergy( - {this.selectedAllergySeverity, this.selectedAllergy, this.remark}); + {this.selectedAllergySeverity, this.selectedAllergy, this.remark, this.isChecked}); MySelectedAllergy.fromJson(Map json) { selectedAllergySeverity = json['selectedAllergySeverity'] != null @@ -16,6 +17,7 @@ class MySelectedAllergy { ? new MasterKeyModel.fromJson(json['selectedAllergy']) : null; remark = json['remark']; + remark = json['isChecked']; } Map toJson() { @@ -27,6 +29,7 @@ class MySelectedAllergy { data['selectedAllergy'] = this.selectedAllergy.toJson(); } data['remark'] = this.remark; + data['isChecked'] = this.remark; return data; } } diff --git a/lib/widgets/patients/profile/soap_update/steps_widget.dart b/lib/widgets/patients/profile/soap_update/steps_widget.dart index 56f3435e..b7e9e837 100644 --- a/lib/widgets/patients/profile/soap_update/steps_widget.dart +++ b/lib/widgets/patients/profile/soap_update/steps_widget.dart @@ -34,7 +34,7 @@ class StepsWidget extends StatelessWidget { top: index == 0 ? 15 : 30, left: 0, child: InkWell( - //onTap: () => changeCurrentTab(0), + onTap: () => changeCurrentTab(0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -84,7 +84,7 @@ class StepsWidget extends StatelessWidget { top: index == 1 ? 15 : 30, left: MediaQuery.of(context).size.width * 0.28, child: InkWell( - //onTap: () => index >= 1 ? changeCurrentTab(1) : null, + onTap: () => index >= 1 ? changeCurrentTab(1) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -187,7 +187,7 @@ class StepsWidget extends StatelessWidget { top: index == 3 ? 15 : 30, right: 0, child: InkWell( - //onTap: () => index >= 3 ? changeCurrentTab(4) : null, + onTap: () => index >= 3 ? changeCurrentTab(4) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -257,7 +257,7 @@ class StepsWidget extends StatelessWidget { top: index == 0 ? 15 : 30, right: 0, child: InkWell( - //onTap: () => changeCurrentTab(0), + onTap: () => changeCurrentTab(0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -307,7 +307,7 @@ class StepsWidget extends StatelessWidget { top: index == 1 ? 15 : 30, right: MediaQuery.of(context).size.width * 0.28, child: InkWell( - //onTap: () => index >= 2 ? changeCurrentTab(1) : null, + onTap: () => index >= 2 ? changeCurrentTab(1) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -357,7 +357,7 @@ class StepsWidget extends StatelessWidget { top: index == 2 ? 15 : 30, right: MediaQuery.of(context).size.width * 0.52, child: InkWell( - //onTap: () => index >= 3 ? changeCurrentTab(2) : null, + onTap: () => index >= 3 ? changeCurrentTab(2) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -411,7 +411,7 @@ class StepsWidget extends StatelessWidget { top: index == 3 ? 15 : 30, left: 0, child: InkWell( - //onTap: () => index >= 3 ? changeCurrentTab(4) : null, + onTap: () => index >= 3 ? changeCurrentTab(4) : null, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index 5d54dfa5..2d1f66ea 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -80,10 +80,15 @@ class _UpdateAllergiesWidgetState extends State { Container( child: Expanded( - child: Texts(projectViewModel.isArabic ? selectedAllergy - .selectedAllergy.nameAr : selectedAllergy - .selectedAllergy.nameEn.toUpperCase(), + child: Texts( + projectViewModel.isArabic + ? selectedAllergy.selectedAllergy.nameAr + : selectedAllergy.selectedAllergy.nameEn + .toUpperCase(), variant: "bodyText", + textDecoration: selectedAllergy.isChecked + ? null + : TextDecoration.lineThrough, bold: true, color: Colors.black), ), @@ -95,17 +100,21 @@ class _UpdateAllergiesWidgetState extends State { .selectedAllergySeverity.nameEn .toUpperCase(), variant: "bodyText", + textDecoration: selectedAllergy.isChecked + ? null + : TextDecoration.lineThrough, bold: true, color: AppGlobal.appPrimaryColor), - InkWell( - child: Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ), - onTap: () => removeAllergy(selectedAllergy), - ) - ], + if(selectedAllergy.isChecked) + InkWell( + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ), + onTap: () => removeAllergy(selectedAllergy), + ) + ], ), SizedBox( height: 10, @@ -119,13 +128,22 @@ class _UpdateAllergiesWidgetState extends State { } removeAllergy(MySelectedAllergy mySelectedAllergy) { - Iterable allergy = - widget.myAllergiesList.where((element) => mySelectedAllergy == element); + List allergy = + // ignore: missing_return + widget.myAllergiesList.where((element) => + mySelectedAllergy.selectedAllergySeverity.id == + element.selectedAllergySeverity.id && + mySelectedAllergy.selectedAllergy.id == element.selectedAllergy.id + ).toList(); - if (allergy.length > 0) + if (allergy.length > 0) { setState(() { - widget.myAllergiesList.remove(allergy.first); + allergy[0].isChecked = false; }); + } + + + print(allergy); } openAllergiesList(BuildContext context) { @@ -137,14 +155,29 @@ class _UpdateAllergiesWidgetState extends State { return AddAllergies( addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { setState(() { - if (!widget.myAllergiesList.contains(mySelectedAllergy)) { + List allergy = + // ignore: missing_return + widget.myAllergiesList.where((element) => + mySelectedAllergy.selectedAllergy.id == + element.selectedAllergy.id + ).toList(); + if (allergy.isEmpty) { widget.myAllergiesList.add(mySelectedAllergy); Navigator.of(context).pop(); } else { - helpers.showErrorToast(TranslationBase - .of(context) - .itemExist); + allergy.first.selectedAllergy = + mySelectedAllergy.selectedAllergy; + allergy.first.selectedAllergySeverity = + mySelectedAllergy.selectedAllergySeverity; + allergy.first.remark = mySelectedAllergy.remark; + allergy.first.isChecked = mySelectedAllergy.isChecked; + + // helpers.showErrorToast(TranslationBase + // .of(context) + // .itemExist); } + + Navigator.of(context).pop(); }); },); }); @@ -353,9 +386,10 @@ class _AddAllergiesState extends State { title: "Add".toUpperCase(), onPressed: () { MySelectedAllergy mySelectedAllergy = new MySelectedAllergy( - remark: remarkController.text, - selectedAllergy: _selectedAllergy, - selectedAllergySeverity: _selectedAllergySeverity); + remark: remarkController.text, + selectedAllergy: _selectedAllergy, + isChecked: true, + selectedAllergySeverity: _selectedAllergySeverity,); widget.addAllergiesFun(mySelectedAllergy); }, ), diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart index 98d1b7d0..ddab4734 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -131,6 +131,10 @@ class _UpdateSubjectivePageState extends State { return BaseView( onModelReady: (model) async { + widget.myAllergiesList.clear(); + widget.myHistoryList.clear(); + + GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, @@ -165,6 +169,7 @@ class _UpdateSubjectivePageState extends State { ); MySelectedAllergy mySelectedAllergy = MySelectedAllergy( selectedAllergy: selectedAllergy, + isChecked: element.isChecked, selectedAllergySeverity: selectedAllergySeverity); if (selectedAllergy != null && selectedAllergySeverity != null) widget.myAllergiesList.add(mySelectedAllergy); diff --git a/lib/widgets/shared/Text.dart b/lib/widgets/shared/Text.dart index 9f6dfdf1..f2e663bf 100644 --- a/lib/widgets/shared/Text.dart +++ b/lib/widgets/shared/Text.dart @@ -16,11 +16,12 @@ class Texts extends StatefulWidget { final bool readMore; final String style; final bool allowExpand; + final TextDecoration textDecoration; Texts(this.text, {Key key, this.variant, this.color, this.bold, this.regular, this.medium, this.allowExpand = true, this.italic:false, this.textAlign, this.maxLength=60, - this.maxLines, this.readMore=false, this.style + this.maxLines, this.readMore=false, this.style, this.textDecoration }) : super(key: key); @override @@ -192,6 +193,7 @@ class _TextsState extends State { fontSize: _getFontSize(), letterSpacing: widget.variant=="overline" ? 1.5 : null, fontWeight: _getFontWeight(), + decoration: widget.textDecoration//TextDecoration.lineThrough ) ), if (widget.readMore && text.length > widget.maxLength && hidden) @@ -228,7 +230,8 @@ class _TextsState extends State { style: _getFontStyle().copyWith( color: HexColor('#FF0000'), fontWeight: FontWeight.w800, - fontFamily: "WorkSans" + fontFamily: "WorkSans", + ) ), ), From 68cfbf8fc78cdce7dc0bd8171ad4fe88cc9274c6 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 3 Jan 2021 15:45:50 +0300 Subject: [PATCH 02/12] doctor leave --- lib/config/localized_values.dart | 1 + .../add-rescheduleleave.dart | 48 ++++++++++++++----- .../reschedule-leaves/reschedule_leave.dart | 26 +++++----- lib/screens/sick-leave/sick_leave.dart | 29 ++++++----- lib/util/translations_delegate_base.dart | 2 + 5 files changed, 70 insertions(+), 36 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 66c2e58c..19c4854c 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -504,4 +504,5 @@ const Map> localizedValues = { 'itemExist': {'en': "This item already exist", 'ar': "هذا العنصر موجود"}, 'selectAllergy': {'en': "Select Allergy", 'ar': "أختر الحساسية"}, 'selectSeverity': {'en': "Select Severity", 'ar': "أختر الدرجه"}, + 'leaveCreated': {'en': "Leave has been created", 'ar': "تم إنشاء الإجازة"} }; diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index a4739247..1b5957b9 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -45,23 +45,49 @@ class AddRescheduleLeavScreen extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppTextFormField( - hintText: - TranslationBase.of(context).requestLeave, - borderColor: Colors.white, - prefix: IconButton( - icon: Icon( - Icons.add_circle, - color: Colors.red, - )), - textInputType: TextInputType.text, + InkWell( + child: Row( + children: [ + Expanded( + flex: 4, + child: AppText( + TranslationBase.of(context) + .requestLeave), + ), + IconButton( + icon: Icon( + Icons.add_circle, + color: Colors.red, + )) + ], + ) + // AppTextFormField( + // hintText: + // TranslationBase.of(context).requestLeave, + // borderColor: Colors.white, + // prefix: IconButton( + // icon: Icon( + // Icons.add_circle, + // color: Colors.red, + // )), + // // textInputType: TextInputType.text, + // readOnly: true, + // onTap: () { + // openLeave( + // context, + // false, + // ); + // return false; + // }, + // inputFormatter: ONLY_LETTERS, + // ) + , onTap: () { openLeave( context, false, ); }, - inputFormatter: ONLY_LETTERS, ) ], ), diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index c74395a3..8c5889c7 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.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/text_validator.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -130,10 +131,12 @@ class _RescheduleLeaveScreen extends State { child: DropdownButton( focusColor: Colors.grey, isExpanded: true, + dropdownColor: + Colors.grey, value: getClinicName( model) ?? "", - iconSize: 40, + iconSize: 0, elevation: 16, selectedItemBuilder: (BuildContext @@ -151,8 +154,8 @@ class _RescheduleLeaveScreen extends State { fontSize: SizeConfig .textMultiplier * 2.1, - color: - Colors.grey, + color: Colors + .grey[500], ), ], ); @@ -234,7 +237,7 @@ class _RescheduleLeaveScreen extends State { child: DropdownButtonHideUnderline( child: DropdownButton( - focusColor: Colors.grey, + // focusColor: Colors.grey, isExpanded: true, value: offTime == null ? model2.allOffTime[0] @@ -256,8 +259,8 @@ class _RescheduleLeaveScreen extends State { fontSize: SizeConfig .textMultiplier * 2.1, - color: - Colors.grey, + // color: + // Colors.grey, ), ], ); @@ -560,8 +563,8 @@ class _RescheduleLeaveScreen extends State { fontSize: SizeConfig .textMultiplier * 2.1, - color: - Colors.grey, + // color: + // Colors.grey, ), ], ); @@ -654,8 +657,6 @@ class _RescheduleLeaveScreen extends State { fontSize: SizeConfig .textMultiplier * 2.1, - color: - Colors.grey, ), ], ); @@ -731,9 +732,10 @@ class _RescheduleLeaveScreen extends State { getProfile() async { Map p = await sharedPref.getObj(DOCTOR_PROFILE); + setState(() { + this.profile = p; if (widget.updateData != null) { - this.profile = p; this.clinicID = widget.updateData.clinicId; _toDateController.text = widget.updateData.dateTimeFrom; @@ -779,7 +781,7 @@ class _RescheduleLeaveScreen extends State { }; model.addReschedule(request).then((response) { - print(response); + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); }); } diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index 2aea6f43..fcc641ff 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -203,7 +203,7 @@ class _SickLeaveScreenState extends State { value: getClinicName( model) ?? "", - iconSize: 40, + iconSize: 0, elevation: 16, selectedItemBuilder: (BuildContext @@ -221,6 +221,8 @@ class _SickLeaveScreenState extends State { fontSize: SizeConfig .textMultiplier * 2.1, + color: + Colors.grey, ), ], ); @@ -310,18 +312,19 @@ class _SickLeaveScreenState extends State { // TranslationBase.of(context).remarks, // fontSize: 10, // ), - AppTextFormField( - borderColor: Colors.white, - hintText: widget.extendedData != null - ? widget.extendedData.remarks - : TranslationBase.of(context).remarks, - onChanged: (value) { - addSickLeave.remarks = value; - }, - validator: (value) { - // return TextValidator().validateName(value); - }, - inputFormatter: ONLY_LETTERS) + TextField( + maxLines: 3, + decoration: InputDecoration( + contentPadding: EdgeInsets.all(20.0), + border: InputBorder.none, + hintText: widget.extendedData != null + ? widget.extendedData.remarks + : TranslationBase.of(context) + .remarks), + onChanged: (value) { + addSickLeave.remarks = value; + }, + ) ], ), ), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 2cc38638..501c2ae5 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -530,6 +530,8 @@ class TranslationBase { localizedValues['selectAllergy'][locale.languageCode]; String get selectSeverity => localizedValues['selectSeverity'][locale.languageCode]; + String get leaveCreated => + localizedValues['leaveCreated'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From 3dffd337288620eeb7d328840e4c0a6afa64b43b Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 3 Jan 2021 15:01:38 +0200 Subject: [PATCH 03/12] hot fix --- .../profile/soap_update/subjective/update_allergies_widget.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index 2d1f66ea..1d143310 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -171,13 +171,13 @@ class _UpdateAllergiesWidgetState extends State { mySelectedAllergy.selectedAllergySeverity; allergy.first.remark = mySelectedAllergy.remark; allergy.first.isChecked = mySelectedAllergy.isChecked; + Navigator.of(context).pop(); // helpers.showErrorToast(TranslationBase // .of(context) // .itemExist); } - Navigator.of(context).pop(); }); },); }); From ceb0cde34cf6805e01ff686a6ddb54b2a0c1915d Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 3 Jan 2021 15:23:37 +0200 Subject: [PATCH 04/12] finish UCAF design and solve problem on vital signs response --- lib/config/localized_values.dart | 8 + .../service/patient-vital-signs-service.dart | 2 +- .../patient-vital-sign-viewmodel.dart | 2 +- .../vital_sign/patient-vital-sign-data.dart | 2 +- .../profile/UCAF/UCAF-detail-screen.dart | 301 +++++++++++++++++- lib/util/translations_delegate_base.dart | 8 + 6 files changed, 314 insertions(+), 9 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index ef5aaaa5..ff3ebd74 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -509,4 +509,12 @@ const Map> localizedValues = { 'vitalSignEmptyMsg': {'en': "There is no vital signs for this patient", 'ar':"لا توجد علامات حيوية لهذا المريض" }, 'referralEmptyMsg': {'en': "There is no referral data", 'ar':"لا توجد بيانات إحالة" }, 'referralSuccessMsg': {'en': "You make referral successfully", 'ar':"You make referral successfully" }, + 'diagnoseType': {'en': "Diagnose Type", 'ar':"نوع التشخيص" }, + 'condition': {'en': "Condition", 'ar':"الحالة" }, + 'id': {'en': "ID", 'ar':"بطاقة هوية" }, + 'quantity': {'en': "Quantity", 'ar':"الكمية" }, + 'codeNo': {'en': "Code #", 'ar':"# الرمز" }, + 'covered': {'en': "Covered", 'ar':"مغطى" }, + 'approvalRequired': {'en': "Approval Required", 'ar':"الموافقة مطلوبة" }, + 'uncoveredByDoctor': {'en': "Uncovered By Doctor", 'ar':"غير مغطى من قبل الدكتور" }, }; diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart index 31c8721d..43786ac0 100644 --- a/lib/core/service/patient-vital-signs-service.dart +++ b/lib/core/service/patient-vital-signs-service.dart @@ -59,7 +59,7 @@ class VitalSignsService extends BaseService{ onSuccess: (dynamic response, int statusCode) { if(response['VitalSignsList'] != null){ if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 0){ - patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList']['0']); + patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList'][0]); } } }, diff --git a/lib/core/viewModel/patient-vital-sign-viewmodel.dart b/lib/core/viewModel/patient-vital-sign-viewmodel.dart index f53def7b..4282141c 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -95,7 +95,7 @@ class VitalSignsViewModel extends BaseViewModel { ); } - String getBMI(double bodyMassIndex) { + String getBMI(var bodyMassIndex) { if (bodyMassIndex <= 18.5) { return "Underweight"; } else if (bodyMassIndex <= 25.0) { diff --git a/lib/models/patient/vital_sign/patient-vital-sign-data.dart b/lib/models/patient/vital_sign/patient-vital-sign-data.dart index 5d20e017..c5e503c2 100644 --- a/lib/models/patient/vital_sign/patient-vital-sign-data.dart +++ b/lib/models/patient/vital_sign/patient-vital-sign-data.dart @@ -5,7 +5,7 @@ class VitalSignData { int bloodPressureHigher; int bloodPressureLower; int bloodPressurePatientPosition; - double bodyMassIndex; + var bodyMassIndex; int fio2; int headCircumCm; int heightCm; diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart index 302b77a8..f9c2470a 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-ucaf-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; @@ -5,6 +6,7 @@ import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -14,7 +16,6 @@ class UcafDetailScreen extends StatefulWidget { } class _UcafDetailScreenState extends State { - int _activeTap = 0; @override @@ -45,7 +46,7 @@ class _UcafDetailScreenState extends State { SizedBox( height: 16, ), - getSelectedTreatmentStepItem(context), + ...getSelectedTreatmentStepItem(context), ], ), ), @@ -64,8 +65,8 @@ class _UcafDetailScreenState extends State { ]; return Container( height: screenSize.height * 0.070, - decoration: - Helpers.containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), + decoration: Helpers.containerBorderDecoration( + Color(0Xffffffff), Color(0xFFCCCCCC)), child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, @@ -105,8 +106,296 @@ class _UcafDetailScreenState extends State { ); } - Widget getSelectedTreatmentStepItem(BuildContext _context) { - return Container(); + List getSelectedTreatmentStepItem(BuildContext _context) { + switch (_activeTap) { + case 0: + return [...List.generate(2, (index) => DiagnosisWidget()).toList()]; + case 1: + return [...List.generate(2, (index) => MedicationWidget()).toList()]; + case 2: + return [...List.generate(2, (index) => ProceduresWidget()).toList()]; + default: + return [ + Container(), + ]; + } + } +} + +class DiagnosisWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).diagnoseType}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Preliminary Diagnosis", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "B34.2 | CORONA VIRUS INFECTION, UNSPECIFIED SITE", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).condition}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "174.00 Same", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); + } +} + +class MedicationWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).id}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "6", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).price}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "35.6", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).quantity}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "3", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "EVE SKIN CREAM WITH HONEY -170GM", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "Every other day for 5 days", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); } +} + +class ProceduresWidget extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).codeNo}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "019054846", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + AppText( + "${TranslationBase.of(context).quantity}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "1", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + Expanded( + child: AppText( + "SCAN - RENAL MASS PROTOCOL", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).covered}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Yes", + fontWeight: FontWeight.normal, + color: Colors.green, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + width: 16, + ), + AppText( + "${TranslationBase.of(context).approvalRequired}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Yes", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + children: [ + AppText( + "${TranslationBase.of(context).uncoveredByDoctor}: ", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "Yes", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + SizedBox( + height: 16, + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 16, + ), + ], + ); + } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 5dee728a..4bbe718f 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -535,6 +535,14 @@ class TranslationBase { String get vitalSignEmptyMsg => localizedValues['vitalSignEmptyMsg'][locale.languageCode]; String get referralEmptyMsg => localizedValues['referralEmptyMsg'][locale.languageCode]; String get referralSuccessMsg => localizedValues['referralSuccessMsg'][locale.languageCode]; + String get diagnoseType => localizedValues['diagnoseType'][locale.languageCode]; + String get condition => localizedValues['condition'][locale.languageCode]; + String get id => localizedValues['id'][locale.languageCode]; + String get quantity => localizedValues['quantity'][locale.languageCode]; + String get codeNo => localizedValues['codeNo'][locale.languageCode]; + String get covered => localizedValues['covered'][locale.languageCode]; + String get approvalRequired => localizedValues['approvalRequired'][locale.languageCode]; + String get uncoveredByDoctor => localizedValues['uncoveredByDoctor'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From ad48415038193db295efddccb50883532cf336d4 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 4 Jan 2021 11:13:25 +0300 Subject: [PATCH 05/12] reschdule leave --- lib/screens/reschedule-leaves/reschedule_leave.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 8c5889c7..3fdbfbe3 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -51,10 +51,11 @@ class _RescheduleLeaveScreen extends State { var clinicID; TextEditingController _controller4; void _presentDatePicker(id) { + var date = new DateTime.now(); showDatePicker( context: context, - initialDate: DateTime.now(), - firstDate: DateTime.now(), + initialDate: new DateTime(date.year, date.month, date.day + 15), + firstDate: new DateTime(date.year, date.month, date.day + 15), lastDate: DateTime(2050), ).then((pickedDate) { if (pickedDate == null) { @@ -782,6 +783,7 @@ class _RescheduleLeaveScreen extends State { model.addReschedule(request).then((response) { DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); + Navigator.pop(context); }); } From c9aac6e2e9fc1e50d5dbcc1385f7c14b91be96d9 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Mon, 4 Jan 2021 11:32:14 +0200 Subject: [PATCH 06/12] vital signs solve overflow of the width --- .../vital_sign/vital-signs-screen.dart | 503 ++++++++++-------- 1 file changed, 287 insertions(+), 216 deletions(-) diff --git a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart index c66555c1..a53a3619 100644 --- a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart @@ -415,43 +415,57 @@ class _TemperatureWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).temperature} (C):", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.temperatureCelcius}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).temperature} (C):", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.temperatureCelcius}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).temperature} (F):", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.temperatureCelcius * (9 / 5) + 32}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).temperature} (F):", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.temperatureCelcius * (9 / 5) + 32}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -534,44 +548,59 @@ class _PulseWidgetState extends State { children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).pulseBeats}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.pulseBeatPerMinute}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).pulseBeats}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.pulseBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).rhythm}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.pulseRhythm}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).rhythm}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.pulseRhythm}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -628,43 +657,57 @@ class _RespirationWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).respBeats}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.respirationBeatPerMinute}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).respBeats}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.respirationBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).patternOfRespiration}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.respirationPattern}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).patternOfRespiration}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.respirationPattern}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -721,43 +764,57 @@ class _BloodPressureWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).bloodPressureDiastoleAndSystole}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressureHigher}, ${widget.vitalSign.bloodPressureLower}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).bloodPressureDiastoleAndSystole}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressureHigher}, ${widget.vitalSign.bloodPressureLower}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).cuffLocation}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressureCuffLocation}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).cuffLocation}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressureCuffLocation}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), ], ), @@ -766,44 +823,54 @@ class _BloodPressureWidgetState extends State { ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).patientPosition}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressurePatientPosition}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: AppText( + "${TranslationBase.of(context).patientPosition}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + ), + SizedBox( + width: 8, + ), + Expanded( + child: AppText( + "${widget.vitalSign.bloodPressurePatientPosition}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).cuffSize}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.bloodPressureCuffSize}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).cuffSize}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.bloodPressureCuffSize}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), ), ], ), @@ -953,43 +1020,47 @@ class _PainScaleWidgetState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).painScale}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.painScore}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).painScale}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.painScore}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).painManagement}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "${widget.vitalSign.isPainManagementDone}", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], + Expanded( + child: Row( + children: [ + AppText( + "${TranslationBase.of(context).painManagement}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${widget.vitalSign.isPainManagementDone}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), ), ], ), From 31d6ca559387c9253d6d099ecd236a448b2ee888 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 4 Jan 2021 13:20:33 +0300 Subject: [PATCH 07/12] Doctor ID updated --- lib/screens/reschedule-leaves/reschedule_leave.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 3fdbfbe3..e5d83515 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -759,7 +759,7 @@ class _RescheduleLeaveScreen extends State { "requisitionNo": 0, "requisitionType": offTime, "clinicId": this.profile['ClinicID'], - "doctorId": this.profile['ClinicID'], + "doctorId": this.profile['DoctorID'], "dateTimeFrom": df.format(fromDate), "dateTimeTo": df.format(toDate), "date": df.format(DateTime.now()), @@ -794,7 +794,7 @@ class _RescheduleLeaveScreen extends State { "requisitionNo": 0, "requisitionType": offTime, "clinicId": this.profile['ClinicID'], - "doctorId": this.profile['ClinicID'], + "doctorId": this.profile['DoctorID'], "dateTimeFrom": df.format(fromDate), "dateTimeTo": df.format(toDate), "date": df.format(DateTime.now()), From d67b531865fdd6540195c5ce6d0a0c4eb13e7a67 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 4 Jan 2021 13:39:53 +0300 Subject: [PATCH 08/12] bug fix --- lib/screens/reschedule-leaves/add-rescheduleleave.dart | 4 ++-- lib/screens/reschedule-leaves/reschedule_leave.dart | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index 1b5957b9..2067029f 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -184,7 +184,7 @@ class AddRescheduleLeavScreen extends StatelessWidget { AppText(getDoctor( model .coveringDoctors, - item.doctorId)) + item.coveringDoctorId)) ]) : SizedBox(), AppText( @@ -298,7 +298,7 @@ class AddRescheduleLeavScreen extends StatelessWidget { getDoctor(model, doctorId) { var obj; - obj = model.where((i) => i['doctorID'] == doctorId).toList(); + obj = model.where((i) => i['doctorID'].toString() == doctorId).toList(); print(obj); return obj.length > 0 ? obj[0]['doctorName'] : ""; diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index e5d83515..362e27d9 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -784,6 +784,7 @@ class _RescheduleLeaveScreen extends State { model.addReschedule(request).then((response) { DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); Navigator.pop(context); + model.getRescheduleLeave(); }); } From e75e7801aa2773ce83ad5240266c624247e23257 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Tue, 5 Jan 2021 10:02:51 +0200 Subject: [PATCH 09/12] working on UCAF get data --- lib/client/base_app_client.dart | 2 + lib/config/localized_values.dart | 1 + lib/core/service/patient-ucaf-service.dart | 53 ++ .../service/patient-vital-signs-service.dart | 37 +- .../viewModel/patient-ucaf-viewmodel.dart | 21 + .../profile/UCAF/UCAF-input-screen.dart | 581 +++++++++--------- lib/util/translations_delegate_base.dart | 1 + pubspec.lock | 6 +- 8 files changed, 386 insertions(+), 316 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 83923ea7..3a39c5e9 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -42,6 +42,8 @@ class BaseAppClient { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); if (body['DoctorID'] == null) body['DoctorID'] = doctorProfile?.doctorID; + if (body['DoctorID'] == "") + body['DoctorID'] = null; body['EditedBy'] = doctorProfile?.doctorID; if (body['ProjectID'] == null) { body['ProjectID'] = doctorProfile?.projectID; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 10ac9856..d0cd8720 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -527,4 +527,5 @@ const Map> localizedValues = { 'covered': {'en': "Covered", 'ar':"مغطى" }, 'approvalRequired': {'en': "Approval Required", 'ar':"الموافقة مطلوبة" }, 'uncoveredByDoctor': {'en': "Uncovered By Doctor", 'ar':"غير مغطى من قبل الدكتور" }, + 'chiefComplaintEmptyMsg': {'en': "There is no Chief Complaint", 'ar':"ليس هناك شكوى رئيس" }, }; diff --git a/lib/core/service/patient-ucaf-service.dart b/lib/core/service/patient-ucaf-service.dart index e776720c..06fbce41 100644 --- a/lib/core/service/patient-ucaf-service.dart +++ b/lib/core/service/patient-ucaf-service.dart @@ -1,5 +1,58 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; class UcafService extends BaseService { + List patientChiefComplaintList = []; + VitalSignData patientVitalSigns; + + Future getPatientChiefComplaint(PatiantInformtion patient) async { + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + body['DoctorID'] = ""; + + await baseAppClient.post (GET_CHIEF_COMPLAINT, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + patientChiefComplaintList.clear(); + response['List_ChiefComplaint']['entityList'].forEach((v) { + patientChiefComplaintList.add(GetChiefComplaintResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getPatientVitalSign(PatiantInformtion patient) async { + patientVitalSigns = null; + hasError = false; + Map body = Map(); + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; + body['EpisodeID'] = patient.episodeNo; + + await baseAppClient.post( + GET_PATIENT_VITAL_SIGN_DATA, + onSuccess: (dynamic response, int statusCode) { + if(response['VitalSignsList'] != null){ + if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 0){ + patientVitalSigns = VitalSignData.fromJson(response['VitalSignsList']['entityList'][0]); + } + } + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error.toString(); + }, + body: body, + ); + } } \ No newline at end of file diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart index 43786ac0..8d0cfc31 100644 --- a/lib/core/service/patient-vital-signs-service.dart +++ b/lib/core/service/patient-vital-signs-service.dart @@ -11,43 +11,8 @@ class VitalSignsService extends BaseService{ List patientVitalSignOrderdSubList = []; VitalSignData patientVitalSigns; - /*Future getPatientVitalSign(patient) async { - hasError = false; - await baseAppClient.post( - GET_PATIENT_VITAL_SIGN, - onSuccess: (dynamic response, int statusCode) { - patientVitalSignList = []; - response['List_DoctorPatientVitalSign'].forEach((v) { - patientVitalSignList.add(new VitalSignResModel.fromJson(v)); - }); - - if (patientVitalSignList.length > 0) { - List patientVitalSignOrderdSubListTemp = []; - patientVitalSignOrderdSubListTemp = patientVitalSignList; - patientVitalSignOrderdSubListTemp - .sort((VitalSignResModel a, VitalSignResModel b) { - return b.vitalSignDate.microsecondsSinceEpoch - - a.vitalSignDate.microsecondsSinceEpoch; - }); - patientVitalSignOrderdSubList.clear(); - int length = patientVitalSignOrderdSubListTemp.length >= 20 - ? 20 - : patientVitalSignOrderdSubListTemp.length; - for (int x = 0; x < length; x++) { - patientVitalSignOrderdSubList - .add(patientVitalSignOrderdSubListTemp[x]); - } - } - }, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, - body: patient, - ); - } // Vit*/ - Future getPatientVitalSign(PatiantInformtion patient) async { + patientVitalSigns = null; hasError = false; Map body = Map(); body['PatientMRN'] = patient.patientMRN; diff --git a/lib/core/viewModel/patient-ucaf-viewmodel.dart b/lib/core/viewModel/patient-ucaf-viewmodel.dart index cf11854b..c120e2ab 100644 --- a/lib/core/viewModel/patient-ucaf-viewmodel.dart +++ b/lib/core/viewModel/patient-ucaf-viewmodel.dart @@ -1,9 +1,30 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/patient-ucaf-service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart'; import '../../locator.dart'; class UcafViewModel extends BaseViewModel { UcafService _ucafService = locator(); + + List get patientChiefComplaintList => _ucafService.patientChiefComplaintList; + VitalSignData get patientVitalSigns => _ucafService.patientVitalSigns; + + Future getUCAFData(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _ucafService.getPatientVitalSign(patient); + await _ucafService.getPatientChiefComplaint(patient); + + if (_ucafService.hasError) { + error = _ucafService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + } \ No newline at end of file diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index e0c2f9a7..0116ce46 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -14,6 +14,7 @@ import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; import '../../../../routes.dart'; +import '../../../QR_reader_screen.dart'; class UCAFInputScreen extends StatefulWidget { @override @@ -55,312 +56,338 @@ class _UCAFInputScreenState extends State { final screenSize = MediaQuery.of(context).size; return BaseView( + onModelReady: (model) => model.getUCAFData(patient), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).ucaf, - body: SingleChildScrollView( - child: Column( - children: [ - PatientHeaderWidgetNoAvatar(patient), - Container( - margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + body: model.patientVitalSigns != null && + model.patientChiefComplaintList != null && + model.patientChiefComplaintList.length > 0 + ? SingleChildScrollView( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - CheckboxListTile( - title: AppText( - TranslationBase.of(context).inPatient, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _inPatient, - onChanged: (newValue) { - setState(() { - _inPatient = newValue; - }); - }, - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), - CheckboxListTile( - title: AppText( - TranslationBase.of(context).emergencyCase, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _emergencyCase, - onChanged: (newValue) { - setState(() { - _emergencyCase = newValue; - }); - }, - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), + PatientHeaderWidgetNoAvatar(patient), Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).durationOfIllness, - null, - false), - enabled: true, - controller: _durationOfIllnessController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - keyboardType: TextInputType.number, - )), - SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "BP (H/L)", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "120/80", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - Row( - children: [ - AppText( - "${TranslationBase.of(context).temperature}", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, - ), - AppText( - "37.5(C), 98.6(F)", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, - ), - ], - ), - ], - ), - SizedBox( - height: 4, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - AppText( - "${TranslationBase.of(context).pulseBeats} :", - fontSize: SizeConfig.textMultiplier * 1.8, - color: Colors.black, - fontWeight: FontWeight.w700, - ), - SizedBox( - width: 8, + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CheckboxListTile( + title: AppText( + TranslationBase.of(context).inPatient, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, ), - AppText( - "80", - fontSize: SizeConfig.textMultiplier * 2, - color: Colors.grey.shade800, - fontWeight: FontWeight.normal, + value: _inPatient, + onChanged: (newValue) { + setState(() { + _inPatient = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).emergencyCase, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, ), - ], - ), - ], - ), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).chiefComplaintsAndSymptoms, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 8, - ), - AppText( - TranslationBase.of(context) - .patientFeelsPainInHisBackAndCough, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - SizedBox( - height: 8, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).additionalTextComplaints, - null, - false), - enabled: true, - controller: _additionalComplaintsController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).otherConditions, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - ...List.generate( - conditionsData.length, - (index) => CheckboxListTile( - title: AppText( - conditionsData[index]['name'], - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.1, + value: _emergencyCase, + onChanged: (newValue) { + setState(() { + _emergencyCase = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .durationOfIllness, + null, + false), + enabled: true, + controller: _durationOfIllnessController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "BP (H/L)", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.bloodPressureHigher}/${model.patientVitalSigns.bloodPressureLower}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], ), - value: conditionsData[index]['isChecked'], - onChanged: (newValue) { - setState(() { - conditionsData[index]['isChecked'] = newValue; - }); - }, - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - )), - SizedBox( - height: 8, - ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).other, - null, - false), - enabled: true, - controller: _otherController, - keyboardType: TextInputType.text, - )), - SizedBox( - height: 8, - ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).how, - null, - false), - enabled: true, - controller: _howController, - keyboardType: TextInputType.text, - )), - SizedBox( - height: 8, - ), - Row( - children: [ - Expanded( - child: Container( + Row( + children: [ + AppText( + "${TranslationBase.of(context).temperature}", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.temperatureCelcius}(C), ${model.patientVitalSigns.temperatureCelcius * (9 / 5) + 32}(F)", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 4, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + AppText( + "${TranslationBase.of(context).pulseBeats} :", + fontSize: SizeConfig.textMultiplier * 1.8, + color: Colors.black, + fontWeight: FontWeight.w700, + ), + SizedBox( + width: 8, + ), + AppText( + "${model.patientVitalSigns.pulseBeatPerMinute}", + fontSize: SizeConfig.textMultiplier * 2, + color: Colors.grey.shade800, + fontWeight: FontWeight.normal, + ), + ], + ), + ], + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context) + .chiefComplaintsAndSymptoms, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 8, + ), + AppText( + TranslationBase.of(context) + .patientFeelsPainInHisBackAndCough, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .additionalTextComplaints, + helpers.parseHtmlString(model + .patientChiefComplaintList[0] + .chiefComplaint), + false), + enabled: false, + controller: _additionalComplaintsController, + keyboardType: TextInputType.text, + /*minLines: 4, + maxLines: 6,*/ + )), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).otherConditions, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ...List.generate( + conditionsData.length, + (index) => CheckboxListTile( + title: AppText( + conditionsData[index]['name'], + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.1, + ), + value: conditionsData[index]['isChecked'], + onChanged: (newValue) { + setState(() { + conditionsData[index]['isChecked'] = + newValue; + }); + }, + controlAffinity: + ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + )), + SizedBox( + height: 8, + ), + Container( height: screenSize.height * 0.070, child: TextField( decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).when, + TranslationBase.of(context).other, null, false), enabled: true, - controller: _whenController, + controller: _otherController, keyboardType: TextInputType.text, )), - ), - SizedBox( - width: 4, - ), - Expanded( - child: Container( + SizedBox( + height: 8, + ), + Container( height: screenSize.height * 0.070, child: TextField( decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).where, + TranslationBase.of(context).how, null, false), enabled: true, - controller: _whereController, + controller: _howController, keyboardType: TextInputType.text, )), - ), - ], - ), - SizedBox( - height: 8, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).specifyPossibleLineManagement, - null, - false), - enabled: true, - controller: _managementsLineController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context) - .significantSigns, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - SizedBox( - height: 8, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).backAbdomen, - null, - false), - enabled: true, - controller: _signsController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 16, - ), - AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: (){ - Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: {'patient': patient}); - }, + SizedBox( + height: 8, + ), + Row( + children: [ + Expanded( + child: Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).when, + null, + false), + enabled: true, + controller: _whenController, + keyboardType: TextInputType.text, + )), + ), + SizedBox( + width: 4, + ), + Expanded( + child: Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: + Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).where, + null, + false), + enabled: true, + controller: _whereController, + keyboardType: TextInputType.text, + )), + ), + ], + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context) + .specifyPossibleLineManagement, + null, + false), + enabled: true, + controller: _managementsLineController, + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).significantSigns, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + SizedBox( + height: 8, + ), + Container( + child: TextField( + decoration: Helpers.textFieldSelectorDecoration( + TranslationBase.of(context).backAbdomen, + null, + false), + enabled: true, + controller: _signsController, + keyboardType: TextInputType.text, + )), + SizedBox( + height: 16, + ), + AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#B8382B"), + onPressed: () { + Navigator.of(context).pushNamed( + PATIENT_UCAF_DETAIL, + arguments: {'patient': patient}); + }, + ), + ], + ), ), ], ), + ) + : Container( + child: Center( + child: AppText( + model.patientVitalSigns == null + ? TranslationBase.of(context).vitalSignEmptyMsg + : TranslationBase.of(context).chiefComplaintEmptyMsg, + fontWeight: FontWeight.normal, + color: HexColor("#B8382B"), + fontSize: SizeConfig.textMultiplier * 2.5, + ), + ), ), - ], - ), - ), ), ); } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 37e39676..e2cba7f3 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -548,6 +548,7 @@ class TranslationBase { String get covered => localizedValues['covered'][locale.languageCode]; String get approvalRequired => localizedValues['approvalRequired'][locale.languageCode]; String get uncoveredByDoctor => localizedValues['uncoveredByDoctor'][locale.languageCode]; + String get chiefComplaintEmptyMsg => localizedValues['chiefComplaintEmptyMsg'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/pubspec.lock b/pubspec.lock index 5650f5f9..7f1d8c1d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -503,7 +503,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: @@ -760,7 +760,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: @@ -895,5 +895,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 044ad7b51a7ea81f384b80c9d98a3c72f3d4962d Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 5 Jan 2021 12:14:35 +0300 Subject: [PATCH 10/12] offtime leave --- lib/config/localized_values.dart | 2 + lib/core/viewModel/sick_leave_view_model.dart | 1 + .../add-rescheduleleave.dart | 4 +- .../reschedule-leaves/reschedule_leave.dart | 77 +++++++++++++------ lib/util/translations_delegate_base.dart | 4 + 5 files changed, 63 insertions(+), 25 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 7e824f5f..254bca19 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -519,4 +519,6 @@ const Map> localizedValues = { 'en': "You make referral successfully", 'ar': "You make referral successfully" }, + 'fromTime': {'en': "From Time", 'ar': "من وقت"}, + 'toTime': {'en': "To Time", 'ar': "الى وقت"}, }; diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index d5aba154..5e86249c 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -99,6 +99,7 @@ class SickLeaveViewModel extends BaseViewModel { Future addReschedule(request) async { setState(ViewState.Busy); await _sickLeaveService.addReschedule(request); + notifyListeners(); if (_sickLeaveService.hasError) { error = _sickLeaveService.error; setState(ViewState.Error); diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index 2067029f..685259b4 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -299,7 +299,7 @@ class AddRescheduleLeavScreen extends StatelessWidget { getDoctor(model, doctorId) { var obj; obj = model.where((i) => i['doctorID'].toString() == doctorId).toList(); - print(obj); + //print(obj); return obj.length > 0 ? obj[0]['doctorName'] : ""; } @@ -307,7 +307,7 @@ class AddRescheduleLeavScreen extends StatelessWidget { getReasons(model, reasonID) { var obj; obj = model.where((i) => i['id'] == reasonID).toList(); - print(obj); + //print(obj); return obj.length > 0 ? projectsProvider.isArabic == true diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 362e27d9..bdd87499 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -24,6 +24,7 @@ import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:provider/provider.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; Helpers helpers = Helpers(); @@ -49,13 +50,40 @@ class _RescheduleLeaveScreen extends State { var fromDate; var toDate; var clinicID; + var fromTime; + var toTime; TextEditingController _controller4; void _presentDatePicker(id) { var date = new DateTime.now(); + var initialDate = id == 'fromDate' + ? new DateTime(date.year, date.month, date.day + 15) + : new DateTime(fromDate.year, fromDate.month, fromDate.day); + var firstDate = id == 'fromDate' + ? new DateTime(date.year, date.month, date.day + 15) + : new DateTime(fromDate.year, fromDate.month, fromDate.day); showDatePicker( context: context, - initialDate: new DateTime(date.year, date.month, date.day + 15), - firstDate: new DateTime(date.year, date.month, date.day + 15), + initialDate: initialDate, + firstDate: firstDate, + lastDate: DateTime(2050), + ).then((pickedDate) { + if (pickedDate == null) { + return; + } + setState(() { + final df = new DateFormat('yyyy-MM-dd'); + fromDate = pickedDate; //df.format(); + _toDateController.text = df.format(pickedDate); + toDate = pickedDate; + }); + }); + } + + void _presentCurrentDate(id) { + showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime.now(), lastDate: DateTime(2050), ).then((pickedDate) { if (pickedDate == null) { @@ -328,7 +356,7 @@ class _RescheduleLeaveScreen extends State { TextInputType.number, controller: _toDateController, onTap: () { - _presentDatePicker( + _presentCurrentDate( 'fromDate'); }, inputFormatter: ONLY_DATE, @@ -355,14 +383,11 @@ class _RescheduleLeaveScreen extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - // new AppTextFormField( - // readOnly: true, - // hintText: "", - // borderColor: Colors.white, - // onSaved: (value) {}, - // inputFormatter: ONLY_NUMBERS), - DateTimePicker( + timeHintText: + TranslationBase.of( + context) + .fromTime, type: DateTimePickerType.time, controller: _controller4, @@ -373,6 +398,7 @@ class _RescheduleLeaveScreen extends State { //locale: Locale('en', 'US'), onChanged: (val) => () { print(val); + this.fromTime = val; }, validator: (val) { print(val); @@ -403,16 +429,15 @@ class _RescheduleLeaveScreen extends State { CrossAxisAlignment.start, children: [ DateTimePicker( + timeHintText: + TranslationBase.of( + context) + .toTime, type: DateTimePickerType.time, controller: _controller4, - //initialValue: _initialValue, - // icon: Icon(Icons.access_time), - - //use24HourFormat: false, - //locale: Locale('en', 'US'), onChanged: (val) => () { - print(val); + this.toTime = val; }, validator: (val) { print(val); @@ -761,7 +786,7 @@ class _RescheduleLeaveScreen extends State { "clinicId": this.profile['ClinicID'], "doctorId": this.profile['DoctorID'], "dateTimeFrom": df.format(fromDate), - "dateTimeTo": df.format(toDate), + "dateTimeTo": toDate != null ? df.format(toDate) : df.format(fromDate), "date": df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, "coveringDoctorId": @@ -772,8 +797,8 @@ class _RescheduleLeaveScreen extends State { "weekDayId": 1, "shiftId": 1, "isOpen": true, - "timeFrom": null, - "timeTo": null, + "timeFrom": fromTime, + "timeTo": toTime, "timeFromstr": "", "timeTostr": "" } @@ -784,7 +809,13 @@ class _RescheduleLeaveScreen extends State { model.addReschedule(request).then((response) { DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); Navigator.pop(context); - model.getRescheduleLeave(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddRescheduleLeavScreen(), + // MyReferredPatient(), + ), + ); }); } @@ -797,7 +828,7 @@ class _RescheduleLeaveScreen extends State { "clinicId": this.profile['ClinicID'], "doctorId": this.profile['DoctorID'], "dateTimeFrom": df.format(fromDate), - "dateTimeTo": df.format(toDate), + "dateTimeTo": toDate != null ? df.format(toDate) : df.format(fromDate), "date": df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, "coveringDoctorId": @@ -808,8 +839,8 @@ class _RescheduleLeaveScreen extends State { "weekDayId": 1, "shiftId": 1, "isOpen": true, - "timeFrom": null, - "timeTo": null, + "timeFrom": fromTime, + "timeTo": toTime, "timeFromstr": "", "timeTostr": "" } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 7edccb43..ec34bf4c 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -289,6 +289,10 @@ class TranslationBase { String get toDate => localizedValues['toDate'][locale.languageCode]; + String get fromTime => localizedValues['fromTime'][locale.languageCode]; + + String get toTime => localizedValues['toTime'][locale.languageCode]; + String get searchPatientImageCaptionTitle => localizedValues['searchPatientImageCaptionTitle'][locale.languageCode]; From eb5a3a59ffed5e8659cfcdc9ce15b1a114df2bf0 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 5 Jan 2021 11:19:13 +0200 Subject: [PATCH 11/12] hot fixing --- .../medical-file/medical_file_page.dart | 10 +++--- lib/screens/patients/patients_screen.dart | 20 ++++------- .../prescription/add_prescription_form.dart | 2 +- .../profile/patient_profile_widget.dart | 36 ++++++++++--------- .../soap_update/update_objective_page.dart | 2 ++ 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/lib/screens/medical-file/medical_file_page.dart b/lib/screens/medical-file/medical_file_page.dart index ad693f47..1e3b4739 100644 --- a/lib/screens/medical-file/medical_file_page.dart +++ b/lib/screens/medical-file/medical_file_page.dart @@ -124,10 +124,12 @@ class _MedicalFilePageState extends State { 'Doctor : '.toUpperCase(), fontWeight: FontWeight.w700, ), - AppText( - model.medicalFileList[0].entityList[0] - .timelines[index].doctorName, - fontWeight: FontWeight.w700, + Expanded( + child: AppText( + model.medicalFileList[0].entityList[0] + .timelines[index].doctorName, + fontWeight: FontWeight.w700, + ), ), ], ), diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 33b2606c..602bd180 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -466,25 +466,17 @@ class _PatientsScreenState extends State { height: 10.0, ), - Padding( - padding: EdgeInsets.symmetric( - vertical: - 5.5, - horizontal: - 22.5), - child: - AppText( + AppText( item.firstName + - " " + - item.lastName, + " " + + item.lastName, fontSize: - 2.0 * SizeConfig.textMultiplier, + 2.0 * SizeConfig.textMultiplier, fontWeight: - FontWeight.bold, + FontWeight.bold, backGroundcolor: - Colors.white, + Colors.white, ), - ), ], ), Row( diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index f39499e1..405f240b 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -696,7 +696,7 @@ class _PrescriptionFormWidgetState extends State { selectDate(BuildContext context, PrescriptionViewModel model) async { DateTime selectedDate; - selectedDate = DateTime.now().add(Duration(hours: 10)); + selectedDate = DateTime.now().add(Duration(hours: 15)); final DateTime picked = await showDatePicker( context: context, initialDate: selectedDate, diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index f50c7669..7f49c868 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -94,7 +94,7 @@ class PatientProfileWidget extends StatelessWidget { color: Color(0xffCCCCCC), ), Container( - height: 10 * SizeConfig.textMultiplier, + height: 11 * SizeConfig.textMultiplier, child: Row( children: [ Expanded( @@ -232,14 +232,16 @@ class PatientProfileWidget extends StatelessWidget { SizeConfig.textMultiplier, ), ), - AppText( - patient.admissionDate != null - ? "${DateUtils.convertDateFromServerFormat(patient.admissionDate, 'EEEE dd, MMMM yyyy hh:mm a')}" - : "", - color: Colors.black, - fontWeight: FontWeight.normal, - fontSize: - 1.6 * SizeConfig.textMultiplier, + Expanded( + child: AppText( + patient.admissionDate != null + ? "${DateUtils.convertDateFromServerFormat(patient.admissionDate, 'EEEE dd, MMMM yyyy hh:mm a')}" + : "", + color: Colors.black, + fontWeight: FontWeight.normal, + fontSize: + 1.6 * SizeConfig.textMultiplier, + ), ), ], ), @@ -374,13 +376,15 @@ class PatientProfileWidget extends StatelessWidget { SizedBox( width: 4, ), - AppText( - "${patient.nursingStationName}\n${patient.roomId}", - fontWeight: - FontWeight.normal, - fontSize: 1.4 * - SizeConfig - .textMultiplier, + Expanded( + child: AppText( + "${patient.nursingStationName}\n${patient.roomId}", + fontWeight: + FontWeight.normal, + fontSize: 1.4 * + SizeConfig + .textMultiplier, + ), ), ], ), diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart index e3aef3f4..37a5d72f 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -505,6 +505,8 @@ class _AddExaminationDailogState extends State { baseViewModel: model, child: MasterKeyCheckboxSearchWidget( model: model, + hintSearchText: 'Search Examination', + buttonName: 'Add Examination', masterList: model.physicalExaminationList, removeHistory: (history){ setState(() { From c4cae6fb38e4d18ae560c0bca412c4f17a9ae14c Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 5 Jan 2021 16:45:20 +0300 Subject: [PATCH 12/12] doctor leave bug fix --- lib/core/service/sickleave_service.dart | 13 +- lib/core/viewModel/sick_leave_view_model.dart | 3 +- .../reschedule-leaves/reschedule_leave.dart | 173 ++++++++++-------- 3 files changed, 112 insertions(+), 77 deletions(-) diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index c4aa8abf..63a7496c 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -21,6 +21,9 @@ class SickLeaveService extends BaseService { List get getAllRescheduleLeave => _getReScheduleLeave; List _getReScheduleLeave = []; + dynamic get postReschedule => _postReschedule; + dynamic _postReschedule; + Future getStatistics(appoNo, patientMRN) async { hasError = false; await baseAppClient.post( @@ -171,15 +174,17 @@ class SickLeaveService extends BaseService { ); } - addReschedule(request) async { + Future addReschedule(request) async { hasError = false; await baseAppClient.post( ADD_RESCHDEULE, onSuccess: (dynamic response, int statusCode) { - Future.value(response); + // return Future.value(response); + _postReschedule = response; }, onFailure: (String error, int statusCode) { + _postReschedule = null; hasError = true; super.error = error; }, @@ -193,9 +198,11 @@ class SickLeaveService extends BaseService { await baseAppClient.post( UPDATE_RESCHDEULE, onSuccess: (dynamic response, int statusCode) { - Future.value(response); + _postReschedule = response; + // return Future.value(response); }, onFailure: (String error, int statusCode) { + _postReschedule = null; hasError = true; super.error = error; }, diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index 5e86249c..8e1c68d9 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -16,6 +16,7 @@ class SickLeaveViewModel extends BaseViewModel { List get allReasons => _sickLeaveService.getReasons; List get coveringDoctors => _sickLeaveService.coveringDoctorsList; get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave; + get postSechedule => _sickLeaveService.postReschedule; Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { setState(ViewState.Busy); await _sickLeaveService.addSickLeave(addSickLeaveRequest); @@ -99,7 +100,7 @@ class SickLeaveViewModel extends BaseViewModel { Future addReschedule(request) async { setState(ViewState.Busy); await _sickLeaveService.addReschedule(request); - notifyListeners(); + if (_sickLeaveService.hasError) { error = _sickLeaveService.error; setState(ViewState.Error); diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index bdd87499..6f3299d1 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; @@ -41,9 +42,10 @@ class _RescheduleLeaveScreen extends State { TextEditingController _toDateController = new TextEditingController(); TextEditingController _toDateController2 = new TextEditingController(); ProjectViewModel projectsProvider; + SickLeaveViewModel sickLeaveViewModel; String _selectedClinic; Map profile = {}; - var offTime = '2'; + var offTime = '1'; var date; var doctorID; var reason; @@ -53,6 +55,7 @@ class _RescheduleLeaveScreen extends State { var fromTime; var toTime; TextEditingController _controller4; + TextEditingController _controller5; void _presentDatePicker(id) { var date = new DateTime.now(); var initialDate = id == 'fromDate' @@ -66,25 +69,6 @@ class _RescheduleLeaveScreen extends State { initialDate: initialDate, firstDate: firstDate, lastDate: DateTime(2050), - ).then((pickedDate) { - if (pickedDate == null) { - return; - } - setState(() { - final df = new DateFormat('yyyy-MM-dd'); - fromDate = pickedDate; //df.format(); - _toDateController.text = df.format(pickedDate); - toDate = pickedDate; - }); - }); - } - - void _presentCurrentDate(id) { - showDatePicker( - context: context, - initialDate: DateTime.now(), - firstDate: DateTime.now(), - lastDate: DateTime(2050), ).then((pickedDate) { if (pickedDate == null) { return; @@ -99,6 +83,13 @@ class _RescheduleLeaveScreen extends State { _toDateController2.text = df.format(pickedDate); } }); + + setState(() { + final df = new DateFormat('yyyy-MM-dd'); + fromDate = pickedDate; //df.format(); + _toDateController.text = df.format(pickedDate); + toDate = pickedDate; + }); }); } @@ -112,6 +103,7 @@ class _RescheduleLeaveScreen extends State { @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); + return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( @@ -345,24 +337,26 @@ class _RescheduleLeaveScreen extends State { CrossAxisAlignment.start, children: [ AppTextFormField( - hintText: TranslationBase.of( - context) - .fromDate, - borderColor: Colors.white, - prefix: IconButton( - icon: Icon(Icons - .calendar_today)), - textInputType: - TextInputType.number, - controller: _toDateController, - onTap: () { - _presentCurrentDate( - 'fromDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (value) { - fromDate = value; - }), + hintText: + TranslationBase.of(context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + Icons.calendar_today)), + textInputType: + TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (val) => + fromDate = val, + onSaved: (val) => + fromDate = val, + ) ], )), Row( @@ -391,22 +385,16 @@ class _RescheduleLeaveScreen extends State { type: DateTimePickerType.time, controller: _controller4, - //initialValue: _initialValue, - // icon: Icon(Icons.access_time), - - //use24HourFormat: false, - //locale: Locale('en', 'US'), - onChanged: (val) => () { - print(val); - this.fromTime = val; - }, + onChanged: (val) => + fromTime = val, validator: (val) { print(val); // setState( // () => _valueToValidate4 = val); return null; }, - onSaved: (val) => {}, + onSaved: (val) => + fromTime = val, ) ], ), @@ -435,10 +423,9 @@ class _RescheduleLeaveScreen extends State { .toTime, type: DateTimePickerType.time, - controller: _controller4, - onChanged: (val) => () { - this.toTime = val; - }, + controller: _controller5, + onChanged: (val) => + toTime = val, validator: (val) { print(val); // setState( @@ -446,7 +433,7 @@ class _RescheduleLeaveScreen extends State { return null; }, onSaved: (val) => - {print(val)}, + toTime = val, ) ], ), @@ -510,7 +497,7 @@ class _RescheduleLeaveScreen extends State { AppTextFormField( hintText: TranslationBase .of(context) - .fromDate, + .toDate, borderColor: Colors.white, prefix: IconButton( icon: Icon( @@ -777,16 +764,34 @@ class _RescheduleLeaveScreen extends State { return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; } - addRecheduleLeave(model) { - final df = new DateFormat('yyyy-MM-ddThh:mm:ss'); + addRecheduleLeave(model) async { + final df = new DateFormat('yyyy-MM-ddTHH:MM:ss'); + final dateFormat = new DateFormat('yyyy-MM-dd'); + var fromDates = fromDate; + var toDates = toDate; + if (offTime == '1') { + fromDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + fromTime + + ':' + + DateTime.now().second.toString())); + toDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + toTime + + ':' + + DateTime.now().second.toString())); + } else { + fromDate = df.format(fromDates); + toDate = df.format(toDates); + } Map request = { "Requisition": { "requisitionNo": 0, "requisitionType": offTime, "clinicId": this.profile['ClinicID'], "doctorId": this.profile['DoctorID'], - "dateTimeFrom": df.format(fromDate), - "dateTimeTo": toDate != null ? df.format(toDate) : df.format(fromDate), + "dateTimeFrom": fromDate, + "dateTimeTo": toDate, "date": df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, "coveringDoctorId": @@ -797,8 +802,8 @@ class _RescheduleLeaveScreen extends State { "weekDayId": 1, "shiftId": 1, "isOpen": true, - "timeFrom": fromTime, - "timeTo": toTime, + "timeFrom": "", + "timeTo": "", "timeFromstr": "", "timeTostr": "" } @@ -806,29 +811,41 @@ class _RescheduleLeaveScreen extends State { } }; - model.addReschedule(request).then((response) { - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); - Navigator.pop(context); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AddRescheduleLeavScreen(), - // MyReferredPatient(), - ), - ); + await model.addReschedule(request).then((value) { + if (model.postSechedule != null) { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); + Navigator.pushNamedAndRemoveUntil(context, HOME, (r) => false); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddRescheduleLeavScreen(), + // MyReferredPatient(), + ), + ); + } }); } updateRecheduleLeave(model) { final df = new DateFormat('yyyy-MM-ddThh:mm:ss'); + final dateFormat = new DateFormat('yyyy-MM-dd'); + + if (offTime == '1') { + fromDate = dateFormat.format(fromDate) + 'T' + fromTime + '00'; + toDate = dateFormat.format(fromDate) + 'T' + toTime + '00'; + } else { + fromDate = df.format(fromDate); + toDate = df.format(toDate); + } + Map request = { "Requisition": { "requisitionNo": 0, "requisitionType": offTime, "clinicId": this.profile['ClinicID'], "doctorId": this.profile['DoctorID'], - "dateTimeFrom": df.format(fromDate), - "dateTimeTo": toDate != null ? df.format(toDate) : df.format(fromDate), + "dateTimeFrom": fromDate, + "dateTimeTo": toDate, "date": df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, "coveringDoctorId": @@ -849,7 +866,17 @@ class _RescheduleLeaveScreen extends State { }; model.updateReschedule(request).then((response) { - print(response); + if (model.postSechedule != null) { + DrAppToastMsg.showSuccesToast(TranslationBase.of(context).leaveCreated); + Navigator.pushNamedAndRemoveUntil(context, HOME, (r) => false); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddRescheduleLeavScreen(), + // MyReferredPatient(), + ), + ); + } }); } }