diff --git a/assets/images/svg/cardiology_clinic_icon.svg b/assets/images/svg/cardiology_clinic_icon.svg new file mode 100644 index 0000000..a4e73f1 --- /dev/null +++ b/assets/images/svg/cardiology_clinic_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/generic_clinic_icon.svg b/assets/images/svg/generic_clinic_icon.svg new file mode 100644 index 0000000..adb1303 --- /dev/null +++ b/assets/images/svg/generic_clinic_icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/svg/hmc.svg b/assets/images/svg/hmc.svg index a127cd9..824ca06 100644 --- a/assets/images/svg/hmc.svg +++ b/assets/images/svg/hmc.svg @@ -1,8 +1,5 @@ - - - + + + + diff --git a/assets/images/svg/hmg.svg b/assets/images/svg/hmg.svg index 7b199bf..ccaed0c 100644 --- a/assets/images/svg/hmg.svg +++ b/assets/images/svg/hmg.svg @@ -1,8 +1,5 @@ - - - + + + + diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart index deb107d..a4e76fc 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -176,8 +176,8 @@ class ApiClientImp implements ApiClient { body[_appState.isAuthenticated ? 'TokenID' : 'LogInTokenID'] = _appState.appAuthToken; } - body['TokenID'] = "@dm!n"; - body['PatientID'] = 4767477; + // body['TokenID'] = "@dm!n"; + // body['PatientID'] = 4767477; } body.removeWhere((key, value) => value == null); diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index fa02b2e..5886dfa 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -727,7 +727,7 @@ const FAMILY_FILES= 'Services/Authentication.svc/REST/GetAllSharedRecordsByStatu class ApiConsts { static const maxSmallScreen = 660; - static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT diff --git a/lib/core/app_assets.dart b/lib/core/app_assets.dart index f7ca57d..1022b5d 100644 --- a/lib/core/app_assets.dart +++ b/lib/core/app_assets.dart @@ -135,6 +135,8 @@ class AppAssets { static const String visa_mastercard_icon = '$svgBasePath/visa_mastercard.svg'; static const String small_livecare_icon = '$svgBasePath/small_livecare_icon.svg'; static const String walkin_appointment_icon = '$svgBasePath/walkin_appointment_icon.svg'; + static const String cardiology_clinic_icon = '$svgBasePath/cardiology_clinic_icon.svg'; + static const String generic_clinic_icon = '$svgBasePath/generic_clinic_icon.svg'; //bottom navigation// static const String homeBottom = '$svgBasePath/home_bottom.svg'; diff --git a/lib/core/utils/doctor_response_mapper.dart b/lib/core/utils/doctor_response_mapper.dart index bff4598..994e9a1 100644 --- a/lib/core/utils/doctor_response_mapper.dart +++ b/lib/core/utils/doctor_response_mapper.dart @@ -2,11 +2,12 @@ import 'dart:math'; import 'package:hmg_patient_app_new/core/cache_consts.dart' show CacheConst; import 'package:hmg_patient_app_new/core/utils/utils.dart' show Utils; +import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/doctor_list_api_response.dart' show RegionList, PatientDoctorAppointmentList, DoctorList, PatientDoctorAppointmentListByRegion; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart' show HospitalsModel; class DoctorMapper{ - static Future getMappedDoctor(List doctorList, + static Future getMappedDoctor(List doctorList, {bool isArabic = false,double lat = 0.0,double long = 0.0}) async { RegionList regionList = RegionList(); @@ -41,16 +42,16 @@ class DoctorMapper{ isHMC: element.isHMC ); if(element.projectDistanceInKiloMeters!= null ){ - if(regionDoctorList!.distance>element.projectDistanceInKiloMeters){ - regionDoctorList.distance = element.projectDistanceInKiloMeters; + if(regionDoctorList!.distance>element.projectDistanceInKiloMeters!){ + regionDoctorList.distance = element.projectDistanceInKiloMeters!; } if (element.isHMC == true && - element.projectDistanceInKiloMeters < + element.projectDistanceInKiloMeters! < regionDoctorList.hmcDistance) { - regionDoctorList.hmcDistance = element.projectDistanceInKiloMeters; - } else if (element.projectDistanceInKiloMeters < + regionDoctorList.hmcDistance = element.projectDistanceInKiloMeters!; + } else if (element.projectDistanceInKiloMeters! < regionDoctorList.hmgDistance) { - regionDoctorList.hmgDistance = element.projectDistanceInKiloMeters; + regionDoctorList.hmgDistance = element.projectDistanceInKiloMeters!; } }else if (lat != 0&& @@ -65,12 +66,12 @@ class DoctorMapper{ regionDoctorList.distance = distance; } if (element.isHMC == true && - element.projectDistanceInKiloMeters < + (element.projectDistanceInKiloMeters??0) < regionDoctorList.hmcDistance) { - regionDoctorList.hmcDistance = element.projectDistanceInKiloMeters; - } else if (element.projectDistanceInKiloMeters < + regionDoctorList.hmcDistance = element.projectDistanceInKiloMeters??0; + } else if ((element.projectDistanceInKiloMeters??0) < regionDoctorList.hmgDistance) { - regionDoctorList.hmgDistance = element.projectDistanceInKiloMeters; + regionDoctorList.hmgDistance = element.projectDistanceInKiloMeters??0; } } targetList?.add(newAppointment); diff --git a/lib/features/book_appointments/book_appointments_view_model.dart b/lib/features/book_appointments/book_appointments_view_model.dart index c42a20d..5ef653a 100644 --- a/lib/features/book_appointments/book_appointments_view_model.dart +++ b/lib/features/book_appointments/book_appointments_view_model.dart @@ -113,6 +113,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { isDoctorsListLoading = true; isDoctorProfileLoading = true; isLiveCareSchedule = false; + currentlySelectedHospitalFromRegionFlow = null; clinicsList.clear(); doctorsList.clear(); liveCareClinicsList.clear(); @@ -289,6 +290,42 @@ class BookAppointmentsViewModel extends ChangeNotifier { ); } + Future getMappedDoctors( + {int projectID = 0, bool isNearest = false, int doctorId = 0, String doctorName = "", isContinueDentalPlan = false, Function(dynamic)? onSuccess, Function(String)? onError}) async { + filteredHospitalList = null; + hospitalList = null; + isRegionListLoading = true; + notifyListeners(); + projectID = currentlySelectedHospitalFromRegionFlow != null ? int.parse(currentlySelectedHospitalFromRegionFlow!) : projectID; + final result = await bookAppointmentsRepo.getDoctorsList(selectedClinic.clinicID ?? 0, projectID, isNearest, doctorId, doctorName); + + result.fold( + (failure) async { + onError!("No doctors found for the search criteria".needTranslation); + }, + (apiResponse) async { + if (apiResponse.messageStatus == 2) { + // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {}); + } else if (apiResponse.messageStatus == 1) { + var doctorList = apiResponse.data!; + hospitalList = await DoctorMapper.getMappedDoctor( + doctorList, + isArabic: _appState.isArabic(), + lat: _appState.userLat, + long: _appState.userLong, + ); + + var isLocationEnabled = (_appState.userLat != 0) && (_appState.userLong != 0); + hospitalList = await DoctorMapper.sortList(isLocationEnabled, hospitalList!); + + isRegionListLoading = false; + filteredHospitalList = hospitalList; + notifyListeners(); + } + }, + ); + } + Future getDoctorProfile({Function(dynamic)? onSuccess, Function(String)? onError}) async { final result = await bookAppointmentsRepo.getDoctorProfile(selectedDoctor.clinicID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, onError: onError); diff --git a/lib/features/book_appointments/models/resp_models/doctors_list_response_model.dart b/lib/features/book_appointments/models/resp_models/doctors_list_response_model.dart index 51a9403..5df6ed8 100644 --- a/lib/features/book_appointments/models/resp_models/doctors_list_response_model.dart +++ b/lib/features/book_appointments/models/resp_models/doctors_list_response_model.dart @@ -59,6 +59,13 @@ class DoctorsListResponseModel { int? virtualEmploymentType; dynamic workingHours; dynamic vida3Id; + String? region; + String? regionArabic; + String? regionEnglish; + String? regionID; + String? projectBottomName; + String? projectTopName; + DoctorsListResponseModel( {this.clinicID, @@ -120,7 +127,13 @@ class DoctorsListResponseModel { this.transactionType, this.virtualEmploymentType, this.workingHours, - this.vida3Id}); + this.vida3Id, + this.region, + this.regionArabic, + this.regionEnglish, + this.regionID, + this.projectBottomName, + this.projectTopName,}); DoctorsListResponseModel.fromJson(Map json) { clinicID = json['ClinicID']; @@ -183,6 +196,10 @@ class DoctorsListResponseModel { virtualEmploymentType = json['VirtualEmploymentType']; workingHours = json['WorkingHours']; vida3Id = json['vida3Id']; + regionArabic = json['RegionNameN']; + regionEnglish = json['RegionName']; + projectBottomName = json['ProjectNameBottom']; + projectTopName = json['ProjectNameTop']; } Map toJson() { @@ -249,4 +266,21 @@ class DoctorsListResponseModel { data['vida3Id'] = this.vida3Id; return data; } + + String? getRegionName(bool isArabic) { + if (isArabic) { + return regionArabic; + } + return regionEnglish; + } + String getProjectCompleteName(){ + return "${this.projectTopName} ${this.projectBottomName}"; + } + + String getProjectCompleteNameWithLocale({bool isArabic = false}) { + if (isArabic) { + return "${this.projectBottomName} ${this.projectTopName}"; + } + return "${this.projectTopName} ${this.projectBottomName}"; + } } diff --git a/lib/features/my_appointments/appointment_via_region_viewmodel.dart b/lib/features/my_appointments/appointment_via_region_viewmodel.dart index 4829f17..51ec097 100644 --- a/lib/features/my_appointments/appointment_via_region_viewmodel.dart +++ b/lib/features/my_appointments/appointment_via_region_viewmodel.dart @@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart' show ChangeNotifier; import 'package:hmg_patient_app_new/core/app_state.dart' show AppState; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/doctor_list_api_response.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/select_clinic_page.dart'; +import 'package:hmg_patient_app_new/presentation/book_appointment/select_doctor_page.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; @@ -14,6 +15,11 @@ enum AppointmentViaRegionState { DOCTOR_SELECTION } +enum RegionBottomSheetType{ + FOR_REGION, + FOR_CLINIIC +} + class AppointmentViaRegionViewmodel extends ChangeNotifier { String? selectedRegionId; String? selectedFacilityType; @@ -23,6 +29,8 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier { AppointmentViaRegionState.REGION_SELECTION; final AppState appState; + RegionBottomSheetType regionBottomSheetType = RegionBottomSheetType.FOR_REGION; + AppointmentViaRegionViewmodel({required this.navigationService,required this.appState}); void setSelectedRegionId(String? regionId) { @@ -35,12 +43,17 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier { notifyListeners(); } + void setBottomSheetType(RegionBottomSheetType type) { + regionBottomSheetType = type; + notifyListeners(); + } + void setBottomSheetState(AppointmentViaRegionState state) { bottomSheetState = state; notifyListeners(); } - void handleLastStep(){ + void handleLastStepForRegion(){ navigationService.pop(); navigationService.push(CustomPageRoute( page: SelectClinicPage(), @@ -65,6 +78,7 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier { void flush() { setSelectedRegionId(null); setFacility(null); + setBottomSheetType(RegionBottomSheetType.FOR_REGION); setBottomSheetState(AppointmentViaRegionState.REGION_SELECTION); } @@ -73,4 +87,11 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier { } bool get isArabic => appState.isArabic(); + + void handleLastStepForClinic() { + navigationService.pop(); + navigationService.push(CustomPageRoute( + page: SelectDoctorPage(), + ),); + } } diff --git a/lib/features/my_appointments/models/resp_models/doctor_list_api_response.dart b/lib/features/my_appointments/models/resp_models/doctor_list_api_response.dart index c3155e1..c2b9add 100644 --- a/lib/features/my_appointments/models/resp_models/doctor_list_api_response.dart +++ b/lib/features/my_appointments/models/resp_models/doctor_list_api_response.dart @@ -1,4 +1,5 @@ +import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart' show HospitalsModel; class DoctorList { @@ -236,7 +237,7 @@ class DoctorList { class PatientDoctorAppointmentList { String? filterName = ""; String? distanceInKMs = ""; - List? patientDoctorAppointmentList = []; + List? patientDoctorAppointmentList = []; String? projectTopName = ""; String? projectBottomName = ""; bool? isHMC; @@ -247,7 +248,7 @@ class PatientDoctorAppointmentList { this.distanceInKMs, this.projectTopName, this.projectBottomName, - DoctorList? patientDoctorAppointment, + DoctorsListResponseModel? patientDoctorAppointment, HospitalsModel? model, this.isHMC = false}) { if (model != null) { diff --git a/lib/presentation/appointments/appointment_details_page.dart b/lib/presentation/appointments/appointment_details_page.dart index f474104..7ebaa37 100644 --- a/lib/presentation/appointments/appointment_details_page.dart +++ b/lib/presentation/appointments/appointment_details_page.dart @@ -139,16 +139,16 @@ class _AppointmentDetailsPageState extends State { ? "Not Confirmed".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500) : "Confirmed".needTranslation.toText12(color: AppColors.successColor, fontWeight: FontWeight.w500)), SizedBox(height: 16.h), + //TODO Add countdown timer in case of LiveCare Appointment widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false ? Row( children: [ - Utils.buildSvgWithAssets(icon: AppAssets.livecare_clinic_icon, width: 58.h, height: 58.h), - SizedBox(width: 18.h), + Utils.buildSvgWithAssets(icon: AppAssets.livecare_clinic_icon, width: 40.h, height: 40.h), + SizedBox(width: 12.h), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "LiveCare Appointment".toText18(color: AppColors.textColor, isBold: true), "The doctor will call you once the appointment time approaches." .needTranslation .toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), diff --git a/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart b/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart index 43ce9c6..e7726ae 100644 --- a/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart +++ b/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart @@ -96,9 +96,16 @@ class HospitalBottomSheetBody extends StatelessWidget { isLocationEnabled: appointmentsViewModel.isLocationEnabled(), ).onPress(() { regionalViewModel.setHospitalModel(hospital); - regionalViewModel.setBottomSheetState(AppointmentViaRegionState.CLINIC_SELECTION); - regionalViewModel.handleLastStep(); - });}, + if (regionalViewModel.regionBottomSheetType == RegionBottomSheetType.FOR_REGION) { + regionalViewModel.setBottomSheetState(AppointmentViaRegionState.CLINIC_SELECTION); + regionalViewModel.handleLastStepForRegion(); + }else if (regionalViewModel.regionBottomSheetType == RegionBottomSheetType.FOR_CLINIIC) { + + regionalViewModel.setBottomSheetState(AppointmentViaRegionState.DOCTOR_SELECTION); + regionalViewModel.handleLastStepForClinic(); + + } + });}, separatorBuilder: (_, __) => SizedBox( height: 16.h, ), diff --git a/lib/presentation/appointments/widgets/region_bottomsheet/region_list_widget.dart b/lib/presentation/appointments/widgets/region_bottomsheet/region_list_widget.dart index 180185f..09c7c40 100644 --- a/lib/presentation/appointments/widgets/region_bottomsheet/region_list_widget.dart +++ b/lib/presentation/appointments/widgets/region_bottomsheet/region_list_widget.dart @@ -6,14 +6,11 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart' show Utils; 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/my_appointments/appointment_via_region_viewmodel.dart'; -import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart' - show MyAppointmentsViewModel; -import 'package:hmg_patient_app_new/presentation/appointments/widgets/region_bottomsheet/region_list_item.dart' - show RegionListItem; +import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart' show MyAppointmentsViewModel; +import 'package:hmg_patient_app_new/presentation/appointments/widgets/region_bottomsheet/region_list_item.dart' show RegionListItem; import 'package:provider/provider.dart'; class RegionBottomSheetBody extends StatefulWidget { - const RegionBottomSheetBody({super.key}); @override @@ -27,7 +24,11 @@ class _RegionBottomSheetBodyState extends State { @override void initState() { scheduleMicrotask(() { - myAppointmentsViewModel.getRegionMappedProjectList(); + if (regionalViewModel.regionBottomSheetType == RegionBottomSheetType.FOR_REGION) { + myAppointmentsViewModel.getRegionMappedProjectList(); + } else if (regionalViewModel.regionBottomSheetType == RegionBottomSheetType.FOR_CLINIIC) { + myAppointmentsViewModel.getMappedDoctors(); + } }); super.initState(); } @@ -53,26 +54,19 @@ class _RegionBottomSheetBodyState extends State { return SizedBox( height: MediaQuery.of(context).size.height * 0.5, child: ListView.separated( - itemCount: - myAppointmentsVM.hospitalList?.registeredDoctorMap?.length ?? - 0, + itemCount: myAppointmentsVM.hospitalList?.registeredDoctorMap?.length ?? 0, separatorBuilder: (_, __) { return SizedBox( height: 16.h, ); }, itemBuilder: (_, index) { - String key = myAppointmentsVM - .hospitalList?.registeredDoctorMap?.keys - .toList()[index] ?? - ''; + String key = myAppointmentsVM.hospitalList?.registeredDoctorMap?.keys.toList()[index] ?? ''; return RegionListItem( title: key, subTitle: "", - hmcCount: - "${myAppointmentsVM.hospitalList?.registeredDoctorMap?[key]?.hmcSize ?? 0}", - hmgCount: - "${myAppointmentsVM.hospitalList?.registeredDoctorMap?[key]?.hmgSize ?? 0}", + hmcCount: "${myAppointmentsVM.hospitalList?.registeredDoctorMap?[key]?.hmcSize ?? 0}", + hmgCount: "${myAppointmentsVM.hospitalList?.registeredDoctorMap?[key]?.hmgSize ?? 0}", ).onPress(() { regionalViewModel.setSelectedRegionId(key); regionalViewModel.setBottomSheetState(AppointmentViaRegionState.TYPE_SELECTION); diff --git a/lib/presentation/book_appointment/book_appointment_page.dart b/lib/presentation/book_appointment/book_appointment_page.dart index 78f1540..0168f24 100644 --- a/lib/presentation/book_appointment/book_appointment_page.dart +++ b/lib/presentation/book_appointment/book_appointment_page.dart @@ -58,7 +58,7 @@ class _BookAppointmentPageState extends State { backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( title: LocaleKeys.bookAppo.tr(context: context), - isLeading: Navigator.canPop(context), + isLeading: false, child: SingleChildScrollView( child: Consumer(builder: (context, bookAppointmentsVM, child) { return Column( @@ -156,6 +156,7 @@ class _BookAppointmentPageState extends State { ], ).onPress(() { bookAppointmentsViewModel.setIsDoctorSearchByNameStarted(false); + bookAppointmentsViewModel.setProjectID(null); Navigator.of(context).push( CustomPageRoute( page: SearchDoctorByName(), @@ -185,7 +186,8 @@ class _BookAppointmentPageState extends State { flipX: appState.isArabic() ? true : false, child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon, iconColor: AppColors.textColor, width: 15.h, height: 15.h)), ], ).onPress(() { - openRegionListBottomSheet(context); + bookAppointmentsViewModel.setProjectID(null); + openRegionListBottomSheet(context, RegionBottomSheetType.FOR_REGION); }), ], ), @@ -291,7 +293,7 @@ class _BookAppointmentPageState extends State { flipX: appState.isArabic() ? true : false, child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon, iconColor: AppColors.textColor, width: 15.h, height: 15.h)), ], ).onPress(() { - openRegionListBottomSheet(context); + openRegionListBottomSheet(context, RegionBottomSheetType.FOR_REGION); }), ], ), @@ -305,8 +307,9 @@ class _BookAppointmentPageState extends State { return Container(); } - void openRegionListBottomSheet(BuildContext context) { + void openRegionListBottomSheet(BuildContext context, RegionBottomSheetType type) { regionalViewModel.flush(); + regionalViewModel.setBottomSheetType(type); // AppointmentViaRegionViewmodel? viewmodel = null; showCommonBottomSheetWithoutHeight(context, title: "", titleWidget: Consumer(builder: (_, data, __) => getTitle(data)), isDismissible: false, child: Consumer(builder: (_, data, __) { diff --git a/lib/presentation/book_appointment/select_clinic_page.dart b/lib/presentation/book_appointment/select_clinic_page.dart index ba5c2ee..d1c7fbd 100644 --- a/lib/presentation/book_appointment/select_clinic_page.dart +++ b/lib/presentation/book_appointment/select_clinic_page.dart @@ -13,12 +13,17 @@ 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/get_clinic_list_response_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_livecare_clinics_response_model.dart'; +import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; +import 'package:hmg_patient_app_new/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart'; +import 'package:hmg_patient_app_new/presentation/appointments/widgets/hospital_bottom_sheet/hospital_bottom_sheet_body.dart'; +import 'package:hmg_patient_app_new/presentation/appointments/widgets/region_bottomsheet/region_list_widget.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/select_doctor_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/select_livecare_clinic_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/clinic_card.dart'; import 'package:hmg_patient_app_new/presentation/lab/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/input_widget.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; @@ -34,7 +39,7 @@ class SelectClinicPage extends StatefulWidget { class _SelectClinicPageState extends State { TextEditingController searchEditingController = TextEditingController(); FocusNode textFocusNode = FocusNode(); - + late AppointmentViaRegionViewmodel regionalViewModel; late AppState appState; late BookAppointmentsViewModel bookAppointmentsViewModel; @@ -55,6 +60,7 @@ class _SelectClinicPageState extends State { @override Widget build(BuildContext context) { bookAppointmentsViewModel = Provider.of(context, listen: false); + regionalViewModel = Provider.of(context, listen: true); appState = getIt.get(); return Scaffold( backgroundColor: AppColors.bgScaffoldColor, @@ -197,15 +203,69 @@ class _SelectClinicPageState extends State { if (clinic.isLiveCareClinicAndOnline ?? false) { Navigator.of(context).push( CustomPageRoute( - page: SelectLivecareClinicPage(), + page: SelectLivecareClinicPage(onNegativeClicked: (){ + openRegionListBottomSheet(context, RegionBottomSheetType.FOR_CLINIIC); + },), ), ); } else { - Navigator.of(context).push( - CustomPageRoute( - page: SelectDoctorPage(), - ), + openRegionListBottomSheet(context, RegionBottomSheetType.FOR_CLINIIC); + // Navigator.of(context).push( + // CustomPageRoute( + // page: SelectDoctorPage(), + // ), + // ); + } + } + + void openRegionListBottomSheet(BuildContext context, RegionBottomSheetType type) { + bookAppointmentsViewModel.setProjectID(null); + + regionalViewModel.flush(); + regionalViewModel.setBottomSheetType(type); + // AppointmentViaRegionViewmodel? viewmodel = null; + showCommonBottomSheetWithoutHeight(context, title: "", titleWidget: Consumer(builder: (_, data, __) => getTitle(data)), isDismissible: false, + child: Consumer(builder: (_, data, __) { + return getRegionalSelectionWidget(data); + }), callBackFunc: () {}); + } + + Widget getRegionalSelectionWidget(AppointmentViaRegionViewmodel data) { + if (data.bottomSheetState == AppointmentViaRegionState.REGION_SELECTION) { + return RegionBottomSheetBody(); + } + if (data.bottomSheetState == AppointmentViaRegionState.TYPE_SELECTION) { + bookAppointmentsViewModel.resetFilterList(); + return FacilityTypeSelectionWidget( + selectedRegion: data.selectedRegionId ?? "", ); } + if (data.bottomSheetState == AppointmentViaRegionState.HOSPITAL_SELECTION) { + return HospitalBottomSheetBody(); + } + if(data.bottomSheetState == AppointmentViaRegionState.DOCTOR_SELECTION){ + bookAppointmentsViewModel.setProjectID(regionalViewModel.selectedHospital?.patientDoctorAppointmentList?.first.projectID.toString()); + } + else { + return SizedBox.shrink(); + } + return SizedBox.shrink(); + } + + getTitle(AppointmentViaRegionViewmodel data) { + if (data.selectedRegionId == null) { + return LocaleKeys.selectRegion.tr().toText20(weight: FontWeight.w600); + } else { + return Transform.flip( + flipX: data.isArabic ? true : false, + child: Utils.buildSvgWithAssets( + icon: AppAssets.arrow_back, + iconColor: Color(0xff2B353E), + fit: BoxFit.contain, + ), + ).onPress(() { + data.handleBackPress(); + }); + } } } diff --git a/lib/presentation/book_appointment/select_livecare_clinic_page.dart b/lib/presentation/book_appointment/select_livecare_clinic_page.dart index 76d85af..ac6b617 100644 --- a/lib/presentation/book_appointment/select_livecare_clinic_page.dart +++ b/lib/presentation/book_appointment/select_livecare_clinic_page.dart @@ -14,7 +14,9 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; class SelectLivecareClinicPage extends StatelessWidget { - const SelectLivecareClinicPage({super.key}); + + final VoidCallback? onNegativeClicked; + const SelectLivecareClinicPage({super.key, this.onNegativeClicked}); @override Widget build(BuildContext context) { @@ -122,11 +124,12 @@ class SelectLivecareClinicPage extends StatelessWidget { text: "No, Thanks. I would like a physical visit".needTranslation, onPressed: () { Navigator.of(context).pop(); - Navigator.of(context).push( - CustomPageRoute( - page: SelectDoctorPage(), - ), - ); + onNegativeClicked?.call(); + // Navigator.of(context).push( + // CustomPageRoute( + // page: SelectDoctorPage(), + // ), + // ); }, backgroundColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor, diff --git a/lib/presentation/book_appointment/widgets/appointment_calendar.dart b/lib/presentation/book_appointment/widgets/appointment_calendar.dart index 046003a..e7a47aa 100644 --- a/lib/presentation/book_appointment/widgets/appointment_calendar.dart +++ b/lib/presentation/book_appointment/widgets/appointment_calendar.dart @@ -59,8 +59,8 @@ class _AppointmentCalendarState extends State { @override void initState() { + _calendarController = CalendarController(); scheduleMicrotask(() { - _calendarController = CalendarController(); _events = { _selectedDay: ['Event A0'] }; diff --git a/lib/presentation/book_appointment/widgets/clinic_card.dart b/lib/presentation/book_appointment/widgets/clinic_card.dart index c9c0555..6850f9f 100644 --- a/lib/presentation/book_appointment/widgets/clinic_card.dart +++ b/lib/presentation/book_appointment/widgets/clinic_card.dart @@ -32,7 +32,7 @@ class ClinicCard extends StatelessWidget { child: Column( children: [ Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "".toText16(isBold: true).toShimmer2(isShow: isLoading), + Utils.buildSvgWithAssets(icon: AppAssets.generic_clinic_icon, width: 24.h, height: 24.h, fit: BoxFit.contain).toShimmer2(isShow: isLoading), (clinicsListResponseModel.isLiveCareClinicAndOnline ?? true) ? Utils.buildSvgWithAssets(icon: AppAssets.livecare_clinic_icon, width: 32.h, height: 32.h, fit: BoxFit.contain).toShimmer2(isShow: isLoading) : SizedBox.shrink(), diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 12bc8f5..402fb6b 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -210,7 +210,7 @@ class _LandingPageState extends State { : 3, layout: SwiperLayout.STACK, loop: true, - itemWidth: MediaQuery.of(context).size.width - 72, + itemWidth: MediaQuery.of(context).size.width - 48.h, indicatorLayout: PageIndicatorLayout.COLOR, axisDirection: AxisDirection.right, controller: _controller, diff --git a/lib/presentation/medical_file/medical_file_page.dart b/lib/presentation/medical_file/medical_file_page.dart index 18b6085..01504b3 100644 --- a/lib/presentation/medical_file/medical_file_page.dart +++ b/lib/presentation/medical_file/medical_file_page.dart @@ -468,7 +468,7 @@ class _MedicalFilePageState extends State { backgroundColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor, textColor: AppColors.primaryRedColor, - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.w500, borderRadius: 12.h, height: 40.h, @@ -485,7 +485,7 @@ class _MedicalFilePageState extends State { backgroundColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor, textColor: AppColors.primaryRedColor, - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.w500, borderRadius: 12.h, height: 40.h, diff --git a/lib/presentation/medical_file/widgets/lab_rad_card.dart b/lib/presentation/medical_file/widgets/lab_rad_card.dart index 66021b2..766ef6d 100644 --- a/lib/presentation/medical_file/widgets/lab_rad_card.dart +++ b/lib/presentation/medical_file/widgets/lab_rad_card.dart @@ -32,7 +32,7 @@ class LabRadCard extends StatelessWidget { fit: BoxFit.contain, ).toShimmer2(isShow: false, radius: 12.h), SizedBox(width: 8.h), - labelText.toText14(isBold: true).toShimmer2(isShow: false, radius: 6.h, height: 32.h), + labelText.toText13(isBold: true).toShimmer2(isShow: false, radius: 6.h, height: 32.h), ], ), SizedBox(height: 16.h), diff --git a/lib/presentation/medical_file/widgets/patient_medical_report_card.dart b/lib/presentation/medical_file/widgets/patient_medical_report_card.dart index eb1730c..1762886 100644 --- a/lib/presentation/medical_file/widgets/patient_medical_report_card.dart +++ b/lib/presentation/medical_file/widgets/patient_medical_report_card.dart @@ -110,15 +110,15 @@ class PatientMedicalReportCard extends StatelessWidget { onPressed: () async { getMedicalReportPDF(false, context, _appState); }, - backgroundColor: AppColors.secondaryLightRedColor, - borderColor: AppColors.secondaryLightRedColor, - textColor: AppColors.primaryRedColor, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, fontSize: 14, fontWeight: FontWeight.w500, borderRadius: 12.h, height: 40.h, icon: AppAssets.download_1, - iconColor: AppColors.primaryRedColor, + iconColor: AppColors.whiteColor, iconSize: 16.h, ).toShimmer2(isShow: isLoading), ), diff --git a/lib/splashPage.dart b/lib/splashPage.dart index 3e70742..fc0d40d 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -48,11 +48,11 @@ class _SplashScreenState extends State { Timer(Duration(seconds: 2, milliseconds: 500), () async { LocalNotification.init(onNotificationClick: (payload) {}); - if (await Utils.getBoolFromPrefs(CacheConst.firstLaunch)) { + // if (await Utils.getBoolFromPrefs(CacheConst.firstLaunch)) { Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: OnboardingScreen()))); - } else { - Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation()))); - } + // } else { + // Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation()))); + // } }); var zoom = ZoomVideoSdk(); InitConfig initConfig = InitConfig(