|
|
|
@ -149,7 +149,7 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
navigateWithName(context, AppRoutes.paymentMethodsView, arguments: PaymentTypes.appointment);
|
|
|
|
navigateWithName(context, AppRoutes.paymentMethodsView, arguments: PaymentTypes.appointment);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
Utils.showToast(LocaleKeys.appointmentBookedSuccessfully.tr());
|
|
|
|
Utils.showToast(LocaleKeys.appointmentBookedSuccessfully.tr());
|
|
|
|
getMyAppointments();
|
|
|
|
getMyAppointmentsForCustomer();
|
|
|
|
navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard);
|
|
|
|
navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -181,9 +181,9 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
context.read<DashboardVmCustomer>().onNavbarTapped(1);
|
|
|
|
context.read<DashboardVmCustomer>().onNavbarTapped(1);
|
|
|
|
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.cancelled);
|
|
|
|
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.cancelled);
|
|
|
|
Utils.showToast(genericRespModel.message.toString());
|
|
|
|
Utils.showToast(genericRespModel.message.toString());
|
|
|
|
await getMyAppointments();
|
|
|
|
await getMyAppointmentsForCustomer();
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
getMyAppointments();
|
|
|
|
getMyAppointmentsForCustomer();
|
|
|
|
navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard);
|
|
|
|
navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
@ -350,7 +350,7 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
// notifyListeners();
|
|
|
|
// notifyListeners();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getMyAppointments({bool isNeedToRebuild = false}) async {
|
|
|
|
Future<void> getMyAppointmentsForCustomer({bool isNeedToRebuild = false}) async {
|
|
|
|
if (isNeedToRebuild) setState(ViewState.busy);
|
|
|
|
if (isNeedToRebuild) setState(ViewState.busy);
|
|
|
|
|
|
|
|
|
|
|
|
myAppointments = await appointmentRepo.getMyAppointmentsForCustomersByFilters();
|
|
|
|
myAppointments = await appointmentRepo.getMyAppointmentsForCustomersByFilters();
|
|
|
|
@ -383,7 +383,9 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
setState(ViewState.busy);
|
|
|
|
setState(ViewState.busy);
|
|
|
|
myAppointments = await appointmentRepo.getMyAppointmentsForProvider(map);
|
|
|
|
myAppointments = await appointmentRepo.getMyAppointmentsForProvider(map);
|
|
|
|
myFilteredAppointments = myAppointments;
|
|
|
|
myFilteredAppointments = myAppointments;
|
|
|
|
myUpComingAppointments = myAppointments.where((element) => element.appointmentStatusEnum == AppointmentStatusEnum.confirmed && (DateHelper.parseStringToDate(element.appointmentDate!).isAfter(DateTime.now()))).toList();
|
|
|
|
myUpComingAppointments = myAppointments
|
|
|
|
|
|
|
|
.where((element) => (element.appointmentStatusEnum == AppointmentStatusEnum.confirmed || element.appointmentStatusEnum == AppointmentStatusEnum.booked) && (DateHelper.parseStringToDate(element.appointmentDate!).isAfter(DateTime.now())))
|
|
|
|
|
|
|
|
.toList();
|
|
|
|
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.allAppointments, isNeedCustomerFilter: true);
|
|
|
|
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.allAppointments, isNeedCustomerFilter: true);
|
|
|
|
setState(ViewState.idle);
|
|
|
|
setState(ViewState.idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -802,7 +804,7 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
context.read<DashboardVmCustomer>().onNavbarTapped(1);
|
|
|
|
context.read<DashboardVmCustomer>().onNavbarTapped(1);
|
|
|
|
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.cancelled);
|
|
|
|
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.cancelled);
|
|
|
|
Utils.showToast(genericRespModel.message.toString());
|
|
|
|
Utils.showToast(genericRespModel.message.toString());
|
|
|
|
getMyAppointments();
|
|
|
|
getMyAppointmentsForCustomer();
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard);
|
|
|
|
navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1419,7 +1421,7 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
appointmentFilterBranchSearchHistory.clear();
|
|
|
|
appointmentFilterBranchSearchHistory.clear();
|
|
|
|
appointmentFiltersCounter = 0;
|
|
|
|
appointmentFiltersCounter = 0;
|
|
|
|
clearAppointmentFilterSelections();
|
|
|
|
clearAppointmentFilterSelections();
|
|
|
|
getMyAppointments();
|
|
|
|
getMyAppointmentsForCustomer();
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|