mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 00:38:11 +00:00
merge conflict
This commit is contained in:
@@ -670,6 +670,13 @@ export const api = {
|
||||
() => ["warehouse-inventory", "ready-to-load-export"],
|
||||
),
|
||||
|
||||
receivedExport: endpoint<void, ReadyToLoadRow[]>(
|
||||
"warehouse-inventory",
|
||||
"received-export",
|
||||
() => warehouseService.receivedExport().then((r) => r.data),
|
||||
() => ["warehouse-inventory", "received-export"],
|
||||
),
|
||||
|
||||
loadedExport: endpoint<void, ReadyToLoadRow[]>(
|
||||
"warehouse-inventory",
|
||||
"loaded-export",
|
||||
|
||||
@@ -60,7 +60,7 @@ export const firstMileService = {
|
||||
list: (pageSize = 1000) =>
|
||||
api.get<FirstMileListResponse>(`${FM.BASE}?pageSize=${pageSize}`),
|
||||
getById: (id: string) => api.get<FirstMileRecord>(FM.BY_ID(id)),
|
||||
update: (id: string, data: { status?: FirstMileApiStatus; vehicleId?: string | null }) =>
|
||||
update: (id: string, data: { status?: FirstMileApiStatus; vehicleId?: string | null; estimatedKm?: number | null; exactKm?: number | null }) =>
|
||||
api.patch<FirstMileRecord>(FM.BY_ID(id), data),
|
||||
accept: (bookingReference: string) =>
|
||||
api.post<FirstMileRecord>(FM.ACCEPT(bookingReference)),
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
import { api as client } from '../auth/http';
|
||||
import { URL_CONSTANTS } from '@/constants/URLS';
|
||||
import { unwrap } from '@/utils/endpoint';
|
||||
import type {
|
||||
AssignCustomsRiskPayload,
|
||||
CreateDjiboutiIncidentPayload,
|
||||
CreateEmptyContainerReturnPayload,
|
||||
DjiboutiIncident,
|
||||
EmptyContainerReturn,
|
||||
ImportCustomsFinalization,
|
||||
ImportOperationActionPayload,
|
||||
RecordDeclarationPayload,
|
||||
UpdateEmptyContainerReturnStatusPayload,
|
||||
UploadImportCustomsDocumentPayload,
|
||||
} from '@/types/importOperations';
|
||||
|
||||
export const importOperationsService = {
|
||||
listIncidents: async (bookingId?: string): Promise<DjiboutiIncident[]> => {
|
||||
const response = await client.get<DjiboutiIncident[]>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.DJIBOUTI_INCIDENTS,
|
||||
{ params: { bookingId } },
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
createIncident: async (
|
||||
payload: CreateDjiboutiIncidentPayload,
|
||||
): Promise<DjiboutiIncident> => {
|
||||
const response = await client.post<DjiboutiIncident>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.DJIBOUTI_INCIDENTS,
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
getCustoms: async (bookingId: string): Promise<ImportCustomsFinalization> => {
|
||||
const response = await client.get<ImportCustomsFinalization>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.CUSTOMS(bookingId),
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
uploadCustomsDocument: async (
|
||||
bookingId: string,
|
||||
payload: UploadImportCustomsDocumentPayload,
|
||||
): Promise<ImportCustomsFinalization> => {
|
||||
const response = await client.post<ImportCustomsFinalization>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.CUSTOMS_DOCUMENTS(bookingId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
recordDeclaration: async (
|
||||
bookingId: string,
|
||||
payload: RecordDeclarationPayload,
|
||||
): Promise<ImportCustomsFinalization> => {
|
||||
const response = await client.post<ImportCustomsFinalization>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.CUSTOMS_DECLARATION(bookingId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
notifyDutiesTaxes: async (
|
||||
bookingId: string,
|
||||
payload: ImportOperationActionPayload = {},
|
||||
): Promise<ImportCustomsFinalization> => {
|
||||
const response = await client.post<ImportCustomsFinalization>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.CUSTOMS_NOTIFY_DUTIES_TAXES(bookingId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
markDutiesTaxesPaid: async (
|
||||
bookingId: string,
|
||||
payload: ImportOperationActionPayload = {},
|
||||
): Promise<ImportCustomsFinalization> => {
|
||||
const response = await client.post<ImportCustomsFinalization>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.CUSTOMS_DUTIES_TAXES_PAID(bookingId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
assignRisk: async (
|
||||
bookingId: string,
|
||||
payload: AssignCustomsRiskPayload,
|
||||
): Promise<ImportCustomsFinalization> => {
|
||||
const response = await client.post<ImportCustomsFinalization>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.CUSTOMS_RISK(bookingId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
markReleasePermitted: async (
|
||||
bookingId: string,
|
||||
payload: ImportOperationActionPayload = {},
|
||||
): Promise<ImportCustomsFinalization> => {
|
||||
const response = await client.post<ImportCustomsFinalization>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.CUSTOMS_RELEASE_PERMITTED(bookingId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
listEmptyReturns: async (): Promise<EmptyContainerReturn[]> => {
|
||||
const response = await client.get<EmptyContainerReturn[]>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.EMPTY_CONTAINER_RETURNS,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
createEmptyReturn: async (
|
||||
payload: CreateEmptyContainerReturnPayload,
|
||||
): Promise<EmptyContainerReturn> => {
|
||||
const response = await client.post<EmptyContainerReturn>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.EMPTY_CONTAINER_RETURNS,
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
updateEmptyReturnStatus: async (
|
||||
id: string,
|
||||
payload: UpdateEmptyContainerReturnStatusPayload,
|
||||
): Promise<EmptyContainerReturn> => {
|
||||
const response = await client.post<EmptyContainerReturn>(
|
||||
URL_CONSTANTS.IMPORT_OPERATIONS.EMPTY_CONTAINER_RETURN_STATUS(id),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
};
|
||||
@@ -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 {
|
||||
@@ -60,7 +60,7 @@ export const lastMileService = {
|
||||
list: (pageSize = 1000) =>
|
||||
api.get<LastMileListResponse>(`${LM.BASE}?pageSize=${pageSize}`),
|
||||
getById: (id: string) => api.get<LastMileRecord>(LM.BY_ID(id)),
|
||||
update: (id: string, data: { status?: LastMileApiStatus; vehicleId?: string | null }) =>
|
||||
update: (id: string, data: { status?: LastMileApiStatus; vehicleId?: string | null; estimatedKm?: number | null; exactKm?: number | null }) =>
|
||||
api.patch<LastMileRecord>(LM.BY_ID(id), data),
|
||||
accept: (bookingReference: string) =>
|
||||
api.post<LastMileRecord>(LM.ACCEPT(encodeURIComponent(bookingReference))),
|
||||
|
||||
@@ -12,6 +12,9 @@ import type {
|
||||
CreateTrainSchedulePayload,
|
||||
EligibleContainerBookingsResponse,
|
||||
FreightType,
|
||||
ImportDjiboutiActionPayload,
|
||||
ImportDjiboutiLoadList,
|
||||
ImportDjiboutiOperation,
|
||||
LocomotiveRecord,
|
||||
PinWagonsPayload,
|
||||
RecordCheckpointPayload,
|
||||
@@ -22,6 +25,7 @@ import type {
|
||||
TrainSchedulePreviewResponse,
|
||||
TrainSchedulingGlobalRules,
|
||||
TrainTrackResponse,
|
||||
UploadImportDjiboutiDocumentPayload,
|
||||
WagonAllocationAttemptResult,
|
||||
YardOption,
|
||||
} from "@/types/trainScheduling";
|
||||
@@ -280,6 +284,101 @@ export const trainSchedulingService = {
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
getImportDjiboutiOperation: async (
|
||||
scheduleId: string,
|
||||
): Promise<ImportDjiboutiOperation> => {
|
||||
const response = await client.get<ImportDjiboutiOperation>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.IMPORT_DJIBOUTI(scheduleId),
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
uploadImportDjiboutiDocument: async (
|
||||
scheduleId: string,
|
||||
payload: UploadImportDjiboutiDocumentPayload,
|
||||
): Promise<ImportDjiboutiOperation> => {
|
||||
const response = await client.post<ImportDjiboutiOperation>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.IMPORT_DJIBOUTI_DOCUMENTS(scheduleId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
grantImportDjiboutiGatepass: async (
|
||||
scheduleId: string,
|
||||
payload: ImportDjiboutiActionPayload = {},
|
||||
): Promise<ImportDjiboutiOperation> => {
|
||||
const response = await client.post<ImportDjiboutiOperation>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.IMPORT_DJIBOUTI_GATEPASS_GRANTED(scheduleId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
markImportDjiboutiReadyForLoading: async (
|
||||
scheduleId: string,
|
||||
payload: ImportDjiboutiActionPayload = {},
|
||||
): Promise<ImportDjiboutiOperation> => {
|
||||
const response = await client.post<ImportDjiboutiOperation>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.IMPORT_DJIBOUTI_READY_FOR_LOADING(scheduleId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
confirmImportDjiboutiLoadedOnTrain: async (
|
||||
scheduleId: string,
|
||||
payload: ImportDjiboutiActionPayload = {},
|
||||
): Promise<ImportDjiboutiOperation> => {
|
||||
const response = await client.post<ImportDjiboutiOperation>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.IMPORT_DJIBOUTI_LOADED_ON_TRAIN(scheduleId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
departImportFromDjibouti: async (
|
||||
scheduleId: string,
|
||||
payload: ImportDjiboutiActionPayload = {},
|
||||
): Promise<ImportDjiboutiOperation> => {
|
||||
const response = await client.post<ImportDjiboutiOperation>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.IMPORT_DJIBOUTI_DEPART(scheduleId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
generateImportDjiboutiLoadList: async (
|
||||
scheduleId: string,
|
||||
payload: ImportDjiboutiActionPayload = {},
|
||||
): Promise<ImportDjiboutiLoadList> => {
|
||||
const response = await client.post<ImportDjiboutiLoadList>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.IMPORT_DJIBOUTI_LOAD_LIST(scheduleId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
downloadImportDjiboutiLoadListDocument: async (
|
||||
scheduleId: string,
|
||||
): Promise<Blob> => {
|
||||
const response = await client.get(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.IMPORT_DJIBOUTI_LOAD_LIST_DOCUMENT(scheduleId),
|
||||
{ responseType: "blob" },
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
downloadExportLoadListDocument: async (
|
||||
scheduleId: string,
|
||||
): Promise<Blob> => {
|
||||
const response = await client.get(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.EXPORT_LOAD_LIST_DOCUMENT(scheduleId),
|
||||
{ responseType: "blob" },
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
getTrack: async (scheduleId: string): Promise<TrainTrackResponse> => {
|
||||
const response = await client.get<TrainTrackResponse>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.CHECKPOINTS(scheduleId),
|
||||
|
||||
@@ -149,6 +149,8 @@ export const warehouseService = {
|
||||
apiClient.post<LoadPassedExportResult>(URL_CONSTANTS.WAREHOUSE_INVENTORY.LOAD_PASSED_EXPORT, {}),
|
||||
bulkMarkInspected: (payload: BulkInspectPayload) =>
|
||||
apiClient.post<BulkInspectResult>(URL_CONSTANTS.WAREHOUSE_INVENTORY.BULK_MARK_INSPECTED, payload),
|
||||
receivedExport: () =>
|
||||
apiClient.get<ReadyToLoadRow[]>(URL_CONSTANTS.WAREHOUSE_INVENTORY.RECEIVED_EXPORT),
|
||||
readyToLoadExport: () =>
|
||||
apiClient.get<ReadyToLoadRow[]>(URL_CONSTANTS.WAREHOUSE_INVENTORY.READY_TO_LOAD_EXPORT),
|
||||
loadedExport: () =>
|
||||
@@ -263,6 +265,14 @@ export const warehouseService = {
|
||||
}),
|
||||
getInvoice: (id: string) =>
|
||||
apiClient.get<WarehouseFeeInvoice>(URL_CONSTANTS.WAREHOUSE_INVOICES.BY_ID(id)),
|
||||
downloadInvoiceDocument: (id: string) =>
|
||||
apiClient.get<Blob>(URL_CONSTANTS.WAREHOUSE_INVOICES.DOCUMENT(id), {
|
||||
responseType: 'blob',
|
||||
}),
|
||||
downloadInvoiceReceipt: (id: string) =>
|
||||
apiClient.get<Blob>(URL_CONSTANTS.WAREHOUSE_INVOICES.RECEIPT(id), {
|
||||
responseType: 'blob',
|
||||
}),
|
||||
invoicesForInventory: (inventoryId: string) =>
|
||||
apiClient.get<WarehouseFeeInvoice[]>(URL_CONSTANTS.WAREHOUSE_INVOICES.FOR_INVENTORY(inventoryId)),
|
||||
invoicesForBooking: (bookingId: string) =>
|
||||
|
||||
Reference in New Issue
Block a user