WD: Arabic name value is handled.

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

@ -48,6 +48,8 @@ class DoctorList {
String? projectTopName;
bool? isHMC;
String? region;
String? regionArabic;
String? regionEnglish;
String? regionID;
DoctorList(
@ -100,7 +102,9 @@ class DoctorList {
this.projectTopName,
this.isHMC,
this.region,
this.regionID,
this.regionArabic,
this.regionEnglish,
this.regionID,
});
DoctorList.fromJson(
@ -154,7 +158,15 @@ class DoctorList {
projectBottomName = json['ProjectNameBottom'];
projectTopName = json['ProjectNameTop'];
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() {

@ -627,6 +627,7 @@ class _SearchByClinicState extends State<SearchByClinic> {
}
callDoctorsSearchAPI(int clinicID) {
bool isArabic = context.read<ProjectViewModel>().isArabic;
int languageID = context.read<ProjectViewModel>().isArabic ? 1 : 2;
GifLoaderDialogUtils.showMyDialog(context);
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 =
await DoctorMapper.sortList(true, regionHospitalList);

@ -91,7 +91,8 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
}
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);
List<DoctorList> doctorsList = [];
DoctorsListService service = new DoctorsListService();
@ -119,7 +120,8 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
});
// print('the counter is ${counter}');
regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList);
regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList,
isArabic: isArabic);
regionHospitalList =
await DoctorMapper.sortList(true, regionHospitalList);

@ -372,7 +372,8 @@ class _SearchByHospitalState extends State<SearchByHospital> {
}
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);
List<DoctorList> doctorsList = [];
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 =
await DoctorMapper.sortList(true, regionHospitalList);

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

Loading…
Cancel
Save