Redirect search to catalog offers flow instead of /request
All checks were successful
Build Docker Image / build (push) Successful in 4m2s

- GlobalSearchBar now redirects to /catalog/offers/[productId]/[hubId]
- GoodsContent redirects to offers flow
- select-location pages redirect to offers flow
- Added quantity tag to offers page
- Added KYC profile loading and offer detail navigation on offers page
This commit is contained in:
Ruslan Bakiev
2026-01-21 14:59:50 +07:00
parent 16c0a8112e
commit 631effdde4
5 changed files with 86 additions and 42 deletions

View File

@@ -73,6 +73,8 @@
:stages="item.stages"
:start-name="item.name"
:end-name="hub?.name"
:kyc-profile-uuid="getOfferData(item.uuid)?.kycProfileUuid"
@select="navigateTo(localePath(`/catalog/offers/${item.uuid}`))"
/>
</template>
@@ -89,7 +91,7 @@
<script setup lang="ts">
import { GetNodeConnectionsDocument, GetOffersByHubDocument } from '~/composables/graphql/public/geo-generated'
import { GetAvailableProductsDocument, GetOfferDocument } from '~/composables/graphql/public/exchange-generated'
import { GetAvailableProductsDocument, GetOfferDocument, GetSupplierProfileByTeamDocument } from '~/composables/graphql/public/exchange-generated'
definePageMeta({
layout: 'topnav'
@@ -108,9 +110,11 @@ const selectedSourceUuid = ref('')
const hoveredSourceUuid = ref<string>()
const rawSources = ref<any[]>([])
const offersData = ref<Map<string, any>>(new Map())
const suppliersData = ref<Map<string, any>>(new Map())
const productId = computed(() => route.params.productId as string)
const hubId = computed(() => route.params.hubId as string)
const quantity = computed(() => route.query.quantity as string | undefined)
// Navigation filters for search bar badges
const navigationFilters = computed(() => {
@@ -132,6 +136,14 @@ const navigationFilters = computed(() => {
})
}
if (quantity.value) {
filters.push({
id: 'quantity',
key: 'Кол-во',
label: `${quantity.value} т`
})
}
return filters
})
@@ -141,6 +153,9 @@ const handleRemoveFilter = (filterId: string) => {
navigateTo(localePath(`/catalog/offers/${productId.value}`))
} else if (filterId === 'product') {
navigateTo(localePath('/catalog/offers'))
} else if (filterId === 'quantity') {
// Remove quantity from query, stay on same page
navigateTo({ path: route.path, query: {} })
}
}
@@ -213,25 +228,57 @@ const getOfferData = (uuid: string) => {
return offersData.value.get(uuid)
}
// Load offer details for prices
// Load offer details for prices and supplier info
const loadOfferDetails = async () => {
if (rawSources.value.length === 0) {
offersData.value.clear()
suppliersData.value.clear()
return
}
const newOffersData = new Map<string, any>()
const newSuppliersData = new Map<string, any>()
const teamUuidsToLoad = new Set<string>()
// First, load all offers
await Promise.all(rawSources.value.map(async (source) => {
try {
const data = await execute(GetOfferDocument, { uuid: source.sourceUuid }, 'public', 'exchange')
if (data?.getOffer) {
newOffersData.set(source.sourceUuid, data.getOffer)
if (data.getOffer.teamUuid) {
teamUuidsToLoad.add(data.getOffer.teamUuid)
}
}
} catch (error) {
console.error('Error loading offer:', source.sourceUuid, error)
}
}))
// Then, load supplier profiles for KYC
await Promise.all([...teamUuidsToLoad].map(async (teamUuid) => {
try {
const data = await execute(GetSupplierProfileByTeamDocument, { teamUuid }, 'public', 'exchange')
if (data?.getSupplierProfileByTeam) {
newSuppliersData.set(teamUuid, data.getSupplierProfileByTeam)
}
} catch (error) {
console.error('Error loading supplier:', teamUuid, error)
}
}))
// Merge kycProfileUuid into offer data
newOffersData.forEach((offer, offerUuid) => {
if (offer.teamUuid) {
const supplier = newSuppliersData.get(offer.teamUuid)
if (supplier?.kycProfileUuid) {
offer.kycProfileUuid = supplier.kycProfileUuid
}
}
})
offersData.value = newOffersData
suppliersData.value = newSuppliersData
}
// Load offers with routes to this hub