|
|
|
@ -46,6 +46,9 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
bool isDoctorSearchByNameStarted = false;
|
|
|
|
bool isDoctorSearchByNameStarted = false;
|
|
|
|
|
|
|
|
|
|
|
|
bool isLiveCareSchedule = false;
|
|
|
|
bool isLiveCareSchedule = false;
|
|
|
|
|
|
|
|
bool isGetDocForHealthCal = false;
|
|
|
|
|
|
|
|
int? calculationID = 0;
|
|
|
|
|
|
|
|
bool isSortByClinic = true;
|
|
|
|
|
|
|
|
|
|
|
|
int initialSlotDuration = 0;
|
|
|
|
int initialSlotDuration = 0;
|
|
|
|
|
|
|
|
|
|
|
|
@ -145,6 +148,17 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
bool isBodyPartsLoading = false;
|
|
|
|
bool isBodyPartsLoading = false;
|
|
|
|
int duration = 0;
|
|
|
|
int duration = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setIsSortByClinic(bool value) {
|
|
|
|
|
|
|
|
isSortByClinic = value;
|
|
|
|
|
|
|
|
if (isSortByClinic) {
|
|
|
|
|
|
|
|
doctorsList.sort((a, b) => a.clinicName!.compareTo(b.clinicName!));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
doctorsList.sort((a, b) => a.projectName!.compareTo(b.projectName!));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BookAppointmentsViewModel(
|
|
|
|
BookAppointmentsViewModel(
|
|
|
|
{required this.bookAppointmentsRepo,
|
|
|
|
{required this.bookAppointmentsRepo,
|
|
|
|
required this.errorHandlerService,
|
|
|
|
required this.errorHandlerService,
|
|
|
|
@ -294,6 +308,8 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void onTabChanged(int index) {
|
|
|
|
void onTabChanged(int index) {
|
|
|
|
|
|
|
|
calculationID = null;
|
|
|
|
|
|
|
|
isGetDocForHealthCal = false;
|
|
|
|
selectedTabIndex = index;
|
|
|
|
selectedTabIndex = index;
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -333,8 +349,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getLiveCareScheduleClinics({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
Future<void> getLiveCareScheduleClinics({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
liveCareClinicsList.clear();
|
|
|
|
liveCareClinicsList.clear();
|
|
|
|
final result =
|
|
|
|
final result = await bookAppointmentsRepo.getLiveCareScheduleClinics(_appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!);
|
|
|
|
await bookAppointmentsRepo.getLiveCareScheduleClinics(_appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.fold(
|
|
|
|
result.fold(
|
|
|
|
(failure) async => await errorHandlerService.handleError(failure: failure),
|
|
|
|
(failure) async => await errorHandlerService.handleError(failure: failure),
|
|
|
|
@ -356,9 +371,8 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getLiveCareDoctorsList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
Future<void> getLiveCareDoctorsList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
doctorsList.clear();
|
|
|
|
doctorsList.clear();
|
|
|
|
final result = await bookAppointmentsRepo.getLiveCareDoctorsList(
|
|
|
|
final result =
|
|
|
|
selectedLiveCareClinic.serviceID!, _appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!,
|
|
|
|
await bookAppointmentsRepo.getLiveCareDoctorsList(selectedLiveCareClinic.serviceID!, _appState.getAuthenticatedUser()!.age!, _appState.getAuthenticatedUser()!.gender!, onError: onError);
|
|
|
|
onError: onError);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.fold(
|
|
|
|
result.fold(
|
|
|
|
(failure) async {
|
|
|
|
(failure) async {
|
|
|
|
@ -381,11 +395,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: Make the API dynamic with parameters for ProjectID, isNearest, languageID, doctorId, doctorName
|
|
|
|
//TODO: Make the API dynamic with parameters for ProjectID, isNearest, languageID, doctorId, doctorName
|
|
|
|
Future<void> getDoctorsList(
|
|
|
|
Future<void> getDoctorsList({int projectID = 0, bool isNearest = true, int doctorId = 0, String doctorName = "", Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
{int projectID = 0, bool isNearest = true, int doctorId = 0,
|
|
|
|
|
|
|
|
String doctorName = "",
|
|
|
|
|
|
|
|
Function(dynamic)? onSuccess,
|
|
|
|
|
|
|
|
Function(String)? onError}) async {
|
|
|
|
|
|
|
|
doctorsList.clear();
|
|
|
|
doctorsList.clear();
|
|
|
|
projectID = currentlySelectedHospitalFromRegionFlow != null ? int.parse(currentlySelectedHospitalFromRegionFlow!) : projectID;
|
|
|
|
projectID = currentlySelectedHospitalFromRegionFlow != null ? int.parse(currentlySelectedHospitalFromRegionFlow!) : projectID;
|
|
|
|
final result =
|
|
|
|
final result =
|
|
|
|
@ -418,14 +428,39 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: GetDockets & Calculations For Health Calculator
|
|
|
|
|
|
|
|
Future<void> getDoctorsListByHealthCal({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
|
|
|
|
doctorsList.clear();
|
|
|
|
|
|
|
|
final result = await bookAppointmentsRepo.getDoctorsListByHealthCal(calculationID!);
|
|
|
|
|
|
|
|
result.fold(
|
|
|
|
|
|
|
|
(failure) async {
|
|
|
|
|
|
|
|
isDoctorsListLoading = false;
|
|
|
|
|
|
|
|
if (onError != null) onError("No doctors found for the search criteria".needTranslation);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
(apiResponse) {
|
|
|
|
|
|
|
|
if (apiResponse.messageStatus == 2) {
|
|
|
|
|
|
|
|
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
|
|
|
|
|
|
|
|
} else if (apiResponse.messageStatus == 1) {
|
|
|
|
|
|
|
|
doctorsList = apiResponse.data!;
|
|
|
|
|
|
|
|
setIsSortByClinic(true);
|
|
|
|
|
|
|
|
filteredDoctorList = doctorsList;
|
|
|
|
|
|
|
|
isDoctorsListLoading = false;
|
|
|
|
|
|
|
|
initializeFilteredList();
|
|
|
|
|
|
|
|
clearSearchFilters();
|
|
|
|
|
|
|
|
getFiltersFromDoctorList();
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
if (onSuccess != null) {
|
|
|
|
|
|
|
|
onSuccess(apiResponse);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getMappedDoctors(
|
|
|
|
Future<void> getMappedDoctors(
|
|
|
|
{int projectID = 0,
|
|
|
|
{int projectID = 0, bool isNearest = false, int doctorId = 0, String doctorName = "", isContinueDentalPlan = false, Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
bool isNearest = false,
|
|
|
|
|
|
|
|
int doctorId = 0,
|
|
|
|
|
|
|
|
String doctorName = "",
|
|
|
|
|
|
|
|
isContinueDentalPlan = false,
|
|
|
|
|
|
|
|
Function(dynamic)? onSuccess,
|
|
|
|
|
|
|
|
Function(String)? onError}) async {
|
|
|
|
|
|
|
|
filteredHospitalList = null;
|
|
|
|
filteredHospitalList = null;
|
|
|
|
hospitalList = null;
|
|
|
|
hospitalList = null;
|
|
|
|
isRegionListLoading = true;
|
|
|
|
isRegionListLoading = true;
|
|
|
|
@ -461,8 +496,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getDoctorProfile({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
Future<void> getDoctorProfile({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
final result = await bookAppointmentsRepo
|
|
|
|
final result = await bookAppointmentsRepo.getDoctorProfile(selectedDoctor.clinicID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, onError: onError);
|
|
|
|
.getDoctorProfile(selectedDoctor.clinicID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, onError: onError);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.fold(
|
|
|
|
result.fold(
|
|
|
|
(failure) async {},
|
|
|
|
(failure) async {},
|
|
|
|
@ -521,8 +555,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
// :
|
|
|
|
// :
|
|
|
|
date = DateUtil.convertStringToDateSaudiTimezone(element, int.parse(selectedDoctor.projectID.toString()));
|
|
|
|
date = DateUtil.convertStringToDateSaudiTimezone(element, int.parse(selectedDoctor.projectID.toString()));
|
|
|
|
slotsList.add(FreeSlot(date, ['slot']));
|
|
|
|
slotsList.add(FreeSlot(date, ['slot']));
|
|
|
|
docFreeSlots.add(TimeSlot(
|
|
|
|
docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element));
|
|
|
|
isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element));
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
@ -541,8 +574,8 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
|
|
|
|
final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
|
|
|
|
Map<DateTime, List> _eventsParsed;
|
|
|
|
Map<DateTime, List> _eventsParsed;
|
|
|
|
|
|
|
|
|
|
|
|
final result = await bookAppointmentsRepo.getLiveCareDoctorFreeSlots(selectedDoctor.clinicID ?? 0, selectedLiveCareClinic.serviceID ?? 0,
|
|
|
|
final result = await bookAppointmentsRepo.getLiveCareDoctorFreeSlots(
|
|
|
|
selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, isBookingForLiveCare,
|
|
|
|
selectedDoctor.clinicID ?? 0, selectedLiveCareClinic.serviceID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, isBookingForLiveCare,
|
|
|
|
onError: onError);
|
|
|
|
onError: onError);
|
|
|
|
|
|
|
|
|
|
|
|
result.fold(
|
|
|
|
result.fold(
|
|
|
|
@ -566,8 +599,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
// :
|
|
|
|
// :
|
|
|
|
date = DateUtil.convertStringToDateSaudiTimezone(element, int.parse(selectedDoctor.projectID.toString()));
|
|
|
|
date = DateUtil.convertStringToDateSaudiTimezone(element, int.parse(selectedDoctor.projectID.toString()));
|
|
|
|
slotsList.add(FreeSlot(date, ['slot']));
|
|
|
|
slotsList.add(FreeSlot(date, ['slot']));
|
|
|
|
docFreeSlots.add(TimeSlot(
|
|
|
|
docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element));
|
|
|
|
isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element));
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
@ -579,10 +611,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> cancelAppointment(
|
|
|
|
Future<void> cancelAppointment({required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
{required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel,
|
|
|
|
|
|
|
|
Function(dynamic)? onSuccess,
|
|
|
|
|
|
|
|
Function(String)? onError}) async {
|
|
|
|
|
|
|
|
final result = await bookAppointmentsRepo.cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel);
|
|
|
|
final result = await bookAppointmentsRepo.cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel);
|
|
|
|
|
|
|
|
|
|
|
|
result.fold(
|
|
|
|
result.fold(
|
|
|
|
@ -666,15 +695,13 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async {
|
|
|
|
await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async {
|
|
|
|
navigationService.pop();
|
|
|
|
navigationService.pop();
|
|
|
|
Future.delayed(Duration(milliseconds: 50)).then((value) async {});
|
|
|
|
Future.delayed(Duration(milliseconds: 50)).then((value) async {});
|
|
|
|
LoadingUtils.showFullScreenLoader(
|
|
|
|
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation);
|
|
|
|
barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation);
|
|
|
|
|
|
|
|
await insertSpecificAppointment(
|
|
|
|
await insertSpecificAppointment(
|
|
|
|
onError: (err) {},
|
|
|
|
onError: (err) {},
|
|
|
|
onSuccess: (apiResp) async {
|
|
|
|
onSuccess: (apiResp) async {
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
await Future.delayed(Duration(milliseconds: 50)).then((value) async {
|
|
|
|
await Future.delayed(Duration(milliseconds: 50)).then((value) async {
|
|
|
|
LoadingUtils.showFullScreenLoader(
|
|
|
|
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr());
|
|
|
|
barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr());
|
|
|
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 4000)).then((value) {
|
|
|
|
await Future.delayed(Duration(milliseconds: 4000)).then((value) {
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
@ -764,15 +791,13 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async {
|
|
|
|
await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async {
|
|
|
|
navigationService.pop();
|
|
|
|
navigationService.pop();
|
|
|
|
Future.delayed(Duration(milliseconds: 50)).then((value) async {});
|
|
|
|
Future.delayed(Duration(milliseconds: 50)).then((value) async {});
|
|
|
|
LoadingUtils.showFullScreenLoader(
|
|
|
|
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation);
|
|
|
|
barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation);
|
|
|
|
|
|
|
|
await insertSpecificAppointment(
|
|
|
|
await insertSpecificAppointment(
|
|
|
|
onError: (err) {},
|
|
|
|
onError: (err) {},
|
|
|
|
onSuccess: (apiResp) async {
|
|
|
|
onSuccess: (apiResp) async {
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
await Future.delayed(Duration(milliseconds: 50)).then((value) async {
|
|
|
|
await Future.delayed(Duration(milliseconds: 50)).then((value) async {
|
|
|
|
LoadingUtils.showFullScreenLoader(
|
|
|
|
LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr());
|
|
|
|
barrierDismissible: true, isSuccessDialog: true, loadingText: LocaleKeys.appointmentSuccess.tr());
|
|
|
|
|
|
|
|
await Future.delayed(Duration(milliseconds: 4000)).then((value) {
|
|
|
|
await Future.delayed(Duration(milliseconds: 4000)).then((value) {
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
LoadingUtils.hideFullScreenLoader();
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
Navigator.pushAndRemoveUntil(
|
|
|
|
@ -846,9 +871,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
filteredHospitalList = RegionList();
|
|
|
|
filteredHospitalList = RegionList();
|
|
|
|
|
|
|
|
|
|
|
|
var list = isHMG
|
|
|
|
var list = isHMG ? hospitalList?.registeredDoctorMap![selectedRegionId]!.hmgDoctorList : hospitalList?.registeredDoctorMap![selectedRegionId]!.hmcDoctorList;
|
|
|
|
? hospitalList?.registeredDoctorMap![selectedRegionId]!.hmgDoctorList
|
|
|
|
|
|
|
|
: hospitalList?.registeredDoctorMap![selectedRegionId]!.hmcDoctorList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (list != null && list.isEmpty) {
|
|
|
|
if (list != null && list.isEmpty) {
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
@ -931,8 +954,8 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void setSelections(List<String>? selectedFacilityForFilters, List<String>? selectedRegionForFilters, String? selectedClinicForFilters,
|
|
|
|
void setSelections(
|
|
|
|
PatientDoctorAppointmentList? selectedHospitalForFilters, bool applyFilters) {
|
|
|
|
List<String>? selectedFacilityForFilters, List<String>? selectedRegionForFilters, String? selectedClinicForFilters, PatientDoctorAppointmentList? selectedHospitalForFilters, bool applyFilters) {
|
|
|
|
this.selectedFacilityForFilters = selectedFacilityForFilters;
|
|
|
|
this.selectedFacilityForFilters = selectedFacilityForFilters;
|
|
|
|
this.selectedClinicForFilters = selectedClinicForFilters;
|
|
|
|
this.selectedClinicForFilters = selectedClinicForFilters;
|
|
|
|
this.selectedHospitalForFilters = selectedHospitalForFilters;
|
|
|
|
this.selectedHospitalForFilters = selectedHospitalForFilters;
|
|
|
|
@ -1000,15 +1023,11 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
List<DoctorsListResponseModel> getDoctorListAsPerSelection() {
|
|
|
|
List<DoctorsListResponseModel> getDoctorListAsPerSelection() {
|
|
|
|
if (!applyFilters) return doctorsList;
|
|
|
|
if (!applyFilters) return doctorsList;
|
|
|
|
|
|
|
|
|
|
|
|
if ((selectedRegionForFilters?.isEmpty == true) &&
|
|
|
|
if ((selectedRegionForFilters?.isEmpty == true) && (selectedFacilityForFilters?.isEmpty == true) && selectedClinicForFilters == null && selectedHospitalForFilters == null) {
|
|
|
|
(selectedFacilityForFilters?.isEmpty == true) &&
|
|
|
|
|
|
|
|
selectedClinicForFilters == null &&
|
|
|
|
|
|
|
|
selectedHospitalForFilters == null) {
|
|
|
|
|
|
|
|
return doctorsList;
|
|
|
|
return doctorsList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var list = doctorsList.where((element) {
|
|
|
|
var list = doctorsList.where((element) {
|
|
|
|
var isInSelectedRegion =
|
|
|
|
var isInSelectedRegion = (selectedRegionForFilters?.isEmpty == true) ? true : selectedRegionForFilters?.any((region) => region == element.getRegionName(isArabic()));
|
|
|
|
(selectedRegionForFilters?.isEmpty == true) ? true : selectedRegionForFilters?.any((region) => region == element.getRegionName(isArabic()));
|
|
|
|
|
|
|
|
var shouldApplyFacilityFilter = (selectedFacilityForFilters?.isEmpty == true) ? false : true;
|
|
|
|
var shouldApplyFacilityFilter = (selectedFacilityForFilters?.isEmpty == true) ? false : true;
|
|
|
|
var isHMC = (selectedFacilityForFilters?.isEmpty == true) ? true : selectedFacilityForFilters?.any((item) => item.contains("hmc"));
|
|
|
|
var isHMC = (selectedFacilityForFilters?.isEmpty == true) ? true : selectedFacilityForFilters?.any((item) => item.contains("hmc"));
|
|
|
|
var isInSelectedClinic = (selectedClinicForFilters == null) ? true : selectedClinicForFilters == element.clinicName;
|
|
|
|
var isInSelectedClinic = (selectedClinicForFilters == null) ? true : selectedClinicForFilters == element.clinicName;
|
|
|
|
@ -1059,8 +1078,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
dentalChiefComplaintsList.clear();
|
|
|
|
dentalChiefComplaintsList.clear();
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
int patientID = _appState.isAuthenticated ? _appState.getAuthenticatedUser()!.patientId ?? -1 : -1;
|
|
|
|
int patientID = _appState.isAuthenticated ? _appState.getAuthenticatedUser()!.patientId ?? -1 : -1;
|
|
|
|
final result = await bookAppointmentsRepo.getDentalChiefComplaintsList(
|
|
|
|
final result = await bookAppointmentsRepo.getDentalChiefComplaintsList(patientID: patientID, projectID: int.parse(currentlySelectedHospitalFromRegionFlow ?? "0"), clinicID: 17);
|
|
|
|
patientID: patientID, projectID: int.parse(currentlySelectedHospitalFromRegionFlow ?? "0"), clinicID: 17);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.fold(
|
|
|
|
result.fold(
|
|
|
|
(failure) async => await errorHandlerService.handleError(failure: failure),
|
|
|
|
(failure) async => await errorHandlerService.handleError(failure: failure),
|
|
|
|
|