Implement client-side validation for container and bul

This commit is contained in:
Marshal
2026-07-09 08:13:20 +00:00
parent c6198a4c62
commit f736523afd
8 changed files with 140 additions and 26 deletions

View File

@@ -39,11 +39,16 @@ export interface SaveRoutePayload {
status?: RouteStatus;
}
/**
* 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.
*/
export function formatRouteLabel(route: RouteRecord): string {
const origin =
route.originYard?.code ?? route.originYard?.label ?? 'Origin';
route.originYard?.label ?? route.originYard?.code ?? 'Origin';
const dest =
route.destinationYard?.code ?? route.destinationYard?.label ?? 'Destination';
route.destinationYard?.label ?? route.destinationYard?.code ?? 'Destination';
return `${origin}${dest}`;
}