auto allocation and batch managemnt, tracking the train

This commit is contained in:
marshal
2026-06-12 11:42:46 +03:00
parent 8618ea2aa8
commit ef0abf1c41
61 changed files with 3541 additions and 378 deletions

View File

@@ -136,9 +136,17 @@ export function AllocateBookingWizard({
const eligibleQuery = useEligibleBookings(eligibleFilters, opened);
const schedulesQuery = useScheduleList();
const routesQuery = useRoutes();
const locomotivesQuery = useAvailableLocomotives();
const locomotivesQuery = useAvailableLocomotives(
scheduleMode === "new" && routeId ? routeId : undefined,
);
const { create, preview, assign, finalize } = useScheduleMutations(selectedScheduleId ?? undefined);
useEffect(() => {
if (scheduleMode === "new") {
setLocomotiveId("");
}
}, [routeId, scheduleMode]);
const matchingSchedules = useMemo(
() =>
(schedulesQuery.data ?? []).filter(
@@ -511,6 +519,7 @@ export function AllocateBookingWizard({
/>
<Select
label="Locomotive"
placeholder={routeId ? "Select locomotive" : "Select a route first"}
data={(locomotivesQuery.data ?? []).map((l) => ({
value: l.id,
label: `${l.code} · ${
@@ -520,6 +529,10 @@ export function AllocateBookingWizard({
value={locomotiveId || null}
onChange={(v) => setLocomotiveId(v ?? "")}
searchable
disabled={!routeId}
nothingFoundMessage={
routeId ? "No available locomotives for this corridor" : "Select a route first"
}
/>
</SimpleGrid>
)}