From 7d3e59e0604b8831c64a653b18fdf451de69a10b Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 22 Nov 2021 16:28:25 +0200 Subject: [PATCH] flutter version 2 --- .../PatientRegistrationViewModel.dart | 6 +- .../profile_gird_for_other.dart | 125 +- .../profile_gird_for_search.dart | 93 +- .../referral/my-referral-detail-screen.dart | 154 ++- .../reschedule-leaves/reschedule_leave.dart | 1043 ++++++++++------- pubspec.lock | 10 +- 6 files changed, 883 insertions(+), 548 deletions(-) diff --git a/lib/core/viewModel/PatientRegistrationViewModel.dart b/lib/core/viewModel/PatientRegistrationViewModel.dart index a60d1ed2..fe32bfcb 100644 --- a/lib/core/viewModel/PatientRegistrationViewModel.dart +++ b/lib/core/viewModel/PatientRegistrationViewModel.dart @@ -141,9 +141,7 @@ class PatientRegistrationViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future sendActivationCodeByOTPNotificationType( - { - required int otpType}) async { + Future sendActivationCodeByOTPNotificationType({required int otpType}) async { setState(ViewState.BusyLocal); print(checkPatientForRegistrationModel); print(checkPatientForRegistrationModel); @@ -181,7 +179,7 @@ class PatientRegistrationViewModel extends BaseViewModel { channel: 3, // TODO Elham* loginType loginType: 4, - logInTokenID:_patientRegistrationService.logInTokenID , + logInTokenID: _patientRegistrationService.logInTokenID, nationalID: checkPatientForRegistrationModel.patientIdentificationID, patientID: 0, mobileNo: checkPatientForRegistrationModel.patientMobileNumber.toString(), diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart index 6f1b57d8..22a5f23b 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_other.dart @@ -33,41 +33,77 @@ class ProfileGridForOther extends StatelessWidget { @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel(TranslationBase.of(context).vital!, TranslationBase.of(context).signs!, VITAL_SIGN_DETAILS, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).vital!, + TranslationBase.of(context).signs!, + VITAL_SIGN_DETAILS, + 'patient/vital_signs.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).lab!, TranslationBase.of(context).result!, LAB_RESULT, 'patient/lab_results.png', + TranslationBase.of(context).lab!, + TranslationBase.of(context).result!, + LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).lab!, TranslationBase.of(context).special!, - ALL_SPECIAL_LAB_RESULT, 'patient/lab_results.png', + PatientProfileCardModel( + TranslationBase.of(context).lab!, + TranslationBase.of(context).special!, + ALL_SPECIAL_LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).radiology!, TranslationBase.of(context).service!, - RADIOLOGY_PATIENT, 'patient/health_summary.png', + PatientProfileCardModel( + TranslationBase.of(context).radiology!, + TranslationBase.of(context).service!, + RADIOLOGY_PATIENT, + 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).prescription!, - ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).prescription!, + ORDER_PRESCRIPTION_NEW, + 'patient/order_prescription.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).health!, TranslationBase.of(context).summary!, HEALTH_SUMMARY, + PatientProfileCardModel( + TranslationBase.of(context).health!, + TranslationBase.of(context).summary!, + HEALTH_SUMMARY, 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", PATIENT_ECG, 'patient/patient_sick_leave.png', + PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", + PATIENT_ECG, 'patient/patient_sick_leave.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).procedures!, - ORDER_PROCEDURE, 'patient/Order_Procedures.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).procedures!, + ORDER_PROCEDURE, + 'patient/Order_Procedures.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).insurance!, TranslationBase.of(context).service!, - PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).insurance!, + TranslationBase.of(context).service!, + PATIENT_INSURANCE_APPROVALS_NEW, + 'patient/vital_signs.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patientSick!, TranslationBase.of(context).leave!, ADD_SICKLEAVE, 'patient/patient_sick_leave.png', + PatientProfileCardModel( + TranslationBase.of(context).patientSick!, + TranslationBase.of(context).leave!, + ADD_SICKLEAVE, + 'patient/patient_sick_leave.png', isInPatient: isInpatient), - if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) - PatientProfileCardModel(TranslationBase.of(context).patient!, TranslationBase.of(context).ucaf!, - PATIENT_UCAF_REQUEST, 'patient/ucaf.png', + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) + PatientProfileCardModel( + TranslationBase.of(context).patient!, + TranslationBase.of(context).ucaf!, + PATIENT_UCAF_REQUEST, + 'patient/ucaf.png', isInPatient: isInpatient, isDisable: isFromLiveCare ? patient.appointmentNo == null - : patient.patientStatusType != 43 || patient.appointmentNo == null), - if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) + : patient.patientStatusType != 43 || + patient.appointmentNo == null), + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) PatientProfileCardModel( TranslationBase.of(context).referral!, TranslationBase.of(context).patient!, @@ -76,15 +112,21 @@ class ProfileGridForOther extends StatelessWidget { isInPatient: isInpatient, isDisable: isFromLiveCare ? patient.appointmentNo == null - : patient.patientStatusType != 43 || patient.appointmentNo == null, + : patient.patientStatusType != 43 || + patient.appointmentNo == null, ), - if (isFromLiveCare || (patient.appointmentNo != null && patient.appointmentNo != 0)) - PatientProfileCardModel(TranslationBase.of(context).admission!, TranslationBase.of(context).request!, - PATIENT_ADMISSION_REQUEST, 'patient/admission_req.png', + if (isFromLiveCare || + (patient.appointmentNo != null && patient.appointmentNo != 0)) + PatientProfileCardModel( + TranslationBase.of(context).admission!, + TranslationBase.of(context).request!, + PATIENT_ADMISSION_REQUEST, + 'patient/admission_req.png', isInPatient: isInpatient, isDisable: isFromLiveCare ? patient.appointmentNo == null - : patient.patientStatusType != 43 || patient.appointmentNo == null), + : patient.patientStatusType != 43 || + patient.appointmentNo == null), ]; return Column( @@ -99,22 +141,23 @@ class ProfileGridForOther extends StatelessWidget { crossAxisCount: 3, itemCount: cardsList.length, staggeredTileBuilder: (int index) => StaggeredTile.fit(1), - itemBuilder: (BuildContext context, int index) => PatientProfileButton( - patient: patient, - patientType: patientType, - arrivalType: arrivalType, - from: from, - to: to, - nameLine1: cardsList[index].nameLine1, - nameLine2: cardsList[index].nameLine2, - route: cardsList[index].route, - icon: cardsList[index].icon, - isInPatient: cardsList[index].isInPatient, - isDischargedPatient: cardsList[index].isDischargedPatient, - isDisable: cardsList[index].isDisable, - onTap: cardsList[index].onTap, - isLoading: cardsList[index].isLoading, - isFromLiveCare: isFromLiveCare), + itemBuilder: (BuildContext context, int index) => + PatientProfileButton( + patient: patient, + patientType: patientType, + arrivalType: arrivalType, + from: from, + to: to, + nameLine1: cardsList[index].nameLine1, + nameLine2: cardsList[index].nameLine2, + route: cardsList[index].route, + icon: cardsList[index].icon, + isInPatient: cardsList[index].isInPatient, + isDischargedPatient: cardsList[index].isDischargedPatient, + isDisable: cardsList[index].isDisable, + onTap: cardsList[index].onTap, + isLoading: cardsList[index].isLoading, + isFromLiveCare: isFromLiveCare), ), ), ], diff --git a/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart b/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart index 3dc919d1..209062eb 100644 --- a/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart +++ b/lib/screens/patients/profile/profile_screen/profile_gird_for_search.dart @@ -30,45 +30,87 @@ class ProfileGridForSearch extends StatelessWidget { @override Widget build(BuildContext context) { final List cardsList = [ - PatientProfileCardModel(TranslationBase.of(context).vital!, TranslationBase.of(context).signs!, VITAL_SIGN_DETAILS, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).vital!, + TranslationBase.of(context).signs!, + VITAL_SIGN_DETAILS, + 'patient/vital_signs.png', isInPatient: isInpatient), PatientProfileCardModel( - TranslationBase.of(context).lab!, TranslationBase.of(context).result!, LAB_RESULT, 'patient/lab_results.png', + TranslationBase.of(context).lab!, + TranslationBase.of(context).result!, + LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).lab!, TranslationBase.of(context).special!, - ALL_SPECIAL_LAB_RESULT, 'patient/lab_results.png', + PatientProfileCardModel( + TranslationBase.of(context).lab!, + TranslationBase.of(context).special!, + ALL_SPECIAL_LAB_RESULT, + 'patient/lab_results.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).radiology!, TranslationBase.of(context).service!, - RADIOLOGY_PATIENT, 'patient/health_summary.png', + PatientProfileCardModel( + TranslationBase.of(context).radiology!, + TranslationBase.of(context).service!, + RADIOLOGY_PATIENT, + 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).prescription!, - ORDER_PRESCRIPTION_NEW, 'patient/order_prescription.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).prescription!, + ORDER_PRESCRIPTION_NEW, + 'patient/order_prescription.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).health!, TranslationBase.of(context).summary!, HEALTH_SUMMARY, + PatientProfileCardModel( + TranslationBase.of(context).health!, + TranslationBase.of(context).summary!, + HEALTH_SUMMARY, 'patient/health_summary.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", PATIENT_ECG, 'patient/patient_sick_leave.png', + PatientProfileCardModel(TranslationBase.of(context).patient!, "ECG", + PATIENT_ECG, 'patient/patient_sick_leave.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).orders!, TranslationBase.of(context).procedures!, - ORDER_PROCEDURE, 'patient/Order_Procedures.png', + PatientProfileCardModel( + TranslationBase.of(context).orders!, + TranslationBase.of(context).procedures!, + ORDER_PROCEDURE, + 'patient/Order_Procedures.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).insurance!, TranslationBase.of(context).service!, - PATIENT_INSURANCE_APPROVALS_NEW, 'patient/vital_signs.png', + PatientProfileCardModel( + TranslationBase.of(context).insurance!, + TranslationBase.of(context).service!, + PATIENT_INSURANCE_APPROVALS_NEW, + 'patient/vital_signs.png', isInPatient: isInpatient), - PatientProfileCardModel(TranslationBase.of(context).patientSick!, TranslationBase.of(context).leave!, ADD_SICKLEAVE, 'patient/patient_sick_leave.png', + PatientProfileCardModel( + TranslationBase.of(context).patientSick!, + TranslationBase.of(context).leave!, + ADD_SICKLEAVE, + 'patient/patient_sick_leave.png', isInPatient: isInpatient), if (patient.appointmentNo != null && patient.appointmentNo != 0) - PatientProfileCardModel(TranslationBase.of(context).patient!, TranslationBase.of(context).ucaf!, - PATIENT_UCAF_REQUEST, 'patient/ucaf.png', - isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false), + PatientProfileCardModel( + TranslationBase.of(context).patient!, + TranslationBase.of(context).ucaf!, + PATIENT_UCAF_REQUEST, + 'patient/ucaf.png', + isInPatient: isInpatient, + isDisable: patient.patientStatusType != 43 ? true : false), if (patient.appointmentNo != null && patient.appointmentNo != 0) - PatientProfileCardModel(TranslationBase.of(context).referral!, TranslationBase.of(context).patient!, - REFER_PATIENT_TO_DOCTOR, 'patient/refer_patient.png', - isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false), + PatientProfileCardModel( + TranslationBase.of(context).referral!, + TranslationBase.of(context).patient!, + REFER_PATIENT_TO_DOCTOR, + 'patient/refer_patient.png', + isInPatient: isInpatient, + isDisable: patient.patientStatusType != 43 ? true : false), if (patient.appointmentNo != null && patient.appointmentNo != 0) - PatientProfileCardModel(TranslationBase.of(context).admission!, TranslationBase.of(context).request!, - PATIENT_ADMISSION_REQUEST, 'patient/admission_req.png', - isInPatient: isInpatient, isDisable: patient.patientStatusType != 43 ? true : false), + PatientProfileCardModel( + TranslationBase.of(context).admission!, + TranslationBase.of(context).request!, + PATIENT_ADMISSION_REQUEST, + 'patient/admission_req.png', + isInPatient: isInpatient, + isDisable: patient.patientStatusType != 43 ? true : false), ]; return Column( @@ -83,7 +125,8 @@ class ProfileGridForSearch extends StatelessWidget { crossAxisCount: 3, itemCount: cardsList.length, staggeredTileBuilder: (int index) => StaggeredTile.fit(1), - itemBuilder: (BuildContext context, int index) => PatientProfileButton( + itemBuilder: (BuildContext context, int index) => + PatientProfileButton( patient: patient, patientType: patientType, arrivalType: arrivalType, diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart index dab0002a..4edb8675 100644 --- a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -18,7 +18,8 @@ import 'package:flutter/material.dart'; class MyReferralDetailScreen extends StatelessWidget { final MyReferralPatientModel? referralPatient; - const MyReferralDetailScreen({Key? key, this.referralPatient}) : super(key: key); + const MyReferralDetailScreen({Key? key, this.referralPatient}) + : super(key: key); @override Widget build(BuildContext context) { @@ -53,7 +54,9 @@ class MyReferralDetailScreen extends StatelessWidget { ), Expanded( child: AppText( - (Helpers.capitalize(referralPatient!.firstName! + " " + referralPatient!.lastName!)), + (Helpers.capitalize(referralPatient!.firstName! + + " " + + referralPatient!.lastName!)), fontSize: SizeConfig.textMultiplier * 2.5, fontWeight: FontWeight.bold, fontFamily: 'Poppins', @@ -93,23 +96,32 @@ class MyReferralDetailScreen extends StatelessWidget { child: Column( children: [ Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ AppText( referralPatient!.referralStatus != null - ? model.getReferralStatusNameByCode(referralPatient!.referralStatus!, context) + ? model.getReferralStatusNameByCode( + referralPatient!.referralStatus!, + context) : "", fontFamily: 'Poppins', fontSize: 1.9 * SizeConfig.textMultiplier, fontWeight: FontWeight.w700, - color: referralPatient!.referralStatus == 1 + color: referralPatient!.referralStatus == + 1 ? Color(0xffc4aa54) - : referralPatient!.referralStatus == 46 || referralPatient!.referralStatus! == 2 + : referralPatient!.referralStatus == + 46 || + referralPatient! + .referralStatus! == + 2 ? Colors.green[700] : Colors.red[700], ), AppText( - AppDateUtils.getDayMonthYearDateFormatted(referralPatient!.referralDate!), + AppDateUtils.getDayMonthYearDateFormatted( + referralPatient!.referralDate!), fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 2.0 * SizeConfig.textMultiplier, @@ -118,29 +130,35 @@ class MyReferralDetailScreen extends StatelessWidget { ], ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).fileNumber, + TranslationBase.of(context) + .fileNumber, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: + 1.7 * SizeConfig.textMultiplier, color: Color(0XFF575757), ), AppText( "${referralPatient!.patientID}", fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: + 1.8 * SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], ), AppText( - AppDateUtils.getTimeHHMMA(referralPatient!.referralDate!), + AppDateUtils.getTimeHHMMA( + referralPatient!.referralDate!), fontFamily: 'Poppins', fontWeight: FontWeight.w600, fontSize: 1.8 * SizeConfig.textMultiplier, @@ -149,50 +167,70 @@ class MyReferralDetailScreen extends StatelessWidget { ], ), Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Column( children: [ Row( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).referredFrom, + TranslationBase.of(context) + .referredFrom, fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * + SizeConfig.textMultiplier, color: Color(0XFF575757), ), AppText( - referralPatient!.targetProjectId! == referralPatient!.sourceProjectId! - ? TranslationBase.of(context).sameBranch - : TranslationBase.of(context).otherBranch, + referralPatient! + .targetProjectId! == + referralPatient! + .sourceProjectId! + ? TranslationBase.of( + context) + .sameBranch + : TranslationBase.of( + context) + .otherBranch, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * + SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], ), Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).remarks! + " : ", + TranslationBase.of(context) + .remarks! + + " : ", fontFamily: 'Poppins', fontWeight: FontWeight.w600, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * + SizeConfig.textMultiplier, color: Color(0XFF575757), ), Expanded( child: AppText( - referralPatient!.referringDoctorRemarks ?? '', + referralPatient! + .referringDoctorRemarks ?? + '', fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.8 * SizeConfig.textMultiplier, + fontSize: 1.8 * + SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ), @@ -204,22 +242,29 @@ class MyReferralDetailScreen extends StatelessWidget { Row( children: [ AppText( - referralPatient!.nationalityName != null + referralPatient!.nationalityName != + null ? referralPatient!.nationalityName : "", fontWeight: FontWeight.bold, color: Color(0xFF2E303A), - fontSize: 1.4 * SizeConfig.textMultiplier, + fontSize: + 1.4 * SizeConfig.textMultiplier, ), - referralPatient!.nationalityFlagURL != null + referralPatient!.nationalityFlagURL != + null ? ClipRRect( - borderRadius: BorderRadius.circular(20.0), + borderRadius: + BorderRadius.circular(20.0), child: Image.network( - referralPatient!.nationalityFlagURL!, + referralPatient! + .nationalityFlagURL!, height: 25, width: 30, - errorBuilder: - (BuildContext ?context, Object ?exception, StackTrace? stackTrace) { + errorBuilder: (BuildContext? + context, + Object? exception, + StackTrace? stackTrace) { return Text('No Image'); }, )) @@ -232,7 +277,8 @@ class MyReferralDetailScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - margin: EdgeInsets.only(left: 10, right: 0), + margin: + EdgeInsets.only(left: 10, right: 0), child: Image.asset( 'assets/images/patient/ic_ref_arrow_up.png', height: 50, @@ -240,14 +286,20 @@ class MyReferralDetailScreen extends StatelessWidget { ), ), Container( - margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0), - padding: EdgeInsets.only(left: 4.0, right: 4.0), + margin: EdgeInsets.only( + left: 0, + top: 25, + right: 0, + bottom: 0), + padding: EdgeInsets.only( + left: 4.0, right: 4.0), child: Container( width: 40, height: 40, child: CircleAvatar( radius: 25.0, - backgroundImage: NetworkImage(referralPatient!.doctorImageURL!), + backgroundImage: NetworkImage( + referralPatient!.doctorImageURL!), backgroundColor: Colors.transparent, ), ), @@ -255,14 +307,19 @@ class MyReferralDetailScreen extends StatelessWidget { Expanded( flex: 4, child: Container( - margin: EdgeInsets.only(left: 10, top: 25, right: 10, bottom: 0), + margin: EdgeInsets.only( + left: 10, + top: 25, + right: 10, + bottom: 0), child: Column( children: [ AppText( referralPatient!.doctorName, fontFamily: 'Poppins', fontWeight: FontWeight.w700, - fontSize: 1.7 * SizeConfig.textMultiplier, + fontSize: 1.7 * + SizeConfig.textMultiplier, color: Color(0XFF2E303A), ), ], @@ -293,7 +350,8 @@ class MyReferralDetailScreen extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 16), child: SizedBox( child: ProfileMedicalInfoWidgetSearch( - patient: model.getPatientFromReferralO(referralPatient!), + patient: model + .getPatientFromReferralO(referralPatient!), patientType: "7", isInpatient: false, from: null, @@ -321,11 +379,14 @@ class MyReferralDetailScreen extends StatelessWidget { vPadding: 12, disabled: model.state == ViewState.Busy, onPressed: () async { - await model.responseReferral(referralPatient!, true); + await model.responseReferral( + referralPatient!, true); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgAccept); + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgAccept); model.getMyReferralOutPatientService(); Navigator.pop(context); Navigator.pop(context); @@ -346,11 +407,14 @@ class MyReferralDetailScreen extends StatelessWidget { vPadding: 12, disabled: model.state == ViewState.Busy, onPressed: () async { - await model.responseReferral(referralPatient!, false); + await model.responseReferral( + referralPatient!, false); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); } else { - DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsgReject); + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .referralSuccessMsgReject); model.getMyReferralOutPatientService(); Navigator.pop(context); Navigator.pop(context); diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index c554e563..f7f2ee31 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -99,442 +99,607 @@ class _RescheduleLeaveScreen extends State { @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); - offTime = widget.updateData != null ? widget.updateData.requisitionType.toString() : offTime; + offTime = widget.updateData != null + ? widget.updateData.requisitionType.toString() + : offTime; return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => BaseView( onModelReady: (model2) => { - model2.getOffTime(), - model2.getReasons(offTime == '1' - ? 18 - : offTime == '2' - ? 19 - : 102), - model2.getCoveringDoctors() - }, + model2.getOffTime(), + model2.getReasons(offTime == '1' + ? 18 + : offTime == '2' + ? 19 + : 102), + model2.getCoveringDoctors() + }, builder: (_, model2, w) => GestureDetector( - onTap: () { - FocusScope.of(context).requestFocus(new FocusNode()); - }, - child: AppScaffold( - baseViewModel: model2, - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).rescheduleLeaves!, - body: Center( - child: Container( - margin: EdgeInsets.only(top: 10), - child: FractionallySizedBox( - widthFactor: 0.9, - child: ListView( - children: [ - - 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.allOffTime.length > 0 - ? Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButtonHideUnderline( - child: DropdownButton( - // focusColor: Colors.grey, - isExpanded: true, - value: offTime == null ? model2.allOffTime[0]['code'] : offTime, - iconSize: 40, - elevation: 16, - selectedItemBuilder: (BuildContext context) { - return model2.allOffTime.map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item['description'], - - fontSize: SizeConfig.textMultiplier * 2.1, - // color: - // Colors.grey, - ), - ], - ); - }).toList(); - }, - 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); - setState(() { - offTime = newValue; - }); - } - }, - items: model2.allOffTime.map((item) { - return DropdownMenuItem( - value: item['code'].toString(), - child: Text( - item['description'], - textAlign: TextAlign.end, - ), - ); - }).toList(), - )), - ) - : SizedBox(), - ], - ) - ], - ), - )), - offTime == '1' - ? Column( + onTap: () { + FocusScope.of(context).requestFocus(new FocusNode()); + }, + child: AppScaffold( + baseViewModel: model2, + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).rescheduleLeaves!, + body: Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( 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), onPressed: () { },), - textInputType: TextInputType.number, - controller: _toDateController, - onTap: () { - _presentDatePicker('fromDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (val) => fromDate = val, - onSaved: (val) => fromDate = val, - ) - ], - )), - 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: [ - DateTimePicker( - timeHintText: TranslationBase.of(context).fromTime, - type: DateTimePickerType.time, - controller: _controller4, - onChanged: (val) => fromTime = val, - validator: (val) { - print(val); - // setState( - // () => _valueToValidate4 = val); - return null; - }, - onSaved: (val) => fromTime = val!, - ) - ], - ), + 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.allOffTime.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: + DropdownButton( + // focusColor: Colors.grey, + isExpanded: true, + value: offTime == null + ? model2.allOffTime[0] + ['code'] + : offTime, + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model2.allOffTime + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + item[ + 'description'], + + fontSize: SizeConfig + .textMultiplier * + 2.1, + // color: + // Colors.grey, + ), + ], + ); + }).toList(); + }, + 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); + setState(() { + offTime = newValue; + }); + } + }, + items: model2.allOffTime + .map((item) { + return DropdownMenuItem< + String>( + value: item['code'] + .toString(), + child: Text( + item['description'], + textAlign: + TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], ), - ), - 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( - timeHintText: TranslationBase.of(context).toTime, - type: DateTimePickerType.time, - controller: _controller5, - onChanged: (val) => toTime = val, - validator: (val) { - print(val); - // setState( - // () => _valueToValidate4 = val); - return null; - }, - onSaved: (val) => toTime = val!, - ) - ], - ), + )), + 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), + onPressed: () {}, + ), + textInputType: + TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (val) => + fromDate = val, + onSaved: (val) => + fromDate = val, + ) + ], + )), + 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: [ + DateTimePicker( + timeHintText: + TranslationBase.of( + context) + .fromTime, + type: DateTimePickerType + .time, + controller: _controller4, + onChanged: (val) => + fromTime = val, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => + fromTime = 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( + timeHintText: + TranslationBase.of( + context) + .toTime, + type: DateTimePickerType + .time, + controller: _controller5, + onChanged: (val) => + toTime = val, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => + toTime = 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), + onPressed: () {}, + ), + textInputType: + TextInputType.number, + readOnly: true, + controller: + _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + fromDate = 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) + .toDate, + readOnly: true, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + Icons.calendar_today), + onPressed: () {}, + ), + textInputType: + TextInputType.number, + controller: + _toDateController2, + onTap: () { + _presentDatePicker( + 'toDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + toDate = value; + }); + }), + ], + )) + ], ), - ) - ], - ) - ], - ) - : 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), onPressed: () { },), - textInputType: TextInputType.number, - readOnly: true, - controller: _toDateController, - onTap: () { - _presentDatePicker('fromDate'); - }, - inputFormatter: ONLY_DATE, - onChanged: (value) { - setState(() { - fromDate = value; - }); - }), - ], + 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) => { + setState(() { + reason = 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"))), - padding: EdgeInsets.all(5), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppTextFormField( - hintText: TranslationBase.of(context).toDate, - readOnly: true, - borderColor: Colors.white, - prefix: IconButton(icon: Icon(Icons.calendar_today), onPressed: () { },), - textInputType: TextInputType.number, - controller: _toDateController2, - onTap: () { - _presentDatePicker('toDate'); - }, - 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"))), - 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, + 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: [ + if (model2.coveringDoctors.length > + 0) + Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownSearch( + mode: Mode.BOTTOM_SHEET, + + dropdownSearchDecoration: + InputDecoration( + contentPadding: + EdgeInsets.all(0), + border: + InputBorder.none), + //maxHeight: 300, + items: model2.coveringDoctors + .map((item) { + return projectsProvider + .isArabic + ? item['doctorNameN'] + : item['doctorName']; + }).toList(), + // label: "Doctor List", + onChanged: (item) { + model2.coveringDoctors + .forEach((newVal) => { + if (newVal[ + 'doctorName'] == + item) + doctorID = newVal[ + 'DoctorID'] + }); + }, + selectedItem: + getSelectedDoctor(model2), + showSearchBox: true, + searchBoxDecoration: + InputDecoration( + border: + OutlineInputBorder(), + contentPadding: + EdgeInsets.fromLTRB( + 12, 12, 8, 0), + labelText: "Search Doctor", + ), + popupTitle: Container( + height: 50, + decoration: BoxDecoration( + color: Theme.of(context) + .primaryColorDark, + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular(20), + topRight: + Radius.circular(20), + ), + ), + child: Center( + child: Text( + '', + style: TextStyle( + fontSize: 24, + fontWeight: + FontWeight.bold, + color: Colors.white, ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - reason = newValue; - }) - }, - items: model2.allReasons.map((item) { - return DropdownMenuItem( - value: item['id'].toString(), - child: Text( - projectsProvider.isArabic ? item['nameAr'] : item['nameEn'], - textAlign: TextAlign.end, + ), + ), + ), + popupShape: + RoundedRectangleBorder( + borderRadius: + BorderRadius.only( + topLeft: + Radius.circular(24), + topRight: + Radius.circular(24), ), - ); - }).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: [ - if (model2.coveringDoctors.length > 0) Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownSearch( - mode: Mode.BOTTOM_SHEET, - - dropdownSearchDecoration: InputDecoration( - contentPadding: EdgeInsets.all(0), border: InputBorder.none), - //maxHeight: 300, - items: model2.coveringDoctors.map((item) { - return projectsProvider.isArabic - ? item['doctorNameN'] - : item['doctorName']; - }).toList(), - // label: "Doctor List", - onChanged: (item) { - model2.coveringDoctors.forEach((newVal) => { - if (newVal['doctorName'] == item) - doctorID = newVal['DoctorID'] - }); - }, - selectedItem: getSelectedDoctor(model2), - showSearchBox: true, - searchBoxDecoration: InputDecoration( - border: OutlineInputBorder(), - contentPadding: EdgeInsets.fromLTRB(12, 12, 8, 0), - labelText: "Search Doctor", - ), - popupTitle: Container( - height: 50, - decoration: BoxDecoration( - color: Theme.of(context).primaryColorDark, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(20), - topRight: Radius.circular(20), - ), - ), - child: Center( - child: Text( - '', - style: TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - color: Colors.white, ), ), - ), - ), - popupShape: RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(24), - topRight: Radius.circular(24), - ), - ), - ), - ) else SizedBox(), + ) + else + SizedBox(), + ], + ) ], - ) + ), + )), + SizedBox(height: SizeConfig.screenHeight * .3), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.isUpdate == true + ? TranslationBase.of(context) + .updateReschedule + : TranslationBase.of(context) + .addReschedule, + color: HexColor('#359846'), + onPressed: () { + if (offTime == '1' || offTime == '2') { + if (widget.isUpdate == true) { + updateRecheduleLeave(model2); + } else { + addRecheduleLeave(model2); + } + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .onlyOfftimeHoliday); + } + }, + ), ], ), - )), - SizedBox(height: SizeConfig.screenHeight * .3), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: widget.isUpdate == true - ? TranslationBase.of(context).updateReschedule - : TranslationBase.of(context).addReschedule, - color: HexColor('#359846'), - onPressed: () { - if (offTime == '1' || offTime == '2') { - if (widget.isUpdate == true) { - updateRecheduleLeave(model2); - } else { - addRecheduleLeave(model2); - } - } else { - DrAppToastMsg.showErrorToast(TranslationBase.of(context).onlyOfftimeHoliday); - } - }, - ), - ], - ), + ), + // Column( + // children: [ + // AppText(TranslationBase.of(context) + // .previousSickLeaveIssue + + // ' ') + // ], + // ) + ], ), - // Column( - // children: [ - // AppText(TranslationBase.of(context) - // .previousSickLeaveIssue + - // ' ') - // ], - // ) - ], + ), ), ), ), - ), - ), - ))); + ))); } getProfile() async { @@ -547,13 +712,16 @@ class _RescheduleLeaveScreen extends State { final df = new DateFormat('HH:mm:ss'); final dateFormat = new DateFormat('yyyy-MM-dd'); this.offTime = widget.updateData.requisitionType.toString(); - _toDateController.text = dateFormat.format(DateTime.parse(widget.updateData.dateTimeFrom)); + _toDateController.text = + dateFormat.format(DateTime.parse(widget.updateData.dateTimeFrom)); //df.format(DateTime.parse(widget.updateData.dateTimeFrom)); - this.fromTime = df.format(DateTime.parse(widget.updateData.dateTimeFrom)); + this.fromTime = + df.format(DateTime.parse(widget.updateData.dateTimeFrom)); this.fromTime = this.fromTime.substring(0, this.fromTime.length - 3); this.toTime = df.format(DateTime.parse(widget.updateData.dateTimeTo)); this.toTime = this.toTime.substring(0, this.toTime.length - 3); - _toDateController2.text = dateFormat.format(DateTime.parse(widget.updateData.dateTimeTo)); + _toDateController2.text = + dateFormat.format(DateTime.parse(widget.updateData.dateTimeTo)); _controller5.text = toTime; _controller4.text = fromTime; toDate = _toDateController2.text; @@ -566,7 +734,8 @@ class _RescheduleLeaveScreen extends State { getClinicName(model) { var clinicID = this.profile['ClinicID'] ?? 1; - var clinicInfo = model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList(); + var clinicInfo = + model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList(); return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; } @@ -576,10 +745,16 @@ class _RescheduleLeaveScreen extends State { var fromDates = fromDate; var toDates = toDate; if (offTime == '1') { - fromDate = df.format( - DateTime.parse(dateFormat.format(fromDates) + 'T' + fromTime + ':' + DateTime.now().second.toString())); - toDate = df - .format(DateTime.parse(dateFormat.format(fromDates) + 'T' + toTime + ':' + DateTime.now().second.toString())); + fromDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + fromTime + + ':' + + DateTime.now().second.toString())); + toDate = df.format(DateTime.parse(dateFormat.format(fromDates) + + 'T' + + toTime + + ':' + + DateTime.now().second.toString())); } else { fromDate = df.format(fromDates); toDate = df.format(toDates); @@ -594,7 +769,8 @@ class _RescheduleLeaveScreen extends State { "dateTimeTo": toDate, "date": offTime == '1' ? fromDate : df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, - "coveringDoctorId": doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, "status": 2, "schedule": [ { @@ -617,9 +793,10 @@ class _RescheduleLeaveScreen extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => AddRescheduleLeavScreen(), settings: RouteSettings(name: 'AddRescheduleLeaveScreen') - // MyReferredPatient(), - ), + builder: (context) => AddRescheduleLeavScreen(), + settings: RouteSettings(name: 'AddRescheduleLeaveScreen') + // MyReferredPatient(), + ), ); } }); @@ -632,13 +809,21 @@ class _RescheduleLeaveScreen extends State { dynamic fromDates = fromDate; dynamic toDates = toDate; if (offTime == '1') { - fromDate = - df.format(DateTime.parse(_toDateController.text)) + 'T' + fromTime + ':' + DateTime.now().second.toString(); - toDate = - df.format(DateTime.parse(_toDateController2.text)) + 'T' + toTime + ':' + DateTime.now().second.toString(); + fromDate = df.format(DateTime.parse(_toDateController.text)) + + 'T' + + fromTime + + ':' + + DateTime.now().second.toString(); + toDate = df.format(DateTime.parse(_toDateController2.text)) + + 'T' + + toTime + + ':' + + DateTime.now().second.toString(); } else { - fromDate = df.format(fromDates is DateTime ? fromDates : DateTime.parse(fromDates)); - toDate = df.format(toDates is DateTime ? toDates : DateTime.parse(toDates)); + fromDate = df.format( + fromDates is DateTime ? fromDates : DateTime.parse(fromDates)); + toDate = + df.format(toDates is DateTime ? toDates : DateTime.parse(toDates)); } Map request = { @@ -651,7 +836,8 @@ class _RescheduleLeaveScreen extends State { "dateTimeTo": toDate, "date": offTime == '1' ? fromDate : df.format(DateTime.now()), "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, - "coveringDoctorId": doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, "status": 2, "schedule": [ { @@ -689,8 +875,9 @@ class _RescheduleLeaveScreen extends State { : model2.coveringDoctors[0]['doctorName']; else { model2.coveringDoctors.forEach((newVal) => { - if (newVal['doctorID'].toString() == doctorID) {doctorName = newVal['doctorName']} - }); + if (newVal['doctorID'].toString() == doctorID) + {doctorName = newVal['doctorName']} + }); return doctorName; } } diff --git a/pubspec.lock b/pubspec.lock index 972d2116..764ad2dd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -35,7 +35,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" autocomplete_textfield: dependency: "direct main" description: @@ -154,7 +154,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -769,7 +769,7 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: @@ -1173,7 +1173,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.3" timing: dependency: transitive description: @@ -1257,7 +1257,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" video_player: dependency: transitive description: