diff --git a/apps/edr-freight-web/backoffice/src/pages/operations/LastMilePage.tsx b/apps/edr-freight-web/backoffice/src/pages/operations/LastMilePage.tsx index c0377a12a..7b19e460b 100644 --- a/apps/edr-freight-web/backoffice/src/pages/operations/LastMilePage.tsx +++ b/apps/edr-freight-web/backoffice/src/pages/operations/LastMilePage.tsx @@ -87,14 +87,12 @@ const bookingRef = (r: LastMileRecord) => r.booking?.reference ?? r.bookingId; const customerName = (r: LastMileRecord) => r.booking?.company?.name ?? "—"; const deliveryLocation = (r: LastMileRecord) => r.booking?.lastMileDeliveryAddress ?? "—"; const cargoDesc = (r: LastMileRecord) => { - const parts = [r.booking?.cargoType?.name ?? r.booking?.cargoFreeText].filter(Boolean); + const parts = [r.booking?.cargoType?.cargoTypeName ?? r.booking?.cargoType?.label ?? r.booking?.cargoType?.name ?? r.booking?.cargoFreeText].filter(Boolean); if (r.booking?.cargoTotalWeightVgm) parts.push(`${r.booking.cargoTotalWeightVgm} t`); return parts.join(" · ") || "—"; }; -const priceAmount = (r: LastMileRecord) => - r.booking?.totalAmount ?? r.advancedPayment; const originYardName = (r: LastMileRecord) => - r.booking?.originYard?.name ?? "—"; + r.booking?.originYard?.label ?? r.booking?.originYard?.name ?? "—"; const contactPersonName = (r: LastMileRecord) => r.booking?.company?.contactPersonName ?? "—"; const contactPhone = (r: LastMileRecord) => @@ -104,7 +102,7 @@ const requestedDate = (r: LastMileRecord) => { return d ? new Date(d).toISOString().slice(0, 10) : "—"; }; const serviceTypeName = (r: LastMileRecord) => - r.booking?.serviceType?.name ?? "—"; + r.booking?.serviceType?.label ?? r.booking?.serviceType?.name ?? "—"; const InfoRow = ({ label, value }: { label: string; value: string }) => ( @@ -130,7 +128,7 @@ const BookingInfo = ({ record }: { record: LastMileRecord }) => ( - + @@ -149,7 +147,7 @@ const BookingInfo = ({ record }: { record: LastMileRecord }) => ( const tripSlipRows = (record: LastMileRecord): [string, string][] => [ ["Customer", customerName(record)], ["Service", serviceTypeName(record)], - ["Origin yard", originYardName(record)], + ["Pickup (origin yard)", originYardName(record)], ["Destination", deliveryLocation(record)], ["Cargo", cargoDesc(record)], ["Advanced Payment", formatPrice(record.advancedPayment)], @@ -593,6 +591,12 @@ const LastMilePage = () => { meta: { headerClassName, cellClassName }, cell: ({ row }) => customerName(row.original), }, + { + id: "pickup", + header: "Pickup", + meta: { headerClassName, cellClassName }, + cell: ({ row }) => originYardName(row.original), + }, { id: "destination", header: "Destination", diff --git a/apps/edr-freight-web/backoffice/src/services/last-mile.service.ts b/apps/edr-freight-web/backoffice/src/services/last-mile.service.ts index 3b7b86e47..cb9e61b52 100644 --- a/apps/edr-freight-web/backoffice/src/services/last-mile.service.ts +++ b/apps/edr-freight-web/backoffice/src/services/last-mile.service.ts @@ -18,10 +18,10 @@ export interface LastMileBooking { totalAmount: number; scheduledDate?: string | null; company?: { id: string; name?: string; phone?: string | null; contactPersonName?: string | null; contactPersonPhone?: string | null } | null; - serviceType?: { id: string; name?: string } | null; - originYard?: { id: string; name?: string } | null; - destinationYard?: { id: string; name?: string } | null; - cargoType?: { id: string; name?: string } | null; + serviceType?: { id: string; name?: string; label?: string } | null; + originYard?: { id: string; name?: string; label?: string } | null; + destinationYard?: { id: string; name?: string; label?: string } | null; + cargoType?: { id: string; name?: string; label?: string; cargoTypeName?: string } | null; } export interface LastMileVehicle {