mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 02:58:11 +00:00
Merge branch 'dev' of github.com:Tria-plc/edr-platform into contrat-backup2
This commit is contained in:
@@ -60,8 +60,10 @@ 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; estimatedKm?: number | null; exactKm?: number | null }) =>
|
||||
update: (id: string, data: { status?: FirstMileApiStatus; vehicleId?: string | null; estimatedKm?: number | null; exactKm?: number | null; paid?: boolean }) =>
|
||||
api.patch<FirstMileRecord>(FM.BY_ID(id), data),
|
||||
accept: (bookingReference: string) =>
|
||||
api.post<FirstMileRecord>(FM.ACCEPT(bookingReference)),
|
||||
remove: (id: string) =>
|
||||
api.delete<void>(FM.BY_ID(id)),
|
||||
};
|
||||
|
||||
@@ -63,8 +63,10 @@ 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; estimatedKm?: number | null; exactKm?: number | null }) =>
|
||||
update: (id: string, data: { status?: LastMileApiStatus; vehicleId?: string | null; estimatedKm?: number | null; exactKm?: number | null; paid?: boolean }) =>
|
||||
api.patch<LastMileRecord>(LM.BY_ID(id), data),
|
||||
accept: (bookingReference: string) =>
|
||||
api.post<LastMileRecord>(LM.ACCEPT(encodeURIComponent(bookingReference))),
|
||||
remove: (id: string) =>
|
||||
api.delete<void>(LM.BY_ID(id)),
|
||||
};
|
||||
|
||||
@@ -4,9 +4,11 @@ import { URL_CONSTANTS } from '@/constants/URLS';
|
||||
export type VehicleType = 'TRUCK' | 'VAN' | 'CAR' | 'BUS' | 'TRAILER' | 'TANKER' | 'FLATBED';
|
||||
export type FuelType = 'PETROL' | 'DIESEL' | 'ELECTRIC' | 'HYBRID';
|
||||
export type VehicleStatus = 'ACTIVE' | 'MAINTENANCE' | 'RETIRED' | 'OUT_OF_SERVICE';
|
||||
export type VehicleAvailability = 'FREE' | 'BUSY';
|
||||
|
||||
export interface VehicleListFilters {
|
||||
status?: VehicleStatus;
|
||||
availability?: VehicleAvailability;
|
||||
search?: string;
|
||||
page?: number;
|
||||
limit?: number;
|
||||
@@ -25,12 +27,14 @@ export interface Vehicle {
|
||||
fuelType: FuelType;
|
||||
capacity: number;
|
||||
status: VehicleStatus;
|
||||
availability: VehicleAvailability;
|
||||
description?: string | null;
|
||||
assignedDriverId?: string | null;
|
||||
assignedDriverName?: string | null;
|
||||
code?: string | null;
|
||||
powerPlateNo?: string | null;
|
||||
trailerPlateNo?: string | null;
|
||||
locationId?: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
@@ -44,6 +48,7 @@ export const vehiclesService = {
|
||||
getAll: (filters: VehicleListFilters = {}) => {
|
||||
const params = new URLSearchParams();
|
||||
if (filters.status) params.set('status', filters.status);
|
||||
if (filters.availability) params.set('availability', filters.availability);
|
||||
if (filters.search) params.set('search', filters.search);
|
||||
if (filters.page) params.set('page', filters.page.toString());
|
||||
if (filters.limit) params.set('limit', filters.limit.toString());
|
||||
@@ -57,7 +62,7 @@ export const vehiclesService = {
|
||||
getById: (id: string) => apiClient.get<Vehicle>(URL_CONSTANTS.VEHICLES.BY_ID(id)),
|
||||
create: (data: Partial<SaveVehiclePayload>) =>
|
||||
apiClient.post(URL_CONSTANTS.VEHICLES.BASE, data),
|
||||
update: (id: string, data: Partial<SaveVehiclePayload>) =>
|
||||
update: (id: string, data: Partial<SaveVehiclePayload & { locationId?: string | null }>) =>
|
||||
apiClient.patch(URL_CONSTANTS.VEHICLES.BY_ID(id), data),
|
||||
delete: (id: string) => apiClient.delete(URL_CONSTANTS.VEHICLES.BY_ID(id)),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user