|
|
|
|
@ -55,6 +55,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
bool isAppointmentDataToBeLoaded = true;
|
|
|
|
|
bool isMyDoctorsDataToBeLoaded = true;
|
|
|
|
|
bool isArrivedAppointmentDataLoaded = false;
|
|
|
|
|
|
|
|
|
|
bool isEyeMeasurementsAppointmentsLoading = false;
|
|
|
|
|
|
|
|
|
|
@ -76,7 +77,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
List<PatientAppointmentHistoryResponseModel> patientUpcomingAppointmentsHistoryList = [];
|
|
|
|
|
List<PatientAppointmentHistoryResponseModel> patientArrivedAppointmentsHistoryList = [];
|
|
|
|
|
|
|
|
|
|
List<PatientAppointmentHistoryResponseModel> patientTimelineAppointmentsList = [];
|
|
|
|
|
List<PatientAppointmentHistoryResponseModel> patientAllArrivedAppointmentsHistoryList = [];
|
|
|
|
|
|
|
|
|
|
List<PatientAppointmentHistoryResponseModel> patientMyDoctorsList = [];
|
|
|
|
|
|
|
|
|
|
@ -172,7 +173,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
patientAppointmentsHistoryList.clear();
|
|
|
|
|
patientUpcomingAppointmentsHistoryList.clear();
|
|
|
|
|
patientArrivedAppointmentsHistoryList.clear();
|
|
|
|
|
patientTimelineAppointmentsList.clear();
|
|
|
|
|
patientAllArrivedAppointmentsHistoryList.clear();
|
|
|
|
|
patientEyeMeasurementsAppointmentsHistoryList.clear();
|
|
|
|
|
isMyAppointmentsLoading = true;
|
|
|
|
|
isTimeLineAppointmentsLoading = true;
|
|
|
|
|
@ -266,7 +267,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> getPatientAppointments(bool isActiveAppointment, bool isArrivedAppointments, {Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
|
Future<void> getPatientAppointments(bool isActiveAppointment, bool isArrivedAppointments, {bool isForTimeLine = false, Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
|
if (patientArrivedAppointmentsHistoryList.isNotEmpty) {
|
|
|
|
|
isPatientHasQueueAppointment = false;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
@ -277,12 +278,11 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
}
|
|
|
|
|
if (!isAppointmentDataToBeLoaded) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
patientAppointmentsByClinic.clear();
|
|
|
|
|
patientAppointmentsByHospital.clear();
|
|
|
|
|
patientAppointmentsViewList.clear();
|
|
|
|
|
|
|
|
|
|
patientTimelineAppointmentsList.clear();
|
|
|
|
|
patientAllArrivedAppointmentsHistoryList.clear();
|
|
|
|
|
filteredAppointmentList.clear();
|
|
|
|
|
patientAppointmentsHistoryList.clear();
|
|
|
|
|
patientUpcomingAppointmentsHistoryList.clear();
|
|
|
|
|
@ -291,7 +291,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
final results = await Future.wait([
|
|
|
|
|
myAppointmentsRepo.getPatientAppointments(isActiveAppointment: isActiveAppointment, isArrivedAppointments: isArrivedAppointments),
|
|
|
|
|
myAppointmentsRepo.getPatientAppointments(isActiveAppointment: false, isArrivedAppointments: true),
|
|
|
|
|
myAppointmentsRepo.getPatientAppointments(isActiveAppointment: false, isArrivedAppointments: true, isForTimeLine: isForTimeLine),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
results[0].fold(
|
|
|
|
|
@ -320,6 +320,10 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
patientArrivedAppointmentsHistoryList = apiResponse.data!;
|
|
|
|
|
isMyAppointmentsLoading = false;
|
|
|
|
|
isAppointmentDataToBeLoaded = false;
|
|
|
|
|
if (!isForTimeLine) {
|
|
|
|
|
patientAllArrivedAppointmentsHistoryList = apiResponse.data!;
|
|
|
|
|
isArrivedAppointmentDataLoaded = true;
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
if (onSuccess != null) {
|
|
|
|
|
onSuccess(apiResponse);
|
|
|
|
|
|