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 hoveredOrderId = ref<string>()
// Map items for CatalogPage (use source location coordinates)
// Map items for CatalogPage - two points per order (source + destination)
const itemsForMap = computed(() => {
return filteredItems.value.map(order => ({
...order,
uuid: order.uuid,
name: order.name || `#${order.uuid.slice(0, 8)}`,
latitude: order.sourceLatitude,
longitude: order.sourceLongitude,
country: order.sourceLocationName
}))
const result: any[] = []
filteredItems.value.forEach(order => {
// Source point
if (order.sourceLatitude && order.sourceLongitude) {
result.push({
...order,
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) => {
selectedOrderId.value = item.uuid
navigateTo(localePath(`/clientarea/orders/${item.uuid}`))
const orderUuid = item.orderUuid || item.uuid
selectedOrderId.value = orderUuid
navigateTo(localePath(`/clientarea/orders/${orderUuid}`))
}
await init()