fix build num

This commit is contained in:
natib21
2026-07-17 10:29:27 +00:00
parent 8671b982c5
commit 3bb4c8fb42
3 changed files with 57 additions and 51 deletions

View File

@@ -1,5 +1,6 @@
import { Freight } from "@edr/types";
import type { ColumnFormat, FormFieldDef } from "@/pages/ruleEngine/config/resources";
import { EXPORT_TRAIN_OPTIONS, importRunFor } from "@/constants/trainRuns";
import { vehiclesConfig, VEHICLE_TYPE_OPTIONS, FUEL_TYPE_OPTIONS, VEHICLE_STATUS_OPTIONS } from "./vehicles";
import { driversConfig, DRIVER_STATUS_OPTIONS } from "./drivers";
@@ -130,33 +131,6 @@ const WAGON_STATUS_OPTIONS = [
{ label: "Detained", value: Freight.WagonStatus.Detained },
];
/**
* EDR run-number pairs, keyed by the odd EXPORT run (Ethiopia → Djibouti). The
* even IMPORT run (Djibouti → Ethiopia) is fixed by the export run, so choosing
* an export number fully determines the import one.
*
* Run numbers are always 4 digits (8401, never 84001). Pairs are listed out
* rather than computed from the 8001/+100/+1 pattern, so a run that ever breaks
* the convention stays correct here.
*/
const TRAIN_RUN_PAIRS: Record<string, string> = {
"8001": "8002",
"8101": "8102",
"8201": "8202",
"8301": "8302",
"8401": "8402",
"8501": "8502",
"8601": "8602",
"8701": "8702",
"8801": "8802",
"8901": "8902",
"9001": "9002",
};
const EXPORT_TRAIN_OPTIONS = Object.keys(TRAIN_RUN_PAIRS).map((run) => ({
label: run,
value: run,
}));
@@ -342,8 +316,7 @@ export const FLEET_RESOURCES: FleetResourceConfig[] = [
type: "text",
description: "Even — Djibouti → Ethiopia runs",
placeholder: "e.g. 8002",
derivedValue: (values) =>
TRAIN_RUN_PAIRS[String(values.exportTrainNumber ?? "")] ?? "",
derivedValue: (values) => importRunFor(values.exportTrainNumber),
// Follows the export run to NULL when that is cleared.
clearable: true,
},