|
|
|
@ -55,20 +55,17 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
|
|
|
|
|
|
|
bool isUpcomingEnabled = true;
|
|
|
|
bool isUpcomingEnabled = true;
|
|
|
|
bool isFetchingLists = false;
|
|
|
|
bool isFetchingLists = false;
|
|
|
|
int selectedBranch = 0;
|
|
|
|
|
|
|
|
int selectedAppointmentIndex = 0;
|
|
|
|
int selectedAppointmentIndex = 0;
|
|
|
|
int selectedAppointmentSubIndex = 0;
|
|
|
|
int selectedAppointmentSubIndex = 0;
|
|
|
|
int selectedAppointmentId = 0;
|
|
|
|
int selectedAppointmentId = 0;
|
|
|
|
|
|
|
|
int selectedBranchIdForAppointments = 0;
|
|
|
|
|
|
|
|
|
|
|
|
List<AppointmentListModel> myAppointments = [];
|
|
|
|
List<AppointmentListModel> myAppointments = [];
|
|
|
|
List<AppointmentListModel> myUpComingAppointments = [];
|
|
|
|
List<AppointmentListModel> myUpComingAppointments = [];
|
|
|
|
List<AppointmentListModel> myFilteredAppointments = [];
|
|
|
|
List<AppointmentListModel> myFilteredAppointments = [];
|
|
|
|
List<FilterListModel> appointmentsFilterOptions = [];
|
|
|
|
List<FilterListModel> appointmentsFilterOptions = [];
|
|
|
|
List<CustomerData> customersAppointments = [];
|
|
|
|
|
|
|
|
List<AppointmentListModel> myFilteredAppointments2 = [];
|
|
|
|
List<AppointmentListModel> myFilteredAppointments2 = [];
|
|
|
|
|
|
|
|
|
|
|
|
// List<ScheduleData> availableSchedules = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isFetchingServices = false;
|
|
|
|
bool isFetchingServices = false;
|
|
|
|
|
|
|
|
|
|
|
|
List<DropValue> branchCategories = [];
|
|
|
|
List<DropValue> branchCategories = [];
|
|
|
|
@ -234,7 +231,6 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
Utils.showToast(genericRespModel.message.toString());
|
|
|
|
Utils.showToast(genericRespModel.message.toString());
|
|
|
|
await getMyAppointmentsForCustomer();
|
|
|
|
await getMyAppointmentsForCustomer();
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
Utils.hideLoading(context);
|
|
|
|
getMyAppointmentsForCustomer();
|
|
|
|
|
|
|
|
navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard);
|
|
|
|
navigateReplaceWithNameUntilRoute(context, AppRoutes.dashboard);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
@ -374,7 +370,7 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
// appointmentStatusEnum.getIdFromAppointmentStatusEnum()]
|
|
|
|
// appointmentStatusEnum.getIdFromAppointmentStatusEnum()]
|
|
|
|
// .isSelected = true;
|
|
|
|
// .isSelected = true;
|
|
|
|
|
|
|
|
|
|
|
|
if (appointmentStatusEnum.getIdFromAppointmentStatusEnum() == 0) {
|
|
|
|
if (appointmentStatusEnum == AppointmentStatusEnum.allAppointments) {
|
|
|
|
myFilteredAppointments = myAppointments;
|
|
|
|
myFilteredAppointments = myAppointments;
|
|
|
|
if (isNeedCustomerFilter) findAppointmentsBasedOnCustomers();
|
|
|
|
if (isNeedCustomerFilter) findAppointmentsBasedOnCustomers();
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
@ -459,10 +455,10 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
|
|
|
|
|
|
|
AppointmentSlots? appointmentSlots;
|
|
|
|
AppointmentSlots? appointmentSlots;
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getAppointmentSlotsInfo({required Map<String, dynamic> map, required BuildContext context, bool isNeedToRebuild = false}) async {
|
|
|
|
Future<void> getAppointmentSlotsInfo({required int branchID, required BuildContext context, bool isNeedToRebuild = false}) async {
|
|
|
|
if (isNeedToRebuild) setState(ViewState.busy);
|
|
|
|
if (isNeedToRebuild) setState(ViewState.busy);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
GenericRespModel genericRespModel = await appointmentRepo.getAppointmentSlots(map);
|
|
|
|
GenericRespModel genericRespModel = await appointmentRepo.getAppointmentSlots(branchID: branchID, fromDate: selectedDateForAppointments, toDate: selectedDateForAppointments);
|
|
|
|
if (genericRespModel.messageStatus == 1) {
|
|
|
|
if (genericRespModel.messageStatus == 1) {
|
|
|
|
appointmentSlots = AppointmentSlots.fromJson(genericRespModel.data);
|
|
|
|
appointmentSlots = AppointmentSlots.fromJson(genericRespModel.data);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -473,9 +469,9 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getMyAppointmentsForProvider(Map<String, dynamic> map) async {
|
|
|
|
Future<void> getMyAppointmentsForProvider({required int branchID}) async {
|
|
|
|
setState(ViewState.busy);
|
|
|
|
setState(ViewState.busy);
|
|
|
|
myAppointments = await appointmentRepo.getMyAppointmentsForProvider(map);
|
|
|
|
myAppointments = await appointmentRepo.getMyAppointmentsForProvidersByFilters(branchID: branchID);
|
|
|
|
myFilteredAppointments = myAppointments;
|
|
|
|
myFilteredAppointments = myAppointments;
|
|
|
|
myUpComingAppointments = myAppointments
|
|
|
|
myUpComingAppointments = myAppointments
|
|
|
|
.where((element) =>
|
|
|
|
.where((element) =>
|
|
|
|
@ -1272,6 +1268,21 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ifAlreadyExistForStringValue({required List<String> list, required String value}) {
|
|
|
|
|
|
|
|
int index = list.indexWhere((element) {
|
|
|
|
|
|
|
|
log("element: $element");
|
|
|
|
|
|
|
|
log("value: $value");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return element == value;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (index != -1) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Rating filter
|
|
|
|
// Rating filter
|
|
|
|
|
|
|
|
|
|
|
|
double branchFilterByRating = 4.0;
|
|
|
|
double branchFilterByRating = 4.0;
|
|
|
|
@ -1285,6 +1296,7 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
List<DropValue> providersDropList = [];
|
|
|
|
List<DropValue> providersDropList = [];
|
|
|
|
List<DropValue> servicesDropList = [];
|
|
|
|
List<DropValue> servicesDropList = [];
|
|
|
|
List<DropValue> itemsDropList = [];
|
|
|
|
List<DropValue> itemsDropList = [];
|
|
|
|
|
|
|
|
List<DropValue> serviceDeliveryTypesDropList = [];
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> fetchAllProviders() async {
|
|
|
|
Future<void> fetchAllProviders() async {
|
|
|
|
if (providersDropList.isNotEmpty) return;
|
|
|
|
if (providersDropList.isNotEmpty) return;
|
|
|
|
@ -1351,6 +1363,25 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
setState(ViewState.idle);
|
|
|
|
setState(ViewState.idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> fetchAllServiceDeliveryTypes() async {
|
|
|
|
|
|
|
|
if (serviceDeliveryTypesDropList.isNotEmpty) return;
|
|
|
|
|
|
|
|
serviceDeliveryTypesDropList.clear();
|
|
|
|
|
|
|
|
setState(ViewState.busy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<EnumsModel> enums = await commonRepo.getEnumTypeValues(enumTypeID: AppEnums.serviceDeliveryTypeEnumId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (EnumsModel element in enums) {
|
|
|
|
|
|
|
|
serviceDeliveryTypesDropList.add(
|
|
|
|
|
|
|
|
DropValue(
|
|
|
|
|
|
|
|
element.enumValue,
|
|
|
|
|
|
|
|
element.enumValueStr,
|
|
|
|
|
|
|
|
"",
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(ViewState.idle);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> populateDataForBranchesFilter() async {
|
|
|
|
Future<void> populateDataForBranchesFilter() async {
|
|
|
|
await fetchAllProviders();
|
|
|
|
await fetchAllProviders();
|
|
|
|
await fetchAllCategories();
|
|
|
|
await fetchAllCategories();
|
|
|
|
@ -1440,7 +1471,6 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
branchesDropList.add(DropValue(element.id ?? 0, element.branchName ?? "N/A", ""));
|
|
|
|
branchesDropList.add(DropValue(element.id ?? 0, element.branchName ?? "N/A", ""));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setState(ViewState.idle);
|
|
|
|
setState(ViewState.idle);
|
|
|
|
|
|
|
|
|
|
|
|
log("branchesDropList: ${branchesDropList.length}");
|
|
|
|
log("branchesDropList: ${branchesDropList.length}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -1449,6 +1479,7 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
await fetchAllCategories();
|
|
|
|
await fetchAllCategories();
|
|
|
|
await fetchAllServices();
|
|
|
|
await fetchAllServices();
|
|
|
|
await fetchAllItems();
|
|
|
|
await fetchAllItems();
|
|
|
|
|
|
|
|
await fetchAllServiceDeliveryTypes();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int appointmentFiltersCounter = 0;
|
|
|
|
int appointmentFiltersCounter = 0;
|
|
|
|
@ -1661,15 +1692,132 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Customer Name Filter for PROVIDER ONLY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> appointmentFilterCustomerNameSearchHistory = [];
|
|
|
|
|
|
|
|
String currentCustomerNameFilter = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void onCurrentCustomerNameFilterChanged(var value) {
|
|
|
|
|
|
|
|
currentCustomerNameFilter = value;
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void removeAppointmentFilterCustomerNameSearchHistory({bool isClear = false, required int index}) {
|
|
|
|
|
|
|
|
if (isClear) {
|
|
|
|
|
|
|
|
appointmentFilterCustomerNameSearchHistory.clear();
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
appointmentFilterCustomerNameSearchHistory.removeAt(index);
|
|
|
|
|
|
|
|
if (appointmentFilterCustomerNameSearchHistory.isEmpty) {
|
|
|
|
|
|
|
|
updateAppointmentFiltersCounter(appointmentFiltersCounter - 1);
|
|
|
|
|
|
|
|
// appointmentFilterSelectedServiceId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void addAppointmentFilterCustomerNameSearchHistory({required String value}) {
|
|
|
|
|
|
|
|
if (appointmentFilterCustomerNameSearchHistory.isEmpty) {
|
|
|
|
|
|
|
|
updateAppointmentFiltersCounter(appointmentFiltersCounter + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!ifAlreadyExistForStringValue(list: appointmentFilterCustomerNameSearchHistory, value: value)) {
|
|
|
|
|
|
|
|
appointmentFilterCustomerNameSearchHistory.add(value);
|
|
|
|
|
|
|
|
currentCustomerNameFilter = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// MOBILE PHONE Filter for PROVIDER ONLY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String currentMobilePhoneFilter = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void onCurrentMobilePhoneFilterChanged(var value) {
|
|
|
|
|
|
|
|
currentMobilePhoneFilter = value;
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> appointmentFilterMobilePhoneSearchHistory = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void removeAppointmentFilterMobilePhoneSearchHistory({bool isClear = false, required int index}) {
|
|
|
|
|
|
|
|
if (isClear) {
|
|
|
|
|
|
|
|
appointmentFilterMobilePhoneSearchHistory.clear();
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
appointmentFilterMobilePhoneSearchHistory.removeAt(index);
|
|
|
|
|
|
|
|
if (appointmentFilterMobilePhoneSearchHistory.isEmpty) {
|
|
|
|
|
|
|
|
updateAppointmentFiltersCounter(appointmentFiltersCounter - 1);
|
|
|
|
|
|
|
|
// appointmentFilterSelectedServiceId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void addAppointmentFilterMobilePhoneSearchHistory({required String value}) {
|
|
|
|
|
|
|
|
if (appointmentFilterMobilePhoneSearchHistory.isEmpty) {
|
|
|
|
|
|
|
|
updateAppointmentFiltersCounter(appointmentFiltersCounter + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!ifAlreadyExistForStringValue(list: appointmentFilterMobilePhoneSearchHistory, value: value)) {
|
|
|
|
|
|
|
|
appointmentFilterMobilePhoneSearchHistory.add(value);
|
|
|
|
|
|
|
|
currentMobilePhoneFilter = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Service Delivery Types For PROVIDER ONLY
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DropValue> appointmentFilterServiceDeliverySearchHistory = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void removeAppointmentFilterServiceDeliverySearchHistory({bool isClear = false, required int index}) {
|
|
|
|
|
|
|
|
if (isClear) {
|
|
|
|
|
|
|
|
appointmentFilterServiceDeliverySearchHistory.clear();
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
appointmentFilterServiceDeliverySearchHistory.removeAt(index);
|
|
|
|
|
|
|
|
if (appointmentFilterServiceDeliverySearchHistory.isEmpty) {
|
|
|
|
|
|
|
|
updateAppointmentFiltersCounter(appointmentFiltersCounter - 1);
|
|
|
|
|
|
|
|
// appointmentFilterSelectedServiceId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void addAppointmentFilterServiceDeliverySearchHistory({required DropValue value}) {
|
|
|
|
|
|
|
|
if (appointmentFilterServiceDeliverySearchHistory.isEmpty) {
|
|
|
|
|
|
|
|
updateAppointmentFiltersCounter(appointmentFiltersCounter + 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appointmentFilterServiceDeliverySearchHistory.add(value);
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SelectionModel appointmentFilterSelectedServiceDeliveryId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void updateAppointmentFilterSelectedServiceDeliveryId(SelectionModel id, {bool isForSearch = false}) async {
|
|
|
|
|
|
|
|
if (isForSearch) {
|
|
|
|
|
|
|
|
DropValue itemsDrop = serviceDeliveryTypesDropList.firstWhere((element) => element.id == id.selectedId);
|
|
|
|
|
|
|
|
if (!ifAlreadyExist(list: appointmentFilterServiceDeliverySearchHistory, value: itemsDrop)) {
|
|
|
|
|
|
|
|
addAppointmentFilterServiceDeliverySearchHistory(value: itemsDrop);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// appointmentFilterSelectedServiceId = id;
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void clearAppointmentFilterSelections() {
|
|
|
|
void clearAppointmentFilterSelections() {
|
|
|
|
appointmentFilterSelectedProviderId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
appointmentFilterSelectedProviderId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
appointmentFilterSelectedCategoryId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
appointmentFilterSelectedCategoryId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
appointmentFilterSelectedServiceId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
appointmentFilterSelectedServiceId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
appointmentFilterSelectedItemId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
appointmentFilterSelectedItemId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
|
|
|
|
appointmentFilterSelectedServiceDeliveryId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
appointmentFilterSelectedBranchId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
appointmentFilterSelectedBranchId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void clearAppointmentFilters() {
|
|
|
|
void clearAppointmentFilters() {
|
|
|
|
|
|
|
|
appointmentFilterServiceDeliverySearchHistory.clear();
|
|
|
|
|
|
|
|
appointmentFilterCustomerNameSearchHistory.clear();
|
|
|
|
|
|
|
|
appointmentFilterMobilePhoneSearchHistory.clear();
|
|
|
|
appointmentFilterItemsSearchHistory.clear();
|
|
|
|
appointmentFilterItemsSearchHistory.clear();
|
|
|
|
appointmentFilterServicesSearchHistory.clear();
|
|
|
|
appointmentFilterServicesSearchHistory.clear();
|
|
|
|
appointmentFilterCategorySearchHistory.clear();
|
|
|
|
appointmentFilterCategorySearchHistory.clear();
|
|
|
|
@ -1677,11 +1825,16 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
appointmentFilterBranchSearchHistory.clear();
|
|
|
|
appointmentFilterBranchSearchHistory.clear();
|
|
|
|
appointmentFiltersCounter = 0;
|
|
|
|
appointmentFiltersCounter = 0;
|
|
|
|
clearAppointmentFilterSelections();
|
|
|
|
clearAppointmentFilterSelections();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (AppState().currentAppType == AppType.provider) {
|
|
|
|
|
|
|
|
getMyAppointmentsForProvider(branchID: selectedBranchIdForAppointments);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
getMyAppointmentsForCustomer();
|
|
|
|
getMyAppointmentsForCustomer();
|
|
|
|
|
|
|
|
}
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getAppointmentsBasedOnFilters() async {
|
|
|
|
Future<void> getAppointmentsBasedOnFiltersForCustomer() async {
|
|
|
|
setState(ViewState.busy);
|
|
|
|
setState(ViewState.busy);
|
|
|
|
List<String> providersIdsList = [];
|
|
|
|
List<String> providersIdsList = [];
|
|
|
|
if (appointmentFilterProviderSearchHistory.isNotEmpty) {
|
|
|
|
if (appointmentFilterProviderSearchHistory.isNotEmpty) {
|
|
|
|
@ -1725,6 +1878,56 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
setState(ViewState.idle);
|
|
|
|
setState(ViewState.idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String selectedDateForAppointments = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getAppointmentsBasedOnFiltersForProviders({required int branchID}) async {
|
|
|
|
|
|
|
|
setState(ViewState.busy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> servicesIdsList = [];
|
|
|
|
|
|
|
|
if (appointmentFilterServicesSearchHistory.isNotEmpty) {
|
|
|
|
|
|
|
|
for (var element in appointmentFilterServicesSearchHistory) {
|
|
|
|
|
|
|
|
servicesIdsList.add(element.id.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> customerNamesList = [];
|
|
|
|
|
|
|
|
if (appointmentFilterCustomerNameSearchHistory.isNotEmpty) {
|
|
|
|
|
|
|
|
for (var element in appointmentFilterCustomerNameSearchHistory) {
|
|
|
|
|
|
|
|
customerNamesList.add(element.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> customerPhonesList = [];
|
|
|
|
|
|
|
|
if (appointmentFilterMobilePhoneSearchHistory.isNotEmpty) {
|
|
|
|
|
|
|
|
for (var element in appointmentFilterMobilePhoneSearchHistory) {
|
|
|
|
|
|
|
|
customerPhonesList.add(element.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> customerDeliveryTypesList = [];
|
|
|
|
|
|
|
|
if (appointmentFilterServiceDeliverySearchHistory.isNotEmpty) {
|
|
|
|
|
|
|
|
for (var element in appointmentFilterServiceDeliverySearchHistory) {
|
|
|
|
|
|
|
|
customerDeliveryTypesList.add(element.id.toString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log("customerNamesList: $customerNamesList");
|
|
|
|
|
|
|
|
log("customerPhonesList: $customerPhonesList");
|
|
|
|
|
|
|
|
log("customerDeliveryTypesList: $customerDeliveryTypesList");
|
|
|
|
|
|
|
|
log("servicesIdsList: $servicesIdsList");
|
|
|
|
|
|
|
|
myAppointments = await appointmentRepo.getMyAppointmentsForProvidersByFilters(
|
|
|
|
|
|
|
|
branchID: branchID,
|
|
|
|
|
|
|
|
customerNamesList: customerNamesList,
|
|
|
|
|
|
|
|
customerPhonesList: customerPhonesList,
|
|
|
|
|
|
|
|
deliveryTypeIdsList: customerDeliveryTypesList,
|
|
|
|
|
|
|
|
serviceProviderServiceIdsList: servicesIdsList,
|
|
|
|
|
|
|
|
fromDate: selectedDateForAppointments,
|
|
|
|
|
|
|
|
toDate: selectedDateForAppointments);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log(" myFilteredAppointments : ${myFilteredAppointments.length}");
|
|
|
|
|
|
|
|
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.allAppointments, isNeedCustomerFilter: true);
|
|
|
|
|
|
|
|
setState(ViewState.idle);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<bool> addProviderToFavorite({required int serviceProviderID, required BuildContext context}) async {
|
|
|
|
Future<bool> addProviderToFavorite({required int serviceProviderID, required BuildContext context}) async {
|
|
|
|
Utils.showLoading(context);
|
|
|
|
Utils.showLoading(context);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|