From 1287ae9db7104e3960504523a75e8c4dc5cf8b39 Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Fri, 6 Feb 2026 18:44:00 +0700 Subject: [PATCH] Group quote results by calculation --- app/components/catalog/OfferResultCard.vue | 11 ++- app/components/catalog/QuotePanel.vue | 84 +++++++++++++++++----- app/pages/catalog/index.vue | 9 +++ 3 files changed, 83 insertions(+), 21 deletions(-) diff --git a/app/components/catalog/OfferResultCard.vue b/app/components/catalog/OfferResultCard.vue index b5b7ae3..f6135db 100644 --- a/app/components/catalog/OfferResultCard.vue +++ b/app/components/catalog/OfferResultCard.vue @@ -1,5 +1,5 @@ @@ -68,6 +100,11 @@ interface Offer { } | null> | null } +interface OfferGroup { + id: string + offers: Offer[] +} + const emit = defineEmits<{ 'select-offer': [offer: Offer] }>() @@ -75,12 +112,21 @@ const emit = defineEmits<{ const props = defineProps<{ loading: boolean offers: Offer[] + calculations?: OfferGroup[] }>() const offersWithPrice = computed(() => (props.offers || []).filter(o => o?.pricePerUnit != null) ) +const offerGroups = computed(() => { + if (props.calculations?.length) return props.calculations + return offersWithPrice.value.map(offer => ({ + id: offer.uuid, + offers: [offer] + })) +}) + const getOfferStages = (offer: Offer) => { const route = offer.routes?.[0] if (!route?.stages) return [] diff --git a/app/pages/catalog/index.vue b/app/pages/catalog/index.vue index 4099911..4662c4c 100644 --- a/app/pages/catalog/index.vue +++ b/app/pages/catalog/index.vue @@ -68,6 +68,7 @@ v-else-if="showQuoteResults" :loading="offersLoading" :offers="offers" + :calculations="quoteCalculations" @select-offer="onSelectOffer" /> @@ -416,6 +417,14 @@ const relatedPoints = computed(() => { // Offers data for quote results const offers = ref([]) + +const quoteCalculations = computed(() => { + if (!offers.value.length) return [] + return offers.value.map(offer => ({ + id: offer.uuid, + offers: [offer] + })) +}) const offersLoading = ref(false) const showQuoteResults = ref(false)