mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 01:48:12 +00:00
merge
This commit is contained in:
@@ -43,8 +43,18 @@ export interface SaveRoutePayload {
|
||||
* Human-readable route label: yard names, not yard codes. Staff read
|
||||
* "Addis Ababa → Dire Dawa", not "ADDIS_ABABA → DIRE_DAWA". Falls back to the
|
||||
* code only when a yard has no label.
|
||||
*
|
||||
* When milestones are present they ARE the full ordered corridor (origin first,
|
||||
* destination last), so the label shows every stop:
|
||||
* "Addis Ababa → Adama → Dire Dawa".
|
||||
*/
|
||||
export function formatRouteLabel(route: RouteRecord): string {
|
||||
const stops = [...(route.milestones ?? [])]
|
||||
.sort((a, b) => a.sequenceNo - b.sequenceNo)
|
||||
.map((m) => m.yard?.label ?? m.yard?.code)
|
||||
.filter((name): name is string => Boolean(name));
|
||||
if (stops.length >= 2) return stops.join(' → ');
|
||||
|
||||
const origin =
|
||||
route.originYard?.label ?? route.originYard?.code ?? 'Origin';
|
||||
const dest =
|
||||
|
||||
Reference in New Issue
Block a user