Use geo offers for quote results
All checks were successful
Build Docker Image / build (push) Successful in 5m9s

This commit is contained in:
Ruslan Bakiev
2026-02-06 18:25:44 +07:00
parent 0453aeae07
commit 87133ed37a
2 changed files with 110 additions and 19 deletions

View File

@@ -34,7 +34,8 @@
:quantity="offer.quantity"
:currency="offer.currency"
:unit="offer.unit"
:stages="[]"
:stages="getOfferStages(offer)"
:total-time-seconds="offer.routes?.[0]?.totalTimeSeconds ?? null"
/>
</div>
</div>
@@ -48,6 +49,7 @@ interface Offer {
productName?: string | null
productUuid?: string | null
supplierName?: string | null
supplierUuid?: string | null
quantity?: number | string | null
unit?: string | null
pricePerUnit?: number | string | null
@@ -55,6 +57,15 @@ interface Offer {
locationName?: string | null
locationCountry?: string | null
locationCountryCode?: string | null
routes?: Array<{
totalTimeSeconds?: number | null
stages?: Array<{
transportType?: string | null
distanceKm?: number | null
travelTimeSeconds?: number | null
fromName?: string | null
} | null> | null
} | null> | null
}
const emit = defineEmits<{
@@ -69,4 +80,17 @@ const props = defineProps<{
const offersWithPrice = computed(() =>
(props.offers || []).filter(o => o?.pricePerUnit != null)
)
const getOfferStages = (offer: Offer) => {
const route = offer.routes?.[0]
if (!route?.stages) return []
return route.stages
.filter((stage): stage is NonNullable<typeof stage> => stage !== null)
.map((stage) => ({
transportType: stage.transportType,
distanceKm: stage.distanceKm,
travelTimeSeconds: stage.travelTimeSeconds,
fromName: stage.fromName
}))
}
</script>