From 0f0b1db3942b5a1387e4407ff3da23ae9b3fb8c4 Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Thu, 5 Feb 2026 19:12:39 +0700 Subject: [PATCH] Unify offers UI to OfferResultCard and require price --- app/components/MapSidebar.vue | 21 ++-- app/components/catalog/CatalogMapPanel.vue | 21 +++- .../catalog/CatalogOffersSection.vue | 17 ++- app/components/catalog/InfoPanel.vue | 9 +- app/components/catalog/OfferCard.vue | 118 ------------------ app/components/catalog/QuotePanel.vue | 16 ++- 6 files changed, 58 insertions(+), 144 deletions(-) delete mode 100644 app/components/catalog/OfferCard.vue diff --git a/app/components/MapSidebar.vue b/app/components/MapSidebar.vue index 25681ee..96fa860 100644 --- a/app/components/MapSidebar.vue +++ b/app/components/MapSidebar.vue @@ -81,15 +81,18 @@
- -
+
{{ t('catalogMap.empty.offers') }}
@@ -136,7 +139,7 @@ interface Offer { validUntil?: string | null } -defineProps<{ +const props = defineProps<{ activeTab: 'hubs' | 'suppliers' | 'offers' hubs: Hub[] suppliers: Supplier[] @@ -152,4 +155,8 @@ defineEmits<{ const localePath = useLocalePath() const { t } = useI18n() + +const offersWithPrice = computed(() => + (props.offers || []).filter(o => o?.pricePerUnit != null) +) diff --git a/app/components/catalog/CatalogMapPanel.vue b/app/components/catalog/CatalogMapPanel.vue index 0f37c38..d97648d 100644 --- a/app/components/catalog/CatalogMapPanel.vue +++ b/app/components/catalog/CatalogMapPanel.vue @@ -38,16 +38,17 @@ @@ -83,10 +84,14 @@ interface Hub { interface Offer { uuid?: string | null title?: string | null + productName?: string | null locationName?: string | null status?: string | null latitude?: number | null longitude?: number | null + pricePerUnit?: number | string | null + currency?: string | null + unit?: string | null } interface Supplier { @@ -114,9 +119,13 @@ const selectedId = ref(null) const { t } = useI18n() +const offersWithPrice = computed(() => + (props.offers || []).filter(o => o?.pricePerUnit != null) +) + const tabs = computed(() => [ { id: 'hubs' as const, label: 'catalogMap.tabs.hubs', count: props.hubs.length }, - { id: 'offers' as const, label: 'catalogMap.tabs.offers', count: props.offers.length }, + { id: 'offers' as const, label: 'catalogMap.tabs.offers', count: offersWithPrice.value.length }, { id: 'suppliers' as const, label: 'catalogMap.tabs.suppliers', count: props.suppliers.length } ]) diff --git a/app/components/catalog/CatalogOffersSection.vue b/app/components/catalog/CatalogOffersSection.vue index 8888ff4..c9c7407 100644 --- a/app/components/catalog/CatalogOffersSection.vue +++ b/app/components/catalog/CatalogOffersSection.vue @@ -14,24 +14,27 @@ - {{ t('common.pagination.showing', { shown: offers.length, total: totalOffers }) }} + {{ t('common.pagination.showing', { shown: offersWithPrice.length, total: totalOffers }) }} - + {{ t('catalogOffersSection.empty.no_offers') }} @@ -51,6 +54,9 @@ interface Offer { status?: string | null validUntil?: string | null lines?: (OfferLine | null)[] | null + pricePerUnit?: number | string | null + currency?: string | null + unit?: string | null } const props = defineProps<{ @@ -63,7 +69,10 @@ const props = defineProps<{ const localePath = useLocalePath() const { t } = useI18n() -const totalOffers = computed(() => props.total ?? props.offers.length) +const offersWithPrice = computed(() => + (props.offers || []).filter(o => o?.pricePerUnit != null) +) +const totalOffers = computed(() => props.total ?? offersWithPrice.value.length) const canLoadMore = computed(() => props.canLoadMore ?? false) const loadMore = () => { props.onLoadMore?.() diff --git a/app/components/catalog/InfoPanel.vue b/app/components/catalog/InfoPanel.vue index 9cdeed2..92a090b 100644 --- a/app/components/catalog/InfoPanel.vue +++ b/app/components/catalog/InfoPanel.vue @@ -129,7 +129,7 @@ {{ $t('catalog.headers.offers') }} - ({{ relatedOffers.length }}) + ({{ offersWithPrice.length }})
-
+
{{ $t('catalog.empty.noOffers') }}
props.relatedProducts ?? []) const relatedHubs = computed(() => props.relatedHubs ?? []) const relatedSuppliers = computed(() => props.relatedSuppliers ?? []) const relatedOffers = computed(() => props.relatedOffers ?? []) +const offersWithPrice = computed(() => + relatedOffers.value.filter(o => o?.pricePerUnit != null) +) // Entity name const entityName = computed(() => { diff --git a/app/components/catalog/OfferCard.vue b/app/components/catalog/OfferCard.vue deleted file mode 100644 index 49c8bdb..0000000 --- a/app/components/catalog/OfferCard.vue +++ /dev/null @@ -1,118 +0,0 @@ - - - diff --git a/app/components/catalog/QuotePanel.vue b/app/components/catalog/QuotePanel.vue index 7bc2041..d0be421 100644 --- a/app/components/catalog/QuotePanel.vue +++ b/app/components/catalog/QuotePanel.vue @@ -14,14 +14,14 @@
-
+

{{ $t('catalog.empty.noOffers') }}

() + +const props = defineProps<{ loading: boolean offers: Offer[] }>() -const emit = defineEmits<{ - 'select-offer': [offer: Offer] -}>() +const offersWithPrice = computed(() => + (props.offers || []).filter(o => o?.pricePerUnit != null) +)