aamir_dev
Faiz Hashmi 1 year ago
parent 2215bbd63b
commit f9a95579dc

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

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

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

Loading…
Cancel
Save