|
|
|
|
@ -363,11 +363,25 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changeTabToArrived() {
|
|
|
|
|
if (patientUpcomingAppointmentsHistoryList.isEmpty && patientArrivedAppointmentsHistoryList.isNotEmpty && selectedTabIndex == 0) {
|
|
|
|
|
selectedTabIndex = 1;
|
|
|
|
|
updateListWRTTab(1);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Loads full arrived appointments list if not already loaded
|
|
|
|
|
/// This is called when navigating to My Appointments page from landing page
|
|
|
|
|
Future<void> loadFullArrivedAppointmentsIfNeeded({Function(dynamic)? onSuccess, Function(String)? onError}) async {
|
|
|
|
|
// Skip if already loaded
|
|
|
|
|
if (isFullArrivedAppointmentsLoaded) {
|
|
|
|
|
// Auto-switch to Arrived tab if no upcoming appointments (even when data is already loaded)
|
|
|
|
|
if (patientUpcomingAppointmentsHistoryList.isEmpty && patientArrivedAppointmentsHistoryList.isNotEmpty && selectedTabIndex == 0) {
|
|
|
|
|
selectedTabIndex = 1;
|
|
|
|
|
updateListWRTTab(1);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -394,8 +408,14 @@ class MyAppointmentsViewModel extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
isMyAppointmentsLoading = false;
|
|
|
|
|
|
|
|
|
|
// Auto-switch to Arrived tab if no upcoming appointments
|
|
|
|
|
if (patientUpcomingAppointmentsHistoryList.isEmpty && patientArrivedAppointmentsHistoryList.isNotEmpty && selectedTabIndex == 0) {
|
|
|
|
|
selectedTabIndex = 1;
|
|
|
|
|
updateListWRTTab(1);
|
|
|
|
|
} else {
|
|
|
|
|
// Update filtered list based on current tab
|
|
|
|
|
updateListWRTTab(selectedTabIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
if (onSuccess != null) {
|
|
|
|
|
|