This commit is contained in:
natib21
2026-07-17 13:10:27 +00:00
parent 6f126a2345
commit 0d98ccb04b
8 changed files with 151 additions and 82 deletions

View File

@@ -1,6 +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 { IMPORT_TRAIN_OPTIONS, exportRunFor } from "@/constants/trainRuns";
import { vehiclesConfig, VEHICLE_TYPE_OPTIONS, FUEL_TYPE_OPTIONS, VEHICLE_STATUS_OPTIONS } from "./vehicles";
import { driversConfig, DRIVER_STATUS_OPTIONS } from "./drivers";
@@ -299,25 +299,25 @@ export const FLEET_RESOURCES: FleetResourceConfig[] = [
],
formFields: [
// Run numbers are optional — a wagon sits in the fleet unassigned to any
// run until an operator picks an export run. The import run is fixed by
// run until an operator picks an import run. The export run is fixed by
// that choice, so it is derived rather than typed.
{
name: "exportTrainNumber",
label: "Export train number",
type: "select",
type: "text",
description: "Odd — Ethiopia → Djibouti runs",
placeholder: "e.g. 8001",
options: EXPORT_TRAIN_OPTIONS,
derivedValue: (values) => exportRunFor(values.importTrainNumber),
// Follows the import run to NULL when that is cleared.
clearable: true,
},
{
name: "importTrainNumber",
label: "Import train number",
type: "text",
type: "select",
description: "Even — Djibouti → Ethiopia runs",
placeholder: "e.g. 8002",
derivedValue: (values) => importRunFor(values.exportTrainNumber),
// Follows the export run to NULL when that is cleared.
options: IMPORT_TRAIN_OPTIONS,
clearable: true,
},
{ name: "wagonNumber", label: "Wagon number", type: "text", required: true },