diff --git a/apps/edr-freight-api/src/contracts/contract-document-view-model.builder.ts b/apps/edr-freight-api/src/contracts/contract-document-view-model.builder.ts index caf161614..05061ed9a 100644 --- a/apps/edr-freight-api/src/contracts/contract-document-view-model.builder.ts +++ b/apps/edr-freight-api/src/contracts/contract-document-view-model.builder.ts @@ -200,7 +200,9 @@ export class ContractDocumentViewModelBuilder { serviceType: this.valueOrDash( contract.serviceType?.serviceName ?? contract.serviceType?.code, ), - scheduledDate: this.formatDate(contract.estimatedShipmentDate), + // Estimated shipment date was removed from the contract wizard; the + // binding scheduled date is set per-booking, not on the contract. + scheduledDate: this.formatDate(null), contractType: this.valueOrDash(contract.contractType), cargoDescription: this.valueOrDash(cargoName), totalWeightVgm: '—', diff --git a/apps/edr-freight-api/src/modules/contracts/contracts.service.ts b/apps/edr-freight-api/src/modules/contracts/contracts.service.ts index 70d2632fa..8d864aac7 100644 --- a/apps/edr-freight-api/src/modules/contracts/contracts.service.ts +++ b/apps/edr-freight-api/src/modules/contracts/contracts.service.ts @@ -200,9 +200,6 @@ export class ContractsService { lastMileDeliveryLng: dto.lastMileDeliveryLng ?? null, isHazardous: dto.isHazardous ?? false, isReefer: dto.isReefer ?? false, - estimatedShipmentDate: dto.estimatedShipmentDate - ? new Date(dto.estimatedShipmentDate) - : null, contractType: dto.contractType ?? null, status: 'DRAFT', clearanceStatus: 'NOT_APPLICABLE', @@ -347,9 +344,6 @@ export class ContractsService { lastMileDeliveryLng: dto.lastMileDeliveryLng ?? existing.lastMileDeliveryLng, contractType: dto.contractType ?? existing.contractType, }; - if (dto.estimatedShipmentDate) { - updates.estimatedShipmentDate = new Date(dto.estimatedShipmentDate); - } if (dto.renewalOfId !== undefined) updates.renewalOfId = dto.renewalOfId ?? null; // Customs clearing always mirrors the (possibly changed) service type. diff --git a/apps/edr-freight-api/src/modules/contracts/dto/create-contract.dto.ts b/apps/edr-freight-api/src/modules/contracts/dto/create-contract.dto.ts index 70dba1e90..b20b99575 100644 --- a/apps/edr-freight-api/src/modules/contracts/dto/create-contract.dto.ts +++ b/apps/edr-freight-api/src/modules/contracts/dto/create-contract.dto.ts @@ -4,7 +4,6 @@ import { ArrayMinSize, IsArray, IsBoolean, - IsDateString, IsIn, IsNumber, IsOptional, @@ -219,14 +218,6 @@ export class CreateContractDto { @Transform(({ value }) => value === 'true' || value === true) isReefer?: boolean; - @ApiPropertyOptional({ - description: 'Non-binding estimate from the wizard (NOT validated against departures)', - example: '2026-07-15T00:00:00.000Z', - }) - @IsOptional() - @IsDateString() - estimatedShipmentDate?: string; - @ApiPropertyOptional({ description: 'Contract document type (SPOT, etc.)' }) @IsOptional() @IsString() diff --git a/apps/edr-freight-web/portal/src/pages/contracts/ContractDetailPage.tsx b/apps/edr-freight-web/portal/src/pages/contracts/ContractDetailPage.tsx index 03be22005..538c58fe7 100644 --- a/apps/edr-freight-web/portal/src/pages/contracts/ContractDetailPage.tsx +++ b/apps/edr-freight-web/portal/src/pages/contracts/ContractDetailPage.tsx @@ -449,17 +449,6 @@ export default function ContractDetailPage() { routes[0]?.destinationYard?.label ?? "—" }`} /> - } - value={ - contract.estimatedShipmentDate - ? new Date( - contract.estimatedShipmentDate, - ).toLocaleDateString() - : "—" - } - /> } diff --git a/apps/edr-freight-web/portal/src/pages/contracts/NewContractPage.tsx b/apps/edr-freight-web/portal/src/pages/contracts/NewContractPage.tsx index 0456bca3e..7821b0076 100644 --- a/apps/edr-freight-web/portal/src/pages/contracts/NewContractPage.tsx +++ b/apps/edr-freight-web/portal/src/pages/contracts/NewContractPage.tsx @@ -541,13 +541,6 @@ export default function NewContractPage({ isHazardous: data.isHazardous, // Reefer is a contract-level flag for both container and bulk. isReefer: data.isRefrigerated, - ...(data.estimatedShipmentDate - ? { - estimatedShipmentDate: new Date( - data.estimatedShipmentDate, - ).toISOString(), - } - : {}), ...(data.previousContractRef ? { renewalOfId: data.previousContractRef } : {}), diff --git a/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/contractToForm.ts b/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/contractToForm.ts index f3d66de3d..8916ef67d 100644 --- a/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/contractToForm.ts +++ b/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/contractToForm.ts @@ -16,12 +16,6 @@ function directionToOperation( return "intercity"; } -/** ISO timestamp → `YYYY-MM-DD` for the native date input. "" when absent. */ -function isoToDateInput(iso: string | null | undefined): string { - if (!iso) return ""; - return iso.slice(0, 10); -} - /** * Rebuild the cargo-type path `[groupId, commodityId]` from a flat cargoTypeId * by locating which reference cargo-type group owns it. @@ -138,7 +132,6 @@ export function contractToFormValues( originYard: primaryRoute?.originYardId ?? "", destinationYard: primaryRoute?.destinationYardId ?? "", extraRoutes, - estimatedShipmentDate: isoToDateInput(contract.estimatedShipmentDate), documents: {}, }; diff --git a/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/schema.ts b/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/schema.ts index 015517f07..5152163d8 100644 --- a/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/schema.ts +++ b/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/schema.ts @@ -187,8 +187,6 @@ export const contractFormSchema = z }), ) .default([]), - // Non-binding estimate. The binding scheduled date is captured at booking. - estimatedShipmentDate: z.string().default(""), documents: z.record(z.string(), z.any()).default({}), notes: z.string().default(""), @@ -222,15 +220,6 @@ export const contractFormSchema = z }, ) .superRefine((data, ctx) => { - // Estimated shipment date is a planning value and is required for all - // contracts (doc §7 step 4). - if (!data.estimatedShipmentDate.trim()) { - ctx.addIssue({ - code: "custom", - path: ["estimatedShipmentDate"], - message: "Select an estimated shipment date.", - }); - } if (data.cargoType === "container") { // Container scope: at least one enabled size. if (data.enabledContainerSizes.length === 0) { @@ -287,7 +276,6 @@ export const initialContractFormValues: DeepPartial = { originYard: "", destinationYard: "", extraRoutes: [], - estimatedShipmentDate: "", documents: {}, notes: "", @@ -311,7 +299,7 @@ export const contractStepFields: Record< "firstMile", "lastMile", ], - // Step 1 — Cargo & Route: scope, sizes, flags, origin/destination, date. + // Step 1 — Cargo & Route: scope, sizes, flags, origin/destination. 1: [ "cargoType", "enabledContainerSizes", @@ -324,7 +312,6 @@ export const contractStepFields: Record< "originYard", "destinationYard", "extraRoutes", - "estimatedShipmentDate", ], // Step 2 — Review & Submit. (The separate Documents step was removed — the // company profile documents are attached to the contract automatically.) diff --git a/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/step4-route.tsx b/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/step4-route.tsx index d678dd318..1e9ead268 100644 --- a/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/step4-route.tsx +++ b/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/step4-route.tsx @@ -1,6 +1,6 @@ import type { Freight } from "@edr/types"; -import { Box, Button, Group, Skeleton, Stack, Text, TextInput } from "@mantine/core"; -import { CalendarDays, MapPin, Plus, Trash2 } from "lucide-react"; +import { Box, Button, Group, Skeleton, Stack, Text } from "@mantine/core"; +import { MapPin, Plus, Trash2 } from "lucide-react"; import { useCallback, useEffect, useMemo } from "react"; import { Controller, @@ -125,12 +125,6 @@ export function Step4Route({ const stationSelectDisabled = yardOptions.length === 0; - const todayISODate = useMemo(() => { - const now = new Date(); - const tz = now.getTimezoneOffset() * 60000; - return new Date(now.getTime() - tz).toISOString().slice(0, 10); - }, []); - return ( {isLoading ? ( @@ -177,27 +171,6 @@ export function Step4Route({ )} - {/* Estimated shipment date — a planning value for every contract. The - binding scheduled date is captured later at booking time. */} - - ( - } - error={fieldState.error?.message} - value={field.value ?? ""} - onChange={(e) => field.onChange(e.currentTarget.value)} - radius="md" - /> - )} - /> - )} diff --git a/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/step8-review.tsx b/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/step8-review.tsx index a5fbbc989..549d5d8be 100644 --- a/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/step8-review.tsx +++ b/apps/edr-freight-web/portal/src/pages/contracts/new-contract-form/step8-review.tsx @@ -9,9 +9,7 @@ import { Text, Textarea, } from "@mantine/core"; -import { format } from "date-fns"; import { - Calendar, CheckCircle2, Circle, ClipboardCheck, @@ -248,10 +246,6 @@ export function Step8Review({ referenceData?.yard.find((y) => y.id === values.destinationYard)?.name ?? values.destinationYard; - const scheduleLabel = values.estimatedShipmentDate - ? format(new Date(values.estimatedShipmentDate), "EEEE, MMM d, yyyy") - : "—"; - const directionLabel = direction ? direction.charAt(0) + direction.slice(1).toLowerCase() : "—"; @@ -353,11 +347,6 @@ export function Step8Review({ : directionLabel } /> - } - label="Estimated shipment" - value={scheduleLabel} - /> } label="Cargo scope" @@ -485,10 +474,6 @@ export function Step8Review({ done={Boolean(values.originYard && values.destinationYard)} label="Route selected" /> -