aamir_dev
Faiz Hashmi 9 months ago
parent 2215bbd63b
commit f9a95579dc

@ -1559,18 +1559,19 @@ class AdVM extends BaseVM {
for (var value in specialServiceCards) {
adsSelectedServices.add(value.serviceSelectedId!.selectedId);
}
log("selectionDurationStartDate: $selectionDurationStartDate");
if (selectionDurationStartDate.isNotEmpty) {
// Define the format of the input string
DateTime startDate = DateTime.parse(
"${selectionDurationStartDate.split('-')[2]}-${selectionDurationStartDate.split('-')[1]}-${selectionDurationStartDate.split('-')[0]}",
);
DateTime startDate = DateHelper.parseStringToDate(selectionDurationStartDate);
DateTime currentDate = DateTime.now();
if (startDate.isBefore(currentDate)) {
selectionDurationStartDate = DateHelper.formatAsYearMonthDay(currentDate);
}
}
log("selectionDurationStartDate: $selectionDurationStartDate");
Ads ads = Ads(
id: isAdEditEnabled ? previousAdDetails!.id : null,
adsDurationID: vehicleAdDurationId.selectedId == -1 ? 0 : vehicleAdDurationId.selectedId,

@ -373,10 +373,9 @@ class AppointmentsVM extends BaseVM {
(element.appointmentStatusEnum == AppointmentStatusEnum.booked || element.appointmentStatusEnum == AppointmentStatusEnum.confirmed) &&
(DateHelper.parseStringToDate(element.appointmentDate!).isAfter(DateTime.now())))
.toList();
log("myUpComingAppointments: ${myUpComingAppointments.length}");
}
log("myUpComingAppointments: ${myUpComingAppointments.length}");
if (isNeedCustomerFilter) {
myFilteredAppointmentsForProvider = findAppointmentsBasedOnCustomers(myFilteredAppointmentsForProvider);
}
@ -391,10 +390,9 @@ class AppointmentsVM extends BaseVM {
}
int index = appointmentsFilterOptions.indexWhere((element) => element.id == appointmentStatusEnum.getIdFromAppointmentStatusEnum());
appointmentsFilterOptions[index].isSelected = true;
isAppointmentLoading = true;
notifyListeners();
myFilteredAppointmentsForCustomers = await getAppointmentsBasedOnFiltersForCustomer();
myFilteredAppointmentsForCustomers = await getAppointmentsBasedOnFiltersForCustomer(appointmentStatusEnum: appointmentStatusEnum);
isAppointmentLoading = false;
if (shouldPopulateUpcoming) {
@ -1814,7 +1812,7 @@ class AppointmentsVM extends BaseVM {
notifyListeners();
}
Future<List<AppointmentListModel>> getAppointmentsBasedOnFiltersForCustomer() async {
Future<List<AppointmentListModel>> getAppointmentsBasedOnFiltersForCustomer({required AppointmentStatusEnum appointmentStatusEnum}) async {
try {
setState(ViewState.busy);
List<String> providersIdsList = [];
@ -1854,6 +1852,7 @@ class AppointmentsVM extends BaseVM {
serviceIdsList: servicesIdsList,
itemIdsList: itemIdsList,
branchIdsList: branchesIdsList,
appointmentStatusEnum: appointmentStatusEnum,
);
setState(ViewState.idle);

@ -64,10 +64,10 @@ class DashboardVmCustomer extends BaseVM {
RequestsVM requestsVM = Provider.of<RequestsVM>(context, listen: false);
ChatVM chatVM = Provider.of<ChatVM>(context, listen: false);
appointmentsVM.populateBranchesFilterList();
appointmentsVM.populateAppointmentsFilterList();
adVM.populateAdsFilterList();
requestsVM.populateDataForRequestsFilter();
await appointmentsVM.populateBranchesFilterList();
await appointmentsVM.populateAppointmentsFilterList();
await adVM.populateAdsFilterList();
await requestsVM.populateDataForRequestsFilter();
await appointmentsVM.applyFilterOnAppointmentsVMForCustomers(appointmentStatusEnum: AppointmentStatusEnum.allAppointments, shouldPopulateUpcoming: true);
await appointmentsVM.applyFilterOnBranches(index: 0); // to get all branches!
await appointmentsVM.getMyRecentBranches(); // to get my recent branches

Loading…
Cancel
Save