Resolve supplier names for offer cards
All checks were successful
Build Docker Image / build (push) Successful in 4m34s
All checks were successful
Build Docker Image / build (push) Successful in 4m34s
This commit is contained in:
@@ -159,7 +159,7 @@
|
|||||||
<OfferResultCard
|
<OfferResultCard
|
||||||
v-for="(offer, index) in offersWithPrice"
|
v-for="(offer, index) in offersWithPrice"
|
||||||
:key="offer.uuid ?? index"
|
:key="offer.uuid ?? index"
|
||||||
:supplier-name="offer.supplierName"
|
:supplier-name="getOfferSupplierName(offer)"
|
||||||
:location-name="offer.locationName || offer.locationCountry || offer.country || offer.locationName"
|
:location-name="offer.locationName || offer.locationCountry || offer.country || offer.locationName"
|
||||||
:product-name="offer.productName"
|
:product-name="offer.productName"
|
||||||
:price-per-unit="offer.pricePerUnit ? Number(offer.pricePerUnit) : null"
|
:price-per-unit="offer.pricePerUnit ? Number(offer.pricePerUnit) : null"
|
||||||
@@ -174,7 +174,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Suppliers Section (for hub only) -->
|
<!-- Suppliers Section (for hub only) -->
|
||||||
<section v-if="entityType === 'hub'">
|
<section v-if="entityType === 'hub' && !selectedProduct">
|
||||||
<h3 class="text-sm font-semibold text-white/80 mb-2 flex items-center gap-2">
|
<h3 class="text-sm font-semibold text-white/80 mb-2 flex items-center gap-2">
|
||||||
<Icon name="lucide:factory" size="16" />
|
<Icon name="lucide:factory" size="16" />
|
||||||
{{ $t('catalog.info.suppliersNearby') }}
|
{{ $t('catalog.info.suppliersNearby') }}
|
||||||
@@ -347,6 +347,27 @@ const offersWithPrice = computed(() =>
|
|||||||
relatedOffers.value.filter(o => o?.pricePerUnit != null)
|
relatedOffers.value.filter(o => o?.pricePerUnit != null)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const suppliersByUuid = computed(() => {
|
||||||
|
const map = new Map<string, string>()
|
||||||
|
relatedSuppliers.value.forEach(supplier => {
|
||||||
|
if (supplier?.uuid && supplier?.name) {
|
||||||
|
map.set(supplier.uuid, supplier.name)
|
||||||
|
}
|
||||||
|
if (supplier?.teamUuid && supplier?.name) {
|
||||||
|
map.set(supplier.teamUuid, supplier.name)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return map
|
||||||
|
})
|
||||||
|
|
||||||
|
const getOfferSupplierName = (offer: InfoOfferItem) => {
|
||||||
|
if (offer.supplierName) return offer.supplierName
|
||||||
|
if (offer.supplierUuid && suppliersByUuid.value.has(offer.supplierUuid)) {
|
||||||
|
return suppliersByUuid.value.get(offer.supplierUuid)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
const selectedProductName = computed(() => {
|
const selectedProductName = computed(() => {
|
||||||
if (!props.selectedProduct) return ''
|
if (!props.selectedProduct) return ''
|
||||||
const match = relatedProducts.value.find(p => p.uuid === props.selectedProduct)
|
const match = relatedProducts.value.find(p => p.uuid === props.selectedProduct)
|
||||||
|
|||||||
Reference in New Issue
Block a user