Migrate orders and addresses to split layout
All checks were successful
Build Docker Image / build (push) Successful in 4m20s

- Use ListMapLayout for two-column list+map view
- Orders: show source locations on map
- Addresses: show address locations on map
- Remove preview map links (map is now inline)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ruslan Bakiev
2026-01-08 09:48:23 +07:00
parent ee7b8d0ee4
commit 1a0305011f
2 changed files with 144 additions and 66 deletions

View File

@@ -1,31 +1,48 @@
<template>
<Section variant="plain" paddingY="md">
<Stack gap="6">
<Alert v-if="hasError" variant="error">
<div class="flex flex-col flex-1 min-h-0">
<!-- Loading state -->
<div v-if="isLoading" class="flex-1 flex items-center justify-center">
<Card padding="lg">
<Stack align="center" justify="center" gap="3">
<Spinner />
<Text tone="muted">{{ t('ordersList.states.loading') }}</Text>
</Stack>
</Card>
</div>
<!-- Error state -->
<div v-else-if="hasError" class="flex-1 flex items-center justify-center">
<Alert variant="error">
<Stack gap="2">
<Heading :level="4" weight="semibold">{{ $t('common.error') }}</Heading>
<Text tone="muted">{{ error }}</Text>
<Button @click="load">{{ t('ordersList.errors.retry') }}</Button>
</Stack>
</Alert>
</div>
<Stack v-else-if="isLoading" align="center" justify="center" gap="3">
<Spinner />
<Text tone="muted">{{ t('ordersList.states.loading') }}</Text>
</Stack>
<template v-else>
<template v-if="items.length">
<NuxtLink :to="localePath('/clientarea/orders/map')" class="block h-48 rounded-lg overflow-hidden cursor-pointer">
<ClientOnly>
<OrdersRoutesPreview :routes="routesForMap" :height="192" />
</ClientOnly>
</NuxtLink>
<!-- ListMapLayout -->
<ListMapLayout
v-else-if="items.length"
:items="itemsForMap"
:selected-item-id="selectedOrderId"
map-id="orders-map"
point-color="#6366f1"
@select-item="onSelectOrder"
>
<template #list>
<Stack gap="4">
<CatalogFilters :filters="filters" v-model="selectedFilter" />
<Stack gap="4">
<Card v-for="order in filteredItems" :key="order.uuid" padding="lg" class="cursor-pointer" @click="openOrder(order)">
<Card
v-for="order in filteredItems"
:key="order.uuid"
padding="lg"
class="cursor-pointer"
:class="{ 'ring-2 ring-primary': order.uuid === selectedOrderId }"
@click="onSelectOrder(order.uuid)"
>
<Stack gap="4">
<Stack direction="row" justify="between" align="center">
<Stack gap="1">
@@ -69,20 +86,26 @@
</Stack>
</Card>
</Stack>
</template>
<EmptyState
v-else
icon="📦"
:title="$t('orders.no_orders')"
:description="$t('orders.no_orders_desc')"
:action-label="$t('orders.create_new')"
:action-to="localePath('/clientarea')"
action-icon="lucide:plus"
/>
<Stack v-if="filteredItems.length === 0" align="center" gap="2">
<Text tone="muted">{{ $t('orders.no_orders') }}</Text>
</Stack>
</Stack>
</template>
</Stack>
</Section>
</ListMapLayout>
<!-- Empty state -->
<div v-else class="flex-1 flex items-center justify-center">
<EmptyState
icon="📦"
:title="$t('orders.no_orders')"
:description="$t('orders.no_orders_desc')"
:action-label="$t('orders.create_new')"
:action-to="localePath('/clientarea')"
action-icon="lucide:plus"
/>
</div>
</div>
</template>
<script setup lang="ts">
@@ -100,7 +123,6 @@ const {
isLoading,
filters,
selectedFilter,
routesForMap,
load,
init,
getStatusVariant,
@@ -109,6 +131,22 @@ const {
const hasError = ref(false)
const error = ref('')
const selectedOrderId = ref<string>()
// Map items for ListMapLayout (use source location coordinates)
const itemsForMap = computed(() => {
return items.value.map(order => ({
uuid: order.uuid,
name: order.name || `#${order.uuid.slice(0, 8)}`,
latitude: order.sourceLatitude,
longitude: order.sourceLongitude,
country: order.sourceLocationName
}))
})
const onSelectOrder = (uuid: string) => {
selectedOrderId.value = uuid
}
try {
await init()
@@ -117,10 +155,6 @@ try {
error.value = err.message || t('ordersDetail.errors.load_failed')
}
const openOrder = (order: any) => {
navigateTo(localePath(`/clientarea/orders/${order.uuid}`))
}
const getOrderStartDate = (order: any) => {
if (!order.createdAt) return t('ordersDetail.labels.dates_undefined')
return formatDate(order.createdAt)