From 49e9ecfa4a0d68da4641086f68d0d9a4c98dc734 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Thu, 31 Dec 2020 09:20:37 +0300 Subject: [PATCH 01/14] doctor leave --- lib/config/config.dart | 18 +- lib/config/localized_values.dart | 8 + lib/core/service/sickleave_service.dart | 55 +++ lib/core/viewModel/sick_leave_view_model.dart | 31 ++ lib/screens/dashboard_screen.dart | 40 ++- .../add-rescheduleleave.dart | 193 +++++++++++ .../reschedule-leaves/reschedule_leave.dart | 315 ++++++++++++++++++ lib/util/translations_delegate_base.dart | 4 + 8 files changed, 658 insertions(+), 6 deletions(-) create mode 100644 lib/screens/reschedule-leaves/add-rescheduleleave.dart create mode 100644 lib/screens/reschedule-leaves/reschedule_leave.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index edb34b5e..41601b9f 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -4,8 +4,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -//const BASE_URL = 'https://hmgwebservices.com/'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; +//const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = @@ -102,6 +102,11 @@ const ARRIVED_PATIENT_URL = const ADD_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/PostSickLeave'; const GET_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/GetAllSickLeaves'; const EXTEND_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/ExtendSickLeave'; + +const GET_OFFTIME = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; + +const GET_RESCHEDULE_LEAVE = + 'Services/DoctorApplication.svc/REST/GetAllSickLeaves'; const GET_PRESCRIPTION_LIST = 'Services/DoctorApplication.svc/REST/GetPrescription'; @@ -120,9 +125,12 @@ const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; -const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; -const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; -const POST_PROGRESS_NOTE = '/Services/DoctorApplication.svc/REST/PostProgressNote'; +const POST_CHIEF_COMPLAINT = + 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; +const POST_PHYSICAL_EXAM = + 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; +const POST_PROGRESS_NOTE = + '/Services/DoctorApplication.svc/REST/PostProgressNote'; var selectedPatientType = 1; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 50d32393..72fa1a26 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -353,4 +353,12 @@ const Map> localizedValues = { 'instruction': {'en': 'Instructions', 'ar': 'إرشادات'}, 'addMedication': {'en': 'ADD MEDICATION', 'ar': 'اضف الدواء'}, 'route': {'en': 'Route', 'ar': 'المسار'}, + 'reschedule-leave': { + 'en': 'Reschedule and leaves', + 'ar': 'إعادة الجدولة والأوراق' + }, + 'no-reschedule-leave': { + 'en': 'No Reschedule and leaves', + 'ar': 'لا إعادة جدولة ويغادر' + } }; diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index 70d9a3e4..926187dd 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -8,7 +8,9 @@ import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.d class SickLeaveService extends BaseService { Map get sickLeavestatisitics => _statistics; Map _statistics = {}; + var offTime = []; + get getOffTimeList => offTime; List get getAllSickLeave => _getAllsickLeave; List _getAllsickLeave = []; Future getStatistics(appoNo, patientMRN) async { @@ -90,4 +92,57 @@ class SickLeaveService extends BaseService { body: {'PatientMRN': 3120772}, ); } + + Future getRescheduleLeave() async { + hasError = false; + await baseAppClient.post( + GET_RESCHEDULE_LEAVE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + _getAllsickLeave.clear(); + // response['SickLeavesList']['entityList'].forEach((v) { + // _getAllsickLeave.add(GetAllSickLeaveResponse.fromJson(v)); + // }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {'PatientMRN': 3120772}, + ); + } + + Future getOffTime() async { + hasError = false; + + await baseAppClient.post( + GET_OFFTIME, + onSuccess: (dynamic response, int statusCode) { + offTime = []; + offTime = response[' ']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"MasterInput": 2013}, + ); + } + + Future getReasons(id) async { + hasError = false; + + await baseAppClient.post( + GET_OFFTIME, + onSuccess: (dynamic response, int statusCode) { + offTime = []; + offTime = response[' ']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"MasterInput": id}, + ); + } } diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index a11d43ec..2e07d3b0 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -12,6 +12,7 @@ class SickLeaveViewModel extends BaseViewModel { SickLeaveService _sickLeaveService = locator(); get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; get getAllSIckLeave => _sickLeaveService.getAllSickLeave; + get allOffTime => _sickLeaveService.getOffTimeList; Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { setState(ViewState.Busy); await _sickLeaveService.addSickLeave(addSickLeaveRequest); @@ -51,4 +52,34 @@ class SickLeaveViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getRescheduleLeave() async { + setState(ViewState.Busy); + await _sickLeaveService.getRescheduleLeave(); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getOffTime() async { + setState(ViewState.Busy); + await _sickLeaveService.getOffTime(); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getReasons(id) async { + setState(ViewState.Busy); + await _sickLeaveService.getReasons(id); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index b6bbc6cf..cb36225f 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -184,7 +185,9 @@ class _DashboardScreenState extends State { ), Container( color: Colors.white, - height: this.isExpanded ? 150 : 110, + height: this.isExpanded + ? MediaQuery.of(context).size.height * 0.19 + : MediaQuery.of(context).size.height * 0.12, ), ], ), @@ -953,6 +956,41 @@ class _DashboardScreenState extends State { SizedBox( height: 20, ), + Row( + children: [ + DashboardItem( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Icon( + Icons.rule_folder, + size: 50, + color: Colors.black, + ), + AppText( + TranslationBase.of(context).rescheduleLeaves, + color: Colors.black, + textAlign: TextAlign.center, + ) + ], + ), + hasBorder: true, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + AddRescheduleLeavScreen(), + // MyReferredPatient(), + ), + ); + }, + ) + ], + ), + SizedBox( + height: 20, + ), ], ), ), diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart new file mode 100644 index 00000000..8963f306 --- /dev/null +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -0,0 +1,193 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.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:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class AddRescheduleLeavScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getRescheduleLeave(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).rescheduleLeaves, + body: model.getAllSIckLeave.length > 0 + ? SingleChildScrollView( + child: Column( + children: model.getAllSIckLeave + .map((GetAllSickLeaveResponse item) { + return CardWithBgWidgetNew( + widget: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Wrap( + // mainAxisAlignment: + // MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(3), + child: AppText( + item.status == 1 + ? TranslationBase.of( + context) + .approved + : item.status == 2 + ? TranslationBase + .of(context) + .extended + : TranslationBase + .of(context) + .pending, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + color: item.status == 1 + ? Colors.green + : Colors.yellow[800], + ), + Row( + children: [ + AppText( + TranslationBase.of( + context) + .leaveStartDate + + ' ', + fontWeight: + FontWeight.bold, + ), + Flexible( + child: Text( + item.startDate, + overflow: + TextOverflow.ellipsis, + )) + ], + ), + AppText( + item.noOfDays.toString() + + ' ' + + TranslationBase.of( + context) + .daysSickleave, + fontWeight: FontWeight.bold, + ), + Row(children: [ + AppText( + item.remarks, + ) + ]), + ], + ), + SizedBox( + width: 20, + ), + ], + ), + ), + (item.status == 1 || item.status == 2) + ? Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.open_in_full, + size: 40, + ), + // color: Colors.green, //Colors.black, + onPressed: () => { + // openSickLeave(context, true, + // extendedData: item) + }, + )) + : SizedBox(), + ], + )), + SizedBox( + height: 20, + ), + Divider( + height: 1, + ), + ], + )); + }).toList(), + ), + ) + : new Builder(builder: (context) { + return Center( + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(40), + decoration: BoxDecoration( + border: Border.all( + color: HexColor('#B8382C'), width: 4), + borderRadius: + BorderRadius.all(Radius.circular(100))), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + ), + onPressed: () { + openLeave( + context, + false, + ); + }), + ), + Padding( + child: AppText( + TranslationBase.of(context).noReScheduleLeave, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), + ), + AppText( + TranslationBase.of(context).applyNow, + fontWeight: FontWeight.bold, + color: HexColor('#B8382C'), + ) + ], + ), + )); + }), + )); + } + + openLeave(BuildContext context, isExtend, + {GetAllSickLeaveResponse extendedData}) { + showModalBottomSheet( + context: context, + builder: (context) { + return new Container( + child: RescheduleLeaveScreen( + // appointmentNo: extendedData.appointmentNo, + // patientMRN: extendedData.patientMRN, + // isExtended: isExtend, + // extendedData: extendedData, + )); + }); + } +} diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart new file mode 100644 index 00000000..6de0779e --- /dev/null +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -0,0 +1,315 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_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/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.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'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; + +Helpers helpers = Helpers(); + +class RescheduleLeaveScreen extends StatefulWidget { + RescheduleLeaveScreen(); + @override + _RescheduleLeaveScreen createState() => _RescheduleLeaveScreen(); +} + +class _RescheduleLeaveScreen extends State { + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + TextEditingController _toDateController = new TextEditingController(); + String _selectedClinic; + Map profile = {}; + AddSickLeaveRequest addSickLeave = AddSickLeaveRequest(); + void _presentDatePicker(id) { + showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(2019), + lastDate: DateTime.now(), + ).then((pickedDate) { + if (pickedDate == null) { + return; + } + setState(() { + // var selectedDate = DateFormat.yMd().format(pickedDate); + final df = new DateFormat('yyyy-MM-dd'); + addSickLeave.startDate = df.format(pickedDate); + + _toDateController.text = addSickLeave.startDate; + //addSickLeave.startDate = selectedDate; + }); + }); + } + + @override + void initState() { + getProfile(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getClinicsList(), + builder: (_, model, w) => BaseView( + onModelReady: (model2) => model2.getOffTime(), + builder: (_, model2, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + Container( + margin: EdgeInsets.only( + top: 10, left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + 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: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + // AppText( + // TranslationBase.of(context).clinicName, + // fontSize: 10, + // ), + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownButtonHideUnderline( + child: new IgnorePointer( + ignoring: true, + child: DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: getClinicName( + model) ?? + "", + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model + .getClinicNameList() + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + item, + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: + Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => + {}, + items: model + .getClinicNameList() + .map((item) { + return DropdownMenuItem( + value: + item.toString(), + child: Text( + item, + textAlign: + TextAlign.end, + ), + ); + }).toList(), + ))), + ), + ], + ) + ], + ), + )), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + new IgnorePointer( + ignoring: true, + child: AppTextFormField( + readOnly: true, + hintText: profile['DoctorName'], + borderColor: Colors.white, + onSaved: (value) {}, + inputFormatter: ONLY_NUMBERS)) + ], + ), + ), + + Container( + margin: EdgeInsets.only( + top: 10, left: 10, right: 10), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + 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: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownButtonHideUnderline( + child: new IgnorePointer( + ignoring: true, + child: DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: getClinicName( + model) ?? + "", + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model + .getClinicNameList() + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + item, + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: + Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => + {}, + items: model + .getClinicNameList() + .map((item) { + return DropdownMenuItem( + value: + item.toString(), + child: Text( + item, + textAlign: + TextAlign.end, + ), + ); + }).toList(), + ))), + ), + ], + ) + ], + ), + )), + + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context).add, + onPressed: () {}, + ), + ], + ), + ), + // Column( + // children: [ + // Texts(TranslationBase.of(context) + // .previousSickLeaveIssue + + // ' ') + // ], + // ) + ], + ), + ), + ), + ), + ))); + } + + getProfile() async { + Map p = await sharedPref.getObj(DOCTOR_PROFILE); + setState(() { + this.profile = p; + }); + } + + getClinicName(model) { + var clinicInfo = model.clinicsList + .where((i) => i['ClinicID'] == this.profile['ClinicID']) + .toList(); + return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; + } +} diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 59eda9e0..4841f0f5 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -387,9 +387,13 @@ class TranslationBase { String get indication => localizedValues['indication'][locale.languageCode]; String get duration => localizedValues['duration'][locale.languageCode]; String get instruction => localizedValues['instruction'][locale.languageCode]; + String get rescheduleLeaves => + localizedValues['reschedule-leave'][locale.languageCode]; String get addMedication => localizedValues['addMedication'][locale.languageCode]; String get route => localizedValues['route'][locale.languageCode]; + String get noReScheduleLeave => + localizedValues['no-reschedule-leave'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From 3c968f0de11e8428a5a67cc9d8dbfd4731229396 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Fri, 1 Jan 2021 09:59:00 +0300 Subject: [PATCH 02/14] doctor leave --- assets/fonts/DoctorApp.ttf | Bin 17812 -> 15928 bytes assets/images/leaves.svg | 7 + lib/config/config.dart | 9 +- lib/config/localized_values.dart | 4 + lib/core/service/sickleave_service.dart | 53 ++- .../viewModel/leave_rechdule_response.dart | 52 +++ lib/core/viewModel/patient_view_model.dart | 2 +- lib/core/viewModel/sick_leave_view_model.dart | 17 +- lib/icons_app/config.json | 41 +- lib/icons_app/doctor_app_icons.dart | 91 ++-- lib/screens/dashboard_screen.dart | 3 +- .../add-rescheduleleave.dart | 259 +++++++----- .../reschedule-leaves/reschedule_leave.dart | 395 +++++++++++++++--- lib/util/translations_delegate_base.dart | 6 + lib/widgets/shared/app_drawer_widget.dart | 39 +- 15 files changed, 730 insertions(+), 248 deletions(-) create mode 100644 assets/images/leaves.svg create mode 100644 lib/core/viewModel/leave_rechdule_response.dart diff --git a/assets/fonts/DoctorApp.ttf b/assets/fonts/DoctorApp.ttf index 21ce4a5dcc4d71ffbba5bd4b4b466b06d1b154c3..22539da0652f12c82f86a0652f0c69f2a8f697c8 100644 GIT binary patch delta 901 zcmYL_K}-`-5Qb-V+ikb)0^KbYTIfOxNCFgXVFLsUQKN}RK@);V*0Kmm3)mKg1j7wf zI3VR3v0o} za|{5k0>H(1Qk@xo`C}M>83bUPuO{ZlV~>~m0jyg9(d`LM9jkqCpM2OMDH8Z<{yTGHmu(8_3e?;bc=od|48EqDG|W6v1jRQ3wRcA)o^ zmU*ux8^CMWmR-X>RI=}IVUbg5l5QB3w31j-E6GAL3Z+p1FNm6#Tgf^~+ydsP3ffe! zm+Mu!PnY$e-l!{PCmnQ&NPtMgA))I33+Y}Mx@h+R+XKDXSImjL!MKo5{4J`@do1nP z7Nk}rpueLx915z*HXaImWR*jKKYPm>wXIkEuI{hi&A+x9;rwiOGn1d~yM&8Q!!Rb< zuj~bIf(vA*gAO2!BA zwPRBmQ|b1YoQ=pBz)E)+wqqD6t3<646+PIcVX=9f3{8ZdImQrtMsnN;! N^c0uS)azOr;14+9%>V!Z delta 2668 zcmZ`)X>1$E6`r@t-4&P1m6qi0iWEulUda+ki`PnFL@`ie_^f3$QWV#|iM-eh!mPHhcCLC> zqm2e3t7O%Qdq3T;J%D;WB!xek3WGi@gd??^%x1w$d?@2zQCM)`sYET{9G&s$UI|!| z@I(NeA`!f))nJQ=8`n^ahzHkji%1u)krojzuF)0|U+pZHwq14K@Z9#^@D+XMR({Sk z5><@Zm}fs>KTi}AB5CpjnIKP-c~T+IkZ+Qg$z}30@@sOPd`LbacL<4wcprpAyi3bN zDmM(77#GfFVlw!kB}xE2_Cp?2msWtL231U_atY`IYVOiFW{_q3{2S2x)Y?ZcNi~((n%rGcopmxLHq$=3roK8o6aw#cZN$66(%;@NSuy*^1M0 z&i-C^vqFJETb z(Zy6%ayX=ul2X6>cGF{1V@l~ns}p#1XQKt2MG<;#&UbE8&u>%B`j2+gJ)Qn#&>fxT zk??G8EianRTMrX+E9{Rk-bJapmTG;2-gjFW)3k42`g8+x`JIzA-6@(W?4F|g6U{L7 zn^QC{z6TyLzuI7O>Ha^dwp+<#Hcch8I6*V(R31U9BIW5Tp*c>7aa*I&1mq4xc$6f` zHZo53k)z}Sd7iw8P$XsovIR(Kx{DY56nA_$7>Xfcawe8nX8aUuY%rTiKu8AF`Tx}s zI906qMs3bWKmoeZh34Y>K;RRQGo!I=1|#|r(il-!*CQ6dl);bR0fLne8LDmy=~im$ z!xa(73o4!`AsaJf5Y#1)-%^|?TDm={!h$H&ZwO-Hb@22hLRN>NcPIV`Vq|#haAfxe zy>+#CF^*$h1AelfV?>#oJ0XaoaAKabi@?KpcR0T#AMWnY0GfSA5FzsoBgdG#%%R#+ zA}FO`T2A}=hKBn5soG14!1!AaSXr6O?x4PQWG5E`G*rC)w?`tw5gh0DaI(m7dqr8C zV8PmMIUY%d^I;sxNati~nwm|gCVvZqyK*%t>26ne%k%)x4@_HlWqW*lWhJwT`J9I3 zJYB{ZtEacG`xze~ItutNfCb^h z58x9;D~zH=DRlUDKqxf(nw~SWW;T;c2UD64%dhFV5#WN^AV8%B#?Fl&KdR=w~SW&dgi!Ptfb)au) zuJDmywF(_)+PWOpptCCm-2IQ(s3kp-3Bgd0UftB*-lz8rK`1kk29|?ZmosQ}bhUMQ zd%XjjpLJ>@Bbw7L-?}B&e`*y51_Ueo-BEHtxa26oOKaDJcU8Z(c29U&U&EVng!1)2 z*w5MZ#KNI%TKCxD%A_F$b(EaS7^BOlpXy8=95(k=O}i?|D!6Sy!{|umddve^#_MHr z`%TvSWi=61EWx;C@F`cwZQHq2?C2;i?X^cptSv$%gda>d5f7Ftr6c7Pc9?-Nxl*2;pP64MA1jxZXXdO&m*X>wv*q}JxLiJ1US2L8 pi4U~3w&huSOKGWee7?MJ+;Z&9!i+e(Tsl==o}XD + + + + + + diff --git a/lib/config/config.dart b/lib/config/config.dart index 7d39df7b..ef5898b3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -4,8 +4,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -const BASE_URL = 'https://hmgwebservices.com/'; -//const BASE_URL = 'https://uat.hmgwebservices.com/'; +//const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = @@ -109,9 +109,10 @@ const GET_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/GetAllSickLeaves'; const EXTEND_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/ExtendSickLeave'; const GET_OFFTIME = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; - +const GET_COVERING_DOCTORS = + 'Services/DoctorApplication.svc/REST/GetCoveringDoctor'; const GET_RESCHEDULE_LEAVE = - 'Services/DoctorApplication.svc/REST/GetAllSickLeaves'; + 'Services/DoctorApplication.svc/REST/GetRequisition'; const GET_PRESCRIPTION_LIST = 'Services/DoctorApplication.svc/REST/GetPrescription'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f9a1fcd5..127ee975 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -386,4 +386,8 @@ const Map> localizedValues = { 'fio2': {'en': "FIO2(%)", 'ar': 'FIO2(%)'}, 'sao2': {'en': "SAO2(%)", 'ar': 'SAO2(%)'}, 'painManagement': {'en': "Pain Management", 'ar': 'إدارة الألم'}, + 'holiday': {'en': "Holiday", 'ar': 'يوم الاجازة'}, + 'to': {'en': "To", 'ar': 'إلى'}, + 'coveringDoctor': {'en': "Covering Doctor", 'ar': 'تغطية دكتور'}, + 'requestLeave': {'en': 'Request Leave', 'ar': 'طلب إجازة'} }; diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index 926187dd..cd0dbf50 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; @@ -8,11 +9,18 @@ import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.d class SickLeaveService extends BaseService { Map get sickLeavestatisitics => _statistics; Map _statistics = {}; - var offTime = []; - - get getOffTimeList => offTime; + List get getOffTimeList => offTime; + List offTime = []; + List get getReasons => reasonse; + List reasonse = []; List get getAllSickLeave => _getAllsickLeave; List _getAllsickLeave = []; + List get coveringDoctorsList => _coveringDoctors; + List _coveringDoctors = []; + + List get getAllRescheduleLeave => + _getReScheduleLeave; + List _getReScheduleLeave = []; Future getStatistics(appoNo, patientMRN) async { hasError = false; await baseAppClient.post( @@ -38,7 +46,7 @@ class SickLeaveService extends BaseService { ADD_SICK_LEAVE, onSuccess: (dynamic response, int statusCode) { Future.value(response); - print(response); + //print(response); // _statistics = {}; // _statistics = response['SickLeaveStatistics']; }, @@ -99,16 +107,16 @@ class SickLeaveService extends BaseService { GET_RESCHEDULE_LEAVE, onSuccess: (dynamic response, int statusCode) { Future.value(response); - _getAllsickLeave.clear(); - // response['SickLeavesList']['entityList'].forEach((v) { - // _getAllsickLeave.add(GetAllSickLeaveResponse.fromJson(v)); - // }); + _getReScheduleLeave.clear(); + response['requisitionList']['entityList'].forEach((v) { + _getReScheduleLeave.add(GetRescheduleLeavesResponse.fromJson(v)); + }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, - body: {'PatientMRN': 3120772}, + body: {'ClinicID': 1}, ); } @@ -119,7 +127,7 @@ class SickLeaveService extends BaseService { GET_OFFTIME, onSuccess: (dynamic response, int statusCode) { offTime = []; - offTime = response[' ']; + offTime = response['MasterLookUpList']['entityList']; }, onFailure: (String error, int statusCode) { hasError = true; @@ -129,20 +137,37 @@ class SickLeaveService extends BaseService { ); } - Future getReasons(id) async { + Future getReasonsByID({id}) async { hasError = false; await baseAppClient.post( GET_OFFTIME, onSuccess: (dynamic response, int statusCode) { - offTime = []; - offTime = response[' ']; + reasonse = []; + reasonse = response['MasterLookUpList']['entityList']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"MasterInput": id ?? 18}, + ); + } + + Future getCoveringDoctors() async { + hasError = false; + + await baseAppClient.post( + GET_COVERING_DOCTORS, + onSuccess: (dynamic response, int statusCode) { + _coveringDoctors = []; + _coveringDoctors = response['coveringDoctorList']['entityList']; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, - body: {"MasterInput": id}, + body: {"ClinicID": 1}, ); } } diff --git a/lib/core/viewModel/leave_rechdule_response.dart b/lib/core/viewModel/leave_rechdule_response.dart new file mode 100644 index 00000000..d7cab8bf --- /dev/null +++ b/lib/core/viewModel/leave_rechdule_response.dart @@ -0,0 +1,52 @@ +class GetRescheduleLeavesResponse { + int clinicId; + var coveringDoctorId; + String date; + String dateTimeFrom; + String dateTimeTo; + int doctorId; + int reasonId; + int requisitionNo; + int requisitionType; + int status; + + GetRescheduleLeavesResponse( + {this.clinicId, + this.coveringDoctorId, + this.date, + this.dateTimeFrom, + this.dateTimeTo, + this.doctorId, + this.reasonId, + this.requisitionNo, + this.requisitionType, + this.status}); + + GetRescheduleLeavesResponse.fromJson(Map json) { + clinicId = json['clinicId']; + coveringDoctorId = json['coveringDoctorId']; + date = json['date']; + dateTimeFrom = json['dateTimeFrom']; + dateTimeTo = json['dateTimeTo']; + doctorId = json['doctorId']; + reasonId = json['reasonId']; + requisitionNo = json['requisitionNo']; + requisitionType = json['requisitionType']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + data['clinicId'] = this.clinicId; + data['coveringDoctorId'] = this.coveringDoctorId; + data['date'] = this.date; + data['dateTimeFrom'] = this.dateTimeFrom; + data['dateTimeTo'] = this.dateTimeTo; + data['doctorId'] = this.doctorId; + data['reasonId'] = this.reasonId; + data['requisitionNo'] = this.requisitionNo; + data['requisitionType'] = this.requisitionType; + data['status'] = this.status; + return data; + } +} diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index 9672da83..2fcdc779 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -49,7 +49,7 @@ class PatientViewModel extends BaseViewModel { List get referralFrequencyList => _patientService.referalFrequancyList; - Future getPatientList( patient, patientType, + Future getPatientList(patient, patientType, {bool isBusyLocal = false}) async { if (isBusyLocal) { setState(ViewState.BusyLocal); diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index 2e07d3b0..7c162ad1 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -12,7 +12,10 @@ class SickLeaveViewModel extends BaseViewModel { SickLeaveService _sickLeaveService = locator(); get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; get getAllSIckLeave => _sickLeaveService.getAllSickLeave; - get allOffTime => _sickLeaveService.getOffTimeList; + List get allOffTime => _sickLeaveService.getOffTimeList; + List get allReasons => _sickLeaveService.getReasons; + List get coveringDoctors => _sickLeaveService.coveringDoctorsList; + get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave; Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { setState(ViewState.Busy); await _sickLeaveService.addSickLeave(addSickLeaveRequest); @@ -75,7 +78,17 @@ class SickLeaveViewModel extends BaseViewModel { Future getReasons(id) async { setState(ViewState.Busy); - await _sickLeaveService.getReasons(id); + await _sickLeaveService.getReasonsByID(id: id); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getCoveringDoctors() async { + setState(ViewState.Busy); + await _sickLeaveService.getCoveringDoctors(); if (_sickLeaveService.hasError) { error = _sickLeaveService.error; setState(ViewState.Error); diff --git a/lib/icons_app/config.json b/lib/icons_app/config.json index fef927b0..ede09595 100644 --- a/lib/icons_app/config.json +++ b/lib/icons_app/config.json @@ -384,6 +384,34 @@ "sync" ] }, + { + "uid": "a0f7dbb184f90f285a9cba8cf09a9b6a", + "css": "drawer_icon", + "code": 59429, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1564.7 1000H68C30.6 1000 0 958.7 0 908.2H0C0 857.6 30.6 816.3 68 816.3H1564.7C1602 816.3 1632.7 857.6 1632.7 908.2H1632.7C1632.7 958.7 1602 1000 1564.7 1000ZM911.6 591.8H68C30.6 591.8 0 550.5 0 500H0C0 449.5 30.6 408.2 68 408.2H911.6C949 408.2 979.6 449.5 979.6 500H979.6C979.6 550.5 949 591.8 911.6 591.8ZM1238.1 183.7H68C30.6 183.7 0 142.4 0 91.8H0C0 41.3 30.6 0 68 0H1238.1C1275.5 0 1306.1 41.3 1306.1 91.8H1306.1C1306.1 142.4 1275.5 183.7 1238.1 183.7Z", + "width": 1633 + }, + "search": [ + "drawer_icon" + ] + }, + { + "uid": "764baf138776221a3e1e845391b188a4", + "css": "leaves", + "code": 59446, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M968.7 468.7H572.9A31.3 31.3 0 1 1 572.9 406.2H968.7A31.3 31.3 0 1 1 968.7 468.7ZM968.7 468.7M812.5 625A31.3 31.3 0 0 1 790.4 571.6L924.5 437.5 790.4 303.3A31.3 31.3 0 0 1 834.6 259.1L990.9 415.4A31.3 31.3 0 0 1 990.9 459.6L834.6 615.8A31.2 31.2 0 0 1 812.5 625ZM812.5 625M333.3 1000A83.3 83.3 0 0 0 416.7 916.7V166.7A83.9 83.9 0 0 0 360.3 87.5L109.9 4.1A84.2 84.2 0 0 0 0 83.4V833.4A83.9 83.9 0 0 0 56.4 912.4L306.8 995.8A87.2 87.2 0 0 0 333.3 1000ZM83.3 62.5A24.5 24.5 0 0 1 90.8 63.6L340.1 146.7A21.4 21.4 0 0 1 354.2 166.6V916.6A22 22 0 0 1 325.9 936.4L76.6 853.3A21.5 21.5 0 0 1 62.5 833.3V83.3A20.9 20.9 0 0 1 83.3 62.5ZM83.3 62.5M635.4 208.3A31.3 31.3 0 0 0 666.7 177.1V114.6A114.7 114.7 0 0 0 552.1 0H83.3A31.3 31.3 0 0 0 83.3 62.5H552.1A52.1 52.1 0 0 1 604.2 114.6V177.1A31.3 31.3 0 0 0 635.4 208.3ZM635.4 208.3M385.4 875H552.1A114.7 114.7 0 0 0 666.6 760.4V697.9A31.3 31.3 0 0 0 604.1 697.9V760.4A52.1 52.1 0 0 1 552.1 812.5H385.4A31.3 31.3 0 0 0 385.4 875ZM385.4 875", + "width": 1000 + }, + "search": [ + "leaves" + ] + }, { "uid": "740f78c2b53c8cc100a8b0d283bbd34f", "css": "home_icon-1", @@ -481,19 +509,6 @@ "search": [ "scdedule_icon_active" ] - }, { - "uid": "a0f7dbb184f90f285a9cba8cf09a9b6a", - "css": "drawer_icon", - "code": 59429, - "src": "custom_icons", - "selected": true, - "svg": { - "path": "M1564.7 1000H68C30.6 1000 0 958.7 0 908.2H0C0 857.6 30.6 816.3 68 816.3H1564.7C1602 816.3 1632.7 857.6 1632.7 908.2H1632.7C1632.7 958.7 1602 1000 1564.7 1000ZM911.6 591.8H68C30.6 591.8 0 550.5 0 500H0C0 449.5 30.6 408.2 68 408.2H911.6C949 408.2 979.6 449.5 979.6 500H979.6C979.6 550.5 949 591.8 911.6 591.8ZM1238.1 183.7H68C30.6 183.7 0 142.4 0 91.8H0C0 41.3 30.6 0 68 0H1238.1C1275.5 0 1306.1 41.3 1306.1 91.8H1306.1C1306.1 142.4 1275.5 183.7 1238.1 183.7Z", - "width": 1633 - }, - "search": [ - "drawer_icon" - ] } ] } \ No newline at end of file diff --git a/lib/icons_app/doctor_app_icons.dart b/lib/icons_app/doctor_app_icons.dart index 80db55c1..ef01c934 100644 --- a/lib/icons_app/doctor_app_icons.dart +++ b/lib/icons_app/doctor_app_icons.dart @@ -11,7 +11,7 @@ /// fonts: /// - asset: fonts/DoctorApp.ttf /// -/// +/// /// import 'package:flutter/widgets.dart'; @@ -19,35 +19,64 @@ class DoctorApp { DoctorApp._(); static const _kFontFam = 'DoctorApp'; - static const _kFontPkg = null; - - static const IconData female_icon = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData reject_icon = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon_active = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon_active = IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon_active = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData scdedule_icon_active = IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule_icon = IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData discharge_patient = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData approved_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData pending_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData in_patient_white = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lab_results = IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon = IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData operations = IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData out_patient = IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData patient = IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData radiology = IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData mail = IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData medicine_search = IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_code = IconData(0xe820, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referral = IconData(0xe821, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referred = IconData(0xe822, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_patient = IconData(0xe823, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData sync_icon = IconData(0xe824, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData drawer_icon = IconData(0xe825, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const String _kFontPkg = null; + static const IconData female_icon = + IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male = + IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData reject_icon = + IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon_active = + IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon = + IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon_active = + IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon = + IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon_active = + IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData scdedule_icon_active = + IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule_icon = + IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData discharge_patient = + IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData approved_icon = + IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData pending_icon = + IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData in_patient_white = + IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData lab_results = + IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon = + IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData operations = + IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData out_patient = + IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData patient = + IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_code = + IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData radiology = + IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral = + IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_patient = + IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData mail = + IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData medicine_search = + IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referred = + IconData(0xe822, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData sync_icon = + IconData(0xe824, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData drawer_icon = + IconData(0xe825, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData leaves = + IconData(0xe836, fontFamily: _kFontFam, fontPackage: _kFontPkg); } diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 948c41f5..292cd585 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -964,9 +964,8 @@ class _DashboardScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Icon( - Icons.rule_folder, + DoctorApp.leaves, size: 50, - color: Colors.black, ), AppText( TranslationBase.of(context).rescheduleLeaves, diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index 8963f306..79b47523 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -1,4 +1,6 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; @@ -8,6 +10,7 @@ import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.da import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:flutter/material.dart'; @@ -17,119 +20,179 @@ class AddRescheduleLeavScreen extends StatelessWidget { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getRescheduleLeave(), + onModelReady: (model) => + {model.getRescheduleLeave(), model.getCoveringDoctors()}, builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).rescheduleLeaves, - body: model.getAllSIckLeave.length > 0 + body: model.getReschduleLeave.length > 0 ? SingleChildScrollView( child: Column( - children: model.getAllSIckLeave - .map((GetAllSickLeaveResponse item) { - return CardWithBgWidgetNew( - widget: Column( - children: [ - Container( - padding: EdgeInsets.only(left: 10, right: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 4, - child: Wrap( - // mainAxisAlignment: - // MainAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, + children: [ + Container( + margin: + EdgeInsets.only(left: 15, right: 15, top: 20), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + 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, + onTap: () { + openLeave( + context, + false, + ); + }, + inputFormatter: ONLY_LETTERS, + ) + ], + ), + ), + Column( + children: model.getReschduleLeave.map( + (GetRescheduleLeavesResponse item) { + return CardWithBgWidgetNew( + widget: Column( + children: [ + Container( + padding: + EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Wrap( children: [ - Container( - padding: EdgeInsets.all(3), - child: AppText( - item.status == 1 - ? TranslationBase.of( - context) - .approved - : item.status == 2 + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: + EdgeInsets.all(3), + child: AppText( + item.status == 1 ? TranslationBase .of(context) - .extended - : TranslationBase - .of(context) - .pending, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - color: item.status == 1 - ? Colors.green - : Colors.yellow[800], - ), - Row( - children: [ - AppText( + .approved + : item.status == 2 + ? TranslationBase.of( + context) + .pending + : TranslationBase.of( + context) + .rejected, + fontWeight: + FontWeight.bold, + color: Colors.white, + ), + color: item.status == 1 + ? Colors.green + : item.status == 2 + ? Colors + .yellow[800] + : Colors.red[800], + ), + SizedBox( + height: 5, + ), + Container( + child: AppText( TranslationBase.of( context) - .leaveStartDate + + .holiday + ' ', fontWeight: FontWeight.bold, + )), + Row( + children: [ + Flexible( + child: Text( + item.dateTimeFrom + + ' ' + + TranslationBase.of( + context) + .to + + ' ' + + item.dateTimeTo, + // overflow: + // TextOverflow.ellipsis, + )) + ], ), - Flexible( - child: Text( - item.startDate, - overflow: - TextOverflow.ellipsis, - )) - ], - ), - AppText( - item.noOfDays.toString() + - ' ' + + SizedBox( + height: 5, + ), + AppText( TranslationBase.of( context) - .daysSickleave, - fontWeight: FontWeight.bold, + .coveringDoctor, + fontWeight: + FontWeight.bold, + ), + model.coveringDoctors + .length > + 0 + ? Row(children: [ + AppText(getDoctor( + model + .coveringDoctors, + item.doctorId)) + ]) + : SizedBox(), + ], + ), + SizedBox( + width: 10, ), - Row(children: [ - AppText( - item.remarks, - ) - ]), ], ), - SizedBox( - width: 20, - ), - ], - ), - ), - (item.status == 1 || item.status == 2) - ? Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.open_in_full, - size: 40, - ), - // color: Colors.green, //Colors.black, - onPressed: () => { - // openSickLeave(context, true, - // extendedData: item) - }, - )) - : SizedBox(), - ], - )), - SizedBox( - height: 20, - ), - Divider( - height: 1, - ), - ], - )); - }).toList(), + ), + (item.status == 1) + ? Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.edit_outlined, + size: 30, + ), + // color: Colors.green, //Colors.black, + onPressed: () => { + // openSickLeave(context, true, + // extendedData: item) + }, + )) + : SizedBox(), + ], + )), + SizedBox( + height: 10, + ), + Divider( + height: 1, + ), + ], + )); + }).toList(), + ) + ], ), ) : new Builder(builder: (context) { @@ -190,4 +253,12 @@ class AddRescheduleLeavScreen extends StatelessWidget { )); }); } + + getDoctor(model, doctorId) { + var obj; + obj = model.where((i) => i['doctorID'] == 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 6de0779e..9ed6dae7 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; 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/screens/base/base_view.dart'; @@ -20,6 +21,7 @@ import 'package:flutter/material.dart'; 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'; Helpers helpers = Helpers(); @@ -32,6 +34,7 @@ class RescheduleLeaveScreen extends StatefulWidget { class _RescheduleLeaveScreen extends State { DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); TextEditingController _toDateController = new TextEditingController(); + ProjectViewModel projectsProvider; String _selectedClinic; Map profile = {}; AddSickLeaveRequest addSickLeave = AddSickLeaveRequest(); @@ -59,17 +62,23 @@ class _RescheduleLeaveScreen extends State { @override void initState() { getProfile(); + super.initState(); } @override Widget build(BuildContext context) { + projectsProvider = Provider.of(context); return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( - onModelReady: (model2) => model2.getOffTime(), + onModelReady: (model2) => { + model2.getOffTime(), + model2.getReasons(18), + model2.getCoveringDoctors() + }, builder: (_, model2, w) => AppScaffold( - baseViewModel: model, + baseViewModel: model2, isShowAppBar: false, body: Center( child: Container( @@ -79,8 +88,7 @@ class _RescheduleLeaveScreen extends State { child: ListView( children: [ Container( - margin: EdgeInsets.only( - top: 10, left: 10, right: 10), + margin: EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.0)), @@ -98,10 +106,6 @@ class _RescheduleLeaveScreen extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - // AppText( - // TranslationBase.of(context).clinicName, - // fontSize: 10, - // ), Row( mainAxisSize: MainAxisSize.max, children: [ @@ -163,11 +167,9 @@ class _RescheduleLeaveScreen extends State { ], ), )), - SizedBox( - height: 10, - ), + Container( - margin: EdgeInsets.only(left: 10, right: 10), + margin: EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.0)), @@ -181,7 +183,9 @@ class _RescheduleLeaveScreen extends State { ignoring: true, child: AppTextFormField( readOnly: true, - hintText: profile['DoctorName'], + hintText: profile != null + ? profile['DoctorName'] + : "", borderColor: Colors.white, onSaved: (value) {}, inputFormatter: ONLY_NUMBERS)) @@ -190,8 +194,7 @@ class _RescheduleLeaveScreen extends State { ), Container( - margin: EdgeInsets.only( - top: 10, left: 10, right: 10), + margin: EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6.0)), @@ -212,65 +215,319 @@ class _RescheduleLeaveScreen extends State { Row( mainAxisSize: MainAxisSize.max, children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: new IgnorePointer( - ignoring: true, - child: DropdownButton( - focusColor: Colors.grey, - isExpanded: true, - value: getClinicName( - model) ?? - "", - iconSize: 40, - elevation: 16, - selectedItemBuilder: - (BuildContext - context) { - return model - .getClinicNameList() - .map((item) { - return Row( - mainAxisSize: - MainAxisSize - .max, - children: [ - AppText( - item, - fontSize: SizeConfig - .textMultiplier * - 2.1, - color: - Colors.grey, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => - {}, - items: model - .getClinicNameList() + model2.allOffTime.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: model2.allOffTime[0] + ['code'], + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return model2.allOffTime .map((item) { - return DropdownMenuItem( - value: - item.toString(), - child: Text( - item, - textAlign: - TextAlign.end, - ), + return Row( + mainAxisSize: + MainAxisSize.max, + children: [ + AppText( + item[ + 'description'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: + Colors.grey, + ), + ], ); - }).toList(), - ))), - ), + }).toList(); + }, + onChanged: (newValue) => {}, + items: model2.allOffTime + .map((item) { + return DropdownMenuItem< + String>( + value: item['code'] + .toString(), + child: Text( + item['description'], + textAlign: + TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], + ), + )), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: 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: () { + _presentDatePicker('_selectedToDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + addSickLeave.startDate = value; + }), + ], + )), + + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + new AppTextFormField( + readOnly: true, + hintText: "", + borderColor: Colors.white, + onSaved: (value) {}, + inputFormatter: ONLY_NUMBERS), + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + new AppTextFormField( + readOnly: true, + hintText: "", + borderColor: Colors.white, + onSaved: (value) {}, + inputFormatter: ONLY_NUMBERS), + ], + ), + ), + ) + ], + ), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + 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: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.allReasons.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: model2.allReasons[0] + ['id'] + .toString(), + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return model2.allReasons + .map((item) { + return Row( + mainAxisSize: + MainAxisSize.max, + children: [ + AppText( + projectsProvider + .isArabic + ? item[ + 'nameAr'] + : item[ + 'nameEn'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: + Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => {}, + items: model2.allReasons + .map((item) { + return DropdownMenuItem< + String>( + value: item['id'] + .toString(), + child: Text( + projectsProvider + .isArabic + ? item['nameAr'] + : item['nameEn'], + textAlign: + TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), ], ) ], ), )), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + 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: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.coveringDoctors.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: model2 + .coveringDoctors[0] + ['doctorID'] + .toString(), + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return model2 + .coveringDoctors + .map((item) { + return Row( + mainAxisSize: + MainAxisSize.max, + children: [ + AppText( + projectsProvider + .isArabic + ? item[ + 'doctorNameN'] + : item[ + 'doctorName'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: + Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => {}, + items: model2 + .coveringDoctors + .map((item) { + return DropdownMenuItem< + String>( + value: item['doctorID'] + .toString(), + child: Text( + projectsProvider + .isArabic + ? item[ + 'doctorNameN'] + : item[ + 'doctorName'], + textAlign: + TextAlign.start, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], + ), + )), Container( margin: EdgeInsets.all( SizeConfig.widthMultiplier * 5), @@ -307,9 +564,9 @@ class _RescheduleLeaveScreen extends State { } getClinicName(model) { - var clinicInfo = model.clinicsList - .where((i) => i['ClinicID'] == this.profile['ClinicID']) - .toList(); + var clinicID = this.profile != null ? this.profile['ClinicID'] : 1; + var clinicInfo = + model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList(); return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index ed6b49e8..6126912e 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -424,6 +424,12 @@ class TranslationBase { String get sao2 => localizedValues['sao2'][locale.languageCode]; String get painManagement => localizedValues['painManagement'][locale.languageCode]; + String get holiday => localizedValues['holiday'][locale.languageCode]; + String get to => localizedValues['to'][locale.languageCode]; + String get coveringDoctor => + localizedValues['coveringDoctor'][locale.languageCode]; + String get requestLeave => + localizedValues['requestLeave'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 4ff72904..808e09dc 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -35,9 +35,6 @@ class _AppDrawerState extends State { // _isInit = false; // } - - - @override Widget build(BuildContext context) { AuthViewModel authProvider = Provider.of(context); @@ -68,20 +65,24 @@ class _AppDrawerState extends State { ), ), SizedBox(height: 15), - CircleAvatar( - radius: SizeConfig.imageSizeMultiplier * 12, - backgroundImage: - NetworkImage(authProvider.doctorProfile.doctorImageURL), - backgroundColor: Colors.white, - ), - Padding( - padding: EdgeInsets.only(top: 10), - child: AppText( - authProvider.doctorProfile?.doctorName, - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: SizeConfig.textMultiplier * 2, - )), + authProvider.doctorProfile != null + ? CircleAvatar( + radius: SizeConfig.imageSizeMultiplier * 12, + backgroundImage: NetworkImage( + authProvider.doctorProfile.doctorImageURL), + backgroundColor: Colors.white, + ) + : SizedBox(), + authProvider.doctorProfile != null + ? Padding( + padding: EdgeInsets.only(top: 10), + child: AppText( + authProvider.doctorProfile?.doctorName, + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: SizeConfig.textMultiplier * 2, + )) + : SizedBox(), AppText( "Director of medical records", //TODO: Make The Dr Title Dynamic and check overflow issue. fontWeight: FontWeight.normal, @@ -121,7 +122,9 @@ class _AppDrawerState extends State { ), InkWell( child: DrawerItem( - TranslationBase.of(context).qr+ TranslationBase.of(context).reader, DoctorApp.qr_code), + TranslationBase.of(context).qr + + TranslationBase.of(context).reader, + DoctorApp.qr_code), onTap: () { Navigator.pop(context); Navigator.of(context).pushNamed(QR_READER); From e23bb7ce94e7f05941d9894250cde97c56b2b85b Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sat, 2 Jan 2021 14:59:43 +0300 Subject: [PATCH 03/14] reschedule leave --- lib/config/config.dart | 1 + lib/core/service/sickleave_service.dart | 16 + lib/core/viewModel/sick_leave_view_model.dart | 10 + .../reschedule-leaves/reschedule_leave.dart | 400 +++++++++++++----- pubspec.yaml | 2 +- 5 files changed, 330 insertions(+), 99 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 14ac4a0a..6b717ace 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -111,6 +111,7 @@ const EXTEND_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/ExtendSickLeave'; const GET_OFFTIME = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const GET_COVERING_DOCTORS = 'Services/DoctorApplication.svc/REST/GetCoveringDoctor'; +const ADD_RESCHDEULE = 'Services/DoctorApplication.svc/REST/PostRequisition'; const GET_RESCHEDULE_LEAVE = 'Services/DoctorApplication.svc/REST/GetRequisition'; const GET_PRESCRIPTION_LIST = diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index cd0dbf50..1b9e12ac 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -170,4 +170,20 @@ class SickLeaveService extends BaseService { body: {"ClinicID": 1}, ); } + + addReschedule(request) async { + hasError = false; + + await baseAppClient.post( + ADD_RESCHDEULE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: request, + ); + } } diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index 7c162ad1..bbcd55a6 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -95,4 +95,14 @@ class SickLeaveViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future addReschedule(request) async { + setState(ViewState.Busy); + await _sickLeaveService.addReschedule(request); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 9ed6dae7..9ac2cf77 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -1,3 +1,4 @@ +import 'package:date_time_picker/date_time_picker.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; @@ -34,16 +35,24 @@ class RescheduleLeaveScreen extends StatefulWidget { class _RescheduleLeaveScreen extends State { DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); TextEditingController _toDateController = new TextEditingController(); + TextEditingController _toDateController2 = new TextEditingController(); ProjectViewModel projectsProvider; String _selectedClinic; Map profile = {}; - AddSickLeaveRequest addSickLeave = AddSickLeaveRequest(); + var offTime = '2'; + var date; + var doctorID; + var reason; + var fromDate; + var toDate; + TextEditingController _controller4; + // AddSickLeaveRequest addSickLeave = AddSickLeaveRequest(); void _presentDatePicker(id) { showDatePicker( context: context, initialDate: DateTime.now(), - firstDate: DateTime(2019), - lastDate: DateTime.now(), + firstDate: DateTime.now(), + lastDate: DateTime(2050), ).then((pickedDate) { if (pickedDate == null) { return; @@ -51,9 +60,16 @@ class _RescheduleLeaveScreen extends State { setState(() { // var selectedDate = DateFormat.yMd().format(pickedDate); final df = new DateFormat('yyyy-MM-dd'); - addSickLeave.startDate = df.format(pickedDate); - _toDateController.text = addSickLeave.startDate; + //addSickLeave.startDate; + + if (id == 'fromDate') { + fromDate = pickedDate; //df.format(); + _toDateController.text = df.format(pickedDate); + } else { + toDate = pickedDate; // + _toDateController2.text = df.format(pickedDate); + } //addSickLeave.startDate = selectedDate; }); }); @@ -223,8 +239,10 @@ class _RescheduleLeaveScreen extends State { child: DropdownButton( focusColor: Colors.grey, isExpanded: true, - value: model2.allOffTime[0] - ['code'], + value: offTime == null + ? model2.allOffTime[0] + ['code'] + : offTime, iconSize: 40, elevation: 16, selectedItemBuilder: @@ -248,7 +266,18 @@ class _RescheduleLeaveScreen extends State { ); }).toList(); }, - onChanged: (newValue) => {}, + onChanged: (newValue) => { + setState(() { + offTime = newValue; + }), + if (offTime == '1') + {model2.getReasons(18)} + else if (offTime == '2') + {model2.getReasons(19)} + else if (offTime == '3' || + offTime == '5') + {model2.getReasons(102)} + }, items: model2.allOffTime .map((item) { return DropdownMenuItem< @@ -270,88 +299,215 @@ class _RescheduleLeaveScreen extends State { ], ), )), - Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: 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: () { - _presentDatePicker('_selectedToDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (value) { - addSickLeave.startDate = value; - }), - ], - )), + offTime == '1' + ? Column( + children: [ + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + 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: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + fromDate = value; + }), + ], + )), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + // new AppTextFormField( + // readOnly: true, + // hintText: "", + // borderColor: Colors.white, + // onSaved: (value) {}, + // inputFormatter: ONLY_NUMBERS), - Row( - children: [ - Expanded( - child: Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - new AppTextFormField( - readOnly: true, - hintText: "", - borderColor: Colors.white, - onSaved: (value) {}, - inputFormatter: ONLY_NUMBERS), - ], - ), - ), - ), - Expanded( - child: Container( - margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - new AppTextFormField( - readOnly: true, - hintText: "", - borderColor: Colors.white, - onSaved: (value) {}, - inputFormatter: ONLY_NUMBERS), - ], - ), + DateTimePicker( + type: + DateTimePickerType.time, + controller: _controller4, + //initialValue: _initialValue, + // icon: Icon(Icons.access_time), + + //use24HourFormat: false, + //locale: Locale('en', 'US'), + onChanged: (val) => () { + print(val); + }, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => {}, + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + DateTimePicker( + type: + DateTimePickerType.time, + controller: _controller4, + //initialValue: _initialValue, + // icon: Icon(Icons.access_time), + + //use24HourFormat: false, + //locale: Locale('en', 'US'), + onChanged: (val) => () { + print(val); + }, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => + {print(val)}, + ) + ], + ), + ), + ) + ], + ) + ], + ) + : Column( + children: [ + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + 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: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + toDate = value; + }); + }), + ], + )), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: TranslationBase + .of(context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + Icons + .calendar_today)), + textInputType: + TextInputType.number, + controller: + _toDateController2, + onTap: () { + _presentDatePicker( + 'toDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + toDate = value; + }); + }), + ], + )) + ], ), - ) - ], - ), Container( margin: EdgeInsets.all(8), decoration: BoxDecoration( @@ -382,9 +538,11 @@ class _RescheduleLeaveScreen extends State { child: DropdownButton( focusColor: Colors.grey, isExpanded: true, - value: model2.allReasons[0] - ['id'] - .toString(), + value: reason == null + ? model2.allReasons[0] + ['id'] + .toString() + : reason, iconSize: 40, elevation: 16, selectedItemBuilder: @@ -412,7 +570,11 @@ class _RescheduleLeaveScreen extends State { ); }).toList(); }, - onChanged: (newValue) => {}, + onChanged: (newValue) => { + setState(() { + reason = newValue; + }) + }, items: model2.allReasons .map((item) { return DropdownMenuItem< @@ -468,10 +630,12 @@ class _RescheduleLeaveScreen extends State { child: DropdownButton( focusColor: Colors.grey, isExpanded: true, - value: model2 - .coveringDoctors[0] - ['doctorID'] - .toString(), + value: doctorID == null + ? model2 + .coveringDoctors[0] + ['doctorID'] + .toString() + : doctorID, iconSize: 40, elevation: 16, selectedItemBuilder: @@ -500,7 +664,11 @@ class _RescheduleLeaveScreen extends State { ); }).toList(); }, - onChanged: (newValue) => {}, + onChanged: (newValue) => { + setState(() { + doctorID = newValue; + }) + }, items: model2 .coveringDoctors .map((item) { @@ -536,7 +704,9 @@ class _RescheduleLeaveScreen extends State { children: [ AppButton( title: TranslationBase.of(context).add, - onPressed: () {}, + onPressed: () { + addRecheduleLeave(model2); + }, ), ], ), @@ -569,4 +739,38 @@ class _RescheduleLeaveScreen extends State { model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList(); return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; } + + addRecheduleLeave(model) { + final df = new DateFormat('yyyy-MM-ddThh:mm:ss'); + Map request = { + "Requisition": { + "requisitionNo": 0, + "requisitionType": offTime, + "clinicId": this.profile['ClinicID'], + "doctorId": this.profile['ClinicID'], + "dateTimeFrom": df.format(fromDate), + "dateTimeTo": df.format(toDate), + "date": df.format(DateTime.now()), + "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "status": 2, + "schedule": [ + { + "weekDayId": 1, + "shiftId": 1, + "isOpen": true, + "timeFrom": null, + "timeTo": null, + "timeFromstr": "", + "timeTostr": "" + } + ] + } + }; + + model.addReschedule(request).then((response) { + print(response); + }); + } } diff --git a/pubspec.yaml b/pubspec.yaml index e15a7182..3f66989b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,7 +62,7 @@ dependencies: #Autocomplete TextField autocomplete_textfield: ^1.7.3 - + date_time_picker: ^1.1.1 #speech to text From 9bf07d71175af6d5df9151494ece331411c00793 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sat, 2 Jan 2021 20:22:02 +0300 Subject: [PATCH 04/14] reschedule leave --- lib/config/config.dart | 2 + lib/config/localized_values.dart | 15 +- lib/core/service/sickleave_service.dart | 20 +- lib/core/viewModel/sick_leave_view_model.dart | 14 +- .../add-rescheduleleave.dart | 15 +- .../reschedule-leaves/reschedule_leave.dart | 59 +++- lib/screens/sick-leave/add-sickleave.dart | 309 +++++++++--------- lib/screens/sick-leave/sick_leave.dart | 30 +- lib/util/translations_delegate_base.dart | 7 + 9 files changed, 293 insertions(+), 178 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 7f5e878e..359d458d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -112,6 +112,8 @@ const GET_OFFTIME = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const GET_COVERING_DOCTORS = 'Services/DoctorApplication.svc/REST/GetCoveringDoctor'; const ADD_RESCHDEULE = 'Services/DoctorApplication.svc/REST/PostRequisition'; +const UPDATE_RESCHDEULE = + 'Services/DoctorApplication.svc/REST/PatchRequisition'; const GET_RESCHEDULE_LEAVE = 'Services/DoctorApplication.svc/REST/GetRequisition'; const GET_PRESCRIPTION_LIST = diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 127ee975..a78f77fa 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -389,5 +389,18 @@ const Map> localizedValues = { 'holiday': {'en': "Holiday", 'ar': 'يوم الاجازة'}, 'to': {'en': "To", 'ar': 'إلى'}, 'coveringDoctor': {'en': "Covering Doctor", 'ar': 'تغطية دكتور'}, - 'requestLeave': {'en': 'Request Leave', 'ar': 'طلب إجازة'} + 'requestLeave': {'en': 'Request Leave', 'ar': 'طلب إجازة'}, + 'pleaseEnterDate': { + 'en': 'Please enter leave start date', + 'ar': 'الرجاء إدخال تاريخ بدء الإجازة' + }, + 'pleaseEnterNoOfDays': { + 'en': 'Please enter sick leave days', + 'ar': 'الرجاء إدخال أيام الإجازة المرضية' + }, + 'pleaseEnterRemarks': { + 'en': 'Please enter remarks', + 'ar': 'الرجاء إدخال الملاحظات' + }, + 'update': {'en': 'Update', 'ar': 'تحديث'} }; diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index 1b9e12ac..13e36d3b 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -82,7 +82,7 @@ class SickLeaveService extends BaseService { ); } - Future getSickLeave() async { + Future getSickLeave(patientMRN) async { hasError = false; await baseAppClient.post( GET_SICK_LEAVE, @@ -97,7 +97,7 @@ class SickLeaveService extends BaseService { hasError = true; super.error = error; }, - body: {'PatientMRN': 3120772}, + body: {'PatientMRN': patientMRN}, ); } @@ -186,4 +186,20 @@ class SickLeaveService extends BaseService { body: request, ); } + + updateReschedule(request) async { + hasError = false; + + await baseAppClient.post( + UPDATE_RESCHDEULE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: request, + ); + } } diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index bbcd55a6..d5aba154 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -46,9 +46,9 @@ class SickLeaveViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getSickLeave() async { + Future getSickLeave(patientMRN) async { setState(ViewState.Busy); - await _sickLeaveService.getSickLeave(); + await _sickLeaveService.getSickLeave(patientMRN); if (_sickLeaveService.hasError) { error = _sickLeaveService.error; setState(ViewState.Error); @@ -105,4 +105,14 @@ class SickLeaveViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future updateReschedule(request) async { + setState(ViewState.Busy); + await _sickLeaveService.updateReschedule(request); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index 79b47523..c48eee79 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -175,8 +175,8 @@ class AddRescheduleLeavScreen extends StatelessWidget { ), // color: Colors.green, //Colors.black, onPressed: () => { - // openSickLeave(context, true, - // extendedData: item) + openLeave(context, true, + extendedData: item) }, )) : SizedBox(), @@ -239,18 +239,15 @@ class AddRescheduleLeavScreen extends StatelessWidget { )); } - openLeave(BuildContext context, isExtend, - {GetAllSickLeaveResponse extendedData}) { + openLeave(BuildContext context, isExtend, {extendedData}) { showModalBottomSheet( context: context, builder: (context) { return new Container( child: RescheduleLeaveScreen( - // appointmentNo: extendedData.appointmentNo, - // patientMRN: extendedData.patientMRN, - // isExtended: isExtend, - // extendedData: extendedData, - )); + isExtend, + extendedData, + )); }); } diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 9ac2cf77..1a807392 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -27,7 +27,9 @@ import 'package:provider/provider.dart'; Helpers helpers = Helpers(); class RescheduleLeaveScreen extends StatefulWidget { - RescheduleLeaveScreen(); + final isUpdate; + final updateData; + RescheduleLeaveScreen(this.isUpdate, this.updateData); @override _RescheduleLeaveScreen createState() => _RescheduleLeaveScreen(); } @@ -45,8 +47,8 @@ class _RescheduleLeaveScreen extends State { var reason; var fromDate; var toDate; + var clinicID; TextEditingController _controller4; - // AddSickLeaveRequest addSickLeave = AddSickLeaveRequest(); void _presentDatePicker(id) { showDatePicker( context: context, @@ -58,11 +60,7 @@ class _RescheduleLeaveScreen extends State { return; } setState(() { - // var selectedDate = DateFormat.yMd().format(pickedDate); final df = new DateFormat('yyyy-MM-dd'); - - //addSickLeave.startDate; - if (id == 'fromDate') { fromDate = pickedDate; //df.format(); _toDateController.text = df.format(pickedDate); @@ -70,7 +68,6 @@ class _RescheduleLeaveScreen extends State { toDate = pickedDate; // _toDateController2.text = df.format(pickedDate); } - //addSickLeave.startDate = selectedDate; }); }); } @@ -703,9 +700,15 @@ class _RescheduleLeaveScreen extends State { alignment: WrapAlignment.center, children: [ AppButton( - title: TranslationBase.of(context).add, + title: widget.isUpdate == true + ? TranslationBase.of(context).update + : TranslationBase.of(context).add, onPressed: () { - addRecheduleLeave(model2); + if (widget.isUpdate == true) { + updateRecheduleLeave(model2); + } else { + addRecheduleLeave(model2); + } }, ), ], @@ -730,6 +733,10 @@ class _RescheduleLeaveScreen extends State { Map p = await sharedPref.getObj(DOCTOR_PROFILE); setState(() { this.profile = p; + this.clinicID = widget.updateData.clinicId; + + _toDateController.text = widget.updateData.dateTimeFrom; + _toDateController2.text = widget.updateData.dateTimeTo; }); } @@ -773,4 +780,38 @@ class _RescheduleLeaveScreen extends State { print(response); }); } + + updateRecheduleLeave(model) { + final df = new DateFormat('yyyy-MM-ddThh:mm:ss'); + Map request = { + "Requisition": { + "requisitionNo": 0, + "requisitionType": offTime, + "clinicId": this.profile['ClinicID'], + "doctorId": this.profile['ClinicID'], + "dateTimeFrom": df.format(fromDate), + "dateTimeTo": df.format(toDate), + "date": df.format(DateTime.now()), + "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "status": 2, + "schedule": [ + { + "weekDayId": 1, + "shiftId": 1, + "isOpen": true, + "timeFrom": null, + "timeTo": null, + "timeFromstr": "", + "timeTostr": "" + } + ] + } + }; + + model.updateReschedule(request).then((response) { + print(response); + }); + } } diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index 37bf9454..d456f2a6 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -2,10 +2,12 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.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:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; @@ -13,166 +15,167 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class AddSickLeavScreen extends StatelessWidget { + PatiantInformtion patient; @override Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; return BaseView( - onModelReady: (model) => model.getSickLeave(), + onModelReady: (model) => model.getSickLeave(patient.patientMRN), builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).sickleave, - body: model.getAllSIckLeave.length > 0 - ? SingleChildScrollView( - child: Column( - children: model.getAllSIckLeave - .map((GetAllSickLeaveResponse item) { - return CardWithBgWidgetNew( - widget: Column( - children: [ - Container( - padding: EdgeInsets.only(left: 10, right: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 4, - child: Wrap( - // mainAxisAlignment: - // MainAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.all(3), - child: AppText( - item.status == 1 - ? TranslationBase.of( - context) - .approved - : item.status == 2 - ? TranslationBase - .of(context) - .extended - : TranslationBase - .of(context) - .pending, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - color: item.status == 1 - ? Colors.green - : Colors.yellow[800], - ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .leaveStartDate + - ' ', - fontWeight: - FontWeight.bold, - ), - Flexible( - child: Text( - item.startDate, - overflow: - TextOverflow.ellipsis, - )) - ], - ), - AppText( - item.noOfDays.toString() + - ' ' + - TranslationBase.of( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).sickleave, + body: SingleChildScrollView( + child: Column(children: [ + PatientPageHeaderWidget(patient), + model.getAllSIckLeave.length > 0 + ? Column( + children: model.getAllSIckLeave + .map((GetAllSickLeaveResponse item) { + return CardWithBgWidgetNew( + widget: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Wrap( + // mainAxisAlignment: + // MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(3), + child: AppText( + item.status == 1 + ? TranslationBase.of( context) - .daysSickleave, + .approved + : item.status == 2 + ? TranslationBase.of( + context) + .extended + : TranslationBase.of( + context) + .pending, fontWeight: FontWeight.bold, + color: Colors.white, ), - Row(children: [ + color: item.status == 1 + ? Colors.green + : Colors.yellow[800], + ), + Row( + children: [ AppText( - item.remarks, - ) - ]), - ], - ), - SizedBox( - width: 20, - ), - ], - ), + TranslationBase.of(context) + .leaveStartDate + + ' ', + fontWeight: FontWeight.bold, + ), + Flexible( + child: Text( + item.startDate, + overflow: + TextOverflow.ellipsis, + )) + ], + ), + AppText( + item.noOfDays.toString() + + ' ' + + TranslationBase.of(context) + .daysSickleave, + fontWeight: FontWeight.bold, + ), + Row(children: [ + AppText( + item.remarks, + ) + ]), + ], + ), + SizedBox( + width: 20, + ), + ], ), - (item.status == 1 || item.status == 2) - ? Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.open_in_full, - size: 40, - ), - // color: Colors.green, //Colors.black, - onPressed: () => { - openSickLeave(context, true, - extendedData: item) - }, - )) - : SizedBox(), - ], - )), - SizedBox( - height: 20, + ), + (item.status == 1 || item.status == 2) + ? Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.open_in_full, + size: 25, + ), + // color: Colors.green, //Colors.black, + onPressed: () => { + openSickLeave(context, true, + extendedData: item) + }, + )) + : SizedBox(), + ], + )), + SizedBox( + height: 20, + ), + Divider( + height: 1, + ), + ], + )); + }).toList(), + ) + : new Builder(builder: (context) { + return Container( + height: MediaQuery.of(context).size.height * .7, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(40), + decoration: BoxDecoration( + border: Border.all( + color: HexColor('#B8382C'), width: 4), + borderRadius: + BorderRadius.all(Radius.circular(100))), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + ), + onPressed: () { + openSickLeave( + context, + false, + ); + }), ), - Divider( - height: 1, + Padding( + child: AppText( + TranslationBase.of(context) + .noSickLeaveApplied, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), ), + AppText( + TranslationBase.of(context).applyNow, + fontWeight: FontWeight.bold, + color: HexColor('#B8382C'), + ) ], )); - }).toList(), - ), - ) - : new Builder(builder: (context) { - return Center( - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - padding: EdgeInsets.all(40), - decoration: BoxDecoration( - border: Border.all( - color: HexColor('#B8382C'), width: 4), - borderRadius: - BorderRadius.all(Radius.circular(100))), - child: IconButton( - icon: Icon( - Icons.add, - size: 35, - ), - onPressed: () { - openSickLeave( - context, - false, - ); - }), - ), - Padding( - child: AppText( - TranslationBase.of(context).noSickLeaveApplied, - fontWeight: FontWeight.bold, - ), - padding: EdgeInsets.all(10), - ), - AppText( - TranslationBase.of(context).applyNow, - fontWeight: FontWeight.bold, - color: HexColor('#B8382C'), - ) - ], - ), - )); }), - )); + ])))); } openSickLeave(BuildContext context, isExtend, @@ -182,11 +185,15 @@ class AddSickLeavScreen extends StatelessWidget { builder: (context) { return new Container( child: SickLeaveScreen( - appointmentNo: extendedData.appointmentNo, - patientMRN: extendedData.patientMRN, - isExtended: isExtend, - extendedData: extendedData, - )); + appointmentNo: isExtend == true + ? extendedData.appointmentNo + : patient.appointmentNo, //extendedData.appointmentNo, + patientMRN: isExtend == true + ? extendedData.patientMRN + : patient.patientMRN, + isExtended: isExtend, + extendedData: extendedData, + patient: patient)); }); } } diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index 026b7c19..caef49ee 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -6,9 +6,11 @@ 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'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -28,11 +30,13 @@ class SickLeaveScreen extends StatefulWidget { final GetAllSickLeaveResponse extendedData; final appointmentNo; final patientMRN; + final patient; SickLeaveScreen( {this.appointmentNo, this.patientMRN, this.isExtended = false, - this.extendedData}); + this.extendedData, + this.patient}); @override _SickLeaveScreenState createState() => _SickLeaveScreenState(); } @@ -252,6 +256,7 @@ class _SickLeaveScreenState extends State { model2.sickLeaveStatistics[ 'recommendedSickLeaveDays'], fontWeight: FontWeight.bold, + textAlign: TextAlign.start, ), padding: EdgeInsets.all(10), ) @@ -339,9 +344,7 @@ class _SickLeaveScreenState extends State { print(value); }); } else { - model2 - .addSickLeave(addSickLeave) - .then((value) => print(value)); + _validateInputs(model2); } }, ), @@ -363,6 +366,25 @@ class _SickLeaveScreenState extends State { ))); } + void _validateInputs(model2) async { + try { + if (addSickLeave.noOfDays == null) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseEnterNoOfDays); + } else if (addSickLeave.remarks == null) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseEnterRemarks); + } else if (addSickLeave.startDate == null) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseEnterDate); + } else { + model2.addSickLeave(addSickLeave).then((value) => print(value)); + } + } catch (err) { + print(err); + } + } + getProfile() async { Map p = await sharedPref.getObj(DOCTOR_PROFILE); setState(() { diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 6126912e..4e94b746 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -430,6 +430,13 @@ class TranslationBase { localizedValues['coveringDoctor'][locale.languageCode]; String get requestLeave => localizedValues['requestLeave'][locale.languageCode]; + String get pleaseEnterDate => + localizedValues['pleaseEnterDate'][locale.languageCode]; + String get pleaseEnterNoOfDays => + localizedValues['pleaseEnterNoOfDays'][locale.languageCode]; + String get pleaseEnterRemarks => + localizedValues['pleaseEnterRemarks'][locale.languageCode]; + String get update => localizedValues['update'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From e65740761ae71dd50ff9032f4980777eed7b615e Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sat, 2 Jan 2021 19:45:48 +0200 Subject: [PATCH 05/14] add improvement on create episode --- assets/images/create-episod.png | Bin 0 -> 651 bytes assets/images/modilfy-episode.png | Bin 0 -> 987 bytes lib/client/base_app_client.dart | 11 ++-- lib/screens/patients/patients_screen.dart | 52 +++++++++--------- .../profile/patient_profile_widget.dart | 3 +- .../profile/profile_medical_info_widget.dart | 9 ++- .../subjective/update_allergies_widget.dart | 12 +++- .../subjective/update_history_widget.dart | 9 ++- .../subjective/update_subjective_page.dart | 2 +- .../soap_update/update_assessment_page.dart | 21 ++++--- .../soap_update/update_objective_page.dart | 4 +- 11 files changed, 73 insertions(+), 50 deletions(-) create mode 100644 assets/images/create-episod.png create mode 100644 assets/images/modilfy-episode.png diff --git a/assets/images/create-episod.png b/assets/images/create-episod.png new file mode 100644 index 0000000000000000000000000000000000000000..02386fd1503c7628aa933022bf219d2fe5c4e6e4 GIT binary patch literal 651 zcmeAS@N?(olHy`uVBq!ia0vp^sz7YO!3HF!wQkl1QjEnx?oJHr&dIz4ax79KJkxxA z8MJ_G4hF{dOa>N^5+IfWVg?4L1x#=e)dkFOwgE^|n!)-wPzj@_i(^Ox=i7+afrlIf z+>ZZW!t6bP&x2D_QS}C6$pYC1*$a&6>=BG*32PYkw??O#?>s9jA!nbLKCRaN)6+>a z4WweHX>Iw>_?~IcjyD;*e`{^%i7|-yDe{HyxsJC>~f+<#Fb%3bi#TEJ=R_2i^JmL$)T z#^je7FLS?`cL>X`Y*SlbP}w6R!hZ1Mrw3jCtWpYi)!S=iZhPAWo9Z}qycB8Kk!Ikz zeLd6ZR;e4&A9!?LMoOi>$d3O!DM*|DD<7+-jb~=hoX{onZ>pto&fIKhUCJyP!y9qU zdv7%3`DXnE55#{=ox*W3$mB&#k;a@~Nwe-N{`6YlxNdSGGrN7QxkPUN8Sk4nUU;~9 zJx+|4)RdN%J?W8YlcTMin!H$9QnR-`H+4x)PKk>0(vKU~_Dt#R?Mqo=BDZbo#7!G7 zPTcL{Ro8RrzsH}atHR~4z52aB%ignY8^5*H+UO6P=jPqdkNW!{@>$HTTGbs=H7R=* cZVvj#u<`f>>$%*!Zh;bor>mdKI;Vst09o1y#sB~S literal 0 HcmV?d00001 diff --git a/assets/images/modilfy-episode.png b/assets/images/modilfy-episode.png new file mode 100644 index 0000000000000000000000000000000000000000..6fdd224f02e9bdca5090677c626d31f99b80e428 GIT binary patch literal 987 zcmV<110?*3P)Px#IAvH#W=%~1DgXcg2mk?xX#fNO00031000^Q000000-yo_1ONa40RR91D4+uX z1ONa40RR91D*ylh03MD$MgRZ@l!i!j`v?s z^G(8Ui0!L<@MoL54dNZR1pj~zUV~iv0Dc2$LNFv(Iv}nyL#dqV6Qy#yST$62k0xk} zXhGHEleAD*-%+cAE~F~;>oQkEI3eU3{s~{sOs|``L zsm*bP=lP6PkeLLvfjZA&4&y&=kpJq>ZSE+8r!aT4!MR>5jR}r~4})=3*cUBmYkq;=T?WP?h37Ds#*F<}{l9I~Db)!?Co%v4002ov JPDHLkV1grMxn=+W literal 0 HcmV?d00001 diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index ff9d957d..75894465 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -82,12 +82,11 @@ class BaseAppClient { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); - // if (!parsed['IsAuthenticated']) { - // // TODO: return it back when IsAuthenticated work fine in all service - // // await helpers.logout(); - // - // helpers.showErrorToast('Your session expired Please login agian'); - // } else + if (!parsed['IsAuthenticated']) { + // TODO: return it back when IsAuthenticated work fine in all service + await helpers.logout(); + helpers.showErrorToast('Your session expired Please login agian'); + } else if (parsed['MessageStatus'] == 1) { if (!parsed['IsAuthenticated']) onFailure(getError(parsed), statusCode); diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 74c9234c..33b2606c 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -274,34 +274,35 @@ class _PatientsScreenState extends State { .then((res) { setState(() { _isLoading = false; - // if (res['MessageStatus'] == 1) { - if (val2 == 7) { - print("Assad"); - if (res[SERVICES_PATIANT2[val2]] == null) { - _isError = true; - _isLoading = false; - this.error = error.toString(); + if (res['MessageStatus'] == 1) { + if (val2 == 7) { + if (res[SERVICES_PATIANT2[val2]] == null) { + _isError = true; + _isLoading = false; + this.error = error.toString(); + } else { + var localList = []; + res["patientArrivalList"]["entityList"].forEach((v) { + Map mergedPatient = { + ...v, + ...v["patientDetails"] + }; + localList.add(mergedPatient); + }); + print(localList.toString()); + lItems = localList; + } } else { - - var localList=[]; - res["patientArrivalList"]["entityList"].forEach((v) { - Map mergedPatient= {...v,...v["patientDetails"]}; - localList.add(mergedPatient); - }); - print(localList.toString()); - lItems = localList;//res[SERVICES_PATIANT2[val2]]["entityList"]; + lItems = res[SERVICES_PATIANT2[val2]]; } + parsed = lItems; + responseModelList = new ModelResponse.fromJson(parsed).list; + responseModelList2 = responseModelList; + _isError = false; } else { - lItems = res[SERVICES_PATIANT2[val2]]; + _isError = true; + error = res['ErrorEndUserMessage'] ?? res['ErrorMessage']; } - parsed = lItems; - responseModelList = new ModelResponse.fromJson(parsed).list; - responseModelList2 = responseModelList; - _isError = false; - // } else { - // _isError = true; - // error = res['ErrorEndUserMessage'] ?? res['ErrorMessage']; - // } }); }).catchError((error) { setState(() { @@ -679,7 +680,8 @@ class _PatientsScreenState extends State { .pushNamed( PATIENTS_PROFILE, arguments: { - "patient": item + "patient": item, + "patientType":patientType }); }, ), diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index 792eb49e..f50c7669 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -22,6 +22,7 @@ class PatientProfileWidget extends StatelessWidget { Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; return Container( color: Color(0XFFF2F2F2), @@ -437,7 +438,7 @@ class PatientProfileWidget extends StatelessWidget { SliverPadding( padding: const EdgeInsets.all(16.0), sliver: ProfileMedicalInfoWidget( - patient: patient, + patient: patient, patientType:patientType )) ]), ); diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 468a1b9d..886b2c9d 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -18,8 +18,9 @@ import 'PatientProfileButton.dart'; *@desc: Profile Medical Info Widget */ class ProfileMedicalInfoWidget extends StatelessWidget { - ProfileMedicalInfoWidget({Key key, this.patient}) : super(key: key); + ProfileMedicalInfoWidget({Key key, this.patient, this.patientType}); PatiantInformtion patient; + String patientType; @override Widget build(BuildContext context) { return SliverGrid.count( @@ -28,20 +29,22 @@ class ProfileMedicalInfoWidget extends StatelessWidget { crossAxisCount: 2, childAspectRatio: 1.5, children: [ + if(int.parse(patientType) ==7) PatientProfileButton( key: key, patient: patient, nameLine1: "Create New", nameLine2: "Episode", route: CREATE_EPISODE, - icon: 'heartbeat.png'), + icon: 'create-episod.png'), + if(int.parse(patientType) ==7) PatientProfileButton( key: key, patient: patient, nameLine1: "Update", nameLine2: "Episode", route: UPDATE_EPISODE, - icon: 'heartbeat.png'), + icon: 'modilfy-episode.png'), PatientProfileButton( key: key, patient: patient, 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 fa6b8acb..f03025ae 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 @@ -70,13 +70,21 @@ class _UpdateAllergiesWidgetState extends State { children: widget.myAllergiesList.map((selectedAllergy) { return Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts(selectedAllergy.selectedAllergy.nameEn.toUpperCase(), - variant: "bodyText", bold: true, color: Colors.black), + Container( + + child: Expanded( + child: Texts(selectedAllergy.selectedAllergy.nameEn.toUpperCase(), + variant: "bodyText", bold: true, color: Colors.black), + ), + width: MediaQuery.of(context).size.width * 0.5, + ), Texts( selectedAllergy.selectedAllergySeverity.nameEn .toUpperCase(), diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart index 5e033127..f720fdfd 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart @@ -81,8 +81,13 @@ class _UpdateHistoryWidgetState extends State Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(myHistory.nameEn, - variant: "bodyText", bold: true, color: Colors.black), + Container( + child: Expanded( + child: Texts(myHistory.nameEn, + variant: "bodyText", bold: true, color: Colors.black), + ), + width: MediaQuery.of(context).size.width * 0.7, + ), InkWell( child: Icon( FontAwesomeIcons.trash, 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 d9828795..53007123 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 @@ -414,7 +414,7 @@ class _UpdateSubjectivePageState extends State { postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM .add(ListHisProgNotePatientAllergyDiseaseVM( allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, patientMRN: widget.patientInfo.patientMRN, episodeId: widget.patientInfo.episodeNo, appointmentNo: widget.patientInfo.appointmentNo, 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 c25b0d5b..86e98e4b 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -277,10 +277,13 @@ class _UpdateAssessmentPageState extends State { SizedBox( height: 6, ), - AppText( - widget.mySelectedAssessment.remark??"", - fontSize: 10, - color: Colors.grey, + Container( + width: MediaQuery.of(context).size.width * 0.5, + child: AppText( + widget.mySelectedAssessment.remark??"", + fontSize: 10, + color: Colors.grey, + ), ), ], ), @@ -298,10 +301,12 @@ class _UpdateAssessmentPageState extends State { fontWeight: FontWeight.bold, fontSize: 16, ), - AppText( - widget.mySelectedAssessment.selectedICD.code.toUpperCase()??"", - fontSize: 10, - color: Colors.grey, + Container( + child: AppText( + widget.mySelectedAssessment.selectedICD.code.trim().toUpperCase()??"", + fontSize: 10, + color: Colors.grey, + ), ), ], ) 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 2a342542..2abdfbae 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -304,14 +304,14 @@ class _UpdateObjectivePageState extends State { ), Container( margin: EdgeInsets.only( - left: 10, right: 10, top: 15), + left: 0, right: 0, top: 15), child: TextFields( hintText: "Remarks", fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, maxLines: 25, - minLines: 13, + minLines: 4, controller: remarksController, validator: (value) { if (value == null) From 6c894c3d3ba9e670c0a768c6e418a7ed5db582a4 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sat, 2 Jan 2021 20:51:07 +0300 Subject: [PATCH 06/14] sick leave --- lib/core/service/sickleave_service.dart | 4 ++-- lib/screens/sick-leave/sick_leave.dart | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index 13e36d3b..c4aa8abf 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -39,8 +39,8 @@ class SickLeaveService extends BaseService { } Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { - addSickLeaveRequest.appointmentNo = '2016054661'; - addSickLeaveRequest.patientMRN = '3120746'; + // addSickLeaveRequest.appointmentNo = '2016054661'; + // addSickLeaveRequest.patientMRN = '3120746'; hasError = false; await baseAppClient.post( ADD_SICK_LEAVE, diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index caef49ee..2aea6f43 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -52,7 +52,7 @@ class _SickLeaveScreenState extends State { context: context, initialDate: DateTime.now(), firstDate: DateTime(2019), - lastDate: DateTime.now(), + lastDate: DateTime(2050), ).then((pickedDate) { if (pickedDate == null) { return; @@ -378,6 +378,8 @@ class _SickLeaveScreenState extends State { DrAppToastMsg.showErrorToast( TranslationBase.of(context).pleaseEnterDate); } else { + addSickLeave.patientMRN = widget.patient.patientMRN.toString(); + addSickLeave.appointmentNo = widget.patient.appointmentNo.toString(); model2.addSickLeave(addSickLeave).then((value) => print(value)); } } catch (err) { From 71b50c84040a63756fdfbba38286a0959b6390db Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 3 Jan 2021 00:09:58 +0200 Subject: [PATCH 07/14] First step translations --- lib/config/localized_values.dart | 16 + lib/core/service/SOAP_service.dart | 19 +- lib/core/viewModel/SOAP_view_model.dart | 12 +- lib/routes.dart | 1 - lib/util/translations_delegate_base.dart | 18 + .../patients/profile/SOAP/add_SOAP_index.dart | 133 ---- .../profile/SOAP/assessment_page.dart | 647 ------------------ .../patients/profile/SOAP/objective_page.dart | 518 -------------- .../patients/profile/SOAP/plan_page.dart | 349 ---------- .../SOAP/subjective/add_allergies_widget.dart | 339 --------- .../SOAP/subjective/add_history_widget.dart | 360 ---------- .../subjective/add_medication_widget.dart | 107 --- .../SOAP/subjective/subjective_page.dart | 402 ----------- .../profile/profile_medical_info_widget.dart | 8 +- .../profile/soap_update/steps_widget.dart | 8 +- .../subjective/update_allergies_widget.dart | 78 ++- .../subjective/update_history_widget.dart | 20 +- .../subjective/update_subjective_page.dart | 91 ++- .../soap_update/update_assessment_page.dart | 4 +- .../soap_update/update_objective_page.dart | 4 +- .../soap_update/update_soap_index.dart | 4 - .../shared/dialogs/master_key_dailog.dart | 13 +- .../master_key_checkbox_search_widget.dart | 108 +-- 23 files changed, 263 insertions(+), 2996 deletions(-) delete mode 100644 lib/widgets/patients/profile/SOAP/add_SOAP_index.dart delete mode 100644 lib/widgets/patients/profile/SOAP/assessment_page.dart delete mode 100644 lib/widgets/patients/profile/SOAP/objective_page.dart delete mode 100644 lib/widgets/patients/profile/SOAP/plan_page.dart delete mode 100644 lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart delete mode 100644 lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart delete mode 100644 lib/widgets/patients/profile/SOAP/subjective/add_medication_widget.dart delete mode 100644 lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c27e8b70..85954bb0 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -415,4 +415,20 @@ const Map> localizedValues = { 'specifyPossibleLineManagement': {'en': "Specify possible line of management", 'ar': 'حدد خط الإدارة المحتمل'}, 'significantSigns': {'en': "SIGNIFICANT SIGNS", 'ar': 'علامات مهمة'}, 'backAbdomen': {'en': "Back : Abdomen", 'ar': 'الظهر: البطن'}, + 'createNew': {'en': "Create New", 'ar': 'انشاء '}, + 'episode': {'en': "Episode", 'ar': 'Episode'}, + 'update': {'en': "Update", 'ar': 'تعديل'}, + 'chiefComplaints': {'en': "Chief Complaints", 'ar': 'الشكاوى'}, + 'addChiefComplaints': {'en': "Add Chief Complaints", 'ar': ' اضافه الشكاوى'}, + 'histories': {'en': "Histories", 'ar': 'التاريخ المرضي'}, + 'allergiesSoap': {'en': "Allergies", 'ar': 'الحساسية'}, + 'historyOfPresentIllness': {'en': "History of Present Illness", 'ar': 'تاريخ المرض الحالي'}, + 'requiredMsg': {'en': "Please add required field correctly", 'ar':"الرجاء إضافة الحقل المطلوب بشكل صحيح" }, + 'addHistory': {'en': "Add History", 'ar':"اضافه تاريخ مرضي" }, + 'searchHistory': {'en': "Search History", 'ar':" البحث" }, + 'addSelectedHistories': {'en': "add selected histories", 'ar':" اضافه تاريخ مرضي" }, + 'addAllergies': {'en': "Add Allergies", 'ar':"أضف الحساسية" }, + 'itemExist': {'en': "This item already exist", 'ar':"هذا العنصر موجود" }, + 'selectAllergy': {'en': "Select Allergy", 'ar':"أختر الحساسية" }, + 'selectSeverity': {'en': "Select Severity", 'ar':"أختر الدرجه" }, }; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 426e0811..d1fff03b 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -212,17 +212,18 @@ class SOAPService extends LookupService { } Future getPatientHistories( - GetHistoryReqModel getHistoryReqModel) async { + GetHistoryReqModel getHistoryReqModel, {bool isFirst = false}) async { hasError = false; - await baseAppClient.post (GET_HISTORY, + await baseAppClient.post(GET_HISTORY, onSuccess: (dynamic response, int statusCode) { - print("Success"); - patientHistoryList.clear(); - response['List_History']['entityList'].forEach((v) { - patientHistoryList.add(GetHistoryResModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; + print("Success"); + if (isFirst) + patientHistoryList.clear(); + response['List_History']['entityList'].forEach((v) { + patientHistoryList.add(GetHistoryResModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; super.error = error; }, body: getHistoryReqModel.toJson()); } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 697e9934..fff7a239 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -226,17 +226,17 @@ class SOAPViewModel extends BaseViewModel { await _SOAPService.getPatientAllergy(generalGetReqForSOAP); if (_SOAPService.hasError) { error = _SOAPService.error; - setState(ViewState.Busy); + setState(ViewState.Error); } else setState(ViewState.Idle); } - Future getPatientHistories(GetHistoryReqModel getHistoryReqModel) async { + Future getPatientHistories(GetHistoryReqModel getHistoryReqModel, {bool isFirst = false}) async { setState(ViewState.Busy); - await _SOAPService.getPatientHistories(getHistoryReqModel); + await _SOAPService.getPatientHistories(getHistoryReqModel, isFirst: isFirst); if (_SOAPService.hasError) { error = _SOAPService.error; - setState(ViewState.Busy); + setState(ViewState.Error); } else setState(ViewState.Idle); } @@ -247,7 +247,7 @@ class SOAPViewModel extends BaseViewModel { await _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel); if (_SOAPService.hasError) { error = _SOAPService.error; - setState(ViewState.Busy); + setState(ViewState.Error); } else setState(ViewState.Idle); } @@ -278,7 +278,7 @@ class SOAPViewModel extends BaseViewModel { await _SOAPService.getPatientAssessment(getAssessmentReqModel); if (_SOAPService.hasError) { error = _SOAPService.error; - setState(ViewState.Busy); + setState(ViewState.Error); } else setState(ViewState.Idle); } diff --git a/lib/routes.dart b/lib/routes.dart index 728b5f06..962df032 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -11,7 +11,6 @@ import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_pat import 'package:doctor_app_flutter/screens/live_care/video_call.dart'; import 'package:doctor_app_flutter/screens/sick-leave/add-sickleave.dart'; import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/add_SOAP_index.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_screen.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_soap_index.dart'; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 213ad371..e928f521 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -452,6 +452,24 @@ class TranslationBase { String get specifyPossibleLineManagement => localizedValues['specifyPossibleLineManagement'][locale.languageCode]; String get significantSigns => localizedValues['significantSigns'][locale.languageCode]; String get backAbdomen => localizedValues['backAbdomen'][locale.languageCode]; + String get createNew => localizedValues['createNew'][locale.languageCode]; + String get update => localizedValues['update'][locale.languageCode]; + String get episode => localizedValues['episode'][locale.languageCode]; + + + String get chiefComplaints=> localizedValues['chiefComplaints'][locale.languageCode]; + String get histories => localizedValues['histories'][locale.languageCode]; + String get allergiesSoap => localizedValues['allergiesSoap'][locale.languageCode]; + String get addChiefComplaints => localizedValues['addChiefComplaints'][locale.languageCode]; + String get historyOfPresentIllness => localizedValues['historyOfPresentIllness'][locale.languageCode]; + String get requiredMsg => localizedValues['requiredMsg'][locale.languageCode]; + String get addHistory => localizedValues['addHistory'][locale.languageCode]; + String get searchHistory => localizedValues['searchHistory'][locale.languageCode]; + String get addSelectedHistories => localizedValues['addSelectedHistories'][locale.languageCode]; + String get addAllergies => localizedValues['addAllergies'][locale.languageCode]; + String get itemExist => localizedValues['itemExist'][locale.languageCode]; + String get selectAllergy => localizedValues['selectAllergy'][locale.languageCode]; + String get selectSeverity => localizedValues['selectSeverity'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart deleted file mode 100644 index 9b4d092d..00000000 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ /dev/null @@ -1,133 +0,0 @@ -import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/assessment_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/objective_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/plan_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/subjective_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -import '../soap_update/steps_widget.dart'; - -class AddSOAPIndex extends StatefulWidget { - final bool isUpdate; - - const AddSOAPIndex({Key key, this.isUpdate}) : super(key: key); - @override - _AddSOAPIndexState createState() => _AddSOAPIndexState(); -} - -class _AddSOAPIndexState extends State - with TickerProviderStateMixin { - PageController _controller; - int _currentIndex = 0; - List myAllergiesList= List(); - List myHistoryList = List(); - List mySelectedExamination = List(); - MySelectedAssessment mySelectedAssessment = new MySelectedAssessment(); - changePageViewIndex(pageIndex) { - _controller.jumpToPage(pageIndex); - } - - @override - void initState() { - // TODO: implement initState - _controller = new PageController(); - - super.initState(); - } - @override - Widget build(BuildContext context) { - final routeArgs = ModalRoute.of(context).settings.arguments as Map; - PatiantInformtion patient = routeArgs['patient']; - return BaseView( - builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).healthRecordInformation, - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - decoration: - BoxDecoration(boxShadow: [], color: Colors.white), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - PatientPageHeaderWidget(patient), - FractionallySizedBox( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.75, - child: Column( - children: [ - Container( - margin: EdgeInsets.only( - left: - MediaQuery.of(context).size.width * 0.05, - right: - MediaQuery.of(context).size.width * 0.05), - child: StepsWidget( - index: _currentIndex, - changeCurrentTab: changePageViewIndex, - ), - ), - Expanded( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - SubjectivePage( - changePageViewIndex: changePageViewIndex, - myAllergiesList: myAllergiesList, - myHistoryList: myHistoryList, - patientInfo: patient, - ), - ObjectivePage( - changePageViewIndex: changePageViewIndex, - mySelectedExamination: - mySelectedExamination, - patientInfo: patient, - ), - AssessmentPage( - changePageViewIndex: changePageViewIndex, - mySelectedAssessment: - mySelectedAssessment, - patientInfo: patient, - ), - PlanPage( - changePageViewIndex: changePageViewIndex, - patientInfo: patient, - ) - ], - ), - ), - ], - ), - ), - ), - ) - ], - ), - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart deleted file mode 100644 index 0f7a8e31..00000000 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ /dev/null @@ -1,647 +0,0 @@ -import 'package:autocomplete_textfield/autocomplete_textfield.dart'; -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_assement.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_assessment_request_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/helpers.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.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:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; -import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; -import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:provider/provider.dart'; - -class AssessmentPage extends StatefulWidget { - final Function changePageViewIndex; - final MySelectedAssessment mySelectedAssessment; - final PatiantInformtion patientInfo; - - AssessmentPage( - {Key key, this.changePageViewIndex, this.mySelectedAssessment, this.patientInfo}); - - @override - _AssessmentPageState createState() => _AssessmentPageState(); -} - -class _AssessmentPageState extends State { - bool isAssessmentExpand = false; - - List assessmentList; - dynamic _referTo; - - TextEditingController remarksController = TextEditingController(); - Helpers helpers = Helpers(); - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - - return BaseView( - builder: (_, model, w) => AppScaffold( - isShowAppBar: false, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Texts('ASSESSMENT', - variant: - isAssessmentExpand ? "bodyText" : '', - bold: isAssessmentExpand ? true : false, - color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], - ), - InkWell( - onTap: () { - setState(() { - isAssessmentExpand = !isAssessmentExpand; - }); - }, - child: Icon(isAssessmentExpand - ? EvaIcons.minus - : EvaIcons.plus)) - ], - ), - bodyWidget: Column(children: [ - SizedBox( - height: 20, - ), - Column( - children: [ - Container( - margin: - EdgeInsets.only(left: 5, right: 5, top: 15), - child: TextFields( - hintText: "Add ASSESSMENT", - fontSize: 13.5, - onTapTextFields: () { - openAssessmentDialog(context); - }, - readOnly: true, - // hintColor: Colors.black, - suffixIcon: EvaIcons.plusCircleOutline, - suffixIconColor: AppGlobal.appPrimaryColor, - fontWeight: FontWeight.w600, - // controller: messageController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - if(widget.mySelectedAssessment != null && - widget.mySelectedAssessment - .appointmentId != - null && widget.mySelectedAssessment - .selectedDiagnosisType != null && - widget.mySelectedAssessment - .selectedDiagnosisCondition != null) - Container( - margin: EdgeInsets.only( - left: 5, right: 5, top: 15), - child: Row( - mainAxisAlignment: MainAxisAlignment - .spaceBetween, - crossAxisAlignment: CrossAxisAlignment - .start, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment - .start, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - "12".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "DEC".toUpperCase(), - fontSize: 10, - color: Colors.grey, - ), - ], - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Appointment #: ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - widget.mySelectedAssessment - .appointmentId - .toString(), - fontSize: 10, - color: Colors.grey, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - widget.mySelectedAssessment - .selectedDiagnosisCondition - .nameEn, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Type : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - widget.mySelectedAssessment - .selectedDiagnosisType - .nameEn, - fontSize: 10, - color: Colors.grey, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Doc : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "Anas Abdullah", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - SizedBox( - height: 6, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - SizedBox( - height: 6, - ), - AppText( - widget.mySelectedAssessment.remark, - fontSize: 10, - color: Colors.grey, - ), - ], - ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: [ - Row( - - children: [ - AppText( - "ICD: ".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "R07.1".toUpperCase(), - fontSize: 10, - color: Colors.grey, - ), - ], - ) - ], - ), - Column( - children: [ - InkWell( - onTap: () { - openAssessmentDialog(context); - }, - child: Icon(EvaIcons - .edit2Outline), - ) - ], - ), - ], - ), - ) - ], - ) - ]), - isExpand: isAssessmentExpand, - ), - DividerWithSpacesAround( - height: 30, - ), - AppButton( - title: TranslationBase.of(context).next, - loading: model.state == ViewState.BusyLocal, - onPressed: () async { - await submitAssessment(model); - }, - ), - SizedBox( - height: 30, - ), - ], - ), - ), - ), - ))); - } - - submitAssessment(SOAPViewModel model) async { - if (widget.mySelectedAssessment.selectedDiagnosisCondition != null && - widget.mySelectedAssessment.selectedDiagnosisType != null) { - PostAssessmentRequestModel postAssessmentRequestModel = - new PostAssessmentRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - icdCodeDetails: [ - new IcdCodeDetails( - remarks: widget.mySelectedAssessment.remark, - complexDiagnosis: true, - conditionId: - widget.mySelectedAssessment.selectedDiagnosisCondition.id, - diagnosisTypeId: - widget.mySelectedAssessment.selectedDiagnosisType.id, - icdcode10Id: "1") - ]); - - await model.postAssessment(postAssessmentRequestModel); - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { - widget.changePageViewIndex(3); - } - } else { - helpers.showErrorToast('Please add required field correctly'); - } - - widget.changePageViewIndex(3); - } - - openAssessmentDialog(BuildContext context) { - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return AddAssessmentDetails( - mySelectedAssessment: widget.mySelectedAssessment, - addSelectedAssessment: () { - setState(() { - Navigator.of(context).pop(); - }); - }); - }); - } - -} - -class AddAssessmentDetails extends StatefulWidget { - final MySelectedAssessment mySelectedAssessment; - final Function() addSelectedAssessment; - - const AddAssessmentDetails( - {Key key, this.mySelectedAssessment, this.addSelectedAssessment}) - : super(key: key); - - @override - _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); -} - -class _AddAssessmentDetailsState extends State { - // MasterKeyModel _selectedDiagnosisCondition; - // MasterKeyModel _selectedDiagnosisType; - TextEditingController remarkController = TextEditingController(); - TextEditingController appointmentIdController = TextEditingController( - text: "234567"); - GlobalKey key = new GlobalKey>(); - - @override - Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - remarkController.text = widget.mySelectedAssessment.remark??""; - final screenSize = MediaQuery - .of(context) - .size; - InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown,{IconData icon}) { - //TODO: make one Input InputDecoration for all - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(icon??Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } - return FractionallySizedBox( - heightFactor: 0.75, - child: BaseView( - onModelReady: (model) async { - if (model.listOfDiagnosisCondition.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisCondition); - } - if (model.listOfDiagnosisType.length == 0) { - await model.getMasterLookup(MasterKeysService.DiagnosisType); - } - // if (model.listOfICD10.length == 0) { - // await model.getMasterLookup(MasterKeysService.ICD10); - // } - }, - builder: (_, model, w) => - AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - "Add Assessment Details".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: TextFields( - hintText: "Appointment Number", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - readOnly: true, - controller: appointmentIdController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.listOfICD10 != null - ? () { - setState(() { - widget.mySelectedAssessment.selectedICD = null; - }); - } - : null, - child:widget.mySelectedAssessment.selectedICD == null ? AutoCompleteTextField( - decoration: textFieldSelectorDecoration("Name or ICD", widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), - itemSubmitted: (item) => setState(() => widget.mySelectedAssessment.selectedICD = item), - key: key, - suggestions: model.listOfICD10, - 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()) - , - ): TextField( - decoration: textFieldSelectorDecoration( - widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.code :"Name or ICD", - widget.mySelectedAssessment.selectedICD != null ? widget.mySelectedAssessment.selectedICD.nameEn : null, true,icon: EvaIcons.search), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.listOfDiagnosisCondition != - null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisCondition, - okText: TranslationBase - .of(context) - .ok, - okFunction: ( - MasterKeyModel selectedValue) { - setState(() { - widget.mySelectedAssessment - .selectedDiagnosisCondition = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Condition", - widget.mySelectedAssessment - .selectedDiagnosisCondition != null - ? widget.mySelectedAssessment - .selectedDiagnosisCondition - .nameEn - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.listOfDiagnosisType != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisType, - okText: TranslationBase - .of(context) - .ok, - okFunction: ( - MasterKeyModel selectedValue) { - setState(() { - // _selectedDiagnosisType = - // selectedValue; - widget.mySelectedAssessment - .selectedDiagnosisType = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Type", - widget.mySelectedAssessment - .selectedDiagnosisType != null - ? widget.mySelectedAssessment - .selectedDiagnosisType.nameEn - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: TextFields( - hintText: "Remarks", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 18, - minLines: 5, - controller: remarkController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 10, - ), - AppButton( - title: "Add".toUpperCase(), - onPressed: () { - setState(() { - widget.mySelectedAssessment.remark = - remarkController.text; - widget.mySelectedAssessment - .appointmentId = int.parse( - appointmentIdController.text); - - widget.addSelectedAssessment(); - }); - }, - ), - ])), - ), - ), - ))), - ); - } -} - diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart deleted file mode 100644 index e5ce583b..00000000 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ /dev/null @@ -1,518 +0,0 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/master_key_checkbox_search_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.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:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; -import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; - -class ObjectivePage extends StatefulWidget { - final Function changePageViewIndex; - final List mySelectedExamination; - final PatiantInformtion patientInfo; - ObjectivePage( - {Key key, this.changePageViewIndex, this.mySelectedExamination, this.patientInfo}); - - @override - _ObjectivePageState createState() => _ObjectivePageState(); -} - -class _ObjectivePageState extends State { - bool isSysExaminationExpand = false; - TextEditingController remarksController = TextEditingController(); - - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { - return BoxDecoration( - color: containerColor, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(6)), - border: Border.fromBorderSide(BorderSide( - color: borderColor, - width: 0.5, - )), - ); - } - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - - return BaseView( - // onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), - builder: (_, model, w) => AppScaffold( - isShowAppBar: false, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Texts('Physical/System Examination', - variant: - isSysExaminationExpand ? "bodyText" : '', - bold: isSysExaminationExpand ? true : false, - color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], - ), - InkWell( - onTap: () { - setState(() { - isSysExaminationExpand = - !isSysExaminationExpand; - }); - }, - child: Icon(isSysExaminationExpand - ? EvaIcons.minus - : EvaIcons.plus)) - ], - ), - bodyWidget: Column(children: [ - SizedBox( - height: 20, - ), - Column( - children: [ - Container( - margin: - EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Add Examination", - fontSize: 13.5, - onTapTextFields: () { - openExaminationList(context); - }, - readOnly: true, - // hintColor: Colors.black, - suffixIcon: EvaIcons.plusCircleOutline, - suffixIconColor: AppGlobal.appPrimaryColor, - fontWeight: FontWeight.w600, - // controller: messageController, - validator: (value) { - if (value == null) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - Column( - children: - widget.mySelectedExamination.map((examination) { - return Container( - margin: EdgeInsets.only( - left: 15, right: 15, top: 15), - child: Column(children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts( - examination - .selectedExamination.nameEn - .toUpperCase(), - variant: "bodyText", - bold: true, - color: Colors.black) - ], - ), - SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - InkWell( - child: Center( - child: Container( - height: - screenSize.height * - 0.070, - decoration: - containerBorderDecoration( - examination - .isNormal - ? Color( - 0xFF515A5D) - : Colors - .white, - Colors.grey), - child: Center( - child: Padding( - padding: - const EdgeInsets - .all(8.0), - child: Text( - "Normal", - style: TextStyle( - fontSize: 12, - color: - examination - .isNormal - ? Colors.white - : Colors - .black, - //Colors.black, - fontWeight: - FontWeight - .bold, - ), - ), - ), - )), - ), - onTap: () { - setState(() { - examination.isAbnormal = - !examination.isAbnormal; - examination.isNormal = - !examination.isNormal; - }); - }), - SizedBox( - width: 12, - ), - InkWell( - child: Center( - child: Container( - height: - screenSize.height * - 0.070, - decoration: - containerBorderDecoration( - examination - .isAbnormal - ? Color( - 0xFF515A5D) - : Colors - .white, - Colors.black), - child: Center( - child: Padding( - padding: - const EdgeInsets - .all(8.0), - child: Text( - "Abnormal", - style: TextStyle( - fontSize: 12, - color: - examination - .isAbnormal - ? Colors.white - : Colors - .black, - //Colors.black, - fontWeight: - FontWeight - .bold, - ), - ), - ), - )), - ), - onTap: () { - setState(() { - examination.isAbnormal = - !examination.isAbnormal; - examination.isNormal = - !examination.isNormal; - }); - }), - ], - ), - InkWell( - - child: Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ), - onTap: () => removeExamination( - examination.selectedExamination), - ) - ], - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only( - left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Remarks", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: remarksController, - validator: (value) { - if (value == null) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - ])); - }).toList(), - ) - ], - ) - ]), - isExpand: isSysExaminationExpand, - ), - DividerWithSpacesAround(height: 30,), - AppButton( - title: TranslationBase.of(context).next, - loading: model.state == ViewState.BusyLocal, - onPressed: () async { - await submitObjectivePage(model); - }, - ), - SizedBox( - height: 30, - ), - ], - ), - ), - ), - ))); - } - - submitObjectivePage(SOAPViewModel model) async { - // if(widget.mySelectedExamination.isNotEmpty){ - // PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); - // widget.mySelectedExamination.forEach((exam) { - // if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == - // null) - // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; - // // TODO : change createdBy editedBy - // postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( - // ListHisProgNotePhysicalExaminationVM( - // patientMRN: widget.patientInfo.patientMRN, - // episodeId: widget.patientInfo.episodeNo, - // appointmentNo: widget.patientInfo.appointmentNo, - // remarks: exam.remark ?? '', - // createdBy: 4709, - // createdOn: DateTime.now().toIso8601String(), - // editedBy: 4709, - // editedOn: DateTime.now().toIso8601String(), - // examId: exam.selectedExamination.id, - // examType: exam.selectedExamination.typeId, - // isAbnormal: exam.isAbnormal, - // isNormal: exam.isNormal, - // masterDescription: exam.selectedExamination, - // notExamined: false - // - // )); - // }); - // - // await model.postPhysicalExam(postPhysicalExamRequestModel); - // - // if (model.state == ViewState.ErrorLocal) { - // helpers.showErrorToast(model.error); - // } else { - // widget.changePageViewIndex(2); - // } - // } else { - // helpers.showErrorToast('Please add required field correctly'); - // } - - widget.changePageViewIndex(2); - } - - removeExamination(MasterKeyModel masterKey) { - Iterable history = widget.mySelectedExamination - .where( - (element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); - - if (history.length > 0) - setState(() { - widget.mySelectedExamination.remove(history.first); - }); - } - - openExaminationList(BuildContext context) { - final screenSize = MediaQuery - .of(context) - .size; - InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } - - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return AddExaminationDailog( - mySelectedExamination: widget.mySelectedExamination, - addSelectedExamination: () { - setState(() { - Navigator.of(context).pop(); - }); - }, - removeExamination: (masterKey) => removeExamination(masterKey),); - }); - } -} - -class AddExaminationDailog extends StatefulWidget { - final List mySelectedExamination; - final Function addSelectedExamination; - final Function (MasterKeyModel) removeExamination; - - const AddExaminationDailog( - {Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination}) - : super(key: key); - - @override - _AddExaminationDailogState createState() => _AddExaminationDailogState(); -} - -class _AddExaminationDailogState extends State { - @override - Widget build(BuildContext context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: BaseView( - onModelReady: (model) async { - if (model.physicalExaminationList.length == 0) { - await model.getMasterLookup( - MasterKeysService.PhysicalExamination); - } - }, - builder: (_, model, w) => - AppScaffold( - // baseViewModel: model, - isShowAppBar: false, - body: Center( - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - "Examinations", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - - NetworkBaseView( - baseViewModel: model, - child: MasterKeyCheckboxSearchWidget( - model: model, - masterList: model.physicalExaminationList, - removeHistory: (history){ - setState(() { - widget.removeExamination(history); - }); - }, - addHistory: (history){ - setState(() { - MySelectedExamination mySelectedExamination = new MySelectedExamination( - selectedExamination: history - ); - widget - .mySelectedExamination - .add( - mySelectedExamination); - }); - }, - addSelectedHistories: (){ - widget.addSelectedExamination(); - }, - isServiceSelected: (master) =>isServiceSelected(master), - ), - ), - - ]), - ))), - )), - ); - } - - isServiceSelected(MasterKeyModel masterKey) { - Iterable exam = - widget - .mySelectedExamination - .where((element) => - masterKey.id == element.selectedExamination.id && - masterKey.typeId == element.selectedExamination.typeId); - if (exam.length > 0) { - return true; - } - return false; - } -} diff --git a/lib/widgets/patients/profile/SOAP/plan_page.dart b/lib/widgets/patients/profile/SOAP/plan_page.dart deleted file mode 100644 index 1bde4b6c..00000000 --- a/lib/widgets/patients/profile/SOAP/plan_page.dart +++ /dev/null @@ -1,349 +0,0 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.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:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; -import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; - -class PlanPage extends StatefulWidget { - final Function changePageViewIndex; - final PatiantInformtion patientInfo; - - PlanPage({Key key, this.changePageViewIndex, this.patientInfo}); - - @override - _PlanPageState createState() => _PlanPageState(); -} - -class _PlanPageState extends State { - bool isProgressNoteExpand = false; - - List progressNoteList; - - TextEditingController progressNoteController = - TextEditingController(text: null); - - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { - return BoxDecoration( - color: containerColor, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(6)), - border: Border.fromBorderSide(BorderSide( - color: borderColor, - width: 0.5, - )), - ); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - - return BaseView( - // onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), - builder: (_, model, w) => AppScaffold( - isShowAppBar: false, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Texts('Progress Note', - variant: - isProgressNoteExpand ? "bodyText" : '', - bold: isProgressNoteExpand ? true : false, - color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], - ), - InkWell( - onTap: () { - setState(() { - isProgressNoteExpand = - !isProgressNoteExpand; - }); - }, - child: Icon(isProgressNoteExpand - ? EvaIcons.minus - : EvaIcons.plus)) - ], - ), - bodyWidget: Column(children: [ - SizedBox( - height: 20, - ), - Column( - children: [ - Container( - margin: - EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Add Progress Note", - fontSize: 13.5, - onTapTextFields: () { - openProgressNote(context); - }, - readOnly: true, - // hintColor: Colors.black, - suffixIcon: EvaIcons.plusCircleOutline, - suffixIconColor: AppGlobal.appPrimaryColor, - fontWeight: FontWeight.w600, - // controller: messageController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - if (progressNoteController.text.isNotEmpty) - Container( - margin: - EdgeInsets.only(left: 5, right: 5, top: 15), - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - "12".toUpperCase(), - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "DEC".toUpperCase(), - fontSize: 10, - color: Colors.grey, - ), - ], - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment - .start, - children: [ - - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - SizedBox( - height: 6, - ), - Padding( - padding: const EdgeInsets.all(0.0), - child: Container( - width: MediaQuery - .of(context) - .size - .width * 0.6, - child: AppText( - progressNoteController.text, - fontSize: 10, - - color: Colors.grey, - ), - ), - ), - ], - ), SizedBox( - height: 8, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Created By : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "Anas Abdullah on 12 De", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - children: [ - AppText( - "Edited By : ", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - AppText( - "Rahim on 13 Dec", - fontSize: 10, - color: Colors.grey, - ), - ], - ), - - ], - ), - Column( - children: [ - InkWell( - onTap: () { - openProgressNote(context); - }, - child: Icon(EvaIcons.edit2Outline), - ) - ], - ), - ], - ), - ) - ], - ) - ]), - isExpand: isProgressNoteExpand, - ), - DividerWithSpacesAround(height: 30,), - AppButton( - title: TranslationBase - .of(context) - .next, - loading: model.state == ViewState.BusyLocal, - onPressed: () { - - submitPlan(model); - // widget.changePageViewIndex(2); - }, - ), - SizedBox( - height: 30, - ), - ], - ), - ), - ), - ),),); - } - - submitPlan(SOAPViewModel model) async { - if (progressNoteController.text.isNotEmpty) { - PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - planNote: progressNoteController.text); - - - await model.postProgressNote(postProgressNoteRequestModel); - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } else { - Navigator.of(context).pop(); - } - } - - // Navigator.of(context).pop(); - } - - openProgressNote(BuildContext context) { - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return FractionallySizedBox( - heightFactor: 0.5, - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 16, - ), - AppText( - "Add Progress Note", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: TextFields( - hintText: "Add progress note here", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 16, - minLines: 8, - controller: progressNoteController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ),SizedBox( - height: 10, - ), - AppButton( - title: "Add".toUpperCase(), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - ]), - )), - ); - }); - } -} diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart deleted file mode 100644 index 43748f3d..00000000 --- a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart +++ /dev/null @@ -1,339 +0,0 @@ -import 'package:autocomplete_textfield/autocomplete_textfield.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.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:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:provider/provider.dart'; - -class AddAllergiesWidget extends StatefulWidget { - final List myAllergiesList; - - AddAllergiesWidget({Key key, this.myAllergiesList}); - - @override - _AddAllergiesWidgetState createState() => _AddAllergiesWidgetState(); -} - -class _AddAllergiesWidgetState extends State { - - TextEditingController remarkController = TextEditingController(); - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - - return Column( - children: [ - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Add Allergies", - fontSize: 13.5, - onTapTextFields: () { - openAllergiesList(context); - }, - readOnly: true, - suffixIcon: EvaIcons.plusCircleOutline, - suffixIconColor: AppGlobal.appPrimaryColor, - fontWeight: FontWeight.w600, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - Container( - margin: - EdgeInsets.only(left: 15, right: 15, top: 15), - child: Column( - children: widget.myAllergiesList.map((selectedAllergy) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts(selectedAllergy.selectedAllergy.nameEn.toUpperCase(), - variant: "bodyText", bold: true, color: Colors.black), - Texts( - selectedAllergy.selectedAllergySeverity.nameEn - .toUpperCase(), - variant: "bodyText", - bold: true, - color: AppGlobal.appPrimaryColor), - InkWell( - child: Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ), - onTap: () => removeAllergy(selectedAllergy), - ) - ], - ), - SizedBox( - height: 10, - ), - ], - ); - }).toList()), - ) - ], - ); - } - - removeAllergy(MySelectedAllergy mySelectedAllergy) { - Iterable allergy = - widget.myAllergiesList.where((element) => mySelectedAllergy == element); - - if (allergy.length > 0) - setState(() { - widget.myAllergiesList.remove(allergy.first); - }); - } - - openAllergiesList(BuildContext context) { - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return AddAllergies( - addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { - setState(() { - widget.myAllergiesList.add(mySelectedAllergy); - Navigator.of(context).pop(); - }); - },); - }); - } - -} - -class AddAllergies extends StatefulWidget { - final Function addAllergiesFun; - - const AddAllergies({Key key, this.addAllergiesFun}) : super(key: key); - - @override - _AddAllergiesState createState() => _AddAllergiesState(); -} - -class _AddAllergiesState extends State { - List allergiesList; - List allergySeverityList; - MasterKeyModel _selectedAllergySeverity; - MasterKeyModel _selectedAllergy; - TextEditingController remarkController = TextEditingController(); - - - InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown,{IconData icon}) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(icon?? Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - } - bool _isShowSearch = false; - GlobalKey key = new GlobalKey>(); - - @override - Widget build(BuildContext context) { - ProjectViewModel projectViewModel = Provider.of(context); - final screenSize = MediaQuery - .of(context) - .size; - return FractionallySizedBox( - heightFactor: 0.7, - child: BaseView( - onModelReady: (model) async { - if (model.allergiesList.length == 0) { - await model.getMasterLookup(MasterKeysService.Allergies); - } - if (model.allergySeverityList.length == 0) { - await model.getMasterLookup(MasterKeysService.AllergySeverity); - } - }, - builder: (_, model, w) => - AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - SizedBox( - height: 16, - ), - AppText( - "Add Allergy", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allergiesList != null - ? () { - setState(() { - _selectedAllergy = null; - }); - } - : null, - child: _selectedAllergy==null? AutoCompleteTextField( - decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search), - itemSubmitted: (item) => setState(() => _selectedAllergy = item), - key: key, - suggestions: model.allergiesList, - itemBuilder: (context, suggestion) => new Padding( - child:Texts( projectViewModel.isArabic? suggestion.nameAr: suggestion.nameEn), - padding: EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - suggestion.nameAr.toLowerCase().startsWith(input.toLowerCase()) ||suggestion.nameEn.toLowerCase().startsWith(input.toLowerCase()), - ):TextField( - decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allergySeverityList != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.allergySeverityList, - okText: TranslationBase - .of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - _selectedAllergySeverity = - selectedValue; - // model.getDoctorBranch().then((value) { - // _selectedBranch = value; - // if (_referTo['id'] == 1) { - // model.getClinics( - // _selectedBranch['ID']); - // } - // }); - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Select Severity", - _selectedAllergySeverity != null - ? _selectedAllergySeverity.nameEn - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: TextFields( - hintText: "Remarks", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: remarkController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), SizedBox( - height: 10, - ), - AppButton( - title: "Add".toUpperCase(), - onPressed: () { - MySelectedAllergy mySelectedAllergy = new MySelectedAllergy( - remark: remarkController.text, - selectedAllergy: _selectedAllergy, - selectedAllergySeverity: _selectedAllergySeverity); - widget.addAllergiesFun(mySelectedAllergy); - }, - ), - ] - - ), - ), - ), - )), - ), - ); - } -} - - - - - diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart deleted file mode 100644 index 6e7bbe00..00000000 --- a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart +++ /dev/null @@ -1,360 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:hexcolor/hexcolor.dart'; - -import '../../../../shared/master_key_checkbox_search_widget.dart'; - -class AddHistoryWidget extends StatefulWidget { - final List myHistoryList; - - const AddHistoryWidget({Key key, this.myHistoryList}) : super(key: key); - - @override - _AddHistoryWidgetState createState() => _AddHistoryWidgetState(); -} - -class _AddHistoryWidgetState extends State - with TickerProviderStateMixin { - PageController _controller; - int _currentIndex = 0; - - changePageViewIndex(pageIndex) { - _controller.jumpToPage(pageIndex); - } - - @override - void initState() { - _controller = new PageController(); - - super.initState(); - } - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Add History", - fontSize: 13.5, - onTapTextFields: () { - openHistoryList(context); - }, - readOnly: true, - // hintColor: Colors.black, - suffixIcon: EvaIcons.plusCircleOutline, - suffixIconColor: AppGlobal.appPrimaryColor, - fontWeight: FontWeight.w600, - // controller: messageController, - validator: (value) { - if (value == null) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - Container( - margin: - EdgeInsets.only(left: 15, right: 15, top: 15), - child: Column( - children: widget.myHistoryList.map((myHistory) { - return Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Texts(myHistory.nameEn, - variant: "bodyText", bold: true, color: Colors.black), - InkWell( - child: Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ), - onTap: () => removeHistory(myHistory), - ) - ], - ), - SizedBox( - height: 20, - ), - ], - ); - }).toList(), - ), - ) - ], - ); - } - - removeHistory(MasterKeyModel masterKey) { - Iterable history = widget.myHistoryList.where((element) => - masterKey.id == element.id && masterKey.typeId == element.typeId); - - if (history.length > 0) - setState(() { - widget.myHistoryList.remove(history.first); - }); - } - - openHistoryList(BuildContext context) { - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return AddHistoryDialog( - changePageViewIndex: changePageViewIndex, - controller: _controller, - myHistoryList: widget.myHistoryList, - addSelectedHistories: () { - setState(() { - Navigator.of(context).pop(); - }); - }, - removeHistory: (masterKey) => removeHistory(masterKey), - ); - }); - } -} - -class PriorityBar extends StatefulWidget { - final Function onTap; - - const PriorityBar({Key key, this.onTap}) : super(key: key); - - @override - _PriorityBarState createState() => _PriorityBarState(); -} - -class _PriorityBarState extends State { - int _activePriority = 0; - - List _priorities = [ - "Family", - "Surgical/Sports", - "Medical", - ]; - - BoxDecoration containerBorderDecoration( - Color containerColor, Color borderColor) { - return BoxDecoration( - color: containerColor, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(6)), - border: Border.fromBorderSide(BorderSide( - color: borderColor, - width: 2.0, - )), - ); - } - - @override - Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; - - return Container( - height: screenSize.height * 0.070, - decoration: - containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), - child: Row( - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: _priorities.map((item) { - bool _isActive = _priorities[_activePriority] == item ? true : false; - return Expanded( - child: InkWell( - child: Center( - child: Container( - height: screenSize.height * 0.070, - decoration: containerBorderDecoration( - _isActive ? HexColor("#B8382B") : Colors.white, - _isActive ? HexColor("#B8382B") : Colors.white), - child: Center( - child: Text( - item, - style: TextStyle( - fontSize: 12, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, - fontWeight: FontWeight.bold, - ), - ), - )), - ), - onTap: () { - widget.onTap(_priorities.indexOf(item)); - - setState(() { - _activePriority = _priorities.indexOf(item); - }); - }), - ); - }).toList(), - ), - ); - } -} - -class AddHistoryDialog extends StatefulWidget { - final Function changePageViewIndex; - final PageController controller; - final List myHistoryList; - final Function addSelectedHistories; - final Function (MasterKeyModel) removeHistory; - - const AddHistoryDialog( - {Key key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory}) - : super(key: key); - - @override - _AddHistoryDialogState createState() => _AddHistoryDialogState(); -} - -class _AddHistoryDialogState extends State { - @override - Widget build(BuildContext context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: BaseView( - onModelReady: (model) async { - if (model.historyFamilyList.length == 0) { - await model.getMasterLookup(MasterKeysService.HistoryFamily); - } - }, - builder: (_, model, w) => AppScaffold( - // baseViewModel: model, - isShowAppBar: false, - body: Center( - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - SizedBox( - height: 10, - ), - PriorityBar(onTap: (activePriority) async { - widget.changePageViewIndex(activePriority); - if(activePriority ==1) { - if (model.historySurgicalList.length == 0) { - await model.getMasterLookup(MasterKeysService.HistorySurgical); - await model.getMasterLookup(MasterKeysService.HistorySports); - } - } - if(activePriority ==2) { - if (model.historyMedicalList.length == 0) { - await model.getMasterLookup(MasterKeysService.HistoryMedical); - } - } - }), - SizedBox( - height: 20, - ), - Expanded( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: widget.controller, - onPageChanged: (index) { - setState(() { - // currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - MasterKeyCheckboxSearchWidget( - model: model, - masterList: model.historyFamilyList, - removeHistory: (history){ - setState(() { - widget.removeHistory(history); - }); - }, - addHistory: (history){ - setState(() { - widget.myHistoryList.add(history); - }); - }, - addSelectedHistories: (){ - widget.addSelectedHistories(); - }, - isServiceSelected: (master) =>isServiceSelected(master), - ), - MasterKeyCheckboxSearchWidget( - model: model, - masterList: model.mergeHistorySurgicalWithHistorySportList, - removeHistory: (history){ - setState(() { - widget.removeHistory(history); - }); - }, - addHistory: (history){ - setState(() { - widget.myHistoryList.add(history); - }); - }, - addSelectedHistories: (){ - widget.addSelectedHistories(); - }, - isServiceSelected: (master) =>isServiceSelected(master), - ), - MasterKeyCheckboxSearchWidget( - model: model, - masterList: model.historyMedicalList, - removeHistory: (history){ - setState(() { - widget.removeHistory(history); - }); - }, - addHistory: (history){ - setState(() { - widget.myHistoryList.add(history); - }); - }, - addSelectedHistories: (){ - widget.addSelectedHistories(); - }, - isServiceSelected: (master) =>isServiceSelected(master), - ), - ], - ), - ), - ], - ), - )), - ), - ), - )); - } - - bool isServiceSelected(MasterKeyModel masterKey) { - Iterable history = - widget.myHistoryList.where((element) => masterKey.id == element.id && masterKey.typeId == element.typeId); - - if (history.length > 0) { - return true; - } - return false; - } - -} diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_medication_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_medication_widget.dart deleted file mode 100644 index 1db7c2e0..00000000 --- a/lib/widgets/patients/profile/SOAP/subjective/add_medication_widget.dart +++ /dev/null @@ -1,107 +0,0 @@ - -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; - -class AddMedication extends StatefulWidget { - @override - _AddMedicationState createState() => _AddMedicationState(); -} - -class _AddMedicationState extends State { - @override - Widget build(BuildContext context) { - return Column( - children: [ - Container( - margin: - EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Current Medications", - fontSize: 13.5, - onTapTextFields: () { - openMedicationsList(context); - }, - readOnly: true, - // hintColor: Colors.black, - suffixIcon: EvaIcons.plusCircleOutline, - suffixIconColor: AppGlobal.appPrimaryColor, - fontWeight: FontWeight.w600, - // controller: messageController, - validator: (value) { - if (value == null) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - Container( - margin: - EdgeInsets.only(left: 15, right: 15, top: 15), - child: Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts('Abdomen Pain', - variant: "bodyText", - bold: true, - color: Colors.black), - Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ) - ], - ), - SizedBox( - height: 20, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts('Back Pain', - variant: "bodyText", - bold: true, - color: Colors.black), - Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ) - ], - ), - ], - ), - ) - ], - ); - } - openMedicationsList(BuildContext context) { - showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: Container( - child: Center( - child: Texts("dfdfd"), - )), - ); - }); - } - -} - diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart deleted file mode 100644 index 2514c463..00000000 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ /dev/null @@ -1,402 +0,0 @@ -import 'package:doctor_app_flutter/client/base_app_client.dart'; -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; -import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_history_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; - -class SubjectivePage extends StatefulWidget { - final Function changePageViewIndex; - final List myAllergiesList; - final List myHistoryList; - final PatiantInformtion patientInfo; - - SubjectivePage( - {Key key, - this.changePageViewIndex, - this.myAllergiesList, - this.myHistoryList, - this.patientInfo}); - - @override - _SubjectivePageState createState() => _SubjectivePageState(); -} - -class _SubjectivePageState extends State { - bool isChiefExpand = false; - bool isHistoryExpand = false; - bool isAllergiesExpand = false; - TextEditingController illnessController = TextEditingController(); - TextEditingController complaintsController = TextEditingController(); - final formKey = GlobalKey(); - - @override - Widget build(BuildContext context) { - return BaseView( - // onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), - builder: (_, model, w) => AppScaffold( - isShowAppBar: false, - baseViewModel: model, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Texts('CHIEF COMPLAINTS', - variant: isChiefExpand ? "bodyText" : '', - bold: isChiefExpand ? true : false, - color: Colors.black), - Icon( - FontAwesomeIcons.asterisk, - color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], - ), - InkWell( - onTap: () { - setState(() { - isChiefExpand = !isChiefExpand; - }); - }, - child: Icon( - isChiefExpand ? EvaIcons.minus : EvaIcons.plus)) - ], - ), - bodyWidget: Form( - key: formKey, - child: Column(children: [ - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "Add Chief Complaints", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: complaintsController, - validator: (value) { - if (value == null || value == "") - return TranslationBase.of(context) - .emptyMessage; - else if (value.length < 25) - return TranslationBase.of(context) - .chiefComplaintLength; - //""; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - Container( - margin: EdgeInsets.only(left: 10, right: 10, top: 15), - child: TextFields( - hintText: "History of Present Illness", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: illnessController, - validator: (value) { - if (value == null || value =="") - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 20, - ), - // TODO return it back when we need it. - // AddMedication(), - ]), - ), - isExpand: isChiefExpand, - ), - - SizedBox( - height: 30, - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Texts('History'.toUpperCase(), - variant: isHistoryExpand ? "bodyText" : '', - bold: isHistoryExpand ? true : false, - color: Colors.black), - ], - ), - InkWell( - onTap: () { - setState(() { - isHistoryExpand = !isHistoryExpand; - }); - }, - child: Icon(isHistoryExpand - ? EvaIcons.minus - : EvaIcons.plus)) - ], - ), - bodyWidget: Column( - children: [ - AddHistoryWidget(myHistoryList: widget.myHistoryList) - ], - ), - isExpand: isHistoryExpand, - ), - SizedBox( - height: 30, - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - SizedBox( - height: 30, - ), - HeaderBodyExpandableNotifier( - headerWidget: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Texts('Allergies'.toUpperCase(), - variant: isAllergiesExpand ? "bodyText" : '', - bold: isAllergiesExpand ? true : false, - color: Colors.black), - ], - ), - InkWell( - onTap: () { - setState(() { - isAllergiesExpand = !isAllergiesExpand; - }); - }, - child: Icon(isAllergiesExpand - ? EvaIcons.minus - : EvaIcons.plus)) - ], - ), - bodyWidget: Column( - children: [ - AddAllergiesWidget( - myAllergiesList: widget.myAllergiesList, - ), - SizedBox( - height: 30, - ), - ], - ), - isExpand: isAllergiesExpand, - ), - SizedBox( - height: 30, - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - SizedBox( - height: 30, - ), - AppButton( - title: TranslationBase.of(context).next, - loading: model.state == ViewState.BusyLocal, - onPressed: () async { - addSubjectiveInfo( - model: model, - myAllergiesList: widget.myAllergiesList, - myHistoryList: widget.myHistoryList); - }, - ), - ], - ), - ), - ), - ), - ), - ); - } - - addSubjectiveInfo( - {SOAPViewModel model, - List myAllergiesList, - List myHistoryList}) async { - formKey.currentState.save(); - formKey.currentState.validate(); - - - // if(complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty && complaintsController.text.length>25) { - // await postChiefComplaint(model: model); - // if (model.state == ViewState.ErrorLocal) { - // helpers.showErrorToast(model.error); - // } else { - // if (myHistoryList.length != 0) { - // await postHistories(model: model, myHistoryList: myHistoryList); - // if (model.state == ViewState.ErrorLocal) { - // helpers.showErrorToast(model.error); - // } else { - // if (myAllergiesList.length != 0) { - // await postAllergy(myAllergiesList: myAllergiesList, model: model); - // if (model.state == ViewState.ErrorLocal) { - // helpers.showErrorToast(model.error); - // } else { - // widget.changePageViewIndex(1); - // } - // } else { - // widget.changePageViewIndex(1); - // - // } - // - // } - // } else { - // if (myAllergiesList.length != 0) { - // await postAllergy(myAllergiesList: myAllergiesList, model: model); - // if (model.state == ViewState.ErrorLocal) { - // helpers.showErrorToast(model.error); - // } else { - // widget.changePageViewIndex(1); - // } - // } else { - // widget.changePageViewIndex(1); - // } - // } - // } - // } else { - // helpers.showErrorToast('Please add required field correctly'); - // } - - widget.changePageViewIndex(1); - - } - - postAllergy( - {List myAllergiesList, SOAPViewModel model}) async { - PostAllergyRequestModel postAllergyRequestModel = - new PostAllergyRequestModel(); - widget.myAllergiesList.forEach((allergy) { - if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == - null) - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; - //TODO: make static value dynamic - postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM - .add(ListHisProgNotePatientAllergyDiseaseVM( - allergyDiseaseId: allergy.selectedAllergy.id, - allergyDiseaseType: allergy.selectedAllergy.typeId, - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - severity: allergy.selectedAllergySeverity.id, - remarks: allergy.remark, - createdBy: 4709, - // - createdOn: DateTime.now() - .toIso8601String(), //"2020-08-14T20:37:22.780Z", - editedBy: 4709, - editedOn: DateTime.now() - .toIso8601String(), //"2020-08-14T20:37:22.780Z", - isChecked: false, - isUpdatedByNurse: false)); - }); - await model.postAllergy(postAllergyRequestModel); - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } - } - - postHistories( - {List myHistoryList, SOAPViewModel model}) async { - PostHistoriesRequestModel postHistoriesRequestModel = - new PostHistoriesRequestModel(); - widget.myHistoryList.forEach((history) { - if (postHistoriesRequestModel.listMedicalHistoryVM == null) - postHistoriesRequestModel.listMedicalHistoryVM = []; - //TODO: make static value dynamic - postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - remarks: "", - historyId: history.id, - historyType: history.typeId, - isChecked: false, - )); - }); - await model.postHistories(postHistoriesRequestModel); - - if (model.state == ViewState.ErrorLocal) { - helpers.showErrorToast(model.error); - } - } - - postChiefComplaint({SOAPViewModel model}) async { - formKey.currentState.save(); - if (formKey.currentState.validate()) { - PostChiefComplaintRequestModel postChiefComplaintRequestModel = - //TODO: make static value dynamic - new PostChiefComplaintRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - chiefComplaint: complaintsController.text, - currentMedication: " currentMedication ", - hopi: illnessController.text, - isLactation: false, - ispregnant: false, - numberOfWeeks: 22); - - await model.postChiefComplaint(postChiefComplaintRequestModel); - } - } -} diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index 86789475..016b5972 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -33,16 +33,16 @@ class ProfileMedicalInfoWidget extends StatelessWidget { PatientProfileButton( key: key, patient: patient, - nameLine1: "Create New", - nameLine2: "Episode", + nameLine1: TranslationBase.of(context).createNew, + nameLine2: TranslationBase.of(context).episode, route: CREATE_EPISODE, icon: 'create-episod.png'), if(int.parse(patientType) ==7) PatientProfileButton( key: key, patient: patient, - nameLine1: "Update", - nameLine2: "Episode", + nameLine1: TranslationBase.of(context).update, + nameLine2: TranslationBase.of(context).episode, route: UPDATE_EPISODE, icon: 'modilfy-episode.png'), Visibility( diff --git a/lib/widgets/patients/profile/soap_update/steps_widget.dart b/lib/widgets/patients/profile/soap_update/steps_widget.dart index d67d94e3..56f3435e 100644 --- a/lib/widgets/patients/profile/soap_update/steps_widget.dart +++ b/lib/widgets/patients/profile/soap_update/steps_widget.dart @@ -295,7 +295,7 @@ class StepsWidget extends StatelessWidget { height: index == 0 ? 5 : 10, ), AppText( - "SUBJECTIVE", + "شخصي", fontWeight: FontWeight.bold, fontSize: 16, ), @@ -345,7 +345,7 @@ class StepsWidget extends StatelessWidget { height: index == 1 ? 5 : 10, ), AppText( - "OBJECTIVE", + "هدف", fontWeight: FontWeight.bold, fontSize: 14, ), @@ -398,7 +398,7 @@ class StepsWidget extends StatelessWidget { padding: const EdgeInsets.only(right: 2), child: AppText( - "ASSESSMENT", + "تقدير", fontWeight: FontWeight.bold, fontSize: 14, ), @@ -451,7 +451,7 @@ class StepsWidget extends StatelessWidget { Container( margin: EdgeInsets.only(right:index == 3? 15:0), child: AppText( - "PLAN", + "خطة", fontWeight: FontWeight.bold, fontSize: 14, ), 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 f03025ae..5d54dfa5 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 @@ -33,14 +33,14 @@ class _UpdateAllergiesWidgetState extends State { @override Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); return Column( children: [ Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( - hintText: "Add Allergies", + hintText: TranslationBase.of(context).addAllergies, fontSize: 13.5, onTapTextFields: () { openAllergiesList(context); @@ -80,13 +80,19 @@ class _UpdateAllergiesWidgetState extends State { Container( child: Expanded( - child: Texts(selectedAllergy.selectedAllergy.nameEn.toUpperCase(), - variant: "bodyText", bold: true, color: Colors.black), + child: Texts(projectViewModel.isArabic ? selectedAllergy + .selectedAllergy.nameAr : selectedAllergy + .selectedAllergy.nameEn.toUpperCase(), + variant: "bodyText", + bold: true, + color: Colors.black), ), width: MediaQuery.of(context).size.width * 0.5, ), Texts( - selectedAllergy.selectedAllergySeverity.nameEn + projectViewModel.isArabic ? selectedAllergy + .selectedAllergySeverity.nameAr : selectedAllergy + .selectedAllergySeverity.nameEn .toUpperCase(), variant: "bodyText", bold: true, @@ -131,8 +137,14 @@ class _UpdateAllergiesWidgetState extends State { return AddAllergies( addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { setState(() { - widget.myAllergiesList.add(mySelectedAllergy); - Navigator.of(context).pop(); + if (!widget.myAllergiesList.contains(mySelectedAllergy)) { + widget.myAllergiesList.add(mySelectedAllergy); + Navigator.of(context).pop(); + } else { + helpers.showErrorToast(TranslationBase + .of(context) + .itemExist); + } }); },); }); @@ -215,7 +227,9 @@ class _AddAllergiesState extends State { height: 16, ), AppText( - "Add Allergy", + TranslationBase + .of(context) + .addAllergies, fontWeight: FontWeight.bold, fontSize: 16, ), @@ -233,18 +247,37 @@ class _AddAllergiesState extends State { } : null, child: _selectedAllergy==null? AutoCompleteTextField( - decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search), - itemSubmitted: (item) => setState(() => _selectedAllergy = item), + decoration: textFieldSelectorDecoration( + TranslationBase + .of(context) + .selectAllergy, + _selectedAllergy != null + ? _selectedAllergy.nameEn + : null, true, icon: EvaIcons.search), + itemSubmitted: (item) => + setState(() => _selectedAllergy = item), key: key, suggestions: model.allergiesList, - itemBuilder: (context, suggestion) => new Padding( - child:Texts( projectViewModel.isArabic? suggestion.nameAr: suggestion.nameEn), + itemBuilder: (context, suggestion) => + new Padding( + child: Texts( + projectViewModel.isArabic ? suggestion + .nameAr : suggestion.nameEn), padding: EdgeInsets.all(8.0)), itemSorter: (a, b) => 1, itemFilter: (suggestion, input) => - suggestion.nameAr.toLowerCase().startsWith(input.toLowerCase()) ||suggestion.nameEn.toLowerCase().startsWith(input.toLowerCase()), + suggestion.nameAr.toLowerCase().startsWith( + input.toLowerCase()) || + suggestion.nameEn.toLowerCase() + .startsWith(input.toLowerCase()), ):TextField( - decoration: textFieldSelectorDecoration("Select Allergy", _selectedAllergy != null ? _selectedAllergy.nameEn : null, true,icon: EvaIcons.search), + decoration: textFieldSelectorDecoration( + TranslationBase + .of(context) + .selectAllergy, + _selectedAllergy != null + ? projectViewModel.isArabic?_selectedAllergy.nameAr: _selectedAllergy.nameEn + : null, true, icon: EvaIcons.search), enabled: false, ), ), @@ -266,13 +299,6 @@ class _AddAllergiesState extends State { setState(() { _selectedAllergySeverity = selectedValue; - // model.getDoctorBranch().then((value) { - // _selectedBranch = value; - // if (_referTo['id'] == 1) { - // model.getClinics( - // _selectedBranch['ID']); - // } - // }); }); }, ); @@ -287,9 +313,11 @@ class _AddAllergiesState extends State { : null, child: TextField( decoration: textFieldSelectorDecoration( - "Select Severity", + TranslationBase + .of(context) + .selectSeverity, _selectedAllergySeverity != null - ? _selectedAllergySeverity.nameEn + ? projectViewModel.isArabic?_selectedAllergySeverity.nameAr:_selectedAllergySeverity.nameEn : null, true), enabled: false, @@ -303,12 +331,12 @@ class _AddAllergiesState extends State { margin: EdgeInsets.only( left: 0, right: 0, top: 15), child: TextFields( - hintText: "Remarks", + hintText: TranslationBase.of(context).remarks, fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, maxLines: 25, - minLines: 13, + minLines: 10, controller: remarkController, validator: (value) { if (value == null) diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart index f720fdfd..ebed11ca 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_history_widget.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -16,6 +17,7 @@ import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class UpdateHistoryWidget extends StatefulWidget { final List myHistoryList; @@ -44,12 +46,13 @@ class _UpdateHistoryWidgetState extends State @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Column( children: [ Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( - hintText: "Add History", + hintText: TranslationBase.of(context).addHistory, fontSize: 13.5, onTapTextFields: () { openHistoryList(context); @@ -83,7 +86,7 @@ class _UpdateHistoryWidgetState extends State children: [ Container( child: Expanded( - child: Texts(myHistory.nameEn, + child: Texts(projectViewModel.isArabic?myHistory.nameAr:myHistory.nameEn, variant: "bodyText", bold: true, color: Colors.black), ), width: MediaQuery.of(context).size.width * 0.7, @@ -152,12 +155,17 @@ class PriorityBar extends StatefulWidget { class _PriorityBarState extends State { int _activePriority = 0; - + int index =-1; List _priorities = [ "Family", "Surgical/Sports", "Medical", ]; + List _prioritiesAr = [ + "أسرة", + "جراحي / رياضي" , + "طبي", + ]; BoxDecoration containerBorderDecoration( Color containerColor, Color borderColor) { @@ -175,6 +183,7 @@ class _PriorityBarState extends State { @override Widget build(BuildContext context) { final screenSize = MediaQuery.of(context).size; + ProjectViewModel projectViewModel = Provider.of(context); return Container( height: screenSize.height * 0.070, @@ -183,8 +192,9 @@ class _PriorityBarState extends State { child: Row( mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, - children: _priorities.map((item) { + children: _priorities.map((item,) { bool _isActive = _priorities[_activePriority] == item ? true : false; + index++; return Expanded( child: InkWell( child: Center( @@ -195,7 +205,7 @@ class _PriorityBarState extends State { _isActive ? HexColor("#B8382B") : Colors.white), child: Center( child: Text( - item, + (projectViewModel.isArabic)?_prioritiesAr[index]: item, style: TextStyle( fontSize: 12, color: _isActive 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 53007123..b9315a28 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 @@ -24,7 +24,6 @@ import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body. import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:html/parser.dart'; class UpdateSubjectivePage extends StatefulWidget { final Function changePageViewIndex; @@ -52,10 +51,21 @@ class _UpdateSubjectivePageState extends State { final formKey = GlobalKey(); getHistory(SOAPViewModel model) async{ GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel( - patientMRN: widget.patientInfo.patientMRN, - episodeID: widget.patientInfo.episodeNo.toString(), - appointmentNo: widget.patientInfo.appointmentNo - ); + patientMRN: widget.patientInfo.patientMRN, + episodeID: widget.patientInfo.episodeNo.toString(), + appointmentNo: widget.patientInfo.appointmentNo); + + getHistoryReqModel.historyType = + MasterKeysService.HistoryFamily.getMasterKeyService(); + await model.getPatientHistories(getHistoryReqModel, isFirst: true); + getHistoryReqModel.historyType = + MasterKeysService.HistoryMedical.getMasterKeyService(); + await model.getPatientHistories(getHistoryReqModel); + getHistoryReqModel.historyType = + MasterKeysService.HistorySurgical.getMasterKeyService(); + await model.getPatientHistories(getHistoryReqModel); + getHistoryReqModel.historyType = + MasterKeysService.HistorySports.getMasterKeyService(); await model.getPatientHistories(getHistoryReqModel); if (model.patientHistoryList.isNotEmpty) { @@ -67,32 +77,51 @@ class _UpdateSubjectivePageState extends State { } if (model.historySurgicalList.length == 0) { await model.getMasterLookup(MasterKeysService.HistorySurgical); + } + if (model.historySportList.length == 0) { await model.getMasterLookup(MasterKeysService.HistorySports); } model.patientHistoryList.forEach((element) { - if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) { - widget.myHistoryList.add( model.getOneMasterKey( + if (element.historyType == + MasterKeysService.HistoryFamily.getMasterKeyService()) { + MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryFamily, id: element.historyId, - )); - }if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) { - widget.myHistoryList.add( model.getOneMasterKey( + ); + if (history != null) { + widget.myHistoryList.add(history); + } + } + if (element.historyType == + MasterKeysService.HistoryMedical.getMasterKeyService()) { + MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistoryMedical, id: element.historyId, - )); - }if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) { - widget.myHistoryList.add( model.getOneMasterKey( + ); + if (history != null) { + widget.myHistoryList.add(history); + } + } + if (element.historyType == + MasterKeysService.HistorySports.getMasterKeyService()) { + MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySports, id: element.historyId, - )); + ); + if (history != null) { + widget.myHistoryList.add(history); + } } if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) { - widget.myHistoryList.add(model.getOneMasterKey( + MasterKeyModel history = model.getOneMasterKey( masterKeys: MasterKeysService.HistorySurgical, id: element.historyId, - )); + ); + if (history != null) { + widget.myHistoryList.add(history); + } } }); } @@ -165,7 +194,7 @@ class _UpdateSubjectivePageState extends State { children: [ Row( children: [ - Texts('CHIEF COMPLAINTS', + Texts(TranslationBase.of(context).chiefComplaints.toUpperCase(), variant: isChiefExpand ? "bodyText" : '', bold: isChiefExpand ? true : false, color: Colors.black), @@ -195,7 +224,9 @@ class _UpdateSubjectivePageState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( - hintText: "Add Chief Complaints", + hintText: TranslationBase + .of(context) + .addChiefComplaints, fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, @@ -203,7 +234,7 @@ class _UpdateSubjectivePageState extends State { minLines: 13, controller: complaintsController, validator: (value) { - if (value == null || value =="") + if (value == null || value == "") return TranslationBase .of(context) .emptyMessage; @@ -211,7 +242,7 @@ class _UpdateSubjectivePageState extends State { return TranslationBase .of(context) .chiefComplaintLength; - //""; + //""; else return null; }), @@ -222,7 +253,9 @@ class _UpdateSubjectivePageState extends State { Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( - hintText: "History of Present Illness", + hintText: TranslationBase + .of(context) + .historyOfPresentIllness, fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, @@ -230,7 +263,7 @@ class _UpdateSubjectivePageState extends State { minLines: 13, controller: illnessController, validator: (value) { - if (value == null || value =="") + if (value == null || value == "") return TranslationBase .of(context) .emptyMessage; @@ -265,7 +298,10 @@ class _UpdateSubjectivePageState extends State { children: [ Row( children: [ - Texts('History'.toUpperCase(), + Texts(TranslationBase + .of(context) + .histories + .toUpperCase(), variant: isHistoryExpand ? "bodyText" : '', bold: isHistoryExpand ? true : false, color: Colors.black), @@ -306,7 +342,10 @@ class _UpdateSubjectivePageState extends State { children: [ Row( children: [ - Texts('Allergies'.toUpperCase(), + Texts(TranslationBase + .of(context) + .allergiesSoap + .toUpperCase(), variant: isAllergiesExpand ? "bodyText" : '', bold: isAllergiesExpand ? true : false, color: Colors.black), @@ -396,7 +435,9 @@ class _UpdateSubjectivePageState extends State { widget.changePageViewIndex(1); } else { - helpers.showErrorToast('Please add required field correctly'); + helpers.showErrorToast(TranslationBase + .of(context) + .requiredMsg); } 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 86e98e4b..20684e19 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -401,7 +401,7 @@ class _UpdateAssessmentPageState extends State { widget.changePageViewIndex(3); } } else { - helpers.showErrorToast('Please add required field correctly'); + helpers.showErrorToast(TranslationBase.of(context).requiredMsg); } widget.changePageViewIndex(3); @@ -664,7 +664,7 @@ class _AddAssessmentDetailsState extends State { margin: EdgeInsets.only( left: 0, right: 0, top: 15), child: TextFields( - hintText: "Remarks", + hintText: TranslationBase.of(context).remarks, fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, 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 2abdfbae..e3aef3f4 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -306,7 +306,7 @@ class _UpdateObjectivePageState extends State { margin: EdgeInsets.only( left: 0, right: 0, top: 15), child: TextFields( - hintText: "Remarks", + hintText: TranslationBase.of(context).remarks, fontSize: 13.5, // hintColor: Colors.black, fontWeight: FontWeight.w600, @@ -390,7 +390,7 @@ class _UpdateObjectivePageState extends State { widget.changePageViewIndex(2); } } else { - helpers.showErrorToast('Please add required field correctly'); + helpers.showErrorToast(TranslationBase.of(context).requiredMsg); } widget.changePageViewIndex(2); diff --git a/lib/widgets/patients/profile/soap_update/update_soap_index.dart b/lib/widgets/patients/profile/soap_update/update_soap_index.dart index 9e5dd82b..fee067f4 100644 --- a/lib/widgets/patients/profile/soap_update/update_soap_index.dart +++ b/lib/widgets/patients/profile/soap_update/update_soap_index.dart @@ -6,11 +6,7 @@ import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/assessment_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/objective_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/plan_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/steps_widget.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/subjective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/update_assessment_page.dart'; diff --git a/lib/widgets/shared/dialogs/master_key_dailog.dart b/lib/widgets/shared/dialogs/master_key_dailog.dart index a3be364b..55046c3c 100644 --- a/lib/widgets/shared/dialogs/master_key_dailog.dart +++ b/lib/widgets/shared/dialogs/master_key_dailog.dart @@ -1,6 +1,8 @@ +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; // ignore: must_be_immutable class MasterKeyDailog extends StatefulWidget { @@ -30,10 +32,11 @@ class _MasterKeyDailogState extends State { @override Widget build(BuildContext context) { - return showAlertDialog(context); + ProjectViewModel projectViewModel = Provider.of(context); + return showAlertDialog(context, projectViewModel); } - showAlertDialog(BuildContext context) { + showAlertDialog(BuildContext context, ProjectViewModel projectViewModel) { // set up the buttons Widget cancelButton = FlatButton( child: Text(TranslationBase.of(context).cancel), @@ -49,7 +52,7 @@ class _MasterKeyDailogState extends State { // set up the AlertDialog AlertDialog alert = AlertDialog( // title: Text(widget.title), - content: createDialogList(), + content: createDialogList(projectViewModel), actions: [ cancelButton, continueButton, @@ -58,7 +61,7 @@ class _MasterKeyDailogState extends State { return alert; } - Widget createDialogList() { + Widget createDialogList(ProjectViewModel projectViewModel) { return Container( height: MediaQuery.of(context).size.height * 0.5, child: SingleChildScrollView( @@ -67,7 +70,7 @@ class _MasterKeyDailogState extends State { ...widget.list .map((item) => RadioListTile( title: Text( - '${item.nameEn}' + (widget.isICD ? '/${item.code}' : '')), + '${projectViewModel.isArabic?item.nameAr:item.nameEn}' + (widget.isICD ? '/${item.code}' : '')), groupValue: widget.isICD ? widget.selectedValue.code.toString() : widget.selectedValue.id.toString(), diff --git a/lib/widgets/shared/master_key_checkbox_search_widget.dart b/lib/widgets/shared/master_key_checkbox_search_widget.dart index f164be4b..7cc8eaad 100644 --- a/lib/widgets/shared/master_key_checkbox_search_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_widget.dart @@ -1,6 +1,8 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; @@ -9,6 +11,7 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class MasterKeyCheckboxSearchWidget extends StatefulWidget { final SOAPViewModel model; @@ -45,6 +48,8 @@ class _MasterKeyCheckboxSearchWidgetState extends State Date: Sun, 3 Jan 2021 00:14:09 +0200 Subject: [PATCH 08/14] small fix --- lib/widgets/shared/master_key_checkbox_search_widget.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/widgets/shared/master_key_checkbox_search_widget.dart b/lib/widgets/shared/master_key_checkbox_search_widget.dart index 7cc8eaad..aafb8adc 100644 --- a/lib/widgets/shared/master_key_checkbox_search_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_widget.dart @@ -100,7 +100,7 @@ class _MasterKeyCheckboxSearchWidgetState extends State Date: Sun, 3 Jan 2021 00:17:01 +0200 Subject: [PATCH 09/14] small fix remove todo --- lib/client/base_app_client.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 75894465..83923ea7 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -83,7 +83,6 @@ class BaseAppClient { } else { var parsed = json.decode(response.body.toString()); if (!parsed['IsAuthenticated']) { - // TODO: return it back when IsAuthenticated work fine in all service await helpers.logout(); helpers.showErrorToast('Your session expired Please login agian'); } else From 7d550ca15fd7c53b298ede6c6d7110d95627ac98 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 3 Jan 2021 00:32:59 +0200 Subject: [PATCH 10/14] prevent null --- .../soap_update/subjective/update_subjective_page.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 b9315a28..98d1b7d0 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 @@ -166,8 +166,8 @@ class _UpdateSubjectivePageState extends State { MySelectedAllergy mySelectedAllergy = MySelectedAllergy( selectedAllergy: selectedAllergy, selectedAllergySeverity: selectedAllergySeverity); - - widget.myAllergiesList.add(mySelectedAllergy); + if (selectedAllergy != null && selectedAllergySeverity != null) + widget.myAllergiesList.add(mySelectedAllergy); }); } From 6a8c37e0d759d180caa32e48ded9db31a707f8e6 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 3 Jan 2021 09:14:59 +0300 Subject: [PATCH 11/14] doctor leave --- lib/config/localized_values.dart | 1 + .../add-rescheduleleave.dart | 31 +++++++++++++++++++ .../reschedule-leaves/reschedule_leave.dart | 12 ++++--- lib/util/translations_delegate_base.dart | 1 + pubspec.lock | 13 ++++++-- 5 files changed, 50 insertions(+), 8 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 05d91477..1490c7bc 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -479,4 +479,5 @@ const Map> localizedValues = { }, 'significantSigns': {'en': "SIGNIFICANT SIGNS", 'ar': 'علامات مهمة'}, 'backAbdomen': {'en': "Back : Abdomen", 'ar': 'الظهر: البطن'}, + 'reasons': {'en': "Reasons", 'ar': 'الأسباب'}, }; diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index c48eee79..a4739247 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.dart'; 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/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; @@ -15,10 +16,13 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; class AddRescheduleLeavScreen extends StatelessWidget { + ProjectViewModel projectsProvider; @override Widget build(BuildContext context) { + projectsProvider = Provider.of(context); return BaseView( onModelReady: (model) => {model.getRescheduleLeave(), model.getCoveringDoctors()}, @@ -157,6 +161,21 @@ class AddRescheduleLeavScreen extends StatelessWidget { item.doctorId)) ]) : SizedBox(), + AppText( + TranslationBase.of( + context) + .reasons, + fontWeight: + FontWeight.bold, + ), + model.allReasons.length > 0 + ? Row(children: [ + AppText(getReasons( + model + .allReasons, + item.reasonId)) + ]) + : SizedBox(), ], ), SizedBox( @@ -258,4 +277,16 @@ class AddRescheduleLeavScreen extends StatelessWidget { return obj.length > 0 ? obj[0]['doctorName'] : ""; } + + getReasons(model, reasonID) { + var obj; + obj = model.where((i) => i['id'] == reasonID).toList(); + print(obj); + + return obj.length > 0 + ? projectsProvider.isArabic == true + ? obj[0]['nameAr'] + : obj[0]['nameEn'] + : ""; + } } diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 1a807392..c74395a3 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -732,16 +732,18 @@ class _RescheduleLeaveScreen extends State { getProfile() async { Map p = await sharedPref.getObj(DOCTOR_PROFILE); setState(() { - this.profile = p; - this.clinicID = widget.updateData.clinicId; + if (widget.updateData != null) { + this.profile = p; + this.clinicID = widget.updateData.clinicId; - _toDateController.text = widget.updateData.dateTimeFrom; - _toDateController2.text = widget.updateData.dateTimeTo; + _toDateController.text = widget.updateData.dateTimeFrom; + _toDateController2.text = widget.updateData.dateTimeTo; + } }); } getClinicName(model) { - var clinicID = this.profile != null ? this.profile['ClinicID'] : 1; + var clinicID = this.profile['ClinicID'] ?? 1; var clinicInfo = model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList(); return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index f54e641d..b9aac20a 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -503,6 +503,7 @@ class TranslationBase { String get significantSigns => localizedValues['significantSigns'][locale.languageCode]; String get backAbdomen => localizedValues['backAbdomen'][locale.languageCode]; + String get reasons => localizedValues['reasons'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/pubspec.lock b/pubspec.lock index 9cbacb6d..7f1d8c1d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -260,6 +260,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.10" + date_time_picker: + dependency: "direct main" + description: + name: date_time_picker + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" device_info: dependency: "direct main" description: @@ -496,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: @@ -753,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: @@ -888,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 4b5bec8c506f7c5bdaa91bac5e60288cb5a38437 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 3 Jan 2021 10:39:53 +0200 Subject: [PATCH 12/14] working on UCAF design --- lib/config/localized_values.dart | 2 + lib/routes.dart | 3 + .../profile/UCAF/UCAF-detail-screen.dart | 107 ++++++++++++++++++ .../profile/UCAF/UCAF-input-screen.dart | 76 +------------ .../referral/refer-patient-screen.dart | 2 +- lib/util/translations_delegate_base.dart | 2 + .../profile/PatientHeaderWidgetNoAvatar.dart | 73 ++++++++++++ pubspec.lock | 8 +- 8 files changed, 197 insertions(+), 76 deletions(-) create mode 100644 lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart create mode 100644 lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 85954bb0..31c15e11 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -431,4 +431,6 @@ const Map> localizedValues = { 'itemExist': {'en': "This item already exist", 'ar':"هذا العنصر موجود" }, 'selectAllergy': {'en': "Select Allergy", 'ar':"أختر الحساسية" }, 'selectSeverity': {'en': "Select Severity", 'ar':"أختر الدرجه" }, + 'medications': {'en': "Medications", 'ar':"الأدوية" }, + 'procedures': {'en': "Procedures", 'ar':"الإجراءات" }, }; diff --git a/lib/routes.dart b/lib/routes.dart index 962df032..e57b56a7 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/root_page.dart'; import 'package:doctor_app_flutter/screens/medical-file/medical_file_page.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-detail-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/UCAF/UCAF-input-screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/insurance_approvals_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/patient_orders_screen.dart'; @@ -91,6 +92,7 @@ const String PATIENT_ADMISSION_REQUEST = 'patients/admission-request'; const String PATIENT_ADMISSION_REQUEST_2 = 'patients/admission-request-second'; const String PATIENT_ADMISSION_REQUEST_3 = 'patients/admission-request-third'; const String PATIENT_UCAF_REQUEST = 'patients/ucaf'; +const String PATIENT_UCAF_DETAIL = 'patients/ucaf/detail'; const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; @@ -155,4 +157,5 @@ var routes = { // LIVECARE_END_DIALOG: (_) => EndCallDialogBox() MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), PATIENT_UCAF_REQUEST: (_) => UCAFInputScreen(), + PATIENT_UCAF_DETAIL: (_) => UcafDetailScreen(), }; diff --git a/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart new file mode 100644 index 00000000..7fc16bfb --- /dev/null +++ b/lib/screens/patients/profile/UCAF/UCAF-detail-screen.dart @@ -0,0 +1,107 @@ +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'; +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:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class UcafDetailScreen extends StatefulWidget { + @override + _UcafDetailScreenState createState() => _UcafDetailScreenState(); +} + +class _UcafDetailScreenState extends State { + + int _activeTap = 1; + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + final screenSize = MediaQuery.of(context).size; + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).ucaf, + body: Container( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + PatientHeaderWidgetNoAvatar(patient), + SizedBox( + height: 10, + ), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + children: [ + treatmentStepsBar(context, screenSize), + SizedBox( + height: 16, + ), + ], + ), + ), + ], + ), + ), + ), + )); + } + + Widget treatmentStepsBar(BuildContext _context, Size screenSize) { + List __treatmentSteps = [ + TranslationBase.of(context).diagnosis.toUpperCase(), + TranslationBase.of(context).medications.toUpperCase(), + TranslationBase.of(context).procedures.toUpperCase(), + ]; + return Container( + height: screenSize.height * 0.070, + decoration: + Helpers.containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), + child: Row( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: __treatmentSteps.map((item) { + bool _isActive = __treatmentSteps[_activeTap] == item ? true : false; + return Expanded( + child: InkWell( + child: Center( + child: Container( + height: screenSize.height * 0.070, + decoration: Helpers.containerBorderDecoration( + _isActive ? HexColor("#B8382B") : Colors.white, + _isActive ? HexColor("#B8382B") : Colors.white), + child: Center( + child: Text( + item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + fontWeight: FontWeight.bold, + ), + ), + )), + ), + onTap: () { + print(__treatmentSteps.indexOf(item)); + setState(() { + _activeTap = __treatmentSteps.indexOf(item); + }); + }, + ), + ); + }).toList(), + ), + ); + } + +} diff --git a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart index 82b01144..e0c2f9a7 100644 --- a/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart +++ b/lib/screens/patients/profile/UCAF/UCAF-input-screen.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/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_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -12,6 +13,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../../../routes.dart'; + class UCAFInputScreen extends StatefulWidget { @override _UCAFInputScreenState createState() => _UCAFInputScreenState(); @@ -58,7 +61,7 @@ class _UCAFInputScreenState extends State { body: SingleChildScrollView( child: Column( children: [ - PatientHeaderWidget(patient), + PatientHeaderWidgetNoAvatar(patient), Container( margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), child: Column( @@ -349,7 +352,7 @@ class _UCAFInputScreenState extends State { title: TranslationBase.of(context).next, color: HexColor("#B8382B"), onPressed: (){ - // Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {'patient': patient}); + Navigator.of(context).pushNamed(PATIENT_UCAF_DETAIL, arguments: {'patient': patient}); }, ), ], @@ -362,72 +365,3 @@ class _UCAFInputScreenState extends State { ); } } - -class PatientHeaderWidget extends StatelessWidget { - final PatiantInformtion patient; - - PatientHeaderWidget(this.patient); - - @override - Widget build(BuildContext context) { - return Column( - children: [ - Container( - margin: EdgeInsets.all(16), - child: Row( - children: [ - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - patient.firstName + ' ' + patient.lastName, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.2, - ), - Row( - children: [ - AppText( - "VIP", - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.2, - ), - SizedBox( - width: 8, - ), - AppText( - " ${patient.age}", - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - ], - ), - AppText( - "NEW VISIT", - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - AppText( - "${patient.companyName}", - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.0, - ), - ], - ), - ), - Icon( - Icons.info_outline, - color: Colors.black, - ), - ], - ), - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - ], - ); - } -} diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 7a210b98..3ca6c9b3 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -19,7 +19,7 @@ import 'package:hexcolor/hexcolor.dart'; import '../../../QR_reader_screen.dart'; class PatientMakeReferralScreen extends StatefulWidget { - // previous design page is: MyReferralPatient + // previous design page is: ReferPatientScreen @override _PatientMakeReferralScreenState createState() => _PatientMakeReferralScreenState(); diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index e928f521..e4243035 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -455,6 +455,8 @@ class TranslationBase { String get createNew => localizedValues['createNew'][locale.languageCode]; String get update => localizedValues['update'][locale.languageCode]; String get episode => localizedValues['episode'][locale.languageCode]; + String get medications => localizedValues['medications'][locale.languageCode]; + String get procedures => localizedValues['procedures'][locale.languageCode]; String get chiefComplaints=> localizedValues['chiefComplaints'][locale.languageCode]; diff --git a/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart b/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart new file mode 100644 index 00000000..25bc80e4 --- /dev/null +++ b/lib/widgets/patients/profile/PatientHeaderWidgetNoAvatar.dart @@ -0,0 +1,73 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class PatientHeaderWidgetNoAvatar extends StatelessWidget { + final PatiantInformtion patient; + + PatientHeaderWidgetNoAvatar(this.patient); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + margin: EdgeInsets.all(16), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + patient.firstName + ' ' + patient.lastName, + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.2, + ), + Row( + children: [ + AppText( + "VIP", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.2, + ), + SizedBox( + width: 8, + ), + AppText( + " ${patient.age}", + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + AppText( + "NEW VISIT", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + AppText( + "${patient.companyName}", + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.0, + ), + ], + ), + ), + Icon( + Icons.info_outline, + color: Colors.black, + ), + ], + ), + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + ], + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 9cbacb6d..61cc667f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -454,7 +454,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3-nullsafety.1" + version: "0.6.2" json_annotation: dependency: transitive description: @@ -496,7 +496,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: @@ -753,7 +753,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: @@ -888,5 +888,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 0c39dc66936f721700b83389b74de1b07ac50a41 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 3 Jan 2021 10:58:14 +0200 Subject: [PATCH 13/14] change on vital signs for uncoment the service --- lib/config/localized_values.dart | 1 + .../service/patient-vital-signs-service.dart | 11 ++++--- .../patient-vital-sign-viewmodel.dart | 27 ++++++---------- .../vital_sign/vital-signs-screen.dart | 32 +++++++++---------- lib/util/translations_delegate_base.dart | 1 + 5 files changed, 32 insertions(+), 40 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 31c15e11..e9b01caf 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -433,4 +433,5 @@ const Map> localizedValues = { 'selectSeverity': {'en': "Select Severity", 'ar':"أختر الدرجه" }, 'medications': {'en': "Medications", 'ar':"الأدوية" }, 'procedures': {'en': "Procedures", 'ar':"الإجراءات" }, + 'vitalSignEmptyMsg': {'en': "There is no vital signs for this patient", 'ar':"لا توجد علامات حيوية لهذا المريض" }, }; diff --git a/lib/core/service/patient-vital-signs-service.dart b/lib/core/service/patient-vital-signs-service.dart index d508fec6..31c8721d 100644 --- a/lib/core/service/patient-vital-signs-service.dart +++ b/lib/core/service/patient-vital-signs-service.dart @@ -1,6 +1,7 @@ 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/patient/PatientArrivalEntity.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 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart'; @@ -46,18 +47,18 @@ class VitalSignsService extends BaseService{ ); } // Vit*/ - Future getPatientVitalSign(PatientArrivalEntity patientArrivalEntity) async { + Future getPatientVitalSign(PatiantInformtion patient) async { hasError = false; Map body = Map(); - body['PatientMRN'] = patientArrivalEntity.patientMRN; - body['AppointmentNo'] = patientArrivalEntity.appointmentNo; - body['EpisodeID'] = patientArrivalEntity.episodeNo; + 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){ + if(response['VitalSignsList']['entityList'] != null && (response['VitalSignsList']['entityList'] as List).length > 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 e58ad089..f53def7b 100644 --- a/lib/core/viewModel/patient-vital-sign-viewmodel.dart +++ b/lib/core/viewModel/patient-vital-sign-viewmodel.dart @@ -16,17 +16,17 @@ class VitalSignsViewModel extends BaseViewModel { VitalSignData get patientVitalSigns => _vitalSignService.patientVitalSigns; - Future getPatientArrivalList(String date, PatiantInformtion patient, + /*Future getPatientArrivalList(String date, PatiantInformtion patient, {String fromDate}) async { // TODO when arrival list work un comment below lines - /* setState(ViewState.Busy); + *//* setState(ViewState.Busy); await _vitalSignService.getPatientArrivalList(date, fromDate: fromDate); if (_vitalSignService.hasError) { error = _vitalSignService.error; setState(ViewState.Error); } else { await getPatientVitalSign(patient); - }*/ + }*//* makeVitalSignDemoData(); } @@ -43,27 +43,18 @@ class VitalSignsViewModel extends BaseViewModel { // print("patient index: $index"); } return null; - } + }*/ Future getPatientVitalSign(PatiantInformtion patient) async { setState(ViewState.Busy); - PatientArrivalEntity patientArrivalEntity = - getPatientAppointmentEntity(patient); - if (patientArrivalEntity == null) { - _vitalSignService.hasError = true; - error = "There is no appointments for this patient"; - setState(ViewState.Error); - return; - } - await _vitalSignService.getPatientVitalSign(patientArrivalEntity); - // TODO remove (not) from below condition - if (!_vitalSignService.hasError) { + await _vitalSignService.getPatientVitalSign(patient); + if (_vitalSignService.hasError) { error = _vitalSignService.error; setState(ViewState.Error); } else { - if (patientVitalSigns == null) { - makeVitalSignDemoData(); - } + // if (patientVitalSigns == null) { + // makeVitalSignDemoData(); + // } setState(ViewState.Idle); } } 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 107e2e6b..c66555c1 100644 --- a/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital-signs-screen.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; class PatientVitalSignScreen extends StatelessWidget { @override @@ -19,10 +20,7 @@ class PatientVitalSignScreen extends StatelessWidget { PatiantInformtion patient = routeArgs['patient']; return BaseView( - onModelReady: (model) => model.getPatientArrivalList( - DateUtils.convertDateToFormat(DateTime.now(), "yyyy-MM-dd"), patient, - fromDate: DateUtils.convertDateToFormat( - DateTime.now().subtract(Duration(days: 500)), "yyyy-MM-dd")), + onModelReady: (model) => model.getPatientVitalSign(patient), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).vitalSign, @@ -213,10 +211,12 @@ class PatientVitalSignScreen extends StatelessWidget { Container( color: Colors.green, child: Padding( - padding: EdgeInsets.symmetric(vertical: 2, horizontal: 8), + padding: EdgeInsets.symmetric( + vertical: 2, horizontal: 8), child: AppText( "${model.getBMI(model.patientVitalSigns.bodyMassIndex)}", - fontSize: SizeConfig.textMultiplier * 2, + fontSize: + SizeConfig.textMultiplier * 2, color: Colors.white, fontWeight: FontWeight.bold, ), @@ -357,7 +357,14 @@ class PatientVitalSignScreen extends StatelessWidget { ), ), ) - : Container(), + : Center( + child: AppText( + "${TranslationBase.of(context).vitalSignEmptyMsg}", + fontSize: SizeConfig.textMultiplier * 2.5, + color: HexColor("#B8382B"), + fontWeight: FontWeight.normal, + ), + ), ), ); } @@ -485,7 +492,6 @@ class _TemperatureWidgetState extends State { } class PulseWidget extends StatefulWidget { - final VitalSignData vitalSign; PulseWidget(this.vitalSign); @@ -496,6 +502,7 @@ class PulseWidget extends StatefulWidget { class _PulseWidgetState extends State { bool isExpand = false; + @override Widget build(BuildContext context) { return Container( @@ -578,7 +585,6 @@ class _PulseWidgetState extends State { } class RespirationWidget extends StatefulWidget { - final VitalSignData vitalSign; RespirationWidget(this.vitalSign); @@ -672,7 +678,6 @@ class _RespirationWidgetState extends State { } class BloodPressureWidget extends StatefulWidget { - final VitalSignData vitalSign; BloodPressureWidget(this.vitalSign); @@ -812,7 +817,6 @@ class _BloodPressureWidgetState extends State { } class OxygenationWidget extends StatefulWidget { - final VitalSignData vitalSign; OxygenationWidget(this.vitalSign); @@ -906,7 +910,6 @@ class _OxygenationWidgetState extends State { } class PainScaleWidget extends StatefulWidget { - final VitalSignData vitalSign; PainScaleWidget(this.vitalSign); @@ -998,8 +1001,3 @@ class _PainScaleWidgetState extends State { ); } } - - - - - diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index e4243035..3b1950db 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -472,6 +472,7 @@ class TranslationBase { String get itemExist => localizedValues['itemExist'][locale.languageCode]; String get selectAllergy => localizedValues['selectAllergy'][locale.languageCode]; String get selectSeverity => localizedValues['selectSeverity'][locale.languageCode]; + String get vitalSignEmptyMsg => localizedValues['vitalSignEmptyMsg'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From e054c282342d8e5bf755ea7e97aea156721274d8 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 3 Jan 2021 11:27:03 +0200 Subject: [PATCH 14/14] hide text --- .../patients/profile/soap_update/update_assessment_page.dart | 1 + lib/widgets/patients/profile/soap_update/update_plan_page.dart | 1 + 2 files changed, 2 insertions(+) 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 20684e19..3eec290c 100644 --- a/lib/widgets/patients/profile/soap_update/update_assessment_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_assessment_page.dart @@ -130,6 +130,7 @@ class _UpdateAssessmentPageState extends State { ), Column( children: [ + if(model.patientAssessmentList.isEmpty) Container( margin: EdgeInsets.only(left: 5, right: 5, top: 15), diff --git a/lib/widgets/patients/profile/soap_update/update_plan_page.dart b/lib/widgets/patients/profile/soap_update/update_plan_page.dart index d5ad12e9..9c851cd5 100644 --- a/lib/widgets/patients/profile/soap_update/update_plan_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_plan_page.dart @@ -115,6 +115,7 @@ class _UpdatePlanPageState extends State { ), Column( children: [ + if(model.patientProgressNoteList.isEmpty) Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15),