mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 07:22:53 +00:00
fix
This commit is contained in:
@@ -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 }) => (
|
||||
<Stack gap={2}>
|
||||
@@ -130,7 +128,7 @@ const BookingInfo = ({ record }: { record: LastMileRecord }) => (
|
||||
<SimpleGrid cols={2} spacing="sm">
|
||||
<InfoRow label="Customer" value={customerName(record)} />
|
||||
<InfoRow label="Service type" value={serviceTypeName(record)} />
|
||||
<InfoRow label="Origin yard" value={originYardName(record)} />
|
||||
<InfoRow label="Pickup (origin yard)" value={originYardName(record)} />
|
||||
<InfoRow label="Destination" value={deliveryLocation(record)} />
|
||||
<InfoRow label="Cargo" value={cargoDesc(record)} />
|
||||
<InfoRow label="Advanced Payment" value={formatPrice(record.advancedPayment)} />
|
||||
@@ -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",
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user