Show routes in hub info panel offers
All checks were successful
Build Docker Image / build (push) Successful in 3m47s

Replace OfferCard with OfferResultCard when displaying offers
for a hub after product selection. This shows the route stages
and distance to the hub instead of just offer info.
This commit is contained in:
Ruslan Bakiev
2026-01-26 08:36:14 +07:00
parent 2b6cccdead
commit 6d916d65a0

View File

@@ -139,12 +139,15 @@
<p>{{ $t('catalog.empty.noOffers') }}</p>
</div>
<div v-else class="flex flex-col gap-2">
<OfferCard
<OfferResultCard
v-for="offer in relatedOffers"
:key="offer.uuid"
:offer="offer"
selectable
compact
:location-name="offer.locationName || offer.productName"
:product-name="offer.productName"
:price-per-unit="offer.pricePerUnit ? Number(offer.pricePerUnit) : null"
:currency="offer.currency"
:unit="offer.unit"
:stages="getOfferStages(offer)"
@select="onOfferSelect(offer)"
/>
</div>
@@ -317,4 +320,14 @@ const onOfferSelect = (offer: any) => {
emit('open-info', 'offer', offer.uuid)
}
}
// Extract route stages for OfferResultCard
const getOfferStages = (offer: any) => {
const route = offer.routes?.[0]
if (!route?.stages) return []
return route.stages.filter(Boolean).map((stage: any) => ({
transportType: stage?.transportType,
distanceKm: stage?.distanceKm
}))
}
</script>