diff --git a/app/components/page/CatalogPage.vue b/app/components/page/CatalogPage.vue index 226e322..2a7f2bd 100644 --- a/app/components/page/CatalogPage.vue +++ b/app/components/page/CatalogPage.vue @@ -166,6 +166,7 @@ interface MapItem { const props = withDefaults(defineProps<{ items: MapItem[] + mapItems?: MapItem[] // Optional separate items for map (if different from list items) loading?: boolean withMap?: boolean mapId?: string @@ -191,9 +192,12 @@ const emit = defineEmits<{ 'update:hoveredId': [uuid: string | undefined] }>() +// Use mapItems if provided, otherwise fall back to items +const itemsForMap = computed(() => props.mapItems || props.items) + // Filter items with valid coordinates for map const itemsWithCoords = computed(() => - props.items.filter(item => + itemsForMap.value.filter(item => item.latitude != null && item.longitude != null && !isNaN(Number(item.latitude)) && @@ -203,7 +207,8 @@ const itemsWithCoords = computed(() => name: item.name || '', latitude: Number(item.latitude), longitude: Number(item.longitude), - country: item.country + country: item.country, + orderUuid: item.orderUuid // Preserve orderUuid for hover matching })) ) @@ -249,7 +254,12 @@ watch(() => props.selectedId, (uuid) => { // Watch hoveredId and fly to it watch(() => props.hoveredId, (uuid) => { if (uuid && props.withMap) { - const item = itemsWithCoords.value.find(i => i.uuid === uuid) + // Try direct match first + let item = itemsWithCoords.value.find(i => i.uuid === uuid) + // If not found, try matching by orderUuid (for mapItems with separate source/dest points) + if (!item) { + item = itemsWithCoords.value.find(i => i.uuid === `${uuid}-source` || (i as any).orderUuid === uuid) + } if (item) { mapRef.value?.flyTo(item.latitude, item.longitude, 8) mobileMapRef.value?.flyTo(item.latitude, item.longitude, 8) diff --git a/app/pages/clientarea/orders/index.vue b/app/pages/clientarea/orders/index.vue index 3376a85..110f6b6 100644 --- a/app/pages/clientarea/orders/index.vue +++ b/app/pages/clientarea/orders/index.vue @@ -1,6 +1,7 @@