This commit is contained in:
Marshal
2026-07-17 13:57:59 +00:00
parent 3a697e12f2
commit 6467173c76
12 changed files with 642 additions and 46 deletions

View File

@@ -176,6 +176,7 @@ const RuleEngineFormDialog = ({
) {
return false;
}
if (field.showIf && !field.showIf(values)) return false;
return true;
}),
[fields, values],
@@ -192,6 +193,22 @@ const RuleEngineFormDialog = ({
if ((name === "appliesTo" || name === "trigger") && "rateUnit" in current) {
next.rateUnit = "";
}
// The legal yards depend on what the rate is for and which way it runs, so
// a leg picked under the old answer is no longer valid — clear it instead
// of submitting a pair the API will reject.
if (
(name === "appliesTo" || name === "tradeDirection") &&
"originYardId" in current
) {
next.originYardId = "";
next.destinationYardId = "";
}
// Intercity asks for a container type or a bulk cargo type, never both —
// switching kind drops whichever the other kind had filled in.
if (name === "intercityKind") {
next.containerTypeId = "";
next.cargoTypeId = "";
}
return next;
});
};