mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 17:38:12 +00:00
approve-delivery exit-gate fix + Import Loading Confirmation frontend panel — done this session, not yet committed
This commit is contained in:
@@ -28,6 +28,11 @@ import type {
|
||||
UpdateFileUploadFieldDto,
|
||||
UpdateFileUploadSettingDto,
|
||||
} from "@/types/fileUploadSettings";
|
||||
import type {
|
||||
Invoice,
|
||||
InvoiceListFilter,
|
||||
PaginatedInvoices,
|
||||
} from "@/types/invoice";
|
||||
import type { IOverviewDashboard, OverviewRange } from "@/types/overview";
|
||||
import {
|
||||
RuleEngineListResult,
|
||||
@@ -130,6 +135,7 @@ import {
|
||||
import { containerTypesService } from "./container-types.service";
|
||||
import { containerService, type Container } from "./containerService";
|
||||
import { customersService } from "./customers.service";
|
||||
import { invoicesService } from "./invoices.service";
|
||||
import { dropdownSettingsService } from "./dropdownSettings.service";
|
||||
import { fileUploadSettingsService } from "./fileUploadSettings.service";
|
||||
import {
|
||||
@@ -199,7 +205,10 @@ const TRAIN_SCHEDULING_INVALIDATIONS: ReadonlyArray<readonly unknown[]> = [
|
||||
export const api = {
|
||||
trainScheduling: {
|
||||
// ── Queries ────────────────────────────────────────────────────────────
|
||||
scheduleList: endpoint<{ freightType?: FreightType }, TrainScheduleListItem[]>(
|
||||
scheduleList: endpoint<
|
||||
{ freightType?: FreightType },
|
||||
TrainScheduleListItem[]
|
||||
>(
|
||||
"train-scheduling",
|
||||
"schedules",
|
||||
({ freightType }) => trainSchedulingService.listSchedules(freightType),
|
||||
@@ -213,11 +222,16 @@ export const api = {
|
||||
() => QUERY_KEYS.TRAIN_SCHEDULING.batchBoard(),
|
||||
),
|
||||
|
||||
batchBoardDetail: endpoint<{ scheduleId: string }, BatchBoardScheduleDetail>(
|
||||
batchBoardDetail: endpoint<
|
||||
{ scheduleId: string },
|
||||
BatchBoardScheduleDetail
|
||||
>(
|
||||
"train-scheduling",
|
||||
"batch-board-detail",
|
||||
({ scheduleId }) => trainSchedulingService.getBatchBoardDetail(scheduleId),
|
||||
({ scheduleId }) => QUERY_KEYS.TRAIN_SCHEDULING.batchBoardDetail(scheduleId),
|
||||
({ scheduleId }) =>
|
||||
trainSchedulingService.getBatchBoardDetail(scheduleId),
|
||||
({ scheduleId }) =>
|
||||
QUERY_KEYS.TRAIN_SCHEDULING.batchBoardDetail(scheduleId),
|
||||
),
|
||||
|
||||
scheduleDetail: endpoint<
|
||||
@@ -365,7 +379,10 @@ export const api = {
|
||||
),
|
||||
|
||||
// ── Mutations ──────────────────────────────────────────────────────────
|
||||
runAllocation: endpoint<{ scheduleId: string }, WagonAllocationAttemptResult>(
|
||||
runAllocation: endpoint<
|
||||
{ scheduleId: string },
|
||||
WagonAllocationAttemptResult
|
||||
>(
|
||||
"train-scheduling",
|
||||
"run-allocation",
|
||||
({ scheduleId }) => trainSchedulingService.runAllocation(scheduleId),
|
||||
@@ -483,7 +500,10 @@ export const api = {
|
||||
() => TRAIN_SCHEDULING_INVALIDATIONS,
|
||||
),
|
||||
|
||||
pinWagons: endpoint<{ id: string; payload: PinWagonsPayload }, TrainScheduleDetail>(
|
||||
pinWagons: endpoint<
|
||||
{ id: string; payload: PinWagonsPayload },
|
||||
TrainScheduleDetail
|
||||
>(
|
||||
"train-scheduling",
|
||||
"pin-wagons",
|
||||
({ id, payload }) => trainSchedulingService.pinWagons(id, payload),
|
||||
@@ -579,8 +599,10 @@ export const api = {
|
||||
({ id }) => warehouseService.getById(id).then((r) => r.data),
|
||||
),
|
||||
|
||||
dashboard: endpoint<void, WarehouseDashboard>("warehouses", "dashboard", () =>
|
||||
warehouseService.dashboard().then((r) => r.data),
|
||||
dashboard: endpoint<void, WarehouseDashboard>(
|
||||
"warehouses",
|
||||
"dashboard",
|
||||
() => warehouseService.dashboard().then((r) => r.data),
|
||||
),
|
||||
|
||||
create: endpoint<SaveWarehousePayload, Warehouse>(
|
||||
@@ -671,10 +693,8 @@ export const api = {
|
||||
listInventory: endpoint<
|
||||
{ filter?: InventoryFilter },
|
||||
WarehouseInventoryItem[]
|
||||
>(
|
||||
"warehouse-inventory",
|
||||
"list",
|
||||
({ filter }) => warehouseService.listInventory(filter).then((r) => r.data),
|
||||
>("warehouse-inventory", "list", ({ filter }) =>
|
||||
warehouseService.listInventory(filter).then((r) => r.data),
|
||||
),
|
||||
|
||||
inquiry: endpoint<
|
||||
@@ -687,11 +707,19 @@ export const api = {
|
||||
({ filter }) => ["warehouse-inventory", "inquiry", filter],
|
||||
),
|
||||
|
||||
eligibleBookings: endpoint<{ direction?: 'IMPORT' | 'EXPORT' } | void, EligibleBooking[]>(
|
||||
eligibleBookings: endpoint<
|
||||
{ direction?: "IMPORT" | "EXPORT" } | void,
|
||||
EligibleBooking[]
|
||||
>(
|
||||
"warehouse-inventory",
|
||||
"eligible-bookings",
|
||||
(input) => warehouseService.eligibleBookings(input?.direction).then((r) => r.data),
|
||||
(input) => ["warehouse-inventory", "eligible-bookings", input?.direction ?? "ALL"],
|
||||
(input) =>
|
||||
warehouseService.eligibleBookings(input?.direction).then((r) => r.data),
|
||||
(input) => [
|
||||
"warehouse-inventory",
|
||||
"eligible-bookings",
|
||||
input?.direction ?? "ALL",
|
||||
],
|
||||
),
|
||||
|
||||
readyToLoadExport: endpoint<void, ReadyToLoadRow[]>(
|
||||
@@ -727,7 +755,11 @@ export const api = {
|
||||
"import-train-items",
|
||||
({ scheduleId }) =>
|
||||
warehouseService.importTrainItems(scheduleId).then((r) => r.data),
|
||||
({ scheduleId }) => ["warehouse-inventory", "import-train-items", scheduleId],
|
||||
({ scheduleId }) => [
|
||||
"warehouse-inventory",
|
||||
"import-train-items",
|
||||
scheduleId,
|
||||
],
|
||||
),
|
||||
|
||||
importUnloadedQueue: endpoint<void, ImportUnloadedItem[]>(
|
||||
@@ -795,8 +827,11 @@ export const api = {
|
||||
"inspection-reports",
|
||||
({ inventoryId }) =>
|
||||
warehouseService.listInspectionReports(inventoryId).then((r) => r.data),
|
||||
({ inventoryId }) =>
|
||||
["warehouse-inventory", inventoryId, "inspection-reports"],
|
||||
({ inventoryId }) => [
|
||||
"warehouse-inventory",
|
||||
inventoryId,
|
||||
"inspection-reports",
|
||||
],
|
||||
),
|
||||
|
||||
allocationRules: endpoint<void, AllocationRule[]>(
|
||||
@@ -813,15 +848,28 @@ export const api = {
|
||||
() => ["warehouse-fee-rules"],
|
||||
),
|
||||
|
||||
feePreview: endpoint<{ inventoryId: string; billingCurrency?: 'ETB' | 'USD' }, FeePreview[]>(
|
||||
feePreview: endpoint<
|
||||
{ inventoryId: string; billingCurrency?: "ETB" | "USD" },
|
||||
FeePreview[]
|
||||
>(
|
||||
"warehouse-inventory",
|
||||
"fee-preview",
|
||||
({ inventoryId, billingCurrency }) =>
|
||||
warehouseService.feePreview(inventoryId, billingCurrency).then((r) => r.data),
|
||||
({ inventoryId, billingCurrency }) => ["warehouse-inventory", inventoryId, "fee-preview", billingCurrency ?? 'USD'],
|
||||
warehouseService
|
||||
.feePreview(inventoryId, billingCurrency)
|
||||
.then((r) => r.data),
|
||||
({ inventoryId, billingCurrency }) => [
|
||||
"warehouse-inventory",
|
||||
inventoryId,
|
||||
"fee-preview",
|
||||
billingCurrency ?? "USD",
|
||||
],
|
||||
),
|
||||
|
||||
invoices: endpoint<{ filter?: WarehouseInvoiceFilter }, WarehouseFeeInvoice[]>(
|
||||
invoices: endpoint<
|
||||
{ filter?: WarehouseInvoiceFilter },
|
||||
WarehouseFeeInvoice[]
|
||||
>(
|
||||
"warehouse-fee-invoices",
|
||||
"list",
|
||||
({ filter }) => warehouseService.listInvoices(filter).then((r) => r.data),
|
||||
@@ -850,7 +898,8 @@ export const api = {
|
||||
receiveInventory: endpoint<ReceiveInventoryPayload, WarehouseInventoryItem>(
|
||||
"warehouse-inventory",
|
||||
"receive",
|
||||
(payload) => warehouseService.receiveInventory(payload).then((r) => r.data),
|
||||
(payload) =>
|
||||
warehouseService.receiveInventory(payload).then((r) => r.data),
|
||||
undefined,
|
||||
() => [["warehouse-inventory"], ["warehouses"]],
|
||||
),
|
||||
@@ -885,7 +934,8 @@ export const api = {
|
||||
>(
|
||||
"warehouse-inventory",
|
||||
"load",
|
||||
({ id, payload }) => warehouseService.load(id, payload).then((r) => r.data),
|
||||
({ id, payload }) =>
|
||||
warehouseService.load(id, payload).then((r) => r.data),
|
||||
undefined,
|
||||
() => INVENTORY_INVALIDATIONS,
|
||||
),
|
||||
@@ -904,7 +954,8 @@ export const api = {
|
||||
>(
|
||||
"warehouse-inventory",
|
||||
"move",
|
||||
({ id, payload }) => warehouseService.move(id, payload).then((r) => r.data),
|
||||
({ id, payload }) =>
|
||||
warehouseService.move(id, payload).then((r) => r.data),
|
||||
undefined,
|
||||
() => INVENTORY_INVALIDATIONS,
|
||||
),
|
||||
@@ -960,7 +1011,8 @@ export const api = {
|
||||
bulkMarkInspected: endpoint<BulkInspectPayload, BulkInspectResult>(
|
||||
"warehouse-inventory",
|
||||
"bulk-mark-inspected",
|
||||
(payload) => warehouseService.bulkMarkInspected(payload).then((r) => r.data),
|
||||
(payload) =>
|
||||
warehouseService.bulkMarkInspected(payload).then((r) => r.data),
|
||||
undefined,
|
||||
() => INVENTORY_INVALIDATIONS,
|
||||
),
|
||||
@@ -978,7 +1030,12 @@ export const api = {
|
||||
{
|
||||
scheduleId: string;
|
||||
warehouseId?: string;
|
||||
assignments?: { bookingId: string; warehouseId: string; yardId: string; zoneId: string }[];
|
||||
assignments?: {
|
||||
bookingId: string;
|
||||
warehouseId: string;
|
||||
yardId: string;
|
||||
zoneId: string;
|
||||
}[];
|
||||
},
|
||||
AutoUnloadArrivedResult
|
||||
>(
|
||||
@@ -1050,11 +1107,11 @@ export const api = {
|
||||
),
|
||||
|
||||
// ── Allocation + fee rules ─────────────────────────────────────────────
|
||||
previewAllocation: endpoint<AllocationCriteria, AllocationPreviewResult | null>(
|
||||
"warehouse-allocation-rules",
|
||||
"preview",
|
||||
(criteria) =>
|
||||
warehouseService.previewAllocation(criteria).then((r) => r.data),
|
||||
previewAllocation: endpoint<
|
||||
AllocationCriteria,
|
||||
AllocationPreviewResult | null
|
||||
>("warehouse-allocation-rules", "preview", (criteria) =>
|
||||
warehouseService.previewAllocation(criteria).then((r) => r.data),
|
||||
),
|
||||
|
||||
createAllocationRule: endpoint<SaveAllocationRulePayload, AllocationRule>(
|
||||
@@ -1116,7 +1173,11 @@ export const api = {
|
||||
|
||||
// ── Invoices ───────────────────────────────────────────────────────────
|
||||
generateInvoice: endpoint<
|
||||
{ inventoryId: string; confirmZero?: boolean; billingCurrency?: 'ETB' | 'USD' },
|
||||
{
|
||||
inventoryId: string;
|
||||
confirmZero?: boolean;
|
||||
billingCurrency?: "ETB" | "USD";
|
||||
},
|
||||
WarehouseFeeInvoice
|
||||
>(
|
||||
"warehouse-fee-invoices",
|
||||
@@ -1172,7 +1233,10 @@ export const api = {
|
||||
},
|
||||
|
||||
routes: {
|
||||
list: endpoint<{ status?: import("./routes.service").RouteStatus } | void, RouteRecord[]>(
|
||||
list: endpoint<
|
||||
{ status?: import("./routes.service").RouteStatus } | void,
|
||||
RouteRecord[]
|
||||
>(
|
||||
"routes",
|
||||
"list",
|
||||
(input) =>
|
||||
@@ -1197,7 +1261,10 @@ export const api = {
|
||||
() => [["routes"]],
|
||||
),
|
||||
|
||||
update: endpoint<{ id: string; data: Partial<SaveRoutePayload> }, RouteRecord>(
|
||||
update: endpoint<
|
||||
{ id: string; data: Partial<SaveRoutePayload> },
|
||||
RouteRecord
|
||||
>(
|
||||
"routes",
|
||||
"update",
|
||||
({ id, data }) => routesService.update(id, data).then((r) => r.data),
|
||||
@@ -1310,10 +1377,8 @@ export const api = {
|
||||
({ trainId }) => ["wagons", "train", trainId],
|
||||
),
|
||||
|
||||
getById: endpoint<{ id: string }, Wagon>(
|
||||
"wagons",
|
||||
"getById",
|
||||
({ id }) => wagonService.getById(id).then((r) => r.data),
|
||||
getById: endpoint<{ id: string }, Wagon>("wagons", "getById", ({ id }) =>
|
||||
wagonService.getById(id).then((r) => r.data),
|
||||
),
|
||||
|
||||
assignToTrain: endpoint<
|
||||
@@ -1692,7 +1757,8 @@ export const api = {
|
||||
>(
|
||||
"file-upload-settings",
|
||||
"addField",
|
||||
({ settingId, dto }) => fileUploadSettingsService.addField(settingId, dto),
|
||||
({ settingId, dto }) =>
|
||||
fileUploadSettingsService.addField(settingId, dto),
|
||||
undefined,
|
||||
() => [["file-upload-settings"]],
|
||||
),
|
||||
@@ -1791,7 +1857,8 @@ export const api = {
|
||||
>(
|
||||
"dropdown-settings",
|
||||
"updateOption",
|
||||
({ optionId, dto }) => dropdownSettingsService.updateOption(optionId, dto),
|
||||
({ optionId, dto }) =>
|
||||
dropdownSettingsService.updateOption(optionId, dto),
|
||||
undefined,
|
||||
() => [["dropdown-settings"]],
|
||||
),
|
||||
@@ -1844,11 +1911,10 @@ export const api = {
|
||||
ruleEngineService.update(resource, id, payload),
|
||||
),
|
||||
|
||||
remove: endpoint<
|
||||
{ resource: RuleEngineResourceSlug; id: string },
|
||||
void
|
||||
>("rule-engine", "remove", ({ resource, id }) =>
|
||||
ruleEngineService.remove(resource, id),
|
||||
remove: endpoint<{ resource: RuleEngineResourceSlug; id: string }, void>(
|
||||
"rule-engine",
|
||||
"remove",
|
||||
({ resource, id }) => ruleEngineService.remove(resource, id),
|
||||
),
|
||||
|
||||
submitRate: endpoint<{ id: string }, RuleEngineRecord>(
|
||||
@@ -1871,14 +1937,21 @@ export const api = {
|
||||
),
|
||||
|
||||
reorder: endpoint<
|
||||
{ resource: RuleEngineResourceSlug; payload: { ids: string[]; requiresDirectorApproval?: boolean } },
|
||||
{
|
||||
resource: RuleEngineResourceSlug;
|
||||
payload: { ids: string[]; requiresDirectorApproval?: boolean };
|
||||
},
|
||||
void
|
||||
>("rule-engine", "reorder", ({ resource, payload }) =>
|
||||
ruleEngineService.reorder(resource, payload),
|
||||
),
|
||||
|
||||
moveOrder: endpoint<
|
||||
{ resource: RuleEngineResourceSlug; id: string; direction: "up" | "down" },
|
||||
{
|
||||
resource: RuleEngineResourceSlug;
|
||||
id: string;
|
||||
direction: "up" | "down";
|
||||
},
|
||||
void
|
||||
>("rule-engine", "moveOrder", ({ resource, id, direction }) =>
|
||||
ruleEngineService.moveOrder(resource, id, direction),
|
||||
@@ -1900,10 +1973,8 @@ export const api = {
|
||||
({ id }) => QUERY_KEYS.BOOKINGS.byId(id),
|
||||
),
|
||||
|
||||
remove: endpoint<{ id: string }, void>(
|
||||
"bookings",
|
||||
"remove",
|
||||
({ id }) => bookingsService.remove(id),
|
||||
remove: endpoint<{ id: string }, void>("bookings", "remove", ({ id }) =>
|
||||
bookingsService.remove(id),
|
||||
),
|
||||
|
||||
staffAccept: endpoint<{ id: string; validityDays: number }, BookingDetail>(
|
||||
@@ -1953,10 +2024,11 @@ export const api = {
|
||||
({ id }) => bookingsService.generateContract(id),
|
||||
),
|
||||
|
||||
getContractView: endpoint<{ id: string }, import("./bookings.service").ContractView>(
|
||||
"bookings",
|
||||
"getContractView",
|
||||
({ id }) => bookingsService.getContractView(id),
|
||||
getContractView: endpoint<
|
||||
{ id: string },
|
||||
import("./bookings.service").ContractView
|
||||
>("bookings", "getContractView", ({ id }) =>
|
||||
bookingsService.getContractView(id),
|
||||
),
|
||||
|
||||
signContract: endpoint<
|
||||
@@ -2040,7 +2112,8 @@ export const api = {
|
||||
>(
|
||||
"customers",
|
||||
"setProfileStatus",
|
||||
({ profileId, status }) => customersService.setProfileStatus(profileId, status),
|
||||
({ profileId, status }) =>
|
||||
customersService.setProfileStatus(profileId, status),
|
||||
undefined,
|
||||
(_input, data) => [
|
||||
QUERY_KEYS.CUSTOMERS.byId(data.companyId),
|
||||
@@ -2061,6 +2134,22 @@ export const api = {
|
||||
),
|
||||
},
|
||||
|
||||
invoices: {
|
||||
list: endpoint<{ filter: InvoiceListFilter }, PaginatedInvoices>(
|
||||
"invoices",
|
||||
"list",
|
||||
({ filter }) => invoicesService.list(filter),
|
||||
({ filter }) => QUERY_KEYS.INVOICES.list(filter),
|
||||
),
|
||||
|
||||
getById: endpoint<{ id: string }, Invoice>(
|
||||
"invoices",
|
||||
"getById",
|
||||
({ id }) => invoicesService.getById(id),
|
||||
({ id }) => QUERY_KEYS.INVOICES.byId(id),
|
||||
),
|
||||
},
|
||||
|
||||
overview: {
|
||||
get: endpoint<{ range?: OverviewRange }, IOverviewDashboard>(
|
||||
"overview",
|
||||
|
||||
Reference in New Issue
Block a user