From 2e9f6bcb51d0e7cba1796c7692188e4ca382d528 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Sun, 27 Apr 2025 11:04:21 +0300 Subject: [PATCH] WD: show nearest doctor item different for search clinic --- .../components/SearchByClinic.dart | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 981bcf04..7e8f345f 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -10,6 +10,7 @@ import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.da import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/DentalComplaints.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/LaserBooking.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/dialog/clinic_list_dialog.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/search_result/SearchResultWithTab.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; @@ -657,6 +658,37 @@ class _SearchByClinicState extends State { v, )); }); + if (nearestAppo) { + doctorsList.forEach((element) { + List doctorByHospital = + _patientDoctorAppointmentListHospital + .where((elementClinic) => + elementClinic.filterName == + element.getProjectCompleteName()) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[ + _patientDoctorAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList! + .add(element); + } else { + _patientDoctorAppointmentListHospital + .add(PatientDoctorAppointmentList( + filterName: element.getProjectCompleteName(), + distanceInKMs: element.projectDistanceInKiloMeters.toString(), + projectTopName: element.projectTopName, + projectBottomName: element.projectBottomName, + patientDoctorAppointment: element, + isHMC: element.isHMC, + )); + } + }); + navigateToSearchResultsForNearestAppointment( + context, doctorsList, _patientDoctorAppointmentListHospital); + return; + } regionHospitalList = await DoctorMapper.getMappedDoctor(doctorsList, isArabic: isArabic); @@ -701,6 +733,23 @@ class _SearchByClinicState extends State { }); } + navigateToSearchResultsForNearestAppointment( + context, + List docList, + List patientDoctorAppointmentListHospital) { + Navigator.push( + context, + FadePage( + page: SearchResults( + isLiveCareAppointment: false, + isDoctorNameSearch: true, + doctorsList: docList, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital, + isDoctorSearchResult: true, + ))); + } + Future navigateToLaserClinic(BuildContext context) async { Navigator.push( context,