From e0e6020020a07994999c434a4d74bdbbe4e946c9 Mon Sep 17 00:00:00 2001 From: ghost2023 Date: Tue, 16 Jun 2026 14:54:07 +0300 Subject: [PATCH] fixes --- apps/edr-freight-web/portal/src/App.tsx | 2 +- .../portal/src/components/AppLayout.tsx | 1 - .../src/components/bookings/BookingTable.tsx | 33 ---- .../step3-first-last-mile.tsx | 144 --------------- .../new-booking-form/step7-documents.tsx | 65 ------- .../src/pages/settings/TabPowerOfAttorney.tsx | 14 +- .../src/pages/tracking/NewShipmentPage.tsx | 174 ------------------ .../src/pages/tracking/TrackingPage.tsx | 68 ++----- 8 files changed, 28 insertions(+), 473 deletions(-) delete mode 100644 apps/edr-freight-web/portal/src/components/bookings/BookingTable.tsx delete mode 100644 apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step3-first-last-mile.tsx delete mode 100644 apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step7-documents.tsx delete mode 100644 apps/edr-freight-web/portal/src/pages/tracking/NewShipmentPage.tsx diff --git a/apps/edr-freight-web/portal/src/App.tsx b/apps/edr-freight-web/portal/src/App.tsx index dd3627fef..080df0ed2 100644 --- a/apps/edr-freight-web/portal/src/App.tsx +++ b/apps/edr-freight-web/portal/src/App.tsx @@ -173,7 +173,7 @@ const App = () => { } /> - }> + }> [] = [ - { key: "reference", header: "Reference" }, - { key: "customerId", header: "Customer" }, - { key: "status", header: "Status" }, - { - key: "scheduledDate", - header: "Scheduled", - render: (row) => new Date(row.scheduledDate).toLocaleDateString(), - }, - { - key: "totalAmount", - header: "Total", - render: (row) => row.totalAmount.toFixed(2), - }, -]; - -const BookingTable = ({ bookings }: BookingTableProps) => ( - row.id} - emptyMessage="No bookings yet" - /> -); - -export default BookingTable; diff --git a/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step3-first-last-mile.tsx b/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step3-first-last-mile.tsx deleted file mode 100644 index 3bc5629ca..000000000 --- a/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step3-first-last-mile.tsx +++ /dev/null @@ -1,144 +0,0 @@ -import { Controller, type UseFormReturn } from "react-hook-form"; -import { Field, FieldError, Input, Switch } from "@edr/ui-common"; -import { type BookingFormValues } from "./schema"; -import { StepHeader } from "./shared"; - -type BookingForm = UseFormReturn; - -export function Step3FirstLastMile({ form }: { form: BookingForm }) { - const firstMileEnabled = form.watch("firstMileEnabled"); - const lastMileEnabled = form.watch("lastMileEnabled"); - const equipmentReturn = form.watch("equipmentReturn"); - - return ( -
- - -
-
- ( -
-
-

First Mile - Pick-up

-

- Truck pick-up from your premises (Door to Port) to the - origin rail yard. -

-
- { - field.onChange(value); - if (!value) { - form.setValue("pickUpAddress", "", { - shouldDirty: true, - shouldValidate: true, - }); - } - }} - /> -
- )} - /> - {firstMileEnabled && ( - ( - - - - - )} - /> - )} -
- -
- ( -
-
-

Last Mile - Delivery

-

- Truck delivery from the destination rail yard to the final - address (Port to Door). -

-
- { - field.onChange(value); - if (!value) { - form.setValue("deliveryAddress", "", { - shouldDirty: true, - shouldValidate: true, - }); - } - }} - /> -
- )} - /> - {lastMileEnabled && ( - ( - - - - - )} - /> - )} - - {lastMileEnabled && ( -
- ( -
-
-

Equipment Return

-

- {field.value === "with_return" - ? "Container returned to EDR after unloading." - : "Container retained by the customer after delivery."} -

-
- { - field.onChange( - value ? "with_return" : "without_return", - ); - }} - /> -
- )} - /> -
- )} -
-
-
- ); -} diff --git a/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step7-documents.tsx b/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step7-documents.tsx deleted file mode 100644 index a4ac23a4b..000000000 --- a/apps/edr-freight-web/portal/src/pages/bookings/new-booking-form/step7-documents.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { Controller, type UseFormReturn } from "react-hook-form"; -import { Field, FieldError, SmartFileInput } from "@edr/ui-common"; -import { - BOOKING_DOCS_SETTING, - REQUIRED_DOC_KEYS, - type BookingFormValues, -} from "./schema"; -import { getUploadedRequiredCount, StepHeader } from "./shared"; - -type BookingForm = UseFormReturn; - -export function Step7Documents({ form }: { form: BookingForm }) { - const documents = form.watch("documents"); - const uploadedRequired = getUploadedRequiredCount(documents); - const documentErrors = form.formState.errors.documents as - | Record - | undefined; - const smartFileErrors = Object.fromEntries( - Object.entries(documentErrors ?? {}).map(([key, value]) => [ - key, - value?.message ?? "", - ]), - ); - - return ( -
- - -
-
- {uploadedRequired}/{REQUIRED_DOC_KEYS.length} -
-

- {uploadedRequired < REQUIRED_DOC_KEYS.length - ? `${REQUIRED_DOC_KEYS.length - uploadedRequired} mandatory document(s) still needed.` - : "All mandatory documents uploaded. Power of Attorney is optional."} -

-
- - ( - - field.onChange(value)} - errors={smartFileErrors} - /> - - - )} - /> -
- ); -} diff --git a/apps/edr-freight-web/portal/src/pages/settings/TabPowerOfAttorney.tsx b/apps/edr-freight-web/portal/src/pages/settings/TabPowerOfAttorney.tsx index 00ecbfdf6..07f3b7720 100644 --- a/apps/edr-freight-web/portal/src/pages/settings/TabPowerOfAttorney.tsx +++ b/apps/edr-freight-web/portal/src/pages/settings/TabPowerOfAttorney.tsx @@ -3,7 +3,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"; import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; -import { CheckCircle2, Loader2, Save, UserCheck, XCircle } from "lucide-react"; +import { CheckCircle2, Save, UserCheck, XCircle } from "lucide-react"; import { Card, Group, @@ -100,8 +100,8 @@ export default function TabPowerOfAttorney({
- Power of Attorney details are optional. Fill them in if you have - an authorized representative, or leave blank. + Power of Attorney details are optional. Fill them in if you have an + authorized representative, or leave blank. - Saved successfully + + Saved successfully + )} {mutation.isError && ( - Save failed + + Save failed + )} diff --git a/apps/edr-freight-web/portal/src/pages/tracking/NewShipmentPage.tsx b/apps/edr-freight-web/portal/src/pages/tracking/NewShipmentPage.tsx deleted file mode 100644 index 81a37f137..000000000 --- a/apps/edr-freight-web/portal/src/pages/tracking/NewShipmentPage.tsx +++ /dev/null @@ -1,174 +0,0 @@ -import type { ReactNode } from "react"; -import { Calendar, MapPin } from "lucide-react"; - -import { - Dialog, - DialogContent, - DialogDescription, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "@/components/ui/dialog"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; -import { Button } from "@/components/ui/button"; - -import { consignments } from "../consignments/consignments.mock"; -import type { ShipmentMode, ShipmentStatus } from "./shipments.mock"; - -export interface ShipmentFormData { - consignmentId?: number; - consignmentReference?: string; - originStation?: string; - destinationStation?: string; - mode?: ShipmentMode; - status?: ShipmentStatus; - currentLocation?: string; - eta?: string; -} - -export interface NewShipmentPageProps { - mode?: "create" | "edit"; - shipment?: ShipmentFormData; - children?: ReactNode; -} - -const selectClass = - "flex h-10 w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-700 shadow-xs outline-none transition hover:border-slate-300 focus:border-[#10B981]/50 focus:ring-2 focus:ring-[#10B981]/20"; - -export default function NewShipmentPage({ - mode = "create", - shipment, - children, -}: NewShipmentPageProps = {}) { - const isEdit = mode === "edit"; - const title = isEdit ? "Edit Shipment" : "New Shipment"; - const description = isEdit - ? "Update shipment tracking information." - : "Create a new shipment for real-time tracking."; - const submitLabel = isEdit ? "Save Changes" : "Create Shipment"; - - return ( - - - {children ?? } - - - - - {title} - {description} - - -
- {/* Consignment */} -
- - -

- Origin and destination auto-fill from the linked consignment. -

-
- - {/* Status */} -
- - -
- - {/* Mode */} -
- - -
- - {/* Origin */} -
- -
- - -
-
- - {/* Destination */} -
- -
- - -
-
- - {/* ETA */} -
- -
- - -
-
- - {/* Current Location */} -
- -
- - -
-
-
- -
- - -
-
-
- ); -} diff --git a/apps/edr-freight-web/portal/src/pages/tracking/TrackingPage.tsx b/apps/edr-freight-web/portal/src/pages/tracking/TrackingPage.tsx index 144bc2bef..ccd8e398c 100644 --- a/apps/edr-freight-web/portal/src/pages/tracking/TrackingPage.tsx +++ b/apps/edr-freight-web/portal/src/pages/tracking/TrackingPage.tsx @@ -8,7 +8,6 @@ import { List, MapPin, MoreHorizontal, - Pencil, Plus, Search, Train, @@ -17,7 +16,6 @@ import { } from "lucide-react"; import Breadcrumbs from "@/components/Breadcrumbs"; -import NewShipmentPage from "./NewShipmentPage"; import DeleteShipmentDialog from "./DeleteShipmentDialog"; import { shipments, @@ -93,13 +91,6 @@ export default function TrackingPage() { className="pl-8!" /> - - - - @@ -279,7 +270,10 @@ function ShipmentCard({ shipment }: { shipment: Shipment }) { -
e.stopPropagation()}> +
e.stopPropagation()} + >