mantine added to Train, wagon, containers and cargoes

This commit is contained in:
hagiye
2026-06-08 09:29:34 +03:00
105 changed files with 6510 additions and 3248 deletions

View File

@@ -0,0 +1,40 @@
import { api as apiClient } from '../auth/http';
import { URL_CONSTANTS } from '@/constants/URLS';
export type LocomotiveType = 'DIESEL' | 'ELECTRIC';
export type LocomotiveStatus =
| 'AVAILABLE'
| 'MAINTENANCE'
| 'ASSIGNED'
| 'OUT_OF_SERVICE';
export interface Locomotive {
id: string;
code: string;
name?: string | null;
locomotiveType: LocomotiveType;
status: LocomotiveStatus;
maxPullWeightTons: number;
maxTrainLengthMeters: number;
powerKw?: number | null;
tractionForceKn?: number | null;
maxSpeedKmh?: number | null;
createdAt: string;
updatedAt: string;
}
export type SaveLocomotivePayload = Omit<
Locomotive,
'id' | 'createdAt' | 'updatedAt'
>;
export const locomotivesService = {
getAll: () => apiClient.get<Locomotive[]>(URL_CONSTANTS.LOCOMOTIVES.BASE),
getById: (id: string) => apiClient.get<Locomotive>(URL_CONSTANTS.LOCOMOTIVES.BY_ID(id)),
create: (data: Partial<SaveLocomotivePayload>) =>
apiClient.post(URL_CONSTANTS.LOCOMOTIVES.BASE, data),
update: (id: string, data: Partial<SaveLocomotivePayload>) =>
apiClient.patch(URL_CONSTANTS.LOCOMOTIVES.BY_ID(id), data),
decommission: (id: string) => apiClient.post(URL_CONSTANTS.LOCOMOTIVES.DECOMMISSION(id), {}),
};

View File

@@ -0,0 +1,52 @@
import { api as apiClient } from '../auth/http';
import { URL_CONSTANTS } from '@/constants/URLS';
export interface YardRef {
id: string;
code: string;
label: string;
country?: string;
}
export interface RouteMilestone {
id: string;
routeId: string;
yardId: string;
sequenceNo: number;
yard?: YardRef | null;
}
export interface RouteRecord {
id: string;
name: string;
originYardId: string;
destinationYardId: string;
isActive: boolean;
originYard?: YardRef | null;
destinationYard?: YardRef | null;
milestones?: RouteMilestone[];
}
export interface SaveRoutePayload {
name: string;
milestones: Array<{ yardId: string }>;
isActive?: boolean;
}
interface YardListResponse {
data: YardRef[];
}
export const routesService = {
getAll: () => apiClient.get<RouteRecord[]>(URL_CONSTANTS.ROUTES.BASE),
getById: (id: string) => apiClient.get<RouteRecord>(URL_CONSTANTS.ROUTES.BY_ID(id)),
create: (data: SaveRoutePayload) => apiClient.post(URL_CONSTANTS.ROUTES.BASE, data),
update: (id: string, data: Partial<SaveRoutePayload>) =>
apiClient.patch(URL_CONSTANTS.ROUTES.BY_ID(id), data),
deactivate: (id: string) => apiClient.delete(URL_CONSTANTS.ROUTES.BY_ID(id)),
getYards: () =>
apiClient.get<YardListResponse>(URL_CONSTANTS.RULE_ENGINE.YARDS, {
params: { isActive: true, pageSize: 200 },
}),
};

View File

@@ -19,6 +19,7 @@ export interface RuleEngineListParams {
const RESOURCE_BASE: Record<RuleEngineResourceSlug, string> = {
"cargo-types": URL_CONSTANTS.RULE_ENGINE.CARGO_TYPES,
"container-types": URL_CONSTANTS.RULE_ENGINE.CONTAINER_TYPES,
"wagon-types": URL_CONSTANTS.RULE_ENGINE.WAGON_TYPES,
"priority-rules": URL_CONSTANTS.RULE_ENGINE.PRIORITY_RULES,
"service-types": URL_CONSTANTS.RULE_ENGINE.SERVICE_TYPES,
"surcharge-types": URL_CONSTANTS.RULE_ENGINE.SURCHARGE_TYPES,
@@ -35,6 +36,8 @@ const byIdPath = (resource: RuleEngineResourceSlug, id: string): string => {
return URL_CONSTANTS.RULE_ENGINE.CARGO_TYPE_BY_ID(id);
case "container-types":
return URL_CONSTANTS.RULE_ENGINE.CONTAINER_TYPE_BY_ID(id);
case "wagon-types":
return URL_CONSTANTS.RULE_ENGINE.WAGON_TYPE_BY_ID(id);
case "priority-rules":
return URL_CONSTANTS.RULE_ENGINE.PRIORITY_RULE_BY_ID(id);
case "service-types":