diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index d0314911..21c81820 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1599,8 +1599,8 @@ const Map localizedValues = { "RequesterInfo": {"en": "Requester Info", "ar": "معلومات مقدم الطلب"}, "PatientInfo": {"en": "Patient Info", "ar": "معلومات المراجع"}, "OtherInfo": {"en": "Other Info", "ar": "معلومات اخرى"}, - "inPrgress": {"en": "In Progress", "ar": "في تقدم"}, - "locked": {"en": "Locked", "ar": "مقفل"}, + "inPrgress": {"en": "In Progress", "ar": "جاري الاختيار"}, + "locked": {"en": "Locked", "ar": "غير مفعل"}, "personalInfo": {"en": "Personal Information", "ar": "معلومات شخصية"}, "cmcTitle": {"en": "Comprehensive", "ar": "خدمة"}, "cmcSubtitle": {"en": "Medical Checkup", "ar": "الفحص الشامل"}, diff --git a/lib/core/model/hospitals/hospitals_model.dart b/lib/core/model/hospitals/hospitals_model.dart index 5fa1677f..93915a2f 100644 --- a/lib/core/model/hospitals/hospitals_model.dart +++ b/lib/core/model/hospitals/hospitals_model.dart @@ -74,6 +74,13 @@ class HospitalsModel { return regionEnglish; } + String? getName(bool isArabic) { + if (isArabic) { + return "$legalNameN"; + } + return legalName; + } + Map toJson() { final Map data = new Map(); data['Desciption'] = this.desciption; diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index c7989cbf..efdf79dc 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -1,18 +1,14 @@ -import 'package:diplomaticquarterapp/analytics/flows/appointments.dart'; import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/search_by_hospital_name.dart'; -import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'components/SearchByClinic.dart'; - class Search extends StatefulWidget { final int type; final List? clnicIds; diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 0e5d430b..981bcf04 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -521,6 +521,7 @@ class _SearchByClinicState extends State { } getClinicsList() async { + AppGlobal.context = context; if (await sharedPref.getObject(CLINICS_LIST) != null) { dynamic res = await sharedPref.getObject(CLINICS_LIST); setState(() { diff --git a/lib/pages/BookAppointment/components/search_by_hospital_name.dart b/lib/pages/BookAppointment/components/search_by_hospital_name.dart index bca54daf..01e9711c 100644 --- a/lib/pages/BookAppointment/components/search_by_hospital_name.dart +++ b/lib/pages/BookAppointment/components/search_by_hospital_name.dart @@ -50,13 +50,27 @@ class _SearchByHospitalState extends State { @override void initState() { - locationUtils = - new LocationUtils(isShowConfirmDialog: true, context: context); WidgetsBinding.instance.addPostFrameCallback((_) { getProjectsList(); }); + locationUtils = + new LocationUtils(isShowConfirmDialog: true, context: context); } + // @override + // void didChangeDependencies() { + // WidgetsBinding.instance.addPostFrameCallback((_) { + // getProjectsList(); + // }); + // } + + // @override + // void didUpdateWidget(SearchByHospital oldWidget) { + // WidgetsBinding.instance.addPostFrameCallback((_) { + // getProjectsList(); + // }); + // } + @override Widget build(BuildContext context) { AppGlobal.context = context; @@ -260,20 +274,20 @@ class _SearchByHospitalState extends State { } getProjectsList() { + AppGlobal.context = context; GifLoaderDialogUtils.showMyDialog(context); - int languageID = context.read().isArabic ? 1 : 2; ClinicListService service = new ClinicListService(); List projectsListLocal = []; - service.getProjectsList(languageID, context).then((res) { + service.getProjectsList(languageID, context).then((res) async { if (res['MessageStatus'] == 1) { - setState(() async { - res['ListProject'].forEach((v) { + res['ListProject'].forEach((v) { projectsListLocal.add(new HospitalsModel.fromJson(v)); }); projectsList = projectsListLocal; - hospitalList = await DoctorMapper.getMappedHospitals(projectsList); - }); + hospitalList = await DoctorMapper.getMappedHospitals(projectsList, + isArabic: context.read().isArabic); + setState(() {}); GifLoaderDialogUtils.hideDialog(context); } else {} GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/services/appointment_services/doctor_response_mapper.dart b/lib/services/appointment_services/doctor_response_mapper.dart index 9a12804e..53d4c65e 100644 --- a/lib/services/appointment_services/doctor_response_mapper.dart +++ b/lib/services/appointment_services/doctor_response_mapper.dart @@ -150,7 +150,7 @@ class DoctorMapper{ existingEntry.first.hospitalList.add(hospital); } else { final newEntry = PatientDoctorAppointmentList( - filterName: hospital.legalName, + filterName: hospital.getName(isArabic), distanceInKMs: hospital.distanceInKilometers?.toString(), projectTopName: hospital.name, projectBottomName: hospital.legalName, diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart index f8f7c49d..6c170710 100644 --- a/lib/uitl/location_util.dart +++ b/lib/uitl/location_util.dart @@ -37,10 +37,11 @@ class LocationUtils { if (callBack != null) callBack(LatLng(value.latitude, value.longitude)); }).catchError((err) { print(err); - if (isShowConfirmDialog && isShowLocationTimeoutDialog) + if (isShowConfirmDialog && isShowLocationTimeoutDialog) { showLocationTimeOutDialog(failureCallBack: () { Geolocator.openAppSettings(); }); + } }); }