diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 19111f7..412dfc1 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -849,6 +849,7 @@ "pleaseEnterEmail": "يرجى إدخال البريد الإلكتروني", "pleaseEnterAValidEmailFormat": "يرجى إدخال تنسيق بريد إلكتروني صالح", "selectCountry": "اختر الدولة", - "forLoginVerification": "للتحقق من تسجيل الدخول" + "forLoginVerification": "للتحقق من تسجيل الدخول", + "searchHospital": "بحث في المستشفى" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 27609c8..9ecb447 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -845,5 +845,6 @@ "pleaseEnterAValidEmailFormat": "Please enter a valid email format", "selectCountry": "Select Country", "forLoginVerification": "for login verification", - "lastLoginBy": "Last login by" + "lastLoginBy": "Last login by", + "searchHospital": "Search Hospital" } \ No newline at end of file diff --git a/lib/features/book_appointments/book_appointments_view_model.dart b/lib/features/book_appointments/book_appointments_view_model.dart index b9750d8..6488dd8 100644 --- a/lib/features/book_appointments/book_appointments_view_model.dart +++ b/lib/features/book_appointments/book_appointments_view_model.dart @@ -414,11 +414,6 @@ class BookAppointmentsViewModel extends ChangeNotifier { } Future getRegionMappedProjectList() async { - //todo handle the case in the location is switch on - // if(hospitalList != null && hospitalList!.registeredDoctorMap != null && hospitalList!.registeredDoctorMap!.isNotEmpty){ - // filteredHospitalList = hospitalList; - // return; - // } isRegionListLoading = true; notifyListeners(); final result = await bookAppointmentsRepo.getProjectList(); @@ -432,7 +427,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { } else if (apiResponse.messageStatus == 1) { var projectList = apiResponse.data!; hospitalList = await DoctorMapper.getMappedHospitals(projectList, - isArabic: false, + isArabic: _appState.isArabic(), lat: _appState.userLat, lng: _appState.userLong, ); diff --git a/lib/features/my_appointments/appointment_via_region_viewmodel.dart b/lib/features/my_appointments/appointment_via_region_viewmodel.dart index 1525280..4829f17 100644 --- a/lib/features/my_appointments/appointment_via_region_viewmodel.dart +++ b/lib/features/my_appointments/appointment_via_region_viewmodel.dart @@ -1,4 +1,5 @@ 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/services/navigation_service.dart'; @@ -20,8 +21,9 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier { final NavigationService navigationService; AppointmentViaRegionState bottomSheetState = AppointmentViaRegionState.REGION_SELECTION; + final AppState appState; - AppointmentViaRegionViewmodel({required this.navigationService}); + AppointmentViaRegionViewmodel({required this.navigationService,required this.appState}); void setSelectedRegionId(String? regionId) { selectedRegionId = regionId; @@ -69,4 +71,6 @@ class AppointmentViaRegionViewmodel extends ChangeNotifier { void setHospitalModel(PatientDoctorAppointmentList? hospital) { selectedHospital = hospital; } + + bool get isArabic => appState.isArabic(); } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index a452959..3d12e5b 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -848,5 +848,6 @@ abstract class LocaleKeys { static const pleaseEnterAValidEmailFormat = 'pleaseEnterAValidEmailFormat'; static const selectCountry = 'selectCountry'; static const forLoginVerification = 'forLoginVerification'; + static const searchHospital = 'searchHospital'; } diff --git a/lib/main.dart b/lib/main.dart index 6abde55..bdd1f29 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -147,8 +147,8 @@ void main() async { ), ), ChangeNotifierProvider( - create: (_) => - AppointmentViaRegionViewmodel(navigationService: getIt())) + create: (_) => AppointmentViaRegionViewmodel( + navigationService: getIt(), appState: getIt())) ], child: MyApp()), ), ); diff --git a/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart b/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart index e1ff677..cacc9d3 100644 --- a/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart +++ b/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart @@ -38,7 +38,7 @@ class FacilityTypeSelectionWidget extends StatelessWidget { ), ), Text( - LocaleKeys.selectFacilitiesSubTitle, + LocaleKeys.selectFacilitiesSubTitle.tr(), style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, @@ -55,9 +55,11 @@ class FacilityTypeSelectionWidget extends StatelessWidget { }), ).onPress( () { - regionalViewModel.setFacility(FacilitySelection.HMG.name); - regionalViewModel.setBottomSheetState( - AppointmentViaRegionState.HOSPITAL_SELECTION); + if(bookAppointmentViewModel.hospitalList?.registeredDoctorMap?[selectedRegion]?.hmgSize != 0) { + regionalViewModel.setFacility(FacilitySelection.HMG.name); + regionalViewModel.setBottomSheetState( + AppointmentViaRegionState.HOSPITAL_SELECTION); + } }, ), SizedBox(height: 16.h), @@ -69,9 +71,11 @@ class FacilityTypeSelectionWidget extends StatelessWidget { "${bookAppointmentViewModel.hospitalList?.registeredDoctorMap?[selectedRegion]?.hmcSize ?? 0}" })).onPress( () { - regionalViewModel.setFacility(FacilitySelection.HMC.name); - regionalViewModel.setBottomSheetState( - AppointmentViaRegionState.HOSPITAL_SELECTION); + if(bookAppointmentViewModel.hospitalList?.registeredDoctorMap?[selectedRegion]?.hmcSize!= 0 ) { + regionalViewModel.setFacility(FacilitySelection.HMC.name); + regionalViewModel.setBottomSheetState( + AppointmentViaRegionState.HOSPITAL_SELECTION); + } }, ), ], 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 8159abd..43ce9c6 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 @@ -50,7 +50,7 @@ class HospitalBottomSheetBody extends StatelessWidget { SizedBox(height: 16.h), TextInputWidget( labelText: LocaleKeys.search.tr(), - hintText: "Search Hospital".tr(), + hintText: LocaleKeys.searchHospital.tr(), controller: searchText, onChange: (value) { appointmentsViewModel.filterHospitalListByString(value, regionalViewModel.selectedRegionId , regionalViewModel.selectedFacilityType == diff --git a/lib/presentation/book_appointment/book_appointment_page.dart b/lib/presentation/book_appointment/book_appointment_page.dart index bb659c4..140b593 100644 --- a/lib/presentation/book_appointment/book_appointment_page.dart +++ b/lib/presentation/book_appointment/book_appointment_page.dart @@ -200,7 +200,11 @@ class _BookAppointmentPageState extends State { void openRegionListBottomSheet(BuildContext context) { regionalViewModel.flush(); // AppointmentViaRegionViewmodel? viewmodel = null; - showCommonBottomSheetWithoutHeight(context, title: "", titleWidget: Consumer(builder: (_, data, __) => getTitle(data)), isDismissible: false, + showCommonBottomSheetWithoutHeight(context, + title: "", + titleWidget: Consumer( + builder: (_, data, __) => getTitle(data)), + isDismissible: false, child: Consumer(builder: (_, data, __) { return getRegionalSelectionWidget(data); }), callBackFunc: () {}); @@ -234,9 +238,19 @@ class _BookAppointmentPageState extends State { if (data.selectedRegionId == null) { return LocaleKeys.selectRegion.tr().toText20(weight: FontWeight.w600); } else { - return Utils.buildSvgWithAssets(icon: AppAssets.arrow_back, iconColor: Color(0xff2B353E)).onPress(() { - data.handleBackPress(); - }); + return + Transform.flip( + flipX: data.isArabic ? true : false, + child: Utils.buildSvgWithAssets( + icon: AppAssets.arrow_back, + iconColor: Color(0xff2B353E), + + fit: BoxFit.contain, + ), + ).onPress(() { + data.handleBackPress(); + }); + } } }