mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 21:15:41 +00:00
Merge pull request #93 from Tria-plc/freight_feature/booking_flow
dynamic contract templates and companyId on bookings
This commit is contained in:
@@ -18,7 +18,8 @@ export function toBookingListRow(booking: BookingDetail): BookingListRow {
|
||||
return {
|
||||
id: booking.id,
|
||||
reference: booking.reference,
|
||||
customerLabel: labelFromRef(booking.customer, booking.customerId),
|
||||
customerLabel: labelFromRef(booking.company, booking.companyId),
|
||||
// customerLabel: labelFromRef(booking.customer, booking.customerId),
|
||||
status: booking.status,
|
||||
scheduledDate: booking.scheduledDate,
|
||||
totalAmount: Number(booking.totalAmount),
|
||||
|
||||
@@ -7,7 +7,8 @@ const B = URL_CONSTANTS.BOOKINGS;
|
||||
|
||||
export interface BookingListFilter {
|
||||
status?: string;
|
||||
customerId?: string;
|
||||
// customerId?: string;
|
||||
companyId?: string;
|
||||
freightType?: string;
|
||||
tradeDirection?: string;
|
||||
paymentCurrency?: string;
|
||||
|
||||
@@ -70,7 +70,8 @@ export interface BookingFile {
|
||||
export interface BookingDetail {
|
||||
id: string;
|
||||
reference: string;
|
||||
customerId: string;
|
||||
// customerId: string;
|
||||
companyId: string;
|
||||
status: BookingStatus;
|
||||
scheduledDate: string;
|
||||
totalAmount: number;
|
||||
@@ -91,7 +92,8 @@ export interface BookingDetail {
|
||||
latestChangeRequestNote?: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
customer?: BookingNamedRef & { companyName?: string };
|
||||
// customer?: BookingNamedRef & { companyName?: string };
|
||||
company?: BookingNamedRef;
|
||||
originYard?: BookingNamedRef;
|
||||
destinationYard?: BookingNamedRef;
|
||||
serviceType?: BookingNamedRef & { code?: string };
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
} from "lucide-react";
|
||||
import { Button } from "@edr/ui-common";
|
||||
import { api } from "@/services/api";
|
||||
import { Freight } from "@edr/types";
|
||||
import type { CreateBookingPayload } from "@/services/bookings.service";
|
||||
import {
|
||||
BookingFormInputValues,
|
||||
@@ -120,7 +121,6 @@ export default function NewBookingPage() {
|
||||
const group = cargoTree.find(
|
||||
(g) => g.code === "CONTAINER" || /container/i.test(g.name),
|
||||
);
|
||||
console.log(group, cargoTree);
|
||||
return group?.id ?? "";
|
||||
};
|
||||
|
||||
@@ -132,14 +132,14 @@ export default function NewBookingPage() {
|
||||
return "";
|
||||
};
|
||||
|
||||
const cargoTypeId = cargoTree[0].id;
|
||||
// data.cargoType === "container"
|
||||
// ? findContainerCargoTypeId()
|
||||
// : (findCargoTypeId(
|
||||
// data.freightType === "bulk"
|
||||
// ? data.bulkCommodity
|
||||
// : data.breakBulkType,
|
||||
// ) ?? "");
|
||||
const cargoTypeId =
|
||||
data.cargoType === "container"
|
||||
? findContainerCargoTypeId()
|
||||
: (findCargoTypeId(
|
||||
data.freightType === "bulk"
|
||||
? data.bulkCommodity
|
||||
: data.breakBulkType,
|
||||
) ?? "");
|
||||
|
||||
const cargoFreeText =
|
||||
data.cargoType === "container"
|
||||
@@ -168,7 +168,11 @@ export default function NewBookingPage() {
|
||||
: direction === "domestic"
|
||||
? "DOMESTIC"
|
||||
: "IMPORT",
|
||||
cargoTypeId,
|
||||
freightType:
|
||||
data.cargoType === "container"
|
||||
? Freight.FreightType.Container
|
||||
: Freight.FreightType.Bulk,
|
||||
cargoTypeId: data.cargoType === "container" ? undefined : cargoTypeId,
|
||||
cargoTotalWeightVgm: totalWeight,
|
||||
isHazardous: data.isHazardous,
|
||||
paymentCurrency: "USD",
|
||||
@@ -181,7 +185,7 @@ export default function NewBookingPage() {
|
||||
vgmPerUnitTons: Number(c.vgm || 0),
|
||||
}))
|
||||
: [],
|
||||
...(customer ? { customerId: customer.id } : {}),
|
||||
...(customer?.company?.id ? { companyId: customer.company.id } : {}),
|
||||
...(data.previousContractRef
|
||||
? { previousContractId: data.previousContractRef }
|
||||
: {}),
|
||||
|
||||
Reference in New Issue
Block a user