fix(catalog): use supplier.uuid instead of teamUuid for navigation
All checks were successful
Build Docker Image / build (push) Successful in 5m25s
All checks were successful
Build Docker Image / build (push) Successful in 5m25s
- SupplierCard.vue: use supplier.uuid in link generation - products/[id].vue: get uuid from supplier profile and use it for navigation Fixes 404 errors on supplier pages
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<component
|
||||
:is="linkable ? NuxtLink : 'div'"
|
||||
:to="linkable ? localePath(`/catalog/suppliers/${supplier.teamUuid || supplier.uuid}`) : undefined"
|
||||
:to="linkable ? localePath(`/catalog/suppliers/${supplier.uuid}`) : undefined"
|
||||
class="block"
|
||||
:class="{ 'cursor-pointer': selectable }"
|
||||
@click="selectable && $emit('select')"
|
||||
@@ -69,7 +69,7 @@ defineEmits<{
|
||||
const localePath = useLocalePath()
|
||||
const { t } = useI18n()
|
||||
|
||||
const linkable = computed(() => !props.selectable && (props.supplier.teamUuid || props.supplier.uuid))
|
||||
const linkable = computed(() => !props.selectable && props.supplier.uuid)
|
||||
|
||||
const reliabilityLabel = computed(() => {
|
||||
if (props.supplier.onTimeRate !== undefined && props.supplier.onTimeRate !== null) {
|
||||
|
||||
@@ -144,10 +144,10 @@
|
||||
<Grid :cols="1" :md="2" :lg="3" :gap="4">
|
||||
<Card
|
||||
v-for="supplier in uniqueSuppliers"
|
||||
:key="supplier.teamUuid"
|
||||
:key="supplier.uuid"
|
||||
padding="md"
|
||||
interactive
|
||||
@click="navigateTo(localePath(`/catalog/suppliers/${supplier.teamUuid}`))"
|
||||
@click="navigateTo(localePath(`/catalog/suppliers/${supplier.uuid}`))"
|
||||
>
|
||||
<Stack direction="row" align="center" gap="3">
|
||||
<IconCircle tone="primary">
|
||||
@@ -243,17 +243,18 @@ const findProduct = (products: any[]) => {
|
||||
|
||||
// Unique suppliers from offers
|
||||
const uniqueSuppliers = computed(() => {
|
||||
const suppliers = new Map<string, { teamUuid: string; name: string; offersCount: number }>()
|
||||
const suppliers = new Map<string, { uuid: string; teamUuid: string; name: string; offersCount: number }>()
|
||||
offers.value.forEach(offer => {
|
||||
if (offer.teamUuid) {
|
||||
const existing = suppliers.get(offer.teamUuid)
|
||||
const supplierInfo = allSuppliers.value.find(s => s.teamUuid === offer.teamUuid)
|
||||
if (existing) {
|
||||
existing.offersCount++
|
||||
} else {
|
||||
} else if (supplierInfo?.uuid) {
|
||||
suppliers.set(offer.teamUuid, {
|
||||
uuid: supplierInfo.uuid,
|
||||
teamUuid: offer.teamUuid,
|
||||
name: supplierInfo?.name || t('catalogProduct.labels.default_supplier'),
|
||||
name: supplierInfo.name || t('catalogProduct.labels.default_supplier'),
|
||||
offersCount: 1
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user