1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 17:29:58 +01:00

feat(inventory): Inventur abbrechen und nach Status filtern (US-6.4)

Ermöglicht das Abbrechen von Inventuren (OPEN/COUNTING → CANCELLED) mit
Pflicht-Begründung sowie das Filtern der Inventurliste nach Status.
This commit is contained in:
Sebastian Frick 2026-03-19 11:39:56 +01:00
parent 58ed0a3810
commit a0ebf46329
28 changed files with 798 additions and 47 deletions

View file

@ -5,10 +5,11 @@ import type {
InventoryCountDTO,
CreateInventoryCountRequest,
RecordCountItemRequest,
CancelInventoryCountRequest,
InventoryCountStatus,
} from '@effigenix/types';
export type { InventoryCountDTO, CreateInventoryCountRequest, RecordCountItemRequest, InventoryCountStatus };
export type { InventoryCountDTO, CreateInventoryCountRequest, RecordCountItemRequest, CancelInventoryCountRequest, InventoryCountStatus };
export const INVENTORY_COUNT_STATUS_LABELS: Record<InventoryCountStatus, string> = {
OPEN: 'Offen',
@ -19,6 +20,7 @@ export const INVENTORY_COUNT_STATUS_LABELS: Record<InventoryCountStatus, string>
export interface InventoryCountFilter {
storageLocationId?: string;
status?: string;
}
const BASE = '/api/inventory/inventory-counts';
@ -28,6 +30,7 @@ export function createInventoryCountsResource(client: AxiosInstance) {
async list(filter?: InventoryCountFilter): Promise<InventoryCountDTO[]> {
const params: Record<string, string> = {};
if (filter?.storageLocationId) params.storageLocationId = filter.storageLocationId;
if (filter?.status) params.status = filter.status;
const res = await client.get<InventoryCountDTO[]>(BASE, { params });
return res.data;
},
@ -56,6 +59,11 @@ export function createInventoryCountsResource(client: AxiosInstance) {
const res = await client.post<InventoryCountDTO>(`${BASE}/${id}/complete`);
return res.data;
},
async cancel(id: string, request: CancelInventoryCountRequest): Promise<InventoryCountDTO> {
const res = await client.post<InventoryCountDTO>(`${BASE}/${id}/cancel`, request);
return res.data;
},
};
}