diff --git a/lib/features/book_appointments/book_appointments_view_model.dart b/lib/features/book_appointments/book_appointments_view_model.dart index 9ed93c0a..8ec370a4 100644 --- a/lib/features/book_appointments/book_appointments_view_model.dart +++ b/lib/features/book_appointments/book_appointments_view_model.dart @@ -404,6 +404,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { isWaitingAppointmentSelected = false; isPatientRescheduleAppointment = false; bodyTypes = [maleLaserCategory, femaleLaserCategory]; + selectedChiefComplaintID = 0; // getLocation(); notifyListeners(); } diff --git a/lib/presentation/book_appointment/review_appointment_page.dart b/lib/presentation/book_appointment/review_appointment_page.dart index b7fb6469..a7e01e4b 100644 --- a/lib/presentation/book_appointment/review_appointment_page.dart +++ b/lib/presentation/book_appointment/review_appointment_page.dart @@ -424,6 +424,7 @@ class _ReviewAppointmentPageState extends State { void initiateBookAppointment() async { // LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: bookAppointmentsViewModel.isPatientRescheduleAppointment ? LocaleKeys.reschedulingAppo.tr(context: context) : LocaleKeys.bookingYourAppointment.tr(context: context)); + Clarity.sendCustomEvent('Appointment_book_success'); LoaderBottomSheet.showLoader( loadingText: bookAppointmentsViewModel.isPatientRescheduleAppointment ? LocaleKeys.reschedulingAppo.tr(context: context) @@ -449,6 +450,7 @@ class _ReviewAppointmentPageState extends State { callBackFunc: () { bookAppointmentsViewModel.setIsPatientRescheduleAppointment(false); bookAppointmentsViewModel.setIsLiveCareSchedule(false); + bookAppointmentsViewModel.setSelectedChiefComplaintID(0); Navigator.pushAndRemoveUntil( context, CustomPageRoute( @@ -524,6 +526,7 @@ class _ReviewAppointmentPageState extends State { child: Utils.getSuccessWidget(loadingText: LocaleKeys.appointmentSuccess.tr()).paddingSymmetrical(0.h, 24.h), callBackFunc: () { bookAppointmentsViewModel.setIsLiveCareSchedule(false); bookAppointmentsViewModel.setIsPatientRescheduleAppointment(false); + bookAppointmentsViewModel.setSelectedChiefComplaintID(0); Navigator.pushAndRemoveUntil(context, CustomPageRoute(page: LandingNavigation()), (r) => false); }, isFullScreen: false, isCloseButtonVisible: false, isAutoDismiss: true); }); diff --git a/lib/presentation/book_appointment/widgets/appointment_calendar.dart b/lib/presentation/book_appointment/widgets/appointment_calendar.dart index c84e909f..11092c79 100644 --- a/lib/presentation/book_appointment/widgets/appointment_calendar.dart +++ b/lib/presentation/book_appointment/widgets/appointment_calendar.dart @@ -14,8 +14,10 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_clinic_list_response_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/timeslots.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/book_appointment/dental_chief_complaints_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/review_appointment_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/waiting_appointment/waiting_appointment_info.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; @@ -110,102 +112,102 @@ class _AppointmentCalendarState extends State { showNavigationArrow: false, headerHeight: 60.h, headerStyle: CalendarHeaderStyle( - backgroundColor: AppColors.transparent, - // textAlign: isArabic ? TextAlign.end : TextAlign.start, - textStyle: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.primaryRedColor), - ), - viewHeaderStyle: ViewHeaderStyle( - // backgroundColor: AppColors.scaffoldBgColor, - dayTextStyle: TextStyle(fontSize: 14.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.textColor), - ), - view: CalendarView.month, - todayHighlightColor: Colors.transparent, - todayTextStyle: TextStyle(color: AppColors.textColor, fontWeight: FontWeight.bold), - selectionDecoration: ShapeDecoration( - color: AppColors.transparent, - shape: SmoothRectangleBorder( - borderRadius: BorderRadius.circular(10.r), - smoothness: 1, - side: BorderSide(color: AppColors.primaryRedColor, width: 1.5), - ), - ), - cellBorderColor: AppColors.transparent, - dataSource: MeetingDataSource(_getDataSource()), - monthCellBuilder: (context, details) => Padding( - padding: EdgeInsets.all(12.h), - child: details.date.day.toString().toText14( - isCenter: true, - color: details.date == _calendarController.selectedDate ? AppColors.primaryRedColor : AppColors.textColor, - isEnglishOnly: true, + backgroundColor: AppColors.transparent, + // textAlign: isArabic ? TextAlign.end : TextAlign.start, + textStyle: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.primaryRedColor), + ), + viewHeaderStyle: ViewHeaderStyle( + // backgroundColor: AppColors.scaffoldBgColor, + dayTextStyle: TextStyle(fontSize: 14.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.textColor), + ), + view: CalendarView.month, + todayHighlightColor: Colors.transparent, + todayTextStyle: TextStyle(color: AppColors.textColor, fontWeight: FontWeight.bold), + selectionDecoration: ShapeDecoration( + color: AppColors.transparent, + shape: SmoothRectangleBorder( + borderRadius: BorderRadius.circular(10.r), + smoothness: 1, + side: BorderSide(color: AppColors.primaryRedColor, width: 1.5), ), - ), - monthViewSettings: MonthViewSettings( - dayFormat: "EEE", - appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, - showTrailingAndLeadingDates: false, - appointmentDisplayCount: 1, - monthCellStyle: MonthCellStyle( - textStyle: TextStyle(fontSize: 19.f), + ), + cellBorderColor: AppColors.transparent, + dataSource: MeetingDataSource(_getDataSource()), + monthCellBuilder: (context, details) => Padding( + padding: EdgeInsets.all(12.h), + child: details.date.day.toString().toText14( + isCenter: true, + color: details.date == _calendarController.selectedDate ? AppColors.primaryRedColor : AppColors.textColor, + isEnglishOnly: true, + ), + ), + monthViewSettings: MonthViewSettings( + dayFormat: "EEE", + appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, + showTrailingAndLeadingDates: false, + appointmentDisplayCount: 1, + monthCellStyle: MonthCellStyle( + textStyle: TextStyle(fontSize: 19.f), + ), + ), + onTap: (CalendarTapDetails details) { + _calendarController.selectedDate = details.date; + _onDaySelected(details.date!); + }, ), ), - onTap: (CalendarTapDetails details) { - _calendarController.selectedDate = details.date; - _onDaySelected(details.date!); - }, ), ), - ), - ), - // Custom Navigation Arrows - Positioned( - top: 0, - right: isArabic ? null : 0, - left: isArabic ? 0 : null, - child: SizedBox( - height: 60.h, - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - // Previous Month Arrow - GestureDetector( - onTap: () { - setState(() { - _calendarController.backward!(); - }); - }, - child: Container( - padding: EdgeInsets.all(8.h), - child: Icon( - // isArabic ? Icons.arrow_forward_ios : Icons.arrow_back_ios, - Icons.arrow_back_ios, - size: 24.h, - color: AppColors.primaryRedColor, + // Custom Navigation Arrows + Positioned( + top: 0, + right: isArabic ? null : 0, + left: isArabic ? 0 : null, + child: SizedBox( + height: 60.h, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + // Previous Month Arrow + GestureDetector( + onTap: () { + setState(() { + _calendarController.backward!(); + }); + }, + child: Container( + padding: EdgeInsets.all(8.h), + child: Icon( + // isArabic ? Icons.arrow_forward_ios : Icons.arrow_back_ios, + Icons.arrow_back_ios, + size: 24.h, + color: AppColors.primaryRedColor, + ), + ), ), - ), - ), - // Next Month Arrow - GestureDetector( - onTap: () { - setState(() { - _calendarController.forward!(); - }); - }, - child: Container( - padding: EdgeInsets.all(8.h), - child: Icon( - // isArabic ? Icons.arrow_back_ios : Icons.arrow_forward_ios, - Icons.arrow_forward_ios, - size: 24.h, - color: AppColors.primaryRedColor, + // Next Month Arrow + GestureDetector( + onTap: () { + setState(() { + _calendarController.forward!(); + }); + }, + child: Container( + padding: EdgeInsets.all(8.h), + child: Icon( + // isArabic ? Icons.arrow_back_ios : Icons.arrow_forward_ios, + Icons.arrow_forward_ios, + size: 24.h, + color: AppColors.primaryRedColor, + ), + ), ), - ), + ], ), - ], + ), ), - ), + ], ), - ], - ), ), SizedBox(height: 10.h), Transform.translate( @@ -266,15 +268,31 @@ class _AppointmentCalendarState extends State { ), ); } else { - bookAppointmentsViewModel.getAppointmentNearestGate( - projectID: bookAppointmentsViewModel.selectedDoctor.projectID!, clinicID: bookAppointmentsViewModel.selectedDoctor.clinicID!); - bookAppointmentsViewModel.setSelectedAppointmentDateTime(selectedDate, selectedTime, selectedDateDisplay); - Navigator.of(context).pop(); - Navigator.of(context).push( - CustomPageRoute( - page: ReviewAppointmentPage(), - ), - ); + if (bookAppointmentsViewModel.selectedClinic.clinicID! == 17 && bookAppointmentsViewModel.selectedChiefComplaintID == 0) { + GetClinicsListResponseModel selectedClinic = GetClinicsListResponseModel( + clinicID: bookAppointmentsViewModel.selectedClinic.clinicID, + clinicDescription: bookAppointmentsViewModel.selectedClinic.clinicDescription, + isLiveCareClinicAndOnline: false, + liveCareServiceID: 0, + liveCareClinicID: 0); + bookAppointmentsViewModel.setProjectID(bookAppointmentsViewModel.selectedDoctor.projectID.toString()); + bookAppointmentsViewModel.setSelectedClinic(selectedClinic); + bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true); + Navigator.of(context).push( + CustomPageRoute( + page: DentalChiefComplaintsPage(), + ), + ); + } else { + bookAppointmentsViewModel.getAppointmentNearestGate(projectID: bookAppointmentsViewModel.selectedDoctor.projectID!, clinicID: bookAppointmentsViewModel.selectedDoctor.clinicID!); + bookAppointmentsViewModel.setSelectedAppointmentDateTime(selectedDate, selectedTime, selectedDateDisplay); + Navigator.of(context).pop(); + Navigator.of(context).push( + CustomPageRoute( + page: ReviewAppointmentPage(), + ), + ); + } } } else { showCommonBottomSheetWithoutHeight( @@ -284,8 +302,7 @@ class _AppointmentCalendarState extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Lottie.asset(AppAnimations.errorAnimation, - repeat: true, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill), + Lottie.asset(AppAnimations.errorAnimation, repeat: true, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill), SizedBox(height: 8.h), (LocaleKeys.loginToUseService.tr(context: context)).toText16(color: AppColors.blackColor), SizedBox(height: 16.h), @@ -384,12 +401,7 @@ class _AppointmentCalendarState extends State { selectedButtonIndex = 0; List> timeList = []; for (var i = 0; i < dayEvents.length; i++) { - Map timeSlot = { - "isoTime": dayEvents[i].isoTime, - "start": dayEvents[i].start.toString(), - "end": dayEvents[i].end.toString(), - "vidaDate": dayEvents[i].vidaDate - }; + Map timeSlot = {"isoTime": dayEvents[i].isoTime, "start": dayEvents[i].start.toString(), "end": dayEvents[i].end.toString(), "vidaDate": dayEvents[i].vidaDate}; timeList.add(timeSlot); } if (dayEvents.isNotEmpty) {