add dispute functionality for contract duty and implement collection dates

This commit is contained in:
Marshal
2026-07-26 16:58:51 +00:00
parent 9b13fa2ac6
commit 5e10c97294
74 changed files with 3684 additions and 342 deletions

View File

@@ -390,11 +390,12 @@ export const bookingsService = {
uploadDeliveryOrder: async (
id: string,
file: File,
vesselDepartureDate?: string,
dates: { vesselArrivalDate: string; doCollectedDate: string },
): Promise<BookingDetail> => {
const form = new FormData();
form.append("file", file);
if (vesselDepartureDate) form.append("vesselDepartureDate", vesselDepartureDate);
form.append("vesselArrivalDate", dates.vesselArrivalDate);
form.append("doCollectedDate", dates.doCollectedDate);
const response = await client.post(B.CLEARANCE_DELIVERY_ORDER(id), form, {
headers: { "Content-Type": "multipart/form-data" },
});

View File

@@ -126,6 +126,23 @@ export interface SignContractPayload {
consentText?: string;
}
/**
* One stored version of a clearance document. The current row plus every
* superseded upload — staff corrections never erase what the customer sent.
*/
export interface ClearanceDocumentVersion {
id: string;
name: string;
url: string;
size: number;
mimeType: string;
uploadedAt: string;
isCurrent: boolean;
replacedAt: string | null;
replacedByUserId: string | null;
replaceReason: string | null;
}
async function postContract<T>(url: string, body?: unknown): Promise<T> {
const response = await client.post<T>(url, body ?? {});
return unwrap(response.data);
@@ -297,6 +314,50 @@ export const contractsService = {
) =>
postContract<Freight.IContract>(C.CLEARANCE_REVIEW(id), payload),
/** GL ET asks Djibouti to name the officer handling the shipment in transit. */
requestTransitAssignee: (id: string, note?: string) =>
postContract<Freight.IContract>(
C.CLEARANCE_TRANSIT_ASSIGNEE_REQUEST(id),
{ note },
),
/** GL Djibouti names (or changes) that officer — unblocks the declaration. */
assignTransitAssignee: (id: string, assignee: string) =>
postContract<Freight.IContract>(C.CLEARANCE_TRANSIT_ASSIGNEE_ASSIGN(id), {
assignee,
}),
/**
* Replace a clearance document in place. The customer's original is retired
* into the version history rather than overwritten, and the new file comes
* back unreviewed so it still has to be approved.
*/
replaceClearanceDocument: async (
id: string,
fileKey: string,
file: File,
reason: string,
): Promise<Freight.IContract> => {
const form = new FormData();
form.append("file", file);
form.append("reason", reason);
const response = await client.post(
C.CLEARANCE_DOC_REPLACE(id, fileKey),
form,
{ headers: { "Content-Type": "multipart/form-data" } },
);
return unwrap(response.data) as Freight.IContract;
},
/** Every stored version of one clearance document, newest first. */
getClearanceDocumentVersions: async (
id: string,
fileKey: string,
): Promise<ClearanceDocumentVersion[]> => {
const response = await client.get(C.CLEARANCE_DOC_VERSIONS(id, fileKey));
return (unwrap(response.data) as ClearanceDocumentVersion[]) ?? [];
},
uploadClearanceOutput: async (
id: string,
files: Record<string, File | null>,
@@ -390,11 +451,12 @@ export const contractsService = {
uploadDeliveryOrder: async (
id: string,
file: File,
vesselDepartureDate?: string,
dates: { vesselArrivalDate: string; doCollectedDate: string },
): Promise<Freight.IContract> => {
const form = new FormData();
form.append("file", file);
if (vesselDepartureDate) form.append("vesselDepartureDate", vesselDepartureDate);
form.append("vesselArrivalDate", dates.vesselArrivalDate);
form.append("doCollectedDate", dates.doCollectedDate);
const response = await client.post(C.CLEARANCE_DELIVERY_ORDER(id), form, {
headers: { "Content-Type": "multipart/form-data" },
});