Merge pull request #1230 from Tria-plc/freight_feature/usermanagement

feat(wagons): enforce wagon availability limits in transfer requests
This commit is contained in:
marshal
2026-08-10 23:32:46 +03:00
committed by GitHub
5 changed files with 127 additions and 18 deletions

View File

@@ -44,9 +44,8 @@ const clampInt = (v: number | string, max: number): number => {
/**
* NumberInput + Slider + All/Half presets, kept in sync. `max` bounds the field
* for actions that move real wagons; omit it for a transfer REQUEST, which may
* legitimately ask for more than the yard holds today (OCC fulfils it in
* instalments) — the slider then just tracks the current value.
* to the wagons on hand; omitting it leaves the field unbounded and the slider
* simply tracks the current value.
*/
const QuantityField = ({
value,
@@ -434,9 +433,14 @@ const WagonYardWorkspaceModal = ({ opened, onClose }: WagonYardWorkspaceModalPro
{availableCount} available
</Badge>
</Group>
{/* No max: the request may exceed what the yard holds
today — OCC fulfils it in instalments. */}
<QuantityField value={transferQty} onChange={setTransferQty} />
{/* Capped at the wagons actually available in this yard
right now (uncoupled + Available) — a request may not
ask for more than the yard can hand over. */}
<QuantityField
value={transferQty}
onChange={setTransferQty}
max={availableCount}
/>
</div>
<Select
label="Destination yard"