diff --git a/lib/presentation/book_appointment/search_doctor_by_name.dart b/lib/presentation/book_appointment/search_doctor_by_name.dart index 438cd746..165acfbf 100644 --- a/lib/presentation/book_appointment/search_doctor_by_name.dart +++ b/lib/presentation/book_appointment/search_doctor_by_name.dart @@ -212,6 +212,7 @@ class _SearchDoctorByNameState extends State { doctorsListResponseModel: bookAppointmentsVM.filteredDoctorList[index], isLoading: false, bookAppointmentsViewModel: bookAppointmentsViewModel, + isDoctorNameSearch: true, ).paddingSymmetrical(16.h, 0.h).onPress(() async { bookAppointmentsVM.setSelectedDoctor(bookAppointmentsVM.filteredDoctorList[index]); LoaderBottomSheet.showLoader(); diff --git a/lib/presentation/book_appointment/widgets/doctor_card.dart b/lib/presentation/book_appointment/widgets/doctor_card.dart index 7a39bc3e..fe7cf3e0 100644 --- a/lib/presentation/book_appointment/widgets/doctor_card.dart +++ b/lib/presentation/book_appointment/widgets/doctor_card.dart @@ -10,13 +10,17 @@ 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/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_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/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/laser/laser_appointment.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; +import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:lottie/lottie.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -25,11 +29,13 @@ class DoctorCard extends StatelessWidget { super.key, required this.doctorsListResponseModel, required this.isLoading, + this.isDoctorNameSearch = false, required this.bookAppointmentsViewModel, }); final DoctorsListResponseModel doctorsListResponseModel; final bool isLoading; + final bool isDoctorNameSearch; final BookAppointmentsViewModel bookAppointmentsViewModel; @@ -173,78 +179,47 @@ class DoctorCard extends StatelessWidget { CustomButton( text: LocaleKeys.bookAppo.tr(context: context), onPressed: () async { - bookAppointmentsViewModel.setSelectedDoctor(doctorsListResponseModel); - LoaderBottomSheet.showLoader(); - bookAppointmentsViewModel.isLiveCareSchedule - ? await bookAppointmentsViewModel.getLiveCareDoctorFreeSlots( - isBookingForLiveCare: true, - onSuccess: (dynamic respData) async { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - title: LocaleKeys.pickADate.tr(context: context), - context, - child: AppointmentCalendar(), - isFullScreen: false, - isCloseButtonVisible: true, - callBackFunc: () {}, - ); - }, - onError: (err) { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - context, - child: Utils.getErrorWidget(loadingText: err), - callBackFunc: () {}, - isFullScreen: false, - isCloseButtonVisible: true, - ); - }) - : await bookAppointmentsViewModel.getDoctorFreeSlots( - isBookingForLiveCare: false, - onSuccess: (dynamic respData) async { - LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight( - title: LocaleKeys.pickADate.tr(context: context), - context, - child: AppointmentCalendar(), - isFullScreen: false, - isCloseButtonVisible: true, - callBackFunc: () {}, - ); - }, - onError: (err) { - LoaderBottomSheet.hideLoader(); - if (bookAppointmentsViewModel.selectedClinic.clinicID == 23) { + if (isDoctorNameSearch && doctorsListResponseModel.clinicID == 17) { + GetClinicsListResponseModel selectedClinic = GetClinicsListResponseModel( + clinicID: doctorsListResponseModel.clinicID, clinicDescription: doctorsListResponseModel.clinicName, isLiveCareClinicAndOnline: false, liveCareServiceID: 0, liveCareClinicID: 0); + bookAppointmentsViewModel.setProjectID(doctorsListResponseModel.projectID.toString()); + bookAppointmentsViewModel.setSelectedClinic(selectedClinic); + bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true); + Navigator.of(context).push( + CustomPageRoute( + page: DentalChiefComplaintsPage(), + ), + ); + } else if (isDoctorNameSearch && doctorsListResponseModel.clinicID == 253) { + GetClinicsListResponseModel selectedClinic = GetClinicsListResponseModel( + clinicID: doctorsListResponseModel.clinicID, clinicDescription: doctorsListResponseModel.clinicName, isLiveCareClinicAndOnline: false, liveCareServiceID: 0, liveCareClinicID: 0); + bookAppointmentsViewModel.setSelectedClinic(selectedClinic); + bookAppointmentsViewModel.getLaserClinic(); + bookAppointmentsViewModel.setIsDoctorsListLoading(true); + Navigator.of(context).push( + CustomPageRoute( + page: LaserAppointment(), + ), + ); + } else { + bookAppointmentsViewModel.setSelectedDoctor(doctorsListResponseModel); + LoaderBottomSheet.showLoader(); + bookAppointmentsViewModel.isLiveCareSchedule + ? await bookAppointmentsViewModel.getLiveCareDoctorFreeSlots( + isBookingForLiveCare: true, + onSuccess: (dynamic respData) async { + LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( + title: LocaleKeys.pickADate.tr(context: context), context, - child: Column( - 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), - SizedBox(height: 8.h), - ("For booking appointments in the Physiotherapy clinic, please contact: 920066666").toText16(color: AppColors.blackColor), - SizedBox(height: 16.h), - CustomButton( - height: 40.h, - backgroundColor: AppColors.primaryRedColor, - borderColor: AppColors.primaryRedColor, - text: LocaleKeys.callNow.tr(), - textColor: AppColors.whiteColor, - iconColor: AppColors.whiteColor, - onPressed: () { - launchUrl( - Uri.parse("tel://920066666"), - ); - }, - icon: AppAssets.call), - ], - ).center, - callBackFunc: () {}, + child: AppointmentCalendar(), isFullScreen: false, isCloseButtonVisible: true, + callBackFunc: () {}, ); - } else { + }, + onError: (err) { + LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, child: Utils.getErrorWidget(loadingText: err), @@ -252,15 +227,70 @@ class DoctorCard extends StatelessWidget { isFullScreen: false, isCloseButtonVisible: true, ); - } - // showCommonBottomSheetWithoutHeight( - // context, - // child: Utils.getErrorWidget(loadingText: err), - // callBackFunc: () {}, - // isFullScreen: false, - // isCloseButtonVisible: true, - // ); - }); + }) + : await bookAppointmentsViewModel.getDoctorFreeSlots( + isBookingForLiveCare: false, + onSuccess: (dynamic respData) async { + LoaderBottomSheet.hideLoader(); + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.pickADate.tr(context: context), + context, + child: AppointmentCalendar(), + isFullScreen: false, + isCloseButtonVisible: true, + callBackFunc: () {}, + ); + }, + onError: (err) { + LoaderBottomSheet.hideLoader(); + if (bookAppointmentsViewModel.selectedClinic.clinicID == 23) { + showCommonBottomSheetWithoutHeight( + context, + child: Column( + 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), + SizedBox(height: 8.h), + ("For booking appointments in the Physiotherapy clinic, please contact: 920066666").toText16(color: AppColors.blackColor), + SizedBox(height: 16.h), + CustomButton( + height: 40.h, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + text: LocaleKeys.callNow.tr(), + textColor: AppColors.whiteColor, + iconColor: AppColors.whiteColor, + onPressed: () { + launchUrl( + Uri.parse("tel://920066666"), + ); + }, + icon: AppAssets.call), + ], + ).center, + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } else { + showCommonBottomSheetWithoutHeight( + context, + child: Utils.getErrorWidget(loadingText: err), + callBackFunc: () {}, + isFullScreen: false, + isCloseButtonVisible: true, + ); + } + // showCommonBottomSheetWithoutHeight( + // context, + // child: Utils.getErrorWidget(loadingText: err), + // callBackFunc: () {}, + // isFullScreen: false, + // isCloseButtonVisible: true, + // ); + }); + } }, backgroundColor: Color(0xffFEE9EA), borderColor: Color(0xffFEE9EA),