From 17dfce0d18aec6fde05922b7344cc68331d8912c Mon Sep 17 00:00:00 2001 From: ghost2023 Date: Tue, 16 Jun 2026 15:45:58 +0300 Subject: [PATCH] fixes --- .../src/pages/bookings/NewBookingPage.tsx | 7 ++- .../bookings/new-booking-form/step4-route.tsx | 9 +--- .../new-booking-form/step8-review.tsx | 49 ++++++++++--------- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/apps/edr-freight-web/portal/src/pages/bookings/NewBookingPage.tsx b/apps/edr-freight-web/portal/src/pages/bookings/NewBookingPage.tsx index 3a1f7ec27..f1b8816e8 100644 --- a/apps/edr-freight-web/portal/src/pages/bookings/NewBookingPage.tsx +++ b/apps/edr-freight-web/portal/src/pages/bookings/NewBookingPage.tsx @@ -322,7 +322,12 @@ export default function NewBookingPage() { )} {step === 6 && } {step === 7 && ( - + )} diff --git a/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step4-route.tsx b/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step4-route.tsx index 162516d67..e8d0310c4 100644 --- a/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step4-route.tsx +++ b/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step4-route.tsx @@ -58,14 +58,7 @@ export function Step4Route({ }, [yardOptions, destinationYard]); console.log({ yardOptions, originYard, destinationYard }); const destData = useMemo(() => { - return yardOptions - .filter((o) => o.value !== originYard) - .filter((d) => { - const origin = referenceData?.yard.find((y) => y.id === originYard); - if (!origin) return true; - - return true; - }); + return yardOptions.filter((o) => o.value !== originYard); }, [yardOptions, originYard]); const direction = getRouteDirection( diff --git a/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step8-review.tsx b/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step8-review.tsx index 53e809035..d3a24d55d 100644 --- a/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step8-review.tsx +++ b/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step8-review.tsx @@ -1,5 +1,5 @@ import { Controller, type UseFormReturn } from "react-hook-form"; -import { Box, Card, Checkbox, SimpleGrid, Text, Textarea, Title } from "@mantine/core"; +import { Box, Card, Checkbox, SimpleGrid, Text, Textarea } from "@mantine/core"; import { BookingFormInputValues, BOOKING_DOCS_SETTING, @@ -9,19 +9,28 @@ import { import { StepHeader } from "./shared"; import type { Freight } from "@/types"; -type BookingForm = UseFormReturn; +type BookingForm = UseFormReturn< + BookingFormInputValues, + any, + BookingFormValues +>; export function Step8Review({ form, setStep, direction, + referenceData, }: { form: BookingForm; setStep: (step: number) => void; direction: Freight.ScheduleTradeDirection; + referenceData?: Freight.BookingReferenceData; }) { const values = form.watch(); const errors = form.formState.errors; + const serviceType = referenceData?.service.find( + (s) => s.id === values.serviceTypeId, + ); function Row({ label, @@ -56,17 +65,17 @@ export function Step8Review({ const containerSummary = values.cargoType === "container" && values.containers.length > 0 ? values.containers - .filter((c) => +c.qty > 0) - .map((c) => `${c.qty} × ${c.type}`) - .join(", ") + .filter((c) => +c.qty > 0) + .map((c) => `${c.qty} × ${c.type}`) + .join(", ") : ""; const totalVgm = values.cargoType === "container" ? values.containers.reduce( - (sum, c) => sum + (+c.qty || 0) * (+c.vgm || 0), - 0, - ) + (sum, c) => sum + (+c.qty || 0) * (+c.vgm || 0), + 0, + ) : 0; const documents = (values.documents ?? {}) as BookingDocuments; @@ -99,7 +108,13 @@ export function Step8Review({ py="sm" className="border-b border-[var(--mantine-color-gray-2)] bg-gray-50/60" > - + {title} @@ -124,17 +139,7 @@ export function Step8Review({ value={values.contractType === "new" ? "New Contract" : "Renewal"} target={1} /> - + @@ -260,9 +265,7 @@ export function Step8Review({ } checked={field.value} onChange={(e) => field.onChange(e.currentTarget.checked)} - error={ - fieldState.error?.message ?? errors.termsAccepted?.message - } + error={fieldState.error?.message ?? errors.termsAccepted?.message} color="edr-green" radius="sm" />