-
-
-
-
-
-
-
-
{{ token.label }}
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
+
-
-
-
+
-
-
-
-
+
+
+
-
- {{ $t('catalog.modes.explore') }}
-
-
-
- {{ $t('catalog.modes.quote') }}
-
-
+
+
+ {{ chip.label }}
+
+
+
@@ -232,8 +253,12 @@ const props = defineProps<{
selectMode?: SelectMode
searchQuery?: string
// Catalog mode props
- showCatalogModeToggle?: boolean
catalogMode?: CatalogMode
+ // Quote mode props
+ productLabel?: string
+ hubLabel?: string
+ quantity?: string
+ canSearch?: boolean
}>()
defineEmits([
@@ -247,8 +272,8 @@ defineEmits([
'edit-token',
'remove-token',
'update:search-query',
- // Catalog mode
- 'set-catalog-mode'
+ // Quote mode
+ 'search'
])
const localePath = useLocalePath()
diff --git a/app/composables/useCatalogSearch.ts b/app/composables/useCatalogSearch.ts
index 97dea50..81cf90c 100644
--- a/app/composables/useCatalogSearch.ts
+++ b/app/composables/useCatalogSearch.ts
@@ -243,6 +243,11 @@ export function useCatalogSearch() {
return !!(productId.value && (hubId.value || supplierId.value))
})
+ // Labels for Quote mode display
+ const productLabel = computed(() => getLabel('product', productId.value))
+ const hubLabel = computed(() => getLabel('hub', hubId.value))
+ const supplierLabel = computed(() => getLabel('supplier', supplierId.value))
+
return {
// State
selectMode,
@@ -262,6 +267,9 @@ export function useCatalogSearch() {
activeTokens,
availableChips,
canSearch,
+ productLabel,
+ hubLabel,
+ supplierLabel,
// Actions
startSelect,
diff --git a/app/layouts/topnav.vue b/app/layouts/topnav.vue
index e7a693d..7682eee 100644
--- a/app/layouts/topnav.vue
+++ b/app/layouts/topnav.vue
@@ -16,8 +16,11 @@
:available-chips="availableChips"
:select-mode="selectMode"
:search-query="searchQuery"
- :show-catalog-mode-toggle="isCatalogSection"
:catalog-mode="catalogMode"
+ :product-label="productLabel"
+ :hub-label="hubLabel"
+ :quantity="quantity"
+ :can-search="canSearch"
@toggle-theme="toggleTheme"
@sign-out="onClickSignOut"
@sign-in="signIn()"
@@ -27,7 +30,7 @@
@edit-token="editFilter"
@remove-token="removeFilter"
@update:search-query="searchQuery = $event"
- @set-catalog-mode="setCatalogMode"
+ @search="onSearch"
/>
@@ -61,7 +64,10 @@ const {
removeFilter,
editFilter,
catalogMode,
- setCatalogMode
+ productLabel,
+ hubLabel,
+ quantity,
+ canSearch
} = useCatalogSearch()
// Collapsible header for catalog pages
@@ -234,4 +240,15 @@ watch(theme, (value) => applyTheme(value))
const toggleTheme = () => {
theme.value = theme.value === 'night' ? 'cupcake' : 'night'
}
+
+// Search handler for Quote mode - emits event that page can handle
+const localePath = useLocalePath()
+const router = useRouter()
+const onSearch = () => {
+ // Navigate to catalog page which will handle the search
+ if (!route.path.includes('/catalog')) {
+ router.push({ path: localePath('/catalog'), query: { ...route.query, mode: 'quote' } })
+ }
+ // The page component will react to canSearch becoming true and perform the search
+}