From af85f20789b5661de5c6ec7e1593413a35ac31a3 Mon Sep 17 00:00:00 2001 From: Marshal Date: Sun, 26 Jul 2026 18:23:37 +0000 Subject: [PATCH] add dispute functionality for contract duty and implement collection dates --- .../TrainScheduleV2ListPage.tsx | 108 +----------------- .../backoffice/src/types/trainScheduling.ts | 2 - 2 files changed, 4 insertions(+), 106 deletions(-) diff --git a/apps/edr-freight-web/backoffice/src/pages/trainScheduling/TrainScheduleV2ListPage.tsx b/apps/edr-freight-web/backoffice/src/pages/trainScheduling/TrainScheduleV2ListPage.tsx index 7641bdde9..946359647 100644 --- a/apps/edr-freight-web/backoffice/src/pages/trainScheduling/TrainScheduleV2ListPage.tsx +++ b/apps/edr-freight-web/backoffice/src/pages/trainScheduling/TrainScheduleV2ListPage.tsx @@ -20,17 +20,15 @@ import { useDebouncedValue } from "@mantine/hooks"; import { isAxiosError } from "axios"; import { ArrowRight, - // Ban, — used only by the commented-out "Cancel schedule" row action + Ban, CalendarClock, Clock, Eye, - Lock, MoreHorizontal, Navigation, Pencil, Play, Send, - Unlock, Train, Weight, } from "lucide-react"; @@ -125,12 +123,10 @@ export default function TrainScheduleV2ListPage() { const [sortDir, setSortDir] = useState<"desc" | "asc">("desc"); const [createOpen, setCreateOpen] = useState(false); const [windowSettingsId, setWindowSettingsId] = useState(null); - // Dispatching a train and closing its booking window are both irreversible - // from this screen, so each goes through an explicit confirmation. + // Dispatch is irreversible from this screen, so it goes through an explicit + // confirmation. const [dispatchTarget, setDispatchTarget] = useState(null); - const [windowTarget, setWindowTarget] = - useState(null); const [editDateSchedule, setEditDateSchedule] = useState(null); const [routeId, setRouteId] = useState(""); @@ -213,10 +209,7 @@ export default function TrainScheduleV2ListPage() { const dispatchSchedule = useMutation( api.trainScheduling.dispatchSchedule.mutationOptions(), ); - const setWindow = useMutation( - api.trainScheduling.setBookingWindow.mutationOptions(), - ); - // const cancel = useMutation(api.trainScheduling.cancelSchedule.mutationOptions()); + const cancel = useMutation(api.trainScheduling.cancelSchedule.mutationOptions()); // Intercity (same-country / DOMESTIC) routes cannot be scheduled yet — the // API rejects them, so keep them out of the picker entirely. @@ -484,27 +477,6 @@ export default function TrainScheduleV2ListPage() { Booking window settings ) : null} - {/* Stop / resume taking bookings on this departure without - opening it. FULL is a capacity state the engine owns, so - only an explicitly OPEN/CLOSED window is toggled here. */} - {canUpdate && - ["DRAFT", "SCHEDULED"].includes(schedule.status) && - schedule.bookingWindowStatus !== "FULL" ? ( - - ) : ( - - ) - } - onClick={() => setWindowTarget(schedule)} - > - {schedule.bookingWindowStatus === "CLOSED" - ? "Open booking window" - : "Close booking window"} - - ) : null} {/* Start the run. Same transition as the detail page's Dispatch button — that page also shows unassigned-wagon and not-loaded warnings, so it stays the fuller surface. */} @@ -516,9 +488,6 @@ export default function TrainScheduleV2ListPage() { Start (dispatch) train ) : null} - {/* Cancel schedule — hidden for now (frontend only; the - cancelSchedule mutation is untouched). Restore by - uncommenting. {["DRAFT", "SCHEDULED"].includes(schedule.status) ? ( ) : null} - */} @@ -902,74 +870,6 @@ export default function TrainScheduleV2ListPage() { onSaved={() => void schedulesQuery.refetch()} /> - setWindowTarget(null)} - title={ - windowTarget?.bookingWindowStatus === "CLOSED" - ? "Open booking window?" - : "Close booking window?" - } - centered - radius="md" - > - - - {windowTarget?.bookingWindowStatus === "CLOSED" ? ( - <> - Customers will be able to book onto{" "} - - {windowTarget?.trainNumber ?? windowTarget?.reference ?? "this departure"} - {" "} - again, up to its remaining capacity. - - ) : ( - <> - No further bookings will be accepted onto{" "} - - {windowTarget?.trainNumber ?? windowTarget?.reference ?? "this departure"} - - . Bookings already aboard are unaffected, and you can reopen the - window from this menu. - - )} - - - - - - - - setDispatchTarget(null)} diff --git a/apps/edr-freight-web/backoffice/src/types/trainScheduling.ts b/apps/edr-freight-web/backoffice/src/types/trainScheduling.ts index b284a9c12..86b597c71 100644 --- a/apps/edr-freight-web/backoffice/src/types/trainScheduling.ts +++ b/apps/edr-freight-web/backoffice/src/types/trainScheduling.ts @@ -203,8 +203,6 @@ export interface TrainScheduleListItem { totalLengthMeters: number; bookingsCount: number; status: TrainScheduleStatus | string; - /** Whether the departure is still taking bookings (orthogonal to `status`). */ - bookingWindowStatus?: "OPEN" | "FULL" | "CLOSED" | string; } export type TrainScheduleSortField =