From 75685b1f614d7870bb18dc938a0cf7ca3ae1faec Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 22 Aug 2023 11:19:42 +0300 Subject: [PATCH] Project selection added in Laser & advance payment --- lib/core/service/hospital_service.dart | 3 ++- .../medical/my_balance_view_model.dart | 4 ++-- .../ancillaryOrdersDetails.dart | 11 +++++++++++ .../components/SearchByClinic.dart | 17 ++++++++++------- .../medical/balance/advance_payment_page.dart | 6 +++--- lib/pages/medical/patient_sick_leave_page.dart | 13 +++++++++---- 6 files changed, 37 insertions(+), 17 deletions(-) diff --git a/lib/core/service/hospital_service.dart b/lib/core/service/hospital_service.dart index 321d2d09..be0024ab 100644 --- a/lib/core/service/hospital_service.dart +++ b/lib/core/service/hospital_service.dart @@ -51,12 +51,13 @@ class HospitalService extends BaseService { } } - Future getHospitals({bool isResBasedOnLoc = true}) async { + Future getHospitals({bool isResBasedOnLoc = true, bool isAdvancePayment = false}) async { if (isResBasedOnLoc) await _getCurrentLocation(); Map body = Map(); body['Latitude'] = await this.sharedPref.getDouble(USER_LAT); body['Longitude'] = await this.sharedPref.getDouble(USER_LONG); body['IsOnlineCheckIn'] = isResBasedOnLoc; + body['IsAdvancePayment'] = isAdvancePayment; await baseAppClient.post(GET_PROJECT, onSuccess: (dynamic response, int statusCode) { _hospitals.clear(); diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart index e12e2b07..4166a4b3 100644 --- a/lib/core/viewModels/medical/my_balance_view_model.dart +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -70,9 +70,9 @@ class MyBalanceViewModel extends BaseViewModel { } } - Future getHospitals() async { + Future getHospitals({bool isAdvancePayment = false}) async { setState(ViewState.Busy); - await _hospitalService.getHospitals(); + await _hospitalService.getHospitals(isAdvancePayment: isAdvancePayment); if (_hospitalService.hasError) { error = _hospitalService.error; setState(ViewState.Error); diff --git a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart index 1dd34876..da5ce04a 100644 --- a/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart +++ b/lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart @@ -57,6 +57,16 @@ class _AnicllaryOrdersState extends State with SingleTic super.dispose(); } + void getAncillaryOrderDetails(AnciallryOrdersViewModel model) { + GifLoaderDialogUtils.showMyDialog(context); + model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID).then((value) { + addToSelectedProcedures(model); + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + }); + } + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); @@ -64,6 +74,7 @@ class _AnicllaryOrdersState extends State with SingleTic AppGlobal.context = context; return BaseView( onModelReady: (model) { + // getAncillaryOrderDetails(model); model.getOrdersDetails(widget.appoNo, widget.orderNo, widget.projectID).then((value) { addToSelectedProcedures(model); }); diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 891d01cb..2d5d514d 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -240,11 +240,10 @@ class _SearchByClinicState extends State { dropdownValue = clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + clincs.liveCareServiceID.toString(); if (dropdownValue == "253-false-0-0") { - Navigator.push(context, FadePage(page: LaserClinic())); + // Navigator.push(context, FadePage(page: LaserClinic())); } else if (!isDentalSelectedAndSupported()) { projectDropdownValue = ""; - if(!nearestAppo) - getDoctorsList(context); + if (!nearestAppo) getDoctorsList(context); } else {} }); projectViewModel.analytics.appointment.book_appointment_select_clinic(appointment_type: 'regular', clinic: clincs.clinicDescription); @@ -333,7 +332,11 @@ class _SearchByClinicState extends State { setState(() { selectedHospital = newValue; projectDropdownValue = newValue.mainProjectID.toString(); - getDoctorsList(context); + if (dropdownValue.split("-")[0] == "253") { + Navigator.push(context, FadePage(page: LaserClinic())); + } else { + getDoctorsList(context); + } }); }, ), @@ -458,7 +461,7 @@ class _SearchByClinicState extends State { bool isDentalSelectedAndSupported() { if (dropdownValue != null) - return dropdownValue != "" && (dropdownValue.split("-")[0] == "17") && isMobileAppDentalAllow; + return dropdownValue != "" && (dropdownValue.split("-")[0] == "17" || dropdownValue.split("-")[0] == "253") && isMobileAppDentalAllow; else return false; } @@ -531,8 +534,8 @@ class _SearchByClinicState extends State { searchInfo.clinic = selectedClinic; searchInfo.date = DateTime.now(); - if(projectViewModel.isLogin) { - if(projectViewModel.user.age > 12) { + if (projectViewModel.isLogin) { + if (projectViewModel.user.age > 12) { navigateToDentalComplaints(context, searchInfo); } else { callDoctorsSearchAPI(17); diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index b555a1bf..a07944f1 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -67,7 +67,7 @@ class _AdvancePaymentPageState extends State { projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) { - model.getHospitals(); + model.getHospitals(isAdvancePayment: true); model.getFamilyFiles(); }, builder: (_, model, w) => AppScaffold( @@ -315,7 +315,6 @@ class _AdvancePaymentPageState extends State { advanceModel.patientName = patientName; GifLoaderDialogUtils.showMyDialog(context); - model.getPatientInfoByPatientIDAndMobileNumber(advanceModel).then((value) { GifLoaderDialogUtils.hideDialog(context); if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) { @@ -327,7 +326,8 @@ class _AdvancePaymentPageState extends State { onSelectedMethod: (String metohd, [String selectedInstallmentPlan]) { setState(() {}); }, - isShowInstallments: false, isFromAdvancePayment: true), + isShowInstallments: false, + isFromAdvancePayment: true), ), ).then( (value) { diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index a82ff6b3..479b5fe6 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -131,11 +131,16 @@ class _PatientSickLeavePageState extends State { GifLoaderDialogUtils.showMyDialog(context); service.getSickLeaveStatusByAdmissionNo(model.sickLeaveList[index].projectID, model.sickLeaveList[index].admissionNo).then((res) { + print(res); GifLoaderDialogUtils.hideDialog(context); - if (res["List_GetSickLeaveStatusByAdmissionNo"].length != 0) { - admissionStatusForSickLeave = AdmissionStatusForSickLeave.fromJson(res["List_GetSickLeaveStatusByAdmissionNo"][0]); - if (admissionStatusForSickLeave.status != 6) { - AppToast.showErrorToast(message: TranslationBase.of(context).sickLeaveAdmittedPatient); + if (res != null && res["List_GetSickLeaveStatusByAdmissionNo"] != null) { + if (res["List_GetSickLeaveStatusByAdmissionNo"].length != 0) { + admissionStatusForSickLeave = AdmissionStatusForSickLeave.fromJson(res["List_GetSickLeaveStatusByAdmissionNo"][0]); + if (admissionStatusForSickLeave.status != 6) { + AppToast.showErrorToast(message: TranslationBase.of(context).sickLeaveAdmittedPatient); + } else { + openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); + } } else { openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); }