Fix InfoPanel for offers - supplier name and map point
Some checks failed
Build Docker Image / build (push) Has been cancelled

- Show supplier name with loading state instead of "View Supplier" link
- Fix offer coordinates on map (use locationLatitude/locationLongitude)
This commit is contained in:
Ruslan Bakiev
2026-01-27 12:12:05 +07:00
parent c152a5b14c
commit c39bc55ebc
2 changed files with 31 additions and 12 deletions

View File

@@ -41,16 +41,22 @@
{{ formatPrice(entity.pricePerUnit) }} {{ entity.currency || 'RUB' }}/{{ entity.unit || 't' }} {{ formatPrice(entity.pricePerUnit) }} {{ entity.currency || 'RUB' }}/{{ entity.unit || 't' }}
</p> </p>
<!-- Supplier link for offer --> <!-- Supplier for offer -->
<div v-if="entityType === 'offer'" class="text-sm text-white/70 flex items-center gap-1 mt-1">
<Icon name="lucide:factory" size="14" />
<span v-if="loadingSuppliers" class="loading loading-spinner loading-xs" />
<span v-else-if="supplierDisplayName">
{{ supplierDisplayName }}
</span>
<button <button
v-if="entityType === 'offer' && entity?.teamUuid" v-else-if="entity?.teamUuid"
class="text-sm text-primary hover:underline flex items-center gap-1 mt-1" class="text-primary hover:underline"
@click="emit('open-info', 'supplier', entity.teamUuid)" @click="emit('open-info', 'supplier', entity.teamUuid)"
> >
<Icon name="lucide:factory" size="14" /> {{ $t('catalog.info.viewSupplier') }}
{{ entity.supplierName || entity.teamName || $t('catalog.info.viewSupplier') }}
</button> </button>
</div> </div>
</div>
<!-- Products Section (for hub/supplier) --> <!-- Products Section (for hub/supplier) -->
<section v-if="entityType === 'hub' || entityType === 'supplier'"> <section v-if="entityType === 'hub' || entityType === 'supplier'">
@@ -209,6 +215,16 @@ const entityIcon = computed(() => {
return 'lucide:info' return 'lucide:info'
}) })
// Supplier name for offer (from entity or relatedSuppliers)
const supplierDisplayName = computed(() => {
if (props.entity?.supplierName) return props.entity.supplierName
if (props.entity?.teamName) return props.entity.teamName
if (relatedSuppliers.value.length > 0 && relatedSuppliers.value[0]?.name) {
return relatedSuppliers.value[0].name
}
return null
})
// Format price // Format price
const formatPrice = (price: number | string) => { const formatPrice = (price: number | string) => {
const num = typeof price === 'string' ? parseFloat(price) : price const num = typeof price === 'string' ? parseFloat(price) : price

View File

@@ -298,12 +298,15 @@ const relatedPoints = computed(() => {
}> = [] }> = []
// Add current entity first (the one we're viewing in InfoPanel) // Add current entity first (the one we're viewing in InfoPanel)
if (entity.value?.latitude && entity.value?.longitude) { // For offers, coordinates are in locationLatitude/locationLongitude
const lat = entity.value?.latitude ?? entity.value?.locationLatitude
const lon = entity.value?.longitude ?? entity.value?.locationLongitude
if (lat && lon) {
points.push({ points.push({
uuid: infoId.value.uuid, uuid: infoId.value.uuid,
name: entity.value.name || '', name: entity.value.name || entity.value.productName || '',
latitude: Number(entity.value.latitude), latitude: Number(lat),
longitude: Number(entity.value.longitude), longitude: Number(lon),
type: infoId.value.type type: infoId.value.type
}) })
} }