feat: show source and destination points on orders map
All checks were successful
Build Docker Image / build (push) Successful in 5m18s
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:
@@ -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[] = []
|
||||||
|
filteredItems.value.forEach(order => {
|
||||||
|
// Source point
|
||||||
|
if (order.sourceLatitude && order.sourceLongitude) {
|
||||||
|
result.push({
|
||||||
...order,
|
...order,
|
||||||
uuid: order.uuid,
|
uuid: `${order.uuid}-source`,
|
||||||
name: order.name || `#${order.uuid.slice(0, 8)}`,
|
name: `📦 ${order.sourceLocationName}`,
|
||||||
latitude: order.sourceLatitude,
|
latitude: order.sourceLatitude,
|
||||||
longitude: order.sourceLongitude,
|
longitude: order.sourceLongitude,
|
||||||
country: order.sourceLocationName
|
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()
|
||||||
|
|||||||
Reference in New Issue
Block a user