mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 01:48:12 +00:00
Merge pull request #1329 from Tria-plc/freight_feature/usermanagement
feat(freight): offer built-train wagons per boarding yard on multi-ya…
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { api as client } from "../auth/http";
|
||||
import { unwrap } from "@/utils/endpoint";
|
||||
import { URL_CONSTANTS } from "@/constants/URLS";
|
||||
import type { ApiResponse } from "@/types/apiResponse";
|
||||
|
||||
const BASE = URL_CONSTANTS.MANUAL_PAYMENT_SETTINGS.BASE;
|
||||
|
||||
/**
|
||||
* Whether Finance may settle invoices by hand (bank transfer / counter) rather
|
||||
* than the customer paying online — switched per currency, because the two
|
||||
* channels are operationally different.
|
||||
*/
|
||||
export interface ManualPaymentSettings {
|
||||
etbEnabled: boolean;
|
||||
usdEnabled: boolean;
|
||||
updatedById: string | null;
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
export const manualPaymentSettingsService = {
|
||||
get: async (): Promise<ManualPaymentSettings> => {
|
||||
const response = await client.get<ApiResponse<ManualPaymentSettings>>(BASE);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
/** Partial: an omitted currency keeps its current setting. */
|
||||
update: async (
|
||||
patch: Partial<Pick<ManualPaymentSettings, "etbEnabled" | "usdEnabled">>,
|
||||
): Promise<ManualPaymentSettings> => {
|
||||
const response = await client.patch<ApiResponse<ManualPaymentSettings>>(
|
||||
BASE,
|
||||
patch,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
};
|
||||
@@ -67,6 +67,8 @@ export interface TrainCompositionWagon {
|
||||
wagonNumber: string;
|
||||
sequenceNumber: number | null;
|
||||
status: string;
|
||||
currentYardId: string | null;
|
||||
currentYard: YardRefLite | null;
|
||||
wagonType: {
|
||||
id: string;
|
||||
code: string;
|
||||
@@ -77,6 +79,14 @@ export interface TrainCompositionWagon {
|
||||
} | null;
|
||||
}
|
||||
|
||||
/** Where a built train's wagons physically stand, largest group first. */
|
||||
export interface TrainWagonYardGroup {
|
||||
yardId: string | null;
|
||||
code: string | null;
|
||||
label: string | null;
|
||||
wagonCount: number;
|
||||
}
|
||||
|
||||
export interface TrainCompositionTotals {
|
||||
wagonCount: number;
|
||||
totalTareTons: number;
|
||||
@@ -104,6 +114,7 @@ export interface TrainComposition {
|
||||
currentYard: YardRefLite | null;
|
||||
locomotives: TrainCompositionLocomotive[];
|
||||
wagons: TrainCompositionWagon[];
|
||||
wagonYards: TrainWagonYardGroup[];
|
||||
totals: TrainCompositionTotals;
|
||||
activeSchedules: ActiveScheduleRef[];
|
||||
editable: boolean;
|
||||
|
||||
Reference in New Issue
Block a user