WD: Arabic name value is handled.

merge-update-with-lab-changes
taha.alam 1 year ago
parent 11b83d1276
commit 7cafe3aaa9

@ -48,6 +48,8 @@ class DoctorList {
String? projectTopName; String? projectTopName;
bool? isHMC; bool? isHMC;
String? region; String? region;
String? regionArabic;
String? regionEnglish;
String? regionID; String? regionID;
DoctorList( DoctorList(
@ -100,7 +102,9 @@ class DoctorList {
this.projectTopName, this.projectTopName,
this.isHMC, this.isHMC,
this.region, this.region,
this.regionID, this.regionArabic,
this.regionEnglish,
this.regionID,
}); });
DoctorList.fromJson( DoctorList.fromJson(
@ -154,7 +158,15 @@ class DoctorList {
projectBottomName = json['ProjectNameBottom']; projectBottomName = json['ProjectNameBottom'];
projectTopName = json['ProjectNameTop']; projectTopName = json['ProjectNameTop'];
this.isHMC = json["IsHMC"]; this.isHMC = json["IsHMC"];
this.region = json["RegionName"]; this.regionArabic = json['RegionNameN'];
this.regionEnglish = json['RegionName'];
}
String? getRegionName(bool isArabic) {
if (isArabic) {
return regionArabic;
}
return regionEnglish;
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {

@ -627,6 +627,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
} }
callDoctorsSearchAPI(int clinicID) { callDoctorsSearchAPI(int clinicID) {
bool isArabic = context.read<ProjectViewModel>().isArabic;
int languageID = context.read<ProjectViewModel>().isArabic ? 1 : 2; int languageID = context.read<ProjectViewModel>().isArabic ? 1 : 2;
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
List<DoctorList> doctorsList = []; List<DoctorList> doctorsList = [];
@ -656,7 +657,8 @@ class _SearchByClinicState extends State<SearchByClinic> {
)); ));
}); });
regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList); regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList,
isArabic: isArabic);
regionHospitalList = regionHospitalList =
await DoctorMapper.sortList(true, regionHospitalList); await DoctorMapper.sortList(true, regionHospitalList);

@ -91,7 +91,8 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
} }
getDoctorsList(BuildContext context) { getDoctorsList(BuildContext context) {
int languageID = context.read<ProjectViewModel>().isArabic ? 1 : 2; bool isArabic = context.read<ProjectViewModel>().isArabic;
int languageID = isArabic ? 1 : 2;
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
List<DoctorList> doctorsList = []; List<DoctorList> doctorsList = [];
DoctorsListService service = new DoctorsListService(); DoctorsListService service = new DoctorsListService();
@ -119,7 +120,8 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
}); });
// print('the counter is ${counter}'); // print('the counter is ${counter}');
regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList); regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList,
isArabic: isArabic);
regionHospitalList = regionHospitalList =
await DoctorMapper.sortList(true, regionHospitalList); await DoctorMapper.sortList(true, regionHospitalList);

@ -372,7 +372,8 @@ class _SearchByHospitalState extends State<SearchByHospital> {
} }
callDoctorsSearchAPI(int clinicID) { callDoctorsSearchAPI(int clinicID) {
int languageID = context.read<ProjectViewModel>().isArabic ? 1 : 2; var isArabic = context.read<ProjectViewModel>().isArabic;
int languageID = isArabic ? 1 : 2;
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
List<DoctorList> doctorsList = []; List<DoctorList> doctorsList = [];
List<String> arr = []; List<String> arr = [];
@ -403,7 +404,8 @@ class _SearchByHospitalState extends State<SearchByHospital> {
)); ));
}); });
regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList); regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList,
isArabic: isArabic);
regionHospitalList = regionHospitalList =
await DoctorMapper.sortList(true, regionHospitalList); await DoctorMapper.sortList(true, regionHospitalList);

@ -5,15 +5,16 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
class DoctorMapper{ class DoctorMapper{
static Future<RegionList> getMappedDoctor(List<DoctorList> doctorList) async { static Future<RegionList> getMappedDoctor(List<DoctorList> doctorList,
{bool isArabic = false}) async {
RegionList regionList = RegionList(); RegionList regionList = RegionList();
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
for (var element in doctorList) { for (var element in doctorList) {
if (element.region == null) continue; String? region = element.getRegionName(isArabic);
if (region == null) continue;
var regionDoctorList = regionList.registeredDoctorMap?.putIfAbsent( var regionDoctorList = regionList.registeredDoctorMap?.putIfAbsent(region, () => PatientDoctorAppointmentListByRegion());
element.region!, () => PatientDoctorAppointmentListByRegion());
List<PatientDoctorAppointmentList>? targetList = element.isHMC == true List<PatientDoctorAppointmentList>? targetList = element.isHMC == true
? regionDoctorList?.hmcDoctorList ? regionDoctorList?.hmcDoctorList
@ -62,7 +63,7 @@ class DoctorMapper{
regionDoctorList?.hmcSize = regionDoctorList.hmcDoctorList?.length ?? 0; regionDoctorList?.hmcSize = regionDoctorList.hmcDoctorList?.length ?? 0;
regionDoctorList?.hmgSize = regionDoctorList.hmgDoctorList?.length ?? 0; regionDoctorList?.hmgSize = regionDoctorList.hmgDoctorList?.length ?? 0;
regionList.registeredDoctorMap?[element.region!] = regionDoctorList; regionList.registeredDoctorMap?[region] = regionDoctorList;
} }
return regionList; return regionList;

Loading…
Cancel
Save