Add cascading filters for Explore mode
All checks were successful
Build Docker Image / build (push) Successful in 3m34s

When a product is selected, hubs and suppliers are filtered
to show only those that are relevant to that product.
This commit is contained in:
Ruslan Bakiev
2026-01-24 11:58:56 +07:00
parent 726c63efb7
commit 8c753edb28
4 changed files with 110 additions and 6 deletions

View File

@@ -119,8 +119,8 @@ const {
setHubFilter,
clearFilters: clearProductFilters
} = useCatalogProducts()
const { items: hubs, isLoading: hubsLoading, isLoadingMore: hubsLoadingMore, canLoadMore: hubsCanLoadMore, loadMore: loadMoreHubs, init: initHubs } = useCatalogHubs()
const { items: suppliers, isLoading: suppliersLoading, isLoadingMore: suppliersLoadingMore, canLoadMore: suppliersCanLoadMore, loadMore: loadMoreSuppliers, init: initSuppliers } = useCatalogSuppliers()
const { items: hubs, isLoading: hubsLoading, isLoadingMore: hubsLoadingMore, canLoadMore: hubsCanLoadMore, loadMore: loadMoreHubs, init: initHubs, setProductFilter: setHubProductFilter } = useCatalogHubs()
const { items: suppliers, isLoading: suppliersLoading, isLoadingMore: suppliersLoadingMore, canLoadMore: suppliersCanLoadMore, loadMore: loadMoreSuppliers, init: initSuppliers, setProductFilter: setSupplierProductFilter } = useCatalogSuppliers()
// Filtered items by map bounds
const filteredProducts = computed(() => {
@@ -196,6 +196,12 @@ watch([supplierId, hubId], ([newSupplierId, newHubId]) => {
}
}, { immediate: true })
// Apply product filter to hubs and suppliers (cascading filter)
watch(productId, (newProductId) => {
setHubProductFilter(newProductId || null)
setSupplierProductFilter(newProductId || null)
}, { immediate: true })
// Offers data for quote results
const offers = ref<any[]>([])
const offersLoading = ref(false)