feat: show source and destination points on orders map
All checks were successful
Build Docker Image / build (push) Successful in 5m18s

Use coordinates from stages to display both origin and destination
This commit is contained in:
Ruslan Bakiev
2026-01-08 14:35:59 +07:00
parent 13f60bd022
commit 75ef38c8b2

View File

@@ -94,21 +94,43 @@ const {
const selectedOrderId = ref<string>() const selectedOrderId = ref<string>()
const hoveredOrderId = ref<string>() const hoveredOrderId = ref<string>()
// Map items for CatalogPage (use source location coordinates) // Map items for CatalogPage - two points per order (source + destination)
const itemsForMap = computed(() => { const itemsForMap = computed(() => {
return filteredItems.value.map(order => ({ const result: any[] = []
...order, filteredItems.value.forEach(order => {
uuid: order.uuid, // Source point
name: order.name || `#${order.uuid.slice(0, 8)}`, if (order.sourceLatitude && order.sourceLongitude) {
latitude: order.sourceLatitude, result.push({
longitude: order.sourceLongitude, ...order,
country: order.sourceLocationName uuid: `${order.uuid}-source`,
})) name: `📦 ${order.sourceLocationName}`,
latitude: order.sourceLatitude,
longitude: order.sourceLongitude,
country: order.sourceLocationName,
orderUuid: order.uuid
})
}
// Destination point - get from last stage
const lastStage = order.stages?.[order.stages.length - 1]
if (lastStage?.destinationLatitude && lastStage?.destinationLongitude) {
result.push({
...order,
uuid: `${order.uuid}-dest`,
name: `🏁 ${order.destinationLocationName}`,
latitude: lastStage.destinationLatitude,
longitude: lastStage.destinationLongitude,
country: order.destinationLocationName,
orderUuid: order.uuid
})
}
})
return result
}) })
const onSelectOrder = (item: any) => { const onSelectOrder = (item: any) => {
selectedOrderId.value = item.uuid const orderUuid = item.orderUuid || item.uuid
navigateTo(localePath(`/clientarea/orders/${item.uuid}`)) selectedOrderId.value = orderUuid
navigateTo(localePath(`/clientarea/orders/${orderUuid}`))
} }
await init() await init()