Unify layouts and create CatalogPage component
All checks were successful
Build Docker Image / build (push) Successful in 3m45s
All checks were successful
Build Docker Image / build (push) Successful in 3m45s
- MainNavigation: center tabs on page (absolute positioning) - SubNavigation: align left instead of center - Create CatalogPage universal component for list+map pages - Migrate catalog pages (offers, suppliers, hubs) to CatalogPage - Remove PageHeader from clientarea pages (redundant with navigation) - Add topnav layout to supplier detail page 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<header class="sticky top-0 z-40 bg-base-100 border-b border-base-300">
|
<header class="sticky top-0 z-40 bg-base-100 border-b border-base-300">
|
||||||
<div class="flex items-center justify-between h-16 px-4 lg:px-6">
|
<div class="relative flex items-center h-16 px-4 lg:px-6">
|
||||||
<!-- Left: Logo -->
|
<!-- Left: Logo -->
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<NuxtLink :to="localePath('/')" class="flex items-center gap-2">
|
<NuxtLink :to="localePath('/')" class="flex items-center gap-2">
|
||||||
@@ -8,8 +8,8 @@
|
|||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Center: Main tabs -->
|
<!-- Center: Main tabs (absolutely centered on page) -->
|
||||||
<nav class="hidden md:flex items-center gap-1">
|
<nav class="hidden md:flex items-center gap-1 absolute left-1/2 -translate-x-1/2">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-for="tab in visibleTabs"
|
v-for="tab in visibleTabs"
|
||||||
:key="tab.key"
|
:key="tab.key"
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<!-- Right: Globe + Team + User -->
|
<!-- Right: Globe + Team + User -->
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2 ml-auto">
|
||||||
<!-- Globe (language/currency) dropdown -->
|
<!-- Globe (language/currency) dropdown -->
|
||||||
<div class="dropdown dropdown-end">
|
<div class="dropdown dropdown-end">
|
||||||
<button tabindex="0" class="btn btn-ghost btn-circle">
|
<button tabindex="0" class="btn btn-ghost btn-circle">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<nav v-if="items.length > 0" class="bg-base-100 border-b border-base-300">
|
<nav v-if="items.length > 0" class="bg-base-100 border-b border-base-300">
|
||||||
<div class="flex items-center justify-center gap-1 py-2 px-4 overflow-x-auto">
|
<div class="flex items-center gap-1 py-2 px-4 lg:px-6 overflow-x-auto">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-for="item in items"
|
v-for="item in items"
|
||||||
:key="item.path"
|
:key="item.path"
|
||||||
|
|||||||
239
app/components/page/CatalogPage.vue
Normal file
239
app/components/page/CatalogPage.vue
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
<template>
|
||||||
|
<div class="flex flex-col flex-1 min-h-0">
|
||||||
|
<!-- Loading state -->
|
||||||
|
<div v-if="loading" class="flex-1 flex items-center justify-center">
|
||||||
|
<Card padding="lg">
|
||||||
|
<Stack align="center" justify="center" gap="3">
|
||||||
|
<Spinner />
|
||||||
|
<Text tone="muted">{{ $t('catalogLanding.states.loading') }}</Text>
|
||||||
|
</Stack>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Content -->
|
||||||
|
<template v-else>
|
||||||
|
<!-- With Map: Split Layout -->
|
||||||
|
<template v-if="withMap">
|
||||||
|
<!-- Desktop: side-by-side -->
|
||||||
|
<div class="hidden lg:flex flex-1 gap-4 min-h-0 py-4">
|
||||||
|
<!-- Left: List (scrollable) -->
|
||||||
|
<div class="w-2/5 overflow-y-auto pr-2">
|
||||||
|
<Stack gap="4">
|
||||||
|
<slot name="filters" />
|
||||||
|
|
||||||
|
<Stack gap="3">
|
||||||
|
<div
|
||||||
|
v-for="item in items"
|
||||||
|
:key="item.uuid"
|
||||||
|
:class="{ 'ring-2 ring-primary rounded-lg': item.uuid === selectedId }"
|
||||||
|
@click="onItemClick(item)"
|
||||||
|
>
|
||||||
|
<slot name="card" :item="item" />
|
||||||
|
</div>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<slot name="pagination" />
|
||||||
|
|
||||||
|
<Stack v-if="items.length === 0" align="center" gap="2">
|
||||||
|
<slot name="empty">
|
||||||
|
<Text tone="muted">{{ $t('common.values.not_available') }}</Text>
|
||||||
|
</slot>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Right: Map -->
|
||||||
|
<div class="w-3/5 rounded-lg overflow-hidden">
|
||||||
|
<ClientOnly>
|
||||||
|
<CatalogMap
|
||||||
|
ref="mapRef"
|
||||||
|
:map-id="mapId"
|
||||||
|
:items="itemsWithCoords"
|
||||||
|
:point-color="pointColor"
|
||||||
|
@select-item="onMapSelect"
|
||||||
|
/>
|
||||||
|
</ClientOnly>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Mobile: toggle between list and map -->
|
||||||
|
<div class="lg:hidden flex-1 flex flex-col min-h-0">
|
||||||
|
<div class="flex-1 overflow-y-auto py-4" v-show="mobileView === 'list'">
|
||||||
|
<Stack gap="4">
|
||||||
|
<slot name="filters" />
|
||||||
|
|
||||||
|
<Stack gap="3">
|
||||||
|
<div
|
||||||
|
v-for="item in items"
|
||||||
|
:key="item.uuid"
|
||||||
|
:class="{ 'ring-2 ring-primary rounded-lg': item.uuid === selectedId }"
|
||||||
|
@click="onItemClick(item)"
|
||||||
|
>
|
||||||
|
<slot name="card" :item="item" />
|
||||||
|
</div>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<slot name="pagination" />
|
||||||
|
|
||||||
|
<Stack v-if="items.length === 0" align="center" gap="2">
|
||||||
|
<slot name="empty">
|
||||||
|
<Text tone="muted">{{ $t('common.values.not_available') }}</Text>
|
||||||
|
</slot>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex-1" v-show="mobileView === 'map'">
|
||||||
|
<ClientOnly>
|
||||||
|
<CatalogMap
|
||||||
|
ref="mobileMapRef"
|
||||||
|
:map-id="`${mapId}-mobile`"
|
||||||
|
:items="itemsWithCoords"
|
||||||
|
:point-color="pointColor"
|
||||||
|
@select-item="onMapSelect"
|
||||||
|
/>
|
||||||
|
</ClientOnly>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Mobile toggle -->
|
||||||
|
<div class="fixed bottom-4 left-1/2 -translate-x-1/2 z-30">
|
||||||
|
<div class="btn-group shadow-lg">
|
||||||
|
<button
|
||||||
|
class="btn btn-sm"
|
||||||
|
:class="{ 'btn-active': mobileView === 'list' }"
|
||||||
|
@click="mobileView = 'list'"
|
||||||
|
>
|
||||||
|
{{ $t('common.list') }}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="btn btn-sm"
|
||||||
|
:class="{ 'btn-active': mobileView === 'map' }"
|
||||||
|
@click="mobileView = 'map'"
|
||||||
|
>
|
||||||
|
{{ $t('common.map') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Without Map: Simple List -->
|
||||||
|
<div v-else class="flex-1 overflow-y-auto py-4">
|
||||||
|
<Stack gap="4">
|
||||||
|
<slot name="filters" />
|
||||||
|
|
||||||
|
<Stack gap="3">
|
||||||
|
<div
|
||||||
|
v-for="item in items"
|
||||||
|
:key="item.uuid"
|
||||||
|
@click="onItemClick(item)"
|
||||||
|
>
|
||||||
|
<slot name="card" :item="item" />
|
||||||
|
</div>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
|
<slot name="pagination" />
|
||||||
|
|
||||||
|
<Stack v-if="items.length === 0" align="center" gap="2">
|
||||||
|
<slot name="empty">
|
||||||
|
<Text tone="muted">{{ $t('common.values.not_available') }}</Text>
|
||||||
|
</slot>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
interface MapItem {
|
||||||
|
uuid: string
|
||||||
|
latitude?: number | null
|
||||||
|
longitude?: number | null
|
||||||
|
name?: string
|
||||||
|
country?: string
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<{
|
||||||
|
items: MapItem[]
|
||||||
|
loading?: boolean
|
||||||
|
withMap?: boolean
|
||||||
|
mapId?: string
|
||||||
|
pointColor?: string
|
||||||
|
selectedId?: string
|
||||||
|
}>(), {
|
||||||
|
loading: false,
|
||||||
|
withMap: true,
|
||||||
|
mapId: 'catalog-map',
|
||||||
|
pointColor: '#3b82f6'
|
||||||
|
})
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
'select': [item: MapItem]
|
||||||
|
'update:selectedId': [uuid: string]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
// Filter items with valid coordinates for map
|
||||||
|
const itemsWithCoords = computed(() =>
|
||||||
|
props.items.filter(item =>
|
||||||
|
item.latitude != null &&
|
||||||
|
item.longitude != null &&
|
||||||
|
!isNaN(Number(item.latitude)) &&
|
||||||
|
!isNaN(Number(item.longitude))
|
||||||
|
).map(item => ({
|
||||||
|
uuid: item.uuid,
|
||||||
|
name: item.name || '',
|
||||||
|
latitude: Number(item.latitude),
|
||||||
|
longitude: Number(item.longitude),
|
||||||
|
country: item.country
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
|
||||||
|
// Mobile view toggle
|
||||||
|
const mobileView = ref<'list' | 'map'>('list')
|
||||||
|
|
||||||
|
// Map refs
|
||||||
|
const mapRef = ref<{ flyTo: (lat: number, lng: number, zoom?: number) => void } | null>(null)
|
||||||
|
const mobileMapRef = ref<{ flyTo: (lat: number, lng: number, zoom?: number) => void } | null>(null)
|
||||||
|
|
||||||
|
// Handle item click from list
|
||||||
|
const onItemClick = (item: MapItem) => {
|
||||||
|
emit('select', item)
|
||||||
|
emit('update:selectedId', item.uuid)
|
||||||
|
|
||||||
|
// Fly to item on map
|
||||||
|
if (props.withMap && item.latitude && item.longitude) {
|
||||||
|
mapRef.value?.flyTo(Number(item.latitude), Number(item.longitude), 8)
|
||||||
|
mobileMapRef.value?.flyTo(Number(item.latitude), Number(item.longitude), 8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle selection from map
|
||||||
|
const onMapSelect = (uuid: string) => {
|
||||||
|
const item = props.items.find(i => i.uuid === uuid)
|
||||||
|
if (item) {
|
||||||
|
emit('select', item)
|
||||||
|
emit('update:selectedId', uuid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch selectedId and fly to it
|
||||||
|
watch(() => props.selectedId, (uuid) => {
|
||||||
|
if (uuid && props.withMap) {
|
||||||
|
const item = itemsWithCoords.value.find(i => i.uuid === uuid)
|
||||||
|
if (item) {
|
||||||
|
mapRef.value?.flyTo(item.latitude, item.longitude, 8)
|
||||||
|
mobileMapRef.value?.flyTo(item.latitude, item.longitude, 8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Expose flyTo for external use
|
||||||
|
const flyTo = (lat: number, lng: number, zoom = 8) => {
|
||||||
|
mapRef.value?.flyTo(lat, lng, zoom)
|
||||||
|
mobileMapRef.value?.flyTo(lat, lng, zoom)
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ flyTo })
|
||||||
|
</script>
|
||||||
@@ -1,62 +1,37 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col flex-1 min-h-0">
|
<CatalogPage
|
||||||
<!-- Header -->
|
:items="items"
|
||||||
<div class="py-4">
|
:loading="isLoading"
|
||||||
<PageHeader :title="t('catalogHubsSection.header.title')" />
|
map-id="hubs-map"
|
||||||
</div>
|
point-color="#10b981"
|
||||||
|
:selected-id="selectedHubId"
|
||||||
|
@select="onSelectHub"
|
||||||
|
>
|
||||||
|
<template #filters>
|
||||||
|
<CatalogFilters :filters="filters" v-model="selectedFilter" />
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- Loading state -->
|
<template #card="{ item }">
|
||||||
<div v-if="isLoading" class="flex-1 flex items-center justify-center">
|
<template v-for="country in getCountryForHub(item)" :key="country.name">
|
||||||
<Card padding="lg">
|
<Text v-if="isFirstInCountry(item)" weight="semibold" class="mb-2">{{ country.name }}</Text>
|
||||||
<Stack align="center" justify="center" gap="3">
|
|
||||||
<Spinner />
|
|
||||||
<Text tone="muted">{{ t('catalogLanding.states.loading') }}</Text>
|
|
||||||
</Stack>
|
|
||||||
</Card>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- ListMapLayout -->
|
|
||||||
<ListMapLayout
|
|
||||||
v-else
|
|
||||||
ref="listMapRef"
|
|
||||||
:items="items"
|
|
||||||
:selected-item-id="selectedHubId"
|
|
||||||
map-id="hubs-map"
|
|
||||||
point-color="#10b981"
|
|
||||||
@select-item="onSelectHub"
|
|
||||||
>
|
|
||||||
<template #list>
|
|
||||||
<Stack gap="4">
|
|
||||||
<CatalogFilters :filters="filters" v-model="selectedFilter" />
|
|
||||||
|
|
||||||
<div v-for="country in itemsByCountry" :key="country.name" class="space-y-3">
|
|
||||||
<Text weight="semibold">{{ country.name }}</Text>
|
|
||||||
<Stack gap="3">
|
|
||||||
<HubCard
|
|
||||||
v-for="hub in country.hubs"
|
|
||||||
:key="hub.uuid"
|
|
||||||
:hub="hub"
|
|
||||||
:class="{ 'ring-2 ring-primary': hub.uuid === selectedHubId }"
|
|
||||||
@click="onSelectHub(hub.uuid)"
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<PaginationLoadMore
|
|
||||||
:shown="items.length"
|
|
||||||
:total="total"
|
|
||||||
:can-load-more="canLoadMore"
|
|
||||||
:loading="isLoadingMore"
|
|
||||||
@load-more="loadMore"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Stack v-if="items.length === 0" align="center" gap="2">
|
|
||||||
<Text tone="muted">{{ t('catalogHubsSection.empty.no_hubs') }}</Text>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
</template>
|
</template>
|
||||||
</ListMapLayout>
|
<HubCard :hub="item" />
|
||||||
</div>
|
</template>
|
||||||
|
|
||||||
|
<template #pagination>
|
||||||
|
<PaginationLoadMore
|
||||||
|
:shown="items.length"
|
||||||
|
:total="total"
|
||||||
|
:can-load-more="canLoadMore"
|
||||||
|
:loading="isLoadingMore"
|
||||||
|
@load-more="loadMore"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #empty>
|
||||||
|
<Text tone="muted">{{ t('catalogHubsSection.empty.no_hubs') }}</Text>
|
||||||
|
</template>
|
||||||
|
</CatalogPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -81,10 +56,22 @@ const {
|
|||||||
|
|
||||||
// Selected hub for map highlighting
|
// Selected hub for map highlighting
|
||||||
const selectedHubId = ref<string>()
|
const selectedHubId = ref<string>()
|
||||||
const listMapRef = ref<{ flyToItem: (uuid: string) => void } | null>(null)
|
|
||||||
|
|
||||||
const onSelectHub = (uuid: string) => {
|
const onSelectHub = (hub: any) => {
|
||||||
selectedHubId.value = uuid
|
selectedHubId.value = hub.uuid
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper to get country for hub
|
||||||
|
const getCountryForHub = (hub: any) => {
|
||||||
|
return itemsByCountry.value.filter(c => c.hubs.some(h => h.uuid === hub.uuid))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if this hub is first in its country group
|
||||||
|
const isFirstInCountry = (hub: any) => {
|
||||||
|
for (const country of itemsByCountry.value) {
|
||||||
|
if (country.hubs[0]?.uuid === hub.uuid) return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
await init()
|
await init()
|
||||||
|
|||||||
@@ -1,17 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col flex-1 min-h-0">
|
<div class="flex flex-col flex-1 min-h-0">
|
||||||
<!-- Header -->
|
|
||||||
<div class="py-4">
|
|
||||||
<PageHeader :title="pageTitle">
|
|
||||||
<template v-if="selectedProduct" #actions>
|
|
||||||
<NuxtLink :to="localePath('/catalog/offers')" class="btn btn-ghost btn-sm">
|
|
||||||
<Icon name="lucide:arrow-left" size="16" />
|
|
||||||
{{ t('common.back') }}
|
|
||||||
</NuxtLink>
|
|
||||||
</template>
|
|
||||||
</PageHeader>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Loading state -->
|
<!-- Loading state -->
|
||||||
<div v-if="isLoading || productsLoading" class="flex-1 flex items-center justify-center">
|
<div v-if="isLoading || productsLoading" class="flex-1 flex items-center justify-center">
|
||||||
<Card padding="lg">
|
<Card padding="lg">
|
||||||
@@ -46,30 +34,33 @@
|
|||||||
</Stack>
|
</Stack>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Offers for selected product - ListMapLayout -->
|
<!-- Offers for selected product -->
|
||||||
<ListMapLayout
|
<template v-else>
|
||||||
v-else
|
<!-- Back button -->
|
||||||
ref="listMapRef"
|
<div class="py-2 px-4 lg:px-0">
|
||||||
:items="items"
|
<NuxtLink :to="localePath('/catalog/offers')" class="btn btn-ghost btn-sm gap-2">
|
||||||
:selected-item-id="selectedOfferId"
|
<Icon name="lucide:arrow-left" size="16" />
|
||||||
map-id="offers-map"
|
{{ t('common.back') }}
|
||||||
point-color="#f59e0b"
|
</NuxtLink>
|
||||||
@select-item="onSelectOffer"
|
</div>
|
||||||
>
|
|
||||||
<template #list>
|
<CatalogPage
|
||||||
<Stack gap="4">
|
:items="items"
|
||||||
|
:loading="isLoading"
|
||||||
|
map-id="offers-map"
|
||||||
|
point-color="#f59e0b"
|
||||||
|
:selected-id="selectedOfferId"
|
||||||
|
@select="onSelectOffer"
|
||||||
|
>
|
||||||
|
<template #filters>
|
||||||
<CatalogFilters :filters="filters" v-model="selectedFilter" />
|
<CatalogFilters :filters="filters" v-model="selectedFilter" />
|
||||||
|
</template>
|
||||||
|
|
||||||
<Stack gap="3">
|
<template #card="{ item }">
|
||||||
<OfferCard
|
<OfferCard :offer="item" />
|
||||||
v-for="offer in items"
|
</template>
|
||||||
:key="offer.uuid"
|
|
||||||
:offer="offer"
|
|
||||||
:class="{ 'ring-2 ring-primary': offer.uuid === selectedOfferId }"
|
|
||||||
@click="onSelectOffer(offer.uuid)"
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
|
<template #pagination>
|
||||||
<PaginationLoadMore
|
<PaginationLoadMore
|
||||||
:shown="items.length"
|
:shown="items.length"
|
||||||
:total="total"
|
:total="total"
|
||||||
@@ -77,13 +68,13 @@
|
|||||||
:loading="isLoadingMore"
|
:loading="isLoadingMore"
|
||||||
@load-more="loadMore"
|
@load-more="loadMore"
|
||||||
/>
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
<Stack v-if="total === 0" align="center" gap="2">
|
<template #empty>
|
||||||
<Text tone="muted">{{ t('catalogOffersSection.empty.no_offers') }}</Text>
|
<Text tone="muted">{{ t('catalogOffersSection.empty.no_offers') }}</Text>
|
||||||
</Stack>
|
</template>
|
||||||
</Stack>
|
</CatalogPage>
|
||||||
</template>
|
</template>
|
||||||
</ListMapLayout>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -143,11 +134,9 @@ const selectProduct = (product: any) => {
|
|||||||
|
|
||||||
// Selected offer for map highlighting
|
// Selected offer for map highlighting
|
||||||
const selectedOfferId = ref<string>()
|
const selectedOfferId = ref<string>()
|
||||||
const listMapRef = ref<{ flyToItem: (uuid: string) => void } | null>(null)
|
|
||||||
|
|
||||||
const onSelectOffer = (uuid: string) => {
|
const onSelectOffer = (offer: any) => {
|
||||||
selectedOfferId.value = uuid
|
selectedOfferId.value = offer.uuid
|
||||||
// flyToItem will be triggered by ListMapLayout watch
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
|
|||||||
@@ -107,6 +107,10 @@ import {
|
|||||||
GetOffersDocument,
|
GetOffersDocument,
|
||||||
} from '~/composables/graphql/public/exchange-generated'
|
} from '~/composables/graphql/public/exchange-generated'
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
layout: 'topnav'
|
||||||
|
})
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const localePath = useLocalePath()
|
const localePath = useLocalePath()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|||||||
@@ -1,59 +1,34 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col flex-1 min-h-0">
|
<CatalogPage
|
||||||
<!-- Header -->
|
:items="items"
|
||||||
<div class="py-4">
|
:loading="isLoading"
|
||||||
<PageHeader :title="t('catalogSuppliersSection.header.title')" />
|
map-id="suppliers-map"
|
||||||
</div>
|
point-color="#3b82f6"
|
||||||
|
:selected-id="selectedSupplierId"
|
||||||
|
@select="onSelectSupplier"
|
||||||
|
>
|
||||||
|
<template #filters>
|
||||||
|
<CatalogFilters :filters="filters" v-model="selectedFilter" />
|
||||||
|
</template>
|
||||||
|
|
||||||
<!-- Loading state -->
|
<template #card="{ item }">
|
||||||
<div v-if="isLoading" class="flex-1 flex items-center justify-center">
|
<SupplierCard :supplier="item" />
|
||||||
<Card padding="lg">
|
</template>
|
||||||
<Stack align="center" justify="center" gap="3">
|
|
||||||
<Spinner />
|
|
||||||
<Text tone="muted">{{ t('catalogLanding.states.loading') }}</Text>
|
|
||||||
</Stack>
|
|
||||||
</Card>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- ListMapLayout -->
|
<template #pagination>
|
||||||
<ListMapLayout
|
<PaginationLoadMore
|
||||||
v-else
|
:shown="items.length"
|
||||||
ref="listMapRef"
|
:total="total"
|
||||||
:items="items"
|
:can-load-more="canLoadMore"
|
||||||
:selected-item-id="selectedSupplierId"
|
:loading="isLoadingMore"
|
||||||
map-id="suppliers-map"
|
@load-more="loadMore"
|
||||||
point-color="#3b82f6"
|
/>
|
||||||
@select-item="onSelectSupplier"
|
</template>
|
||||||
>
|
|
||||||
<template #list>
|
|
||||||
<Stack gap="4">
|
|
||||||
<CatalogFilters :filters="filters" v-model="selectedFilter" />
|
|
||||||
|
|
||||||
<Stack gap="3">
|
<template #empty>
|
||||||
<SupplierCard
|
<Text tone="muted">{{ t('catalogSuppliersSection.empty.no_suppliers') }}</Text>
|
||||||
v-for="supplier in items"
|
</template>
|
||||||
:key="supplier.uuid || supplier.teamUuid"
|
</CatalogPage>
|
||||||
:supplier="supplier"
|
|
||||||
:class="{ 'ring-2 ring-primary': (supplier.uuid || supplier.teamUuid) === selectedSupplierId }"
|
|
||||||
@click="onSelectSupplier(supplier.uuid || supplier.teamUuid)"
|
|
||||||
/>
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
<PaginationLoadMore
|
|
||||||
:shown="items.length"
|
|
||||||
:total="total"
|
|
||||||
:can-load-more="canLoadMore"
|
|
||||||
:loading="isLoadingMore"
|
|
||||||
@load-more="loadMore"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Stack v-if="total === 0" align="center" gap="2">
|
|
||||||
<Text tone="muted">{{ t('catalogSuppliersSection.empty.no_suppliers') }}</Text>
|
|
||||||
</Stack>
|
|
||||||
</Stack>
|
|
||||||
</template>
|
|
||||||
</ListMapLayout>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -77,10 +52,9 @@ const {
|
|||||||
|
|
||||||
// Selected supplier for map highlighting
|
// Selected supplier for map highlighting
|
||||||
const selectedSupplierId = ref<string>()
|
const selectedSupplierId = ref<string>()
|
||||||
const listMapRef = ref<{ flyToItem: (uuid: string) => void } | null>(null)
|
|
||||||
|
|
||||||
const onSelectSupplier = (uuid: string) => {
|
const onSelectSupplier = (supplier: any) => {
|
||||||
selectedSupplierId.value = uuid
|
selectedSupplierId.value = supplier.uuid || supplier.teamUuid
|
||||||
}
|
}
|
||||||
|
|
||||||
await init()
|
await init()
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<Section variant="plain" paddingY="md">
|
<Section variant="plain" paddingY="md">
|
||||||
<Stack gap="6">
|
<Stack gap="6">
|
||||||
<PageHeader
|
|
||||||
:title="t('profileAddresses.header.title')"
|
|
||||||
:actions="[{ label: t('profileAddresses.actions.add'), icon: 'lucide:plus', to: localePath('/clientarea/addresses/new') }]"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Card v-if="isLoading" padding="lg">
|
<Card v-if="isLoading" padding="lg">
|
||||||
<Stack align="center" gap="3">
|
<Stack align="center" gap="3">
|
||||||
<Spinner />
|
<Spinner />
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<Section variant="plain" paddingY="md">
|
<Section variant="plain" paddingY="md">
|
||||||
<Stack gap="6">
|
<Stack gap="6">
|
||||||
<PageHeader
|
|
||||||
:title="$t('dashboard.orders')"
|
|
||||||
:actions="[{ label: t('ordersList.actions.new_calc'), icon: 'lucide:plus', to: localePath('/clientarea') }]"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Alert v-if="hasError" variant="error">
|
<Alert v-if="hasError" variant="error">
|
||||||
<Stack gap="2">
|
<Stack gap="2">
|
||||||
<Heading :level="4" weight="semibold">{{ $t('common.error') }}</Heading>
|
<Heading :level="4" weight="semibold">{{ $t('common.error') }}</Heading>
|
||||||
|
|||||||
Reference in New Issue
Block a user