mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 18:55:42 +00:00
add GL operations for customs risk assignment, duty advising, and incident reporting
This commit is contained in:
@@ -250,4 +250,75 @@ export const contractsService = {
|
||||
C.COMPLETE_BOOKING_MILESTONE(bookingId, code),
|
||||
{ note },
|
||||
),
|
||||
|
||||
// ── GL post-booking operational actions ──
|
||||
assignRisk: (
|
||||
bookingId: string,
|
||||
payload: { riskLevel: Freight.CustomsRiskLevel; note?: string },
|
||||
) =>
|
||||
postContract<Freight.IClearanceMilestone>(
|
||||
C.BOOKING_RISK(bookingId),
|
||||
payload,
|
||||
),
|
||||
|
||||
adviseDuty: (
|
||||
bookingId: string,
|
||||
payload: {
|
||||
amount: number;
|
||||
currency: string;
|
||||
declarationSerial?: string;
|
||||
note?: string;
|
||||
},
|
||||
) =>
|
||||
postContract<Freight.IClearanceMilestone>(
|
||||
C.BOOKING_DUTY(bookingId),
|
||||
payload,
|
||||
),
|
||||
|
||||
assignStation: (
|
||||
bookingId: string,
|
||||
payload: { stationYardId: string; staffId?: string },
|
||||
) => postContract(C.BOOKING_STATION_ASSIGN(bookingId), payload),
|
||||
|
||||
uploadGlDocuments: async (
|
||||
bookingId: string,
|
||||
files: Record<string, File | null>,
|
||||
): Promise<{ uploaded: number; completedMilestones: string[] }> => {
|
||||
const form = new FormData();
|
||||
for (const [key, file] of Object.entries(files)) {
|
||||
if (file) form.append(key, file);
|
||||
}
|
||||
const response = await client.post(C.BOOKING_GL_DOCUMENTS(bookingId), form, {
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
});
|
||||
return unwrap(response.data) as {
|
||||
uploaded: number;
|
||||
completedMilestones: string[];
|
||||
};
|
||||
},
|
||||
|
||||
listIncidents: async (
|
||||
bookingId: string,
|
||||
): Promise<Freight.IClearanceIncident[]> => {
|
||||
const response = await client.get(C.BOOKING_INCIDENTS(bookingId));
|
||||
return (unwrap(response.data) ?? []) as Freight.IClearanceIncident[];
|
||||
},
|
||||
|
||||
reportIncident: async (
|
||||
bookingId: string,
|
||||
payload: {
|
||||
incidentType: Freight.IncidentType;
|
||||
description: string;
|
||||
photos: File[];
|
||||
},
|
||||
): Promise<Freight.IClearanceIncident> => {
|
||||
const form = new FormData();
|
||||
form.append("incidentType", payload.incidentType);
|
||||
form.append("description", payload.description);
|
||||
for (const photo of payload.photos) form.append("photos", photo);
|
||||
const response = await client.post(C.BOOKING_INCIDENTS(bookingId), form, {
|
||||
headers: { "Content-Type": "multipart/form-data" },
|
||||
});
|
||||
return unwrap(response.data) as Freight.IClearanceIncident;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user