|
|
|
|
@ -1,9 +1,12 @@
|
|
|
|
|
import 'dart:developer';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:mc_common_app/classes/consts.dart';
|
|
|
|
|
import 'package:mc_common_app/config/routes.dart';
|
|
|
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:mc_common_app/models/appointments_models/appointment_list_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/appointments_models/appointment_slots.dart';
|
|
|
|
|
import 'package:mc_common_app/models/appointments_models/service_schedule_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/general_models/enums_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/general_models/generic_resp_model.dart';
|
|
|
|
|
@ -12,13 +15,13 @@ import 'package:mc_common_app/models/general_models/widgets_models.dart';
|
|
|
|
|
import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/provider_branches_models/profile/categroy.dart';
|
|
|
|
|
import 'package:mc_common_app/models/provider_branches_models/profile/services.dart';
|
|
|
|
|
import 'package:mc_common_app/models/provider_branches_models/provider_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/provider_branches_models/provider_profile_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/services_models/item_model.dart';
|
|
|
|
|
import 'package:mc_common_app/models/services_models/service_model.dart';
|
|
|
|
|
import 'package:mc_common_app/repositories/appointment_repo.dart';
|
|
|
|
|
import 'package:mc_common_app/repositories/branch_repo.dart';
|
|
|
|
|
import 'package:mc_common_app/repositories/common_repo.dart';
|
|
|
|
|
import 'package:mc_common_app/repositories/provider_repo.dart';
|
|
|
|
|
import 'package:mc_common_app/services/common_services.dart';
|
|
|
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/enums.dart';
|
|
|
|
|
@ -34,16 +37,13 @@ import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import '../models/appointments_models/appointment_slots.dart';
|
|
|
|
|
|
|
|
|
|
class AppointmentsVM extends BaseVM {
|
|
|
|
|
final CommonRepo commonRepo;
|
|
|
|
|
final CommonAppServices commonServices;
|
|
|
|
|
final ProviderRepo providerRepo;
|
|
|
|
|
final BranchRepo branchRepo;
|
|
|
|
|
final AppointmentRepo scheduleRepo;
|
|
|
|
|
|
|
|
|
|
AppointmentsVM({required this.commonServices, required this.scheduleRepo, required this.providerRepo, required this.commonRepo, required this.branchRepo});
|
|
|
|
|
AppointmentsVM({required this.commonServices, required this.scheduleRepo, required this.commonRepo, required this.branchRepo});
|
|
|
|
|
|
|
|
|
|
bool isUpcommingEnabled = true;
|
|
|
|
|
bool isFetchingLists = false;
|
|
|
|
|
@ -221,7 +221,7 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<FilterListModel> providersFilterOptions = [];
|
|
|
|
|
List<FilterListModel> branchesFilterOptions = [];
|
|
|
|
|
|
|
|
|
|
List<ServiceModel> servicesInCurrentAppointment = [];
|
|
|
|
|
ServiceModel? currentServiceSelection;
|
|
|
|
|
@ -279,11 +279,11 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
value.isSelected = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
appointmentsFilterOptions.forEach((element) {
|
|
|
|
|
for (var element in appointmentsFilterOptions) {
|
|
|
|
|
if (element.id == appointmentStatusEnum.getIdFromAppointmentStatusEnum()) {
|
|
|
|
|
element.isSelected = true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// appointmentsFilterOptions[
|
|
|
|
|
// appointmentStatusEnum.getIdFromAppointmentStatusEnum()]
|
|
|
|
|
// .isSelected = true;
|
|
|
|
|
@ -495,18 +495,20 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
applyFilterOnProviders({required int index}) {
|
|
|
|
|
if (providersFilterOptions.isEmpty) return;
|
|
|
|
|
for (var value in providersFilterOptions) {
|
|
|
|
|
applyFilterOnBranches({required int index}) async {
|
|
|
|
|
if (branchesFilterOptions.isEmpty) return;
|
|
|
|
|
for (var value in branchesFilterOptions) {
|
|
|
|
|
value.isSelected = false;
|
|
|
|
|
}
|
|
|
|
|
providersFilterOptions[index].isSelected = true;
|
|
|
|
|
branchesFilterOptions[index].isSelected = true;
|
|
|
|
|
|
|
|
|
|
await getBranchesBasedOnCategoryFilters(categoryId: branchesFilterOptions[index].id);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<List<ItemData>> getServiceItems(int serviceId) async {
|
|
|
|
|
serviceItemsFromApi.clear();
|
|
|
|
|
serviceItemsFromApi = await providerRepo.getServiceItems(serviceId);
|
|
|
|
|
serviceItemsFromApi = await branchRepo.getServiceItems(serviceId);
|
|
|
|
|
for (var item in serviceItemsFromApi) {
|
|
|
|
|
if (ifItemAlreadySelected(item.id!)) {
|
|
|
|
|
item.isUpdateOrSelected = true;
|
|
|
|
|
@ -783,24 +785,43 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
|
|
|
|
|
List<ServiceModel> branchServices = [];
|
|
|
|
|
|
|
|
|
|
populateBranchesFilterList() {
|
|
|
|
|
providersFilterOptions.clear(); // TODO: THIS SHOULD BE DYNAMIC AND FILTERS SHOULD COME FORM API
|
|
|
|
|
providersFilterOptions = [
|
|
|
|
|
FilterListModel(title: "All Providers", isSelected: true, id: 0),
|
|
|
|
|
FilterListModel(title: "Maintenance", isSelected: false, id: 1),
|
|
|
|
|
FilterListModel(title: "Oil Service", isSelected: false, id: 2),
|
|
|
|
|
FilterListModel(title: "Accessories", isSelected: false, id: 3),
|
|
|
|
|
FilterListModel(title: "Tire Service", isSelected: false, id: 4),
|
|
|
|
|
FilterListModel(title: "Dent and Paint", isSelected: false, id: 5),
|
|
|
|
|
];
|
|
|
|
|
// populateBranchesFilterList() {
|
|
|
|
|
// branchesFilterOptions.clear(); // TODO: THIS SHOULD BE DYNAMIC AND FILTERS SHOULD COME FORM API
|
|
|
|
|
// branchesFilterOptions = [
|
|
|
|
|
// FilterListModel(title: "All Branches", isSelected: true, id: 0),
|
|
|
|
|
// FilterListModel(title: "Maintenance", isSelected: false, id: 1),
|
|
|
|
|
// FilterListModel(title: "Oil Service", isSelected: false, id: 2),
|
|
|
|
|
// FilterListModel(title: "Accessories", isSelected: false, id: 3),
|
|
|
|
|
// FilterListModel(title: "Tire Service", isSelected: false, id: 4),
|
|
|
|
|
// FilterListModel(title: "Dent and Paint", isSelected: false, id: 5),
|
|
|
|
|
// ];
|
|
|
|
|
// notifyListeners();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
Future<void> populateBranchesFilterList() async {
|
|
|
|
|
if (branchesFilterOptions.isNotEmpty) return;
|
|
|
|
|
branchesFilterOptions.clear();
|
|
|
|
|
setOnlyState(ViewState.busy);
|
|
|
|
|
Category category = await branchRepo.fetchBranchCategory();
|
|
|
|
|
category.data?.forEach((element) {
|
|
|
|
|
branchesFilterOptions.add(FilterListModel(id: element.id ?? 0, isSelected: false, title: element.categoryName ?? "N/A"));
|
|
|
|
|
});
|
|
|
|
|
branchesFilterOptions.insert(0, FilterListModel(id: 0, isSelected: true, title: "All Branches"));
|
|
|
|
|
notifyListeners();
|
|
|
|
|
setState(ViewState.idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAllNearBranches({bool isNeedToRebuild = false}) async {
|
|
|
|
|
//TODO: needs to lat,long into API
|
|
|
|
|
getAllNearBranches({bool isNeedToRebuild = false, bool isFromRefresh = false}) async {
|
|
|
|
|
nearbyBranches.clear();
|
|
|
|
|
if (isNeedToRebuild) setState(ViewState.busy);
|
|
|
|
|
nearbyBranches = await providerRepo.getAllNearBranchAndServices();
|
|
|
|
|
|
|
|
|
|
if (isFromRefresh) {
|
|
|
|
|
var selectedBranch = branchesFilterOptions.firstWhere((element) => element.isSelected);
|
|
|
|
|
nearbyBranches = await branchRepo.getBranchesByFilters(categoryIdsList: [selectedBranch.id]);
|
|
|
|
|
setState(ViewState.idle);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
nearbyBranches = await branchRepo.getAllNearBranchAndServices();
|
|
|
|
|
setState(ViewState.idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -833,7 +854,7 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
|
|
|
|
|
getBranchAndServices(int providerId) async {
|
|
|
|
|
providerProfileModel = null;
|
|
|
|
|
providerProfileModel = await providerRepo.getBranchAndServices(providerId);
|
|
|
|
|
providerProfileModel = await branchRepo.getBranchAndServicesByProviderId(providerId);
|
|
|
|
|
setState(ViewState.idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -851,6 +872,13 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int branchFiltersCounter = 0;
|
|
|
|
|
|
|
|
|
|
updateBranchFiltersCounter(int value) {
|
|
|
|
|
branchFiltersCounter = value;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double branchFilterCurrentDistance = 25.0;
|
|
|
|
|
|
|
|
|
|
updateBranchFilterCurrentDistance(double value) {
|
|
|
|
|
@ -868,17 +896,33 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
branchFilterProviderSearchHistory.removeAt(index);
|
|
|
|
|
if (branchFilterProviderSearchHistory.isEmpty) {
|
|
|
|
|
updateBranchFiltersCounter(branchFiltersCounter - 1);
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void addBranchFilterProviderSearchHistory({required DropValue value}) {
|
|
|
|
|
if (branchFilterProviderSearchHistory.isEmpty) {
|
|
|
|
|
updateBranchFiltersCounter(branchFiltersCounter + 1);
|
|
|
|
|
}
|
|
|
|
|
branchFilterProviderSearchHistory.add(value);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SelectionModel branchFilterSelectedProviderId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
|
|
|
|
|
|
void updateBranchFilterSelectedProviderId(SelectionModel id, {bool isForSearch = false}) async {}
|
|
|
|
|
void updateBranchFilterSelectedProviderId(SelectionModel id, {bool isForSearch = false}) async {
|
|
|
|
|
if (isForSearch) {
|
|
|
|
|
DropValue providerDrop = providersDropList.firstWhere((element) => element.id == id.selectedId);
|
|
|
|
|
if (!ifAlreadyExist(list: branchFilterProviderSearchHistory, value: providerDrop)) {
|
|
|
|
|
addBranchFilterProviderSearchHistory(value: providerDrop);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
branchFilterSelectedProviderId = id;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Category Filter
|
|
|
|
|
List<DropValue> branchFilterCategorySearchHistory = [];
|
|
|
|
|
@ -890,10 +934,16 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
branchFilterCategorySearchHistory.removeAt(index);
|
|
|
|
|
if (branchFilterCategorySearchHistory.isEmpty) {
|
|
|
|
|
updateBranchFiltersCounter(branchFiltersCounter - 1);
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void addBranchFilterCategorySearchHistory({required DropValue value}) {
|
|
|
|
|
if (branchFilterCategorySearchHistory.isEmpty) {
|
|
|
|
|
updateBranchFiltersCounter(branchFiltersCounter + 1);
|
|
|
|
|
}
|
|
|
|
|
branchFilterCategorySearchHistory.add(value);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
@ -912,8 +962,6 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Services Filter
|
|
|
|
|
List<DropValue> branchFilterServicesSearchHistory = [];
|
|
|
|
|
|
|
|
|
|
@ -924,10 +972,16 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
branchFilterServicesSearchHistory.removeAt(index);
|
|
|
|
|
if (branchFilterServicesSearchHistory.isEmpty) {
|
|
|
|
|
updateBranchFiltersCounter(branchFiltersCounter - 1);
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void addBranchFilterServicesSearchHistory({required DropValue value}) {
|
|
|
|
|
if (branchFilterServicesSearchHistory.isEmpty) {
|
|
|
|
|
updateBranchFiltersCounter(branchFiltersCounter + 1);
|
|
|
|
|
}
|
|
|
|
|
branchFilterServicesSearchHistory.add(value);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
@ -936,7 +990,7 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
|
|
|
|
|
void updateBranchFilterSelectedServiceId(SelectionModel id, {bool isForSearch = false}) async {
|
|
|
|
|
if (isForSearch) {
|
|
|
|
|
DropValue serviceDrop = categoryDropList.firstWhere((element) => element.id == id.selectedId);
|
|
|
|
|
DropValue serviceDrop = servicesDropList.firstWhere((element) => element.id == id.selectedId);
|
|
|
|
|
if (!ifAlreadyExist(list: branchFilterServicesSearchHistory, value: serviceDrop)) {
|
|
|
|
|
addBranchFilterServicesSearchHistory(value: serviceDrop);
|
|
|
|
|
}
|
|
|
|
|
@ -944,7 +998,6 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
|
|
|
|
|
branchFilterSelectedServiceId = id;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ifAlreadyExist({required List<DropValue> list, required DropValue value}) {
|
|
|
|
|
@ -959,39 +1012,57 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Rating filter
|
|
|
|
|
|
|
|
|
|
double branchFilterByRating = 4.0;
|
|
|
|
|
|
|
|
|
|
updateBranchFilterByRating(double value) {
|
|
|
|
|
branchFilterByRating = value;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<DropValue> categoryDropList = [];
|
|
|
|
|
List<DropValue> servicesDropList = [];
|
|
|
|
|
List<DropValue> providersDropList = [];
|
|
|
|
|
|
|
|
|
|
Future<void> fetchAllProviders() async {
|
|
|
|
|
if (providersDropList.isNotEmpty) return;
|
|
|
|
|
|
|
|
|
|
providersDropList.clear();
|
|
|
|
|
setOnlyState(ViewState.busy);
|
|
|
|
|
providersDropList.clear(); // IN PROGRESS
|
|
|
|
|
List<ProviderBasicDataModel> providers = await branchRepo.getAllProvidersWitheBasicData();
|
|
|
|
|
for (var element in providers) {
|
|
|
|
|
providersDropList.add(
|
|
|
|
|
DropValue(element.id ?? 0, element.providerName ?? "N/A", ""),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
setState(ViewState.idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> fetchAllCategories(String countryCode) async {
|
|
|
|
|
if (categoryDropList.isNotEmpty) return;
|
|
|
|
|
categoryDropList.clear();
|
|
|
|
|
setOnlyState(ViewState.busy);
|
|
|
|
|
Category category = await branchRepo.fetchBranchCategory();
|
|
|
|
|
category.data?.forEach((element) {
|
|
|
|
|
categoryDropList.add(
|
|
|
|
|
DropValue(
|
|
|
|
|
element.id ?? 0,
|
|
|
|
|
((element.categoryName!.isEmpty
|
|
|
|
|
? "N/A"
|
|
|
|
|
: countryCode == "SA"
|
|
|
|
|
? element.categoryNameN
|
|
|
|
|
: element.categoryName) ??
|
|
|
|
|
"N/A"),
|
|
|
|
|
"",
|
|
|
|
|
),
|
|
|
|
|
element.id ?? 0,
|
|
|
|
|
((element.categoryName!.isEmpty
|
|
|
|
|
? "N/A"
|
|
|
|
|
: countryCode == "SA"
|
|
|
|
|
? element.categoryNameN
|
|
|
|
|
: element.categoryName) ??
|
|
|
|
|
"N/A"),
|
|
|
|
|
""),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
setState(ViewState.idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> fetchAllServices() async {
|
|
|
|
|
servicesDropList = [];
|
|
|
|
|
if (servicesDropList.isNotEmpty) return;
|
|
|
|
|
servicesDropList.clear();
|
|
|
|
|
setState(ViewState.busy);
|
|
|
|
|
Services services = await branchRepo.fetchServicesByCategoryId(serviceCategoryId: -1); // to get all services
|
|
|
|
|
|
|
|
|
|
@ -1008,8 +1079,72 @@ class AppointmentsVM extends BaseVM {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> populateDataForBranchesFilter() async {
|
|
|
|
|
await fetchAllProviders(); // saudi arabia
|
|
|
|
|
await fetchAllCategories("SA"); // saudi arabia
|
|
|
|
|
await fetchAllServices(); // saudi arabia
|
|
|
|
|
updateBranchFilterCurrentDistance(25.0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void clearBranchFilters() {
|
|
|
|
|
branchFilterServicesSearchHistory.clear();
|
|
|
|
|
branchFilterCategorySearchHistory.clear();
|
|
|
|
|
branchFilterProviderSearchHistory.clear();
|
|
|
|
|
branchFilterByRating = 4.0;
|
|
|
|
|
branchFilterCurrentDistance = 25.0;
|
|
|
|
|
branchFiltersCounter = 0;
|
|
|
|
|
clearBranchFilterSelections();
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void clearBranchFilterSelections() {
|
|
|
|
|
branchFilterSelectedProviderId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
|
branchFilterSelectedCategoryId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
|
branchFilterSelectedServiceId = SelectionModel(selectedOption: "", selectedId: -1, errorValue: "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> getBranchesBasedOnFilters() async {
|
|
|
|
|
nearbyBranches.clear();
|
|
|
|
|
setState(ViewState.busy);
|
|
|
|
|
List<int> providersIdsList = [];
|
|
|
|
|
if (branchFilterProviderSearchHistory.isNotEmpty) {
|
|
|
|
|
for (var element in branchFilterProviderSearchHistory) {
|
|
|
|
|
providersIdsList.add(element.id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<int> categoryIdsList = [];
|
|
|
|
|
if (branchFilterCategorySearchHistory.isNotEmpty) {
|
|
|
|
|
for (var element in branchFilterCategorySearchHistory) {
|
|
|
|
|
categoryIdsList.add(element.id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<int> servicesIdsList = [];
|
|
|
|
|
if (branchFilterServicesSearchHistory.isNotEmpty) {
|
|
|
|
|
for (var element in branchFilterServicesSearchHistory) {
|
|
|
|
|
servicesIdsList.add(element.id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nearbyBranches = await branchRepo.getBranchesByFilters(
|
|
|
|
|
providerIdsList: providersIdsList.isNotEmpty ? providersIdsList : null,
|
|
|
|
|
categoryIdsList: categoryIdsList.isNotEmpty ? categoryIdsList : null,
|
|
|
|
|
serviceIdsList: servicesIdsList.isNotEmpty ? servicesIdsList : null,
|
|
|
|
|
distanceKm: branchFilterCurrentDistance.toInt(),
|
|
|
|
|
rating: branchFilterByRating.toInt(),
|
|
|
|
|
latitude: 24.694969,
|
|
|
|
|
longitude: 46.724129,
|
|
|
|
|
);
|
|
|
|
|
setState(ViewState.idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> getBranchesBasedOnCategoryFilters({required int categoryId}) async {
|
|
|
|
|
if (categoryId == 0) {
|
|
|
|
|
await getAllNearBranches();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
setState(ViewState.busy);
|
|
|
|
|
|
|
|
|
|
nearbyBranches.clear();
|
|
|
|
|
nearbyBranches = await branchRepo.getBranchesByFilters(categoryIdsList: [categoryId]);
|
|
|
|
|
setState(ViewState.idle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|