diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 28b7a873..ab92ff16 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -1644,6 +1644,7 @@ "addDoctors": "إضافة الأطباء", "favouriteList": "قائمة المفضلة", "later": "لاحقاً", - "cancelAppointmentConfirmMessage": "هل أنت متأكد من رغبتك في إلغاء هذا الموعد؟" + "cancelAppointmentConfirmMessage": "هل أنت متأكد من رغبتك في إلغاء هذا الموعد؟", + "acknowledged": "معترف به" } diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 50e635ba..53688f84 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -1636,5 +1636,6 @@ "addDoctors": "Add Doctors", "favouriteList": "Favourite List", "later": "Later", - "cancelAppointmentConfirmMessage": "Are you sure you want to cancel this appointment?" + "cancelAppointmentConfirmMessage": "Are you sure you want to cancel this appointment?", + "acknowledged": "Acknowledged" } diff --git a/lib/features/book_appointments/book_appointments_view_model.dart b/lib/features/book_appointments/book_appointments_view_model.dart index 907fc35c..59ceddde 100644 --- a/lib/features/book_appointments/book_appointments_view_model.dart +++ b/lib/features/book_appointments/book_appointments_view_model.dart @@ -139,6 +139,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { bool applyFilters = false; bool isWaitingAppointmentAvailable = false; + bool isPatientRescheduleAppointment = false; bool isWaitingAppointmentSelected = false; int waitingAppointmentProjectID = 0; @@ -289,6 +290,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { isContinueDentalPlan = false; isChiefComplaintsListLoading = true; isWaitingAppointmentSelected = false; + isPatientRescheduleAppointment = false; bodyTypes = [maleLaserCategory, femaleLaserCategory]; // getLocation(); notifyListeners(); @@ -427,6 +429,11 @@ class BookAppointmentsViewModel extends ChangeNotifier { notifyListeners(); } + setIsPatientRescheduleAppointment(bool isPatientRescheduleAppointment) { + this.isPatientRescheduleAppointment = isPatientRescheduleAppointment; + notifyListeners(); + } + void onTabChanged(int index) { calculationID = null; isGetDocForHealthCal = false; @@ -854,64 +861,103 @@ class BookAppointmentsViewModel extends ChangeNotifier { print(failure); onError!(failure.message); }, - (apiResponse) { + (apiResponse) async { if (apiResponse.messageStatus == 2) { // onError!(apiResponse); - LoadingUtils.hideFullScreenLoader(); - showCommonBottomSheetWithoutHeight( - title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), - navigationService.navigatorKey.currentContext!, - child: Utils.getWarningWidget( - loadingText: apiResponse.data["ErrorEndUserMessage"], - isShowActionButtons: true, - onCancelTap: () { - navigationService.pop(); - }, - onConfirmTap: () async { - navigationService.pop(); - PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel = PatientAppointmentHistoryResponseModel( - appointmentNo: apiResponse.data["SameClinicApptList"][0]['AppointmentNo'], - clinicID: apiResponse.data["SameClinicApptList"][0]['ClinicID'], - projectID: apiResponse.data["SameClinicApptList"][0]['ProjectID'], - endDate: apiResponse.data["SameClinicApptList"][0]['EndTime'], - startTime: apiResponse.data["SameClinicApptList"][0]['StartTime'], - doctorID: apiResponse.data["SameClinicApptList"][0]['DoctorID'], - isLiveCareAppointment: apiResponse.data["SameClinicApptList"][0]['IsLiveCareAppointment'], - originalClinicID: 0, - originalProjectID: 0, - appointmentDate: apiResponse.data["SameClinicApptList"][0]['AppointmentDate'], - ); + if (isPatientRescheduleAppointment) { + PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel = PatientAppointmentHistoryResponseModel( + appointmentNo: apiResponse.data["SameClinicApptList"][0]['AppointmentNo'], + clinicID: apiResponse.data["SameClinicApptList"][0]['ClinicID'], + projectID: apiResponse.data["SameClinicApptList"][0]['ProjectID'], + endDate: apiResponse.data["SameClinicApptList"][0]['EndTime'], + startTime: apiResponse.data["SameClinicApptList"][0]['StartTime'], + doctorID: apiResponse.data["SameClinicApptList"][0]['DoctorID'], + isLiveCareAppointment: apiResponse.data["SameClinicApptList"][0]['IsLiveCareAppointment'], + originalClinicID: 0, + originalProjectID: 0, + appointmentDate: apiResponse.data["SameClinicApptList"][0]['AppointmentDate'], + ); - LoaderBottomSheet.showLoader( - loadingText: LocaleKeys.reschedulingAppo.tr(context: navigationService.navigatorKey.currentContext!), - ); - await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async { - LoaderBottomSheet.hideLoader(); - Future.delayed(Duration(milliseconds: 50)).then((value) async {}); - LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: LocaleKeys.bookingYourAppointment.tr()); - await insertSpecificAppointment( - onError: (err) {}, - onSuccess: (apiResp) async { - LoadingUtils.hideFullScreenLoader(); - await Future.delayed(Duration(milliseconds: 50)).then((value) async { - LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr()); - await Future.delayed(Duration(milliseconds: 4000)).then((value) { - LoadingUtils.hideFullScreenLoader(); - Navigator.pushAndRemoveUntil( - navigationService.navigatorKey.currentContext!, - CustomPageRoute( - page: LandingNavigation(), - ), - (r) => false); + await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async { + LoaderBottomSheet.hideLoader(); + Future.delayed(Duration(milliseconds: 50)).then((value) async {}); + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: LocaleKeys.bookingYourAppointment.tr()); + await insertSpecificAppointment( + onError: (err) {}, + onSuccess: (apiResp) async { + LoadingUtils.hideFullScreenLoader(); + await Future.delayed(Duration(milliseconds: 50)).then((value) async { + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr()); + await Future.delayed(Duration(milliseconds: 4000)).then((value) { + setIsPatientRescheduleAppointment(false); + LoadingUtils.hideFullScreenLoader(); + Navigator.pushAndRemoveUntil( + navigationService.navigatorKey.currentContext!, + CustomPageRoute( + page: LandingNavigation(), + ), + (r) => false); + }); + }); + }); + }); + } else { + LoadingUtils.hideFullScreenLoader(); + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), + navigationService.navigatorKey.currentContext!, + child: Utils.getWarningWidget( + loadingText: apiResponse.data["ErrorEndUserMessage"], + isShowActionButtons: true, + onCancelTap: () { + navigationService.pop(); + }, + onConfirmTap: () async { + navigationService.pop(); + PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel = PatientAppointmentHistoryResponseModel( + appointmentNo: apiResponse.data["SameClinicApptList"][0]['AppointmentNo'], + clinicID: apiResponse.data["SameClinicApptList"][0]['ClinicID'], + projectID: apiResponse.data["SameClinicApptList"][0]['ProjectID'], + endDate: apiResponse.data["SameClinicApptList"][0]['EndTime'], + startTime: apiResponse.data["SameClinicApptList"][0]['StartTime'], + doctorID: apiResponse.data["SameClinicApptList"][0]['DoctorID'], + isLiveCareAppointment: apiResponse.data["SameClinicApptList"][0]['IsLiveCareAppointment'], + originalClinicID: 0, + originalProjectID: 0, + appointmentDate: apiResponse.data["SameClinicApptList"][0]['AppointmentDate'], + ); + + LoaderBottomSheet.showLoader( + loadingText: LocaleKeys.reschedulingAppo.tr(context: navigationService.navigatorKey.currentContext!), + ); + await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async { + LoaderBottomSheet.hideLoader(); + Future.delayed(Duration(milliseconds: 50)).then((value) async {}); + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: LocaleKeys.bookingYourAppointment.tr()); + await insertSpecificAppointment( + onError: (err) {}, + onSuccess: (apiResp) async { + LoadingUtils.hideFullScreenLoader(); + await Future.delayed(Duration(milliseconds: 50)).then((value) async { + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr()); + await Future.delayed(Duration(milliseconds: 4000)).then((value) { + LoadingUtils.hideFullScreenLoader(); + Navigator.pushAndRemoveUntil( + navigationService.navigatorKey.currentContext!, + CustomPageRoute( + page: LandingNavigation(), + ), + (r) => false); + }); }); }); - }); - }); - }), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); + }); + }), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } } else if (apiResponse.messageStatus == 1) { if (apiResponse.data == null || apiResponse.data!.isEmpty) { onError!("No free slots available".tr()); diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 94d7a20f..35b5a1c9 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1637,5 +1637,6 @@ abstract class LocaleKeys { static const favouriteList = 'favouriteList'; static const later = 'later'; static const cancelAppointmentConfirmMessage = 'cancelAppointmentConfirmMessage'; + static const acknowledged = 'acknowledged'; } diff --git a/lib/presentation/appointments/appointment_details_page.dart b/lib/presentation/appointments/appointment_details_page.dart index 1930f5fe..43a74422 100644 --- a/lib/presentation/appointments/appointment_details_page.dart +++ b/lib/presentation/appointments/appointment_details_page.dart @@ -36,6 +36,7 @@ import 'package:hmg_patient_app_new/presentation/ask_doctor/ask_doctor_page.dart import 'package:hmg_patient_app_new/presentation/ask_doctor/doctor_response_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart'; import 'package:hmg_patient_app_new/presentation/contact_us/feedback_page.dart'; +import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_detail_page.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -244,16 +245,22 @@ class _AppointmentDetailsPageState extends State { LoaderBottomSheet.hideLoader(); myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true); myAppointmentsViewModel.initAppointmentsViewModel(); - myAppointmentsViewModel.getPatientAppointments(true, false); + // myAppointmentsViewModel.getPatientAppointments(true, false); showCommonBottomSheetWithoutHeight( title: "", context, child: Utils.getSuccessWidget(loadingText: LocaleKeys.appointmentConfirmedSuccessfully.tr(context: context)), callBackFunc: () { - Navigator.of(context).pop(); + Navigator.pushAndRemoveUntil( + context, + CustomPageRoute( + page: LandingNavigation(), + ), + (r) => false); }, isFullScreen: false, - isCloseButtonVisible: true, + isCloseButtonVisible: false, + isAutoDismiss: true ); }); }, @@ -1008,6 +1015,7 @@ class _AppointmentDetailsPageState extends State { projectName: widget.patientAppointmentHistoryResponseModel.projectName, ); bookAppointmentsViewModel.setSelectedDoctor(doctor); + bookAppointmentsViewModel.setIsPatientRescheduleAppointment(true); LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingDoctorSchedulePleaseWait.tr(context: context)); await bookAppointmentsViewModel.getDoctorFreeSlots( isBookingForLiveCare: false, @@ -1061,7 +1069,8 @@ class _AppointmentDetailsPageState extends State { label: LocaleKeys.notice.tr(), onOkPressed: () {}, okLabel: "confirm", - cancelLabel: LocaleKeys.confirm.tr(context: context), + cancelLabel: LocaleKeys.acknowledged.tr(context: context), + isConfirmButton: true, ); case 20: myAppointmentsViewModel.setIsPatientAppointmentShareLoading(true); diff --git a/lib/presentation/book_appointment/review_appointment_page.dart b/lib/presentation/book_appointment/review_appointment_page.dart index 5609eaf2..eb39b5d4 100644 --- a/lib/presentation/book_appointment/review_appointment_page.dart +++ b/lib/presentation/book_appointment/review_appointment_page.dart @@ -316,7 +316,7 @@ class _ReviewAppointmentPageState extends State { } void initiateBookAppointment() async { - LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: LocaleKeys.bookingYourAppointment.tr(context: context)); + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: bookAppointmentsViewModel.isPatientRescheduleAppointment ? LocaleKeys.reschedulingAppo.tr(context: context) : LocaleKeys.bookingYourAppointment.tr(context: context)); myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true); if (bookAppointmentsViewModel.isLiveCareSchedule) { diff --git a/lib/presentation/book_appointment/select_doctor_page.dart b/lib/presentation/book_appointment/select_doctor_page.dart index 5044adb1..7947fa05 100644 --- a/lib/presentation/book_appointment/select_doctor_page.dart +++ b/lib/presentation/book_appointment/select_doctor_page.dart @@ -220,7 +220,7 @@ class _SelectDoctorPageState extends State { ], ).paddingSymmetrical(0.h, 0.h), if (bookAppointmentsViewModel.isGetDocForHealthCal && bookAppointmentsVM.showSortFilterButtons) SizedBox(height: 16.h), - bookAppointmentsVM.selectedClinic.clinicID != 17 ? Row( + Row( mainAxisSize: MainAxisSize.max, children: [ Column( @@ -241,7 +241,7 @@ class _SelectDoctorPageState extends State { }, ), ], - ) : SizedBox.shrink(), + ), ListView.separated( padding: EdgeInsets.only(top: 16.h), shrinkWrap: true, diff --git a/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart b/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart index 840d38cf..8dcf6183 100644 --- a/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart +++ b/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart @@ -385,7 +385,7 @@ class _CmcSelectionReviewPageState extends State { isCloseButtonVisible: false, isDismissible: false, isFullScreen: false, - ); + isAutoDismiss: true); } void _handleConfirm() { diff --git a/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart b/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart index 9efcb01b..066e90cf 100644 --- a/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart +++ b/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart @@ -320,6 +320,7 @@ class _WalletPaymentConfirmPageState extends State { }, isFullScreen: false, isCloseButtonVisible: true, + isAutoDismiss: true ); }, onError: (err) { diff --git a/lib/presentation/insurance/widgets/insurance_update_details_card.dart b/lib/presentation/insurance/widgets/insurance_update_details_card.dart index 770f4da2..e7cfe059 100644 --- a/lib/presentation/insurance/widgets/insurance_update_details_card.dart +++ b/lib/presentation/insurance/widgets/insurance_update_details_card.dart @@ -130,6 +130,7 @@ class PatientInsuranceCardUpdateCard extends StatelessWidget { }, isFullScreen: false, isCloseButtonVisible: false, + isAutoDismiss: true ); // Future.delayed(Duration(milliseconds: 2000)).then((value) async { // Navigator.pop(context); diff --git a/lib/presentation/medical_report/medical_reports_page.dart b/lib/presentation/medical_report/medical_reports_page.dart index fd3ba7f9..9dccdf79 100644 --- a/lib/presentation/medical_report/medical_reports_page.dart +++ b/lib/presentation/medical_report/medical_reports_page.dart @@ -419,6 +419,7 @@ class _MedicalReportsPageState extends State { callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, + isAutoDismiss: true ); } } diff --git a/lib/presentation/my_invoices/my_invoices_details_page.dart b/lib/presentation/my_invoices/my_invoices_details_page.dart index 0410d311..83cb885f 100644 --- a/lib/presentation/my_invoices/my_invoices_details_page.dart +++ b/lib/presentation/my_invoices/my_invoices_details_page.dart @@ -56,6 +56,7 @@ class _MyInvoicesDetailsPageState extends State { callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, + isAutoDismiss: true ); }, onError: (err) { diff --git a/lib/presentation/prescriptions/prescription_delivery_order_summary_page.dart b/lib/presentation/prescriptions/prescription_delivery_order_summary_page.dart index d6a616ee..070132ad 100644 --- a/lib/presentation/prescriptions/prescription_delivery_order_summary_page.dart +++ b/lib/presentation/prescriptions/prescription_delivery_order_summary_page.dart @@ -135,6 +135,7 @@ class PrescriptionDeliveryOrderSummaryPage extends StatelessWidget { isCloseButtonVisible: true, isDismissible: false, isFullScreen: false, + isAutoDismiss: true ); }, onError: (err) { diff --git a/lib/presentation/profile_settings/widgets/preferred_language_widget.dart b/lib/presentation/profile_settings/widgets/preferred_language_widget.dart index dcd30360..9678349b 100644 --- a/lib/presentation/profile_settings/widgets/preferred_language_widget.dart +++ b/lib/presentation/profile_settings/widgets/preferred_language_widget.dart @@ -72,7 +72,7 @@ class _PreferredLanguageWidgetState extends State { callBackFunc: () async { Navigator.of(context).pop(); profileSettingsViewModel.getProfileSettings(); - }, isFullScreen: false); + }, isFullScreen: false, isAutoDismiss: true); }, onError: (error) { LoaderBottomSheet.hideLoader(); diff --git a/lib/presentation/profile_settings/widgets/update_email_widget.dart b/lib/presentation/profile_settings/widgets/update_email_widget.dart index cb844bcb..0b27dc82 100644 --- a/lib/presentation/profile_settings/widgets/update_email_widget.dart +++ b/lib/presentation/profile_settings/widgets/update_email_widget.dart @@ -96,7 +96,7 @@ class _UpdateEmailDialogState extends State { callBackFunc: () async { Navigator.of(context).pop(); profileSettingsViewModel!.getProfileSettings(); - }, isFullScreen: false); + }, isFullScreen: false, isAutoDismiss: true); }, onError: (error) { LoaderBottomSheet.hideLoader(); diff --git a/lib/presentation/profile_settings/widgets/update_emergency_contact_widget.dart b/lib/presentation/profile_settings/widgets/update_emergency_contact_widget.dart index f725bba1..71505dff 100644 --- a/lib/presentation/profile_settings/widgets/update_emergency_contact_widget.dart +++ b/lib/presentation/profile_settings/widgets/update_emergency_contact_widget.dart @@ -96,7 +96,7 @@ class _UpdateEmergencyContactDialogState extends State { child: Utils.getSuccessWidget(loadingText: "${LocaleKeys.paymentCompletedSuccessfully.tr(context: context)}, ${LocaleKeys.hereIsYourInvoiceNumber.tr(context: context)}$invoiceNo"), isCloseButtonVisible: true, isDismissible: true, - isFullScreen: false, callBackFunc: () { + isFullScreen: false, isAutoDismiss: true, callBackFunc: () { // Pop until we reach the LandingPage todoSectionViewModel.setIsAncillaryOrdersNeedReloading(true); Navigator.pushAndRemoveUntil( diff --git a/lib/services/dialog_service.dart b/lib/services/dialog_service.dart index d2ba2723..b3ccbf51 100644 --- a/lib/services/dialog_service.dart +++ b/lib/services/dialog_service.dart @@ -23,7 +23,7 @@ abstract class DialogService { Future showExceptionBottomSheet({required String message, required Function() onOkPressed, Function()? onCancelPressed}); - Future showCommonBottomSheetWithoutH({String? label, required String message, String? okLabel, String? cancelLabel, required Function() onOkPressed, Function()? onCancelPressed}); + Future showCommonBottomSheetWithoutH({String? label, required String message, String? okLabel, String? cancelLabel, bool isConfirmButton = false, required Function() onOkPressed, Function()? onCancelPressed}); Future showSuccessBottomSheetWithoutH({String? label, required String message, required Function() onOkPressed, Function()? onCancelPressed}); @@ -119,7 +119,7 @@ class DialogServiceImp implements DialogService { } @override - Future showCommonBottomSheetWithoutH({String? label, required String message, String? okLabel, String? cancelLabel, required Function() onOkPressed, Function()? onCancelPressed}) async { + Future showCommonBottomSheetWithoutH({String? label, required String message, String? okLabel, String? cancelLabel, bool isConfirmButton = false, required Function() onOkPressed, Function()? onCancelPressed}) async { final context = navigationService.navigatorKey.currentContext; if (context == null) return; showCommonBottomSheetWithoutHeight( @@ -239,7 +239,7 @@ class DialogServiceImp implements DialogService { } } -Widget exceptionBottomSheetWidget({required BuildContext context, required String message, String? okLabel, String? cancelLabel, required Function() onOkPressed, Function()? onCancelPressed}) { +Widget exceptionBottomSheetWidget({required BuildContext context, required String message, String? okLabel, String? cancelLabel, bool isConfirmButton = false, required Function() onOkPressed, Function()? onCancelPressed}) { return Column( children: [ (message).toText16(isBold: false, color: AppColors.textColor), @@ -266,8 +266,8 @@ Widget exceptionBottomSheetWidget({required BuildContext context, required Strin child: CustomButton( text: okLabel ?? LocaleKeys.confirm.tr(context: context), onPressed: onOkPressed, - backgroundColor: AppColors.bgGreenColor, - borderColor: AppColors.bgGreenColor, + backgroundColor: isConfirmButton ? AppColors.successColor : AppColors.bgGreenColor, + borderColor: AppColors.successColor, textColor: Colors.white, icon: AppAssets.confirm, ), diff --git a/lib/widgets/common_bottom_sheet.dart b/lib/widgets/common_bottom_sheet.dart index 9129962c..9b5fa025 100644 --- a/lib/widgets/common_bottom_sheet.dart +++ b/lib/widgets/common_bottom_sheet.dart @@ -220,6 +220,7 @@ void showCommonBottomSheetWithoutHeight( required Widget child, VoidCallback? callBackFunc, String title = "", + bool isConfirmButton = false, bool isCloseButtonVisible = true, bool isFullScreen = true, bool isDismissible = true,