mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 10:45:44 +00:00
fix issue
This commit is contained in:
@@ -19,7 +19,7 @@ export function AssignWagonDialog({ trainId }: { trainId: string }) {
|
||||
const { toast } = useToast();
|
||||
|
||||
const available = (wagons ?? []).filter(
|
||||
(w) => w.status === Freight.WagonStatus.Available || !w.trainId,
|
||||
(w) => w.status === Freight.WagonStatus.Available && !w.trainId,
|
||||
);
|
||||
|
||||
const yardLabelById = useMemo(
|
||||
|
||||
@@ -183,10 +183,22 @@ const WagonYardWorkspaceModal = ({ opened, onClose }: WagonYardWorkspaceModalPro
|
||||
return yardWagons.filter((w) => w.currentYardId === yardId && w.wagonTypeId === typeId);
|
||||
}, [yardWagons, yardId, typeId]);
|
||||
|
||||
const availableWagons = useMemo(() => matching.filter((w) => w.status === AVAILABLE), [matching]);
|
||||
const assignedWagons = useMemo(() => matching.filter((w) => w.status === ASSIGNED), [matching]);
|
||||
// Wagons coupled to a built train (trainId set) are managed through the
|
||||
// train-builder flow — they can't be bulk-flipped or transferred here, so
|
||||
// keep them out of the action pools and bucket them under "Other".
|
||||
const availableWagons = useMemo(
|
||||
() => matching.filter((w) => w.status === AVAILABLE && !w.trainId),
|
||||
[matching],
|
||||
);
|
||||
const assignedWagons = useMemo(
|
||||
() => matching.filter((w) => w.status === ASSIGNED && !w.trainId),
|
||||
[matching],
|
||||
);
|
||||
const otherWagons = useMemo(
|
||||
() => matching.filter((w) => w.status !== AVAILABLE && w.status !== ASSIGNED),
|
||||
() =>
|
||||
matching.filter(
|
||||
(w) => w.trainId != null || (w.status !== AVAILABLE && w.status !== ASSIGNED),
|
||||
),
|
||||
[matching],
|
||||
);
|
||||
const total = matching.length;
|
||||
|
||||
Reference in New Issue
Block a user