diff --git a/app/components/catalog/QuotePanel.vue b/app/components/catalog/QuotePanel.vue index 50d16f5..42fd6de 100644 --- a/app/components/catalog/QuotePanel.vue +++ b/app/components/catalog/QuotePanel.vue @@ -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" /> @@ -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 => stage !== null) + .map((stage) => ({ + transportType: stage.transportType, + distanceKm: stage.distanceKm, + travelTimeSeconds: stage.travelTimeSeconds, + fromName: stage.fromName + })) +} diff --git a/app/pages/catalog/index.vue b/app/pages/catalog/index.vue index 5ab9d40..4099911 100644 --- a/app/pages/catalog/index.vue +++ b/app/pages/catalog/index.vue @@ -83,11 +83,33 @@