diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 205909c9..93cb81e5 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -44,6 +44,8 @@ class DoctorList { List? specialityN; dynamic workingHours; dynamic decimalDoctorRate; + String? projectBottomName; + String? projectTopName; DoctorList( {this.clinicID, @@ -90,7 +92,9 @@ class DoctorList { this.speciality, this.specialityN, this.workingHours, - this.decimalDoctorRate}); + this.decimalDoctorRate, + this.projectBottomName, + this.projectTopName}); DoctorList.fromJson(Map json) { clinicID = json['ClinicID']; @@ -138,6 +142,8 @@ class DoctorList { if (json.containsKey('SpecialityN') && json['SpecialityN'] != null) specialityN = json['SpecialityN'].cast(); workingHours = json['WorkingHours']; decimalDoctorRate = json['DecimalDoctorRate']; + projectBottomName = json['ProjectNameBottom']; + projectTopName = json['ProjectNameTop']; } Map toJson() { @@ -188,6 +194,10 @@ class DoctorList { data['DecimalDoctorRate'] = this.decimalDoctorRate; return data; } + + String getProjectCompleteName(){ + return "${this.projectTopName} ${this.projectBottomName}"; + } } class PatientDoctorAppointmentList { diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index 0cd0da0f..c7989cbf 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -79,13 +79,12 @@ class _SearchState extends State with TickerProviderStateMixin { letterSpacing: -0.48, ), tabs: [ - Text( - TranslationBase.of(context).clinicName, + TranslationBase.of(context).hospitalName, style: TextStyle(fontSize: 12), ), Text( - TranslationBase.of(context).hospitalName, + TranslationBase.of(context).clinicName, style: TextStyle(fontSize: 12), ), Text( @@ -112,8 +111,8 @@ class _SearchState extends State with TickerProviderStateMixin { child: TabBarView( physics: NeverScrollableScrollPhysics(), children: [ - SearchByClinic(clnicIds: widget.clnicIds), SearchByHospital(), + SearchByClinic(clnicIds: widget.clnicIds), SearchByDoctor(), ], controller: _tabController, diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 849a0afc..f89b6349 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -656,7 +656,7 @@ class _SearchByClinicState extends State { _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); } else { _patientDoctorAppointmentListHospital - .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); + .add(PatientDoctorAppointmentList(filterName: element.getProjectCompleteName(), distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); } else {} diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index f5c98d87..55f1a31d 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -111,7 +111,7 @@ class _SearchByDoctorState extends State { _patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element); } else { _patientDoctorAppointmentListHospital - .add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); + .add(PatientDoctorAppointmentList(filterName: element.getProjectCompleteName(), distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); } else { diff --git a/lib/pages/BookAppointment/components/search_by_hospital_name.dart b/lib/pages/BookAppointment/components/search_by_hospital_name.dart index 3de28dff..d6315e35 100644 --- a/lib/pages/BookAppointment/components/search_by_hospital_name.dart +++ b/lib/pages/BookAppointment/components/search_by_hospital_name.dart @@ -70,16 +70,11 @@ class _SearchByHospitalState extends State { value: nearestAppo, onChanged: (bool? value) { nearestAppo = value ?? false; - setState(() { - - }); + setState(() {}); }, ), AutoSizeText( - TranslationBase - .of(context) - .nearestAppo - .trim(), + TranslationBase.of(context).nearestAppo.trim(), maxLines: 1, minFontSize: 10, style: TextStyle( @@ -93,14 +88,12 @@ class _SearchByHospitalState extends State { ], ), ), - mHeight(8), Container( width: double.infinity, decoration: containerRadius(Colors.white, 12), margin: EdgeInsets.only(left: 20, right: 20), - padding: - EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), + padding: EdgeInsets.only(left: 10, right: 10, top: 12, bottom: 12), child: Row( children: [ Flexible( @@ -108,9 +101,7 @@ class _SearchByHospitalState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase - .of(context) - .selectHospital, + TranslationBase.of(context).selectHospital, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -123,9 +114,7 @@ class _SearchByHospitalState extends State { child: DropdownButtonHideUnderline( child: DropdownButton( hint: Text( - TranslationBase - .of(context) - .selectHospital), + TranslationBase.of(context).selectHospital), value: selectedHospital, iconSize: 0, isExpanded: true, @@ -141,8 +130,7 @@ class _SearchByHospitalState extends State { maxLines: 1, minFontSize: 10, style: TextStyle( - fontSize: - SizeConfig.textMultiplier! * 1.6, + fontSize: SizeConfig.textMultiplier! * 1.6, fontWeight: FontWeight.w600, letterSpacing: -0.39, height: 0.8, @@ -151,7 +139,7 @@ class _SearchByHospitalState extends State { // Text('${item.name!}'), ); }).toList(), - onChanged: (HospitalsModel? newValue){ + onChanged: (HospitalsModel? newValue) { getClinicWrtHospital(newValue); setState(() { selectedHospital = newValue; @@ -172,29 +160,28 @@ class _SearchByHospitalState extends State { onTap: () { showClickListDialog(context, clinicIds ?? List.empty(), onSelection: (ListClinicCentralized clincs) { - selectedClinic = clincs; - Navigator.pop(context); - setState(() { - dropdownTitle = clincs.clinicDescription!; - dropdownValue = clincs.clinicID.toString() + + selectedClinic = clincs; + Navigator.pop(context); + setState(() { + dropdownTitle = clincs.clinicDescription!; + dropdownValue = clincs.clinicID.toString() + "-" + clincs.isLiveCareClinicAndOnline.toString() + "-" + clincs.liveCareClinicID.toString() + "-" + - clincs.liveCareServiceID.toString( - ); - }); - getDoctorsList(context); - - context - .read() - .analytics - .appointment - .book_appointment_select_clinic( + clincs.liveCareServiceID.toString(); + }); + getDoctorsList(context); + + context + .read() + .analytics + .appointment + .book_appointment_select_clinic( appointment_type: 'regular', clinic: clincs.clinicDescription); - }); + }); }, child: Container( width: double.infinity, @@ -208,9 +195,7 @@ class _SearchByHospitalState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - TranslationBase - .of(context) - .selectClinic, + TranslationBase.of(context).selectClinic, style: TextStyle( fontSize: 11, letterSpacing: -0.44, @@ -264,9 +249,7 @@ class _SearchByHospitalState extends State { getProjectsList() { GifLoaderDialogUtils.showMyDialog(context); - int languageID = context - .read() - .isArabic ? 1 : 2; + int languageID = context.read().isArabic ? 1 : 2; ClinicListService service = new ClinicListService(); List projectsListLocal = []; service.getProjectsList(languageID, context).then((res) { @@ -289,7 +272,6 @@ class _SearchByHospitalState extends State { }); } - void getClinicWrtHospital(HospitalsModel? newValue) async { GifLoaderDialogUtils.showMyDialog(context); ClinicListService service = new ClinicListService(); @@ -299,43 +281,33 @@ class _SearchByHospitalState extends State { }); List clinicId = []; try { - Map res = await service - .getClinicB - - yHospital( + Map res = await service.getClinicByHospital( projectID: newValue?.mainProjectID.toString() ?? ""); GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { List list = res['ListClinic']; if (list.isEmpty) { - AppToast.showErrorToast(message: - TranslationBase - .of(context) - .NoClinicFound, + AppToast.showErrorToast( + message: TranslationBase.of(context).NoClinicFound, ); } res['ListClinic'].forEach((v) { clinicId.add(ListClinicCentralized.fromJson(v)); }); clinicIds = clinicId; - setState(() { - - }); + setState(() {}); } else { - AppToast.showErrorToast(message: - TranslationBase - .of(context) - .NoClinicFound, + AppToast.showErrorToast( + message: TranslationBase.of(context).NoClinicFound, ); } } catch (e) { print("the error is $e"); - AppToast.showErrorToast(message: - TranslationBase.of(context).NoClinicFound, - ); - GifLoaderDialogUtils.hideDialog(context); - + AppToast.showErrorToast( + message: TranslationBase.of(context).NoClinicFound, + ); + GifLoaderDialogUtils.hideDialog(context); } // .then((res) { @@ -383,8 +355,8 @@ class _SearchByHospitalState extends State { super.dispose(); } - Future navigateToDentalComplaints(BuildContext context, - SearchInfo searchInfo) async { + Future navigateToDentalComplaints( + BuildContext context, SearchInfo searchInfo) async { Navigator.push( context, FadePage( @@ -400,9 +372,7 @@ class _SearchByHospitalState extends State { } callDoctorsSearchAPI(int clinicID) { - int languageID = context - .read() - .isArabic ? 1 : 2; + int languageID = context.read().isArabic ? 1 : 2; GifLoaderDialogUtils.showMyDialog(context); List doctorsList = []; List arr = []; @@ -410,18 +380,18 @@ class _SearchByHospitalState extends State { List result; int numAll; List _patientDoctorAppointmentListHospital = - []; + []; DoctorsListService service = new DoctorsListService(); service .getDoctorsList( - clinicID, - selectedHospital?.mainProjectID.toString() != "" - ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") - : 0, - nearestAppo, - languageID, - null) + clinicID, + selectedHospital?.mainProjectID.toString() != "" + ? int.parse(selectedHospital?.mainProjectID.toString() ?? "-1") + : 0, + nearestAppo, + languageID, + null) .then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { @@ -429,29 +399,29 @@ class _SearchByHospitalState extends State { if (res['DoctorList'].length != 0) { doctorsList.clear(); res['DoctorList'].forEach((v) { - doctorsList.add( DoctorList.fromJson(v)); + doctorsList.add(DoctorList.fromJson(v)); }); doctorsList.forEach((element) { List doctorByHospital = - _patientDoctorAppointmentListHospital - .where( - (elementClinic) => - elementClinic.filterName == element.projectName, - ) - .toList(); + _patientDoctorAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); if (doctorByHospital.length != 0) { _patientDoctorAppointmentListHospital[ - _patientDoctorAppointmentListHospital - .indexOf(doctorByHospital[0])] + _patientDoctorAppointmentListHospital + .indexOf(doctorByHospital[0])] .patientDoctorAppointmentList! .add(element); } else { _patientDoctorAppointmentListHospital.add( PatientDoctorAppointmentList( - filterName: element.projectName, + filterName: element.getProjectCompleteName(), distanceInKMs: - element.projectDistanceInKiloMeters.toString(), + element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element)); } }); @@ -472,27 +442,26 @@ class _SearchByHospitalState extends State { }); } - Future navigateToSearchResults(context, + Future navigateToSearchResults( + context, List docList, List - patientDoctorAppointmentListHospital) async { + patientDoctorAppointmentListHospital) async { Navigator.push( - context, - FadePage( - page: SearchResults( - isLiveCareAppointment: false, - doctorsList: docList, - patientDoctorAppointmentListHospital: - patientDoctorAppointmentListHospital))) + context, + FadePage( + page: SearchResults( + isLiveCareAppointment: false, + doctorsList: docList, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital))) .then((value) { print("navigation return "); dropdownValue = null; dropdownTitle = ""; selectedHospital = null; clinicIds = List.empty(); - setState(() { - - }); + setState(() {}); // getProjectsList(); }); } @@ -522,13 +491,8 @@ class _SearchByHospitalState extends State { searchInfo.clinic = selectedClinic; searchInfo.date = DateTime.now(); - if (context - .read() - .isLogin) { - if (context - .read() - .user - .age! > 12) { + if (context.read().isLogin) { + if (context.read().user.age! > 12) { navigateToDentalComplaints(context, searchInfo); } else { callDoctorsSearchAPI(17); @@ -540,9 +504,9 @@ class _SearchByHospitalState extends State { navigateToLaserClinic(context); // callDoctorsSearchAPI(); } else if (dropdownValue!.split("-")[1] == "true" - // && authProvider.isLogin && - // authUser.patientType == 1 - ) { + // && authProvider.isLogin && + // authUser.patientType == 1 + ) { Navigator.push( context, FadePage( @@ -564,9 +528,7 @@ class _SearchByHospitalState extends State { callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0])); } }); - setState(() { - - }); + setState(() {}); } else { callDoctorsSearchAPI(int.parse(dropdownValue!.split("-")[0])); }