Replace breadcrumbs with key-value badges in search bar
All checks were successful
Build Docker Image / build (push) Successful in 4m0s
All checks were successful
Build Docker Image / build (push) Successful in 4m0s
- Add key property to FilterOption interface in CatalogSearchBar - Display badges in "Key: Value" format (e.g., "Поставщик: Name") - Remove SuppliersBreadcrumbs from supplier catalog pages - Add navigationFilters computed with supplier/product/hub badges - Add handleRemoveFilter to navigate back when badge is clicked
This commit is contained in:
@@ -6,6 +6,14 @@
|
||||
map-id="supplier-route-map"
|
||||
point-color="#10b981"
|
||||
>
|
||||
<template #searchBar>
|
||||
<CatalogSearchBar
|
||||
:active-filters="navigationFilters"
|
||||
:show-counter="false"
|
||||
@remove-filter="handleRemoveFilter"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #header>
|
||||
<!-- Not Found -->
|
||||
<Card v-if="!isLoading && (!supplier || !product || !hub)" padding="lg">
|
||||
@@ -23,16 +31,6 @@
|
||||
|
||||
<!-- Content Header -->
|
||||
<Stack v-else gap="4">
|
||||
<!-- Breadcrumbs -->
|
||||
<SuppliersBreadcrumbs
|
||||
:supplier-id="supplierId"
|
||||
:supplier-name="supplier?.name"
|
||||
:product-id="productId"
|
||||
:product-name="product?.name"
|
||||
:hub-id="hubId"
|
||||
:hub-name="hub?.name"
|
||||
/>
|
||||
|
||||
<!-- Header -->
|
||||
<div>
|
||||
<Heading :level="1">{{ product?.name }}</Heading>
|
||||
@@ -130,6 +128,48 @@ const supplierId = computed(() => routeRef.params.supplierId as string)
|
||||
const productId = computed(() => routeRef.params.productId as string)
|
||||
const hubId = computed(() => routeRef.params.hubId as string)
|
||||
|
||||
// Navigation filters for search bar badges
|
||||
const navigationFilters = computed(() => {
|
||||
const filters: Array<{ id: string; label: string; key: string }> = []
|
||||
|
||||
if (supplier.value?.name) {
|
||||
filters.push({
|
||||
id: 'supplier',
|
||||
key: 'Поставщик',
|
||||
label: supplier.value.name
|
||||
})
|
||||
}
|
||||
|
||||
if (product.value?.name) {
|
||||
filters.push({
|
||||
id: 'product',
|
||||
key: 'Товар',
|
||||
label: product.value.name
|
||||
})
|
||||
}
|
||||
|
||||
if (hub.value?.name) {
|
||||
filters.push({
|
||||
id: 'hub',
|
||||
key: 'Хаб',
|
||||
label: hub.value.name
|
||||
})
|
||||
}
|
||||
|
||||
return filters
|
||||
})
|
||||
|
||||
// Handle removing navigation filter (navigate back)
|
||||
const handleRemoveFilter = (filterId: string) => {
|
||||
if (filterId === 'hub') {
|
||||
navigateTo(localePath(`/catalog/suppliers/${supplierId.value}/${productId.value}`))
|
||||
} else if (filterId === 'product') {
|
||||
navigateTo(localePath(`/catalog/suppliers/${supplierId.value}`))
|
||||
} else if (filterId === 'supplier') {
|
||||
navigateTo(localePath('/catalog/suppliers'))
|
||||
}
|
||||
}
|
||||
|
||||
// Map items - show source and destination
|
||||
const routePoints = computed(() => {
|
||||
const points: Array<{ uuid: string; name: string; latitude: number; longitude: number }> = []
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
<template #searchBar="{ displayedCount, totalCount }">
|
||||
<CatalogSearchBar
|
||||
v-model:search-query="searchQuery"
|
||||
:active-filters="navigationFilters"
|
||||
:displayed-count="displayedCount"
|
||||
:total-count="totalCount"
|
||||
@remove-filter="handleRemoveFilter"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -35,14 +37,6 @@
|
||||
|
||||
<!-- Content Header -->
|
||||
<Stack v-else gap="4">
|
||||
<!-- Breadcrumbs -->
|
||||
<SuppliersBreadcrumbs
|
||||
:supplier-id="supplierId"
|
||||
:supplier-name="supplier?.name"
|
||||
:product-id="productId"
|
||||
:product-name="product?.name"
|
||||
/>
|
||||
|
||||
<!-- Header -->
|
||||
<div>
|
||||
<Heading :level="1">{{ product?.name }}</Heading>
|
||||
@@ -116,6 +110,38 @@ const hoveredHubId = ref<string>()
|
||||
const supplierId = computed(() => routeRef.params.supplierId as string)
|
||||
const productId = computed(() => routeRef.params.productId as string)
|
||||
|
||||
// Navigation filters for search bar badges
|
||||
const navigationFilters = computed(() => {
|
||||
const filters: Array<{ id: string; label: string; key: string }> = []
|
||||
|
||||
if (supplier.value?.name) {
|
||||
filters.push({
|
||||
id: 'supplier',
|
||||
key: 'Поставщик',
|
||||
label: supplier.value.name
|
||||
})
|
||||
}
|
||||
|
||||
if (product.value?.name) {
|
||||
filters.push({
|
||||
id: 'product',
|
||||
key: 'Товар',
|
||||
label: product.value.name
|
||||
})
|
||||
}
|
||||
|
||||
return filters
|
||||
})
|
||||
|
||||
// Handle removing navigation filter (navigate back)
|
||||
const handleRemoveFilter = (filterId: string) => {
|
||||
if (filterId === 'product') {
|
||||
navigateTo(localePath(`/catalog/suppliers/${supplierId.value}`))
|
||||
} else if (filterId === 'supplier') {
|
||||
navigateTo(localePath('/catalog/suppliers'))
|
||||
}
|
||||
}
|
||||
|
||||
// Search
|
||||
const searchQuery = ref('')
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
<template #searchBar="{ displayedCount, totalCount }">
|
||||
<CatalogSearchBar
|
||||
v-model:search-query="searchQuery"
|
||||
:active-filters="navigationFilters"
|
||||
:displayed-count="displayedCount"
|
||||
:total-count="totalCount"
|
||||
@remove-filter="handleRemoveFilter"
|
||||
/>
|
||||
</template>
|
||||
|
||||
@@ -33,9 +35,6 @@
|
||||
|
||||
<!-- Content Header -->
|
||||
<Stack v-else gap="4">
|
||||
<!-- Breadcrumbs -->
|
||||
<SuppliersBreadcrumbs :supplier-id="supplierId" :supplier-name="supplier?.name" />
|
||||
|
||||
<!-- Header with supplier info -->
|
||||
<div class="flex items-start gap-4">
|
||||
<!-- Logo -->
|
||||
@@ -100,6 +99,28 @@ const offers = ref<any[]>([])
|
||||
|
||||
const supplierId = computed(() => route.params.supplierId as string)
|
||||
|
||||
// Navigation filters for search bar badges
|
||||
const navigationFilters = computed(() => {
|
||||
const filters: Array<{ id: string; label: string; key: string }> = []
|
||||
|
||||
if (supplier.value?.name) {
|
||||
filters.push({
|
||||
id: 'supplier',
|
||||
key: 'Поставщик',
|
||||
label: supplier.value.name
|
||||
})
|
||||
}
|
||||
|
||||
return filters
|
||||
})
|
||||
|
||||
// Handle removing navigation filter (navigate back)
|
||||
const handleRemoveFilter = (filterId: string) => {
|
||||
if (filterId === 'supplier') {
|
||||
navigateTo(localePath('/catalog/suppliers'))
|
||||
}
|
||||
}
|
||||
|
||||
// Search
|
||||
const searchQuery = ref('')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user