Use offer result cards in catalog and compute routes for supplier offers
All checks were successful
Build Docker Image / build (push) Successful in 5m50s

This commit is contained in:
Ruslan Bakiev
2026-02-05 19:02:26 +07:00
parent f1eb7bc746
commit beb02bd3fc
5 changed files with 61 additions and 43 deletions

View File

@@ -141,12 +141,15 @@
{{ $t('catalog.empty.noOffers') }}
</div>
<div v-else-if="!loadingOffers" class="flex flex-col gap-2">
<OfferCard
<OfferResultCard
v-for="(offer, index) in relatedOffers"
:key="offer.uuid ?? index"
:offer="offer"
compact
selectable
:location-name="offer.locationName || offer.locationCountry || offer.locationName"
: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>
@@ -217,6 +220,7 @@ import type {
InfoSupplierItem,
InfoOfferItem
} from '~/composables/useCatalogInfo'
import type { RouteStageType } from '~/composables/graphql/public/geo-generated'
const props = defineProps<{
entityType: InfoEntityType
@@ -344,4 +348,15 @@ const onSupplierSelect = (supplier: InfoSupplierItem) => {
emit('open-info', 'supplier', supplier.uuid)
}
}
const getOfferStages = (offer: InfoOfferItem) => {
const route = offer.routes?.[0]
if (!route?.stages) return []
return route.stages
.filter((stage): stage is NonNullable<RouteStageType> => stage !== null)
.map(stage => ({
transportType: stage.transportType,
distanceKm: stage.distanceKm
}))
}
</script>