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

fix issue
This commit is contained in:
marshal
2026-07-31 20:55:41 +03:00
committed by GitHub
6 changed files with 160 additions and 34 deletions

View File

@@ -147,8 +147,12 @@ export default function ContractClearanceDetailPage() {
!isDjiboutiGl(user);
const canResubmitBooking = bookingNeedsChanges && isGlBookingOwner;
const canRebook = bookingExpired && isGlBookingOwner;
// Rebook completes the SAME expired booking (it already carries the price and
// cargo from its first completion) via the /complete endpoint's EXPIRED
// branch — routing it through create-booking instead would create a
// duplicate booking on the contract rather than resubmitting the existing one.
const rebookHref = linkedBookingId
? `${bookingHref}?copyFrom=${linkedBookingId}`
? `/dashboard/contracts/${id}/bookings/${linkedBookingId}/complete?copyFrom=${linkedBookingId}`
: bookingHref;
const { data: bookingMilestones, refetch: refetchBookingMilestones } =

View File

@@ -77,6 +77,7 @@ import { WagonPlanGrid } from "@/components/trainScheduling/WagonPlanGrid";
import { WorkflowRail, WorkflowStep } from "@/components/trainScheduling/WorkflowStep";
import { openPdfBlob } from "@/components/warehouses/pdf";
import { useMutation, useQuery } from "@tanstack/react-query";
import { useBookingWindowSocket } from "@/features/bookingWindows/useBookingWindowSocket";
import { api } from "@/services/api";
import { trainSchedulingService } from "@/services/trainScheduling.service";
import { useToast } from "@/hooks/use-toast";
@@ -121,8 +122,13 @@ export default function TrainScheduleV2DetailPage() {
api.trainScheduling.scheduleDetail.queryOptions({
input: { id: scheduleId ?? "" },
enabled: Boolean(scheduleId),
// Live phase updates come from the booking-window socket (PHASE pushes
// invalidate this query); 60s is the self-heal net for a missed emit so
// the workspace countdown never freezes on an expired phase.
refetchInterval: 60_000,
}),
);
useBookingWindowSocket(Boolean(scheduleId));
const schedule = detailQuery.data;
const freightType: FreightType | undefined = schedule?.freightType as FreightType | undefined;
const isDjiboutiPort = (value?: string | null) =>