1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 18:49:59 +01:00

feat(tui): Create-Screen für Produktionsaufträge

Types, API-Client Resource, Hook und TUI-Screen für den neuen
POST /api/production/production-orders Endpoint. Menüeintrag
im Produktionsmenü ergänzt.
This commit is contained in:
Sebastian Frick 2026-02-23 23:55:57 +01:00
parent 2938628db4
commit fb8387c10e
10 changed files with 381 additions and 2 deletions

View file

@ -25,6 +25,7 @@ export { createCustomersResource } from './resources/customers.js';
export { createStorageLocationsResource } from './resources/storage-locations.js';
export { createRecipesResource } from './resources/recipes.js';
export { createBatchesResource } from './resources/batches.js';
export { createProductionOrdersResource } from './resources/production-orders.js';
export { createStocksResource } from './resources/stocks.js';
export {
ApiError,
@ -98,6 +99,8 @@ export type {
CompleteBatchRequest,
RecordConsumptionRequest,
CancelBatchRequest,
ProductionOrderDTO,
CreateProductionOrderRequest,
StockDTO,
CreateStockRequest,
CreateStockResponse,
@ -132,6 +135,8 @@ export type { RecipesResource, RecipeType, RecipeStatus, UoM } from './resources
export { RECIPE_TYPE_LABELS, UOM_VALUES, UOM_LABELS } from './resources/recipes.js';
export type { BatchesResource, BatchStatus } from './resources/batches.js';
export { BATCH_STATUS_LABELS } from './resources/batches.js';
export type { ProductionOrdersResource, Priority } from './resources/production-orders.js';
export { PRIORITY_LABELS } from './resources/production-orders.js';
export type { StocksResource, BatchType, StockBatchStatus, StockFilter } from './resources/stocks.js';
export { BATCH_TYPE_LABELS, STOCK_BATCH_STATUS_LABELS } from './resources/stocks.js';
@ -146,6 +151,7 @@ import { createCustomersResource } from './resources/customers.js';
import { createStorageLocationsResource } from './resources/storage-locations.js';
import { createRecipesResource } from './resources/recipes.js';
import { createBatchesResource } from './resources/batches.js';
import { createProductionOrdersResource } from './resources/production-orders.js';
import { createStocksResource } from './resources/stocks.js';
import type { TokenProvider } from './token-provider.js';
import type { ApiConfig } from '@effigenix/config';
@ -171,6 +177,7 @@ export function createEffigenixClient(
storageLocations: createStorageLocationsResource(axiosClient),
recipes: createRecipesResource(axiosClient),
batches: createBatchesResource(axiosClient),
productionOrders: createProductionOrdersResource(axiosClient),
stocks: createStocksResource(axiosClient),
};
}

View file

@ -0,0 +1,28 @@
/** Production Orders resource Production BC. */
import type { AxiosInstance } from 'axios';
import type { ProductionOrderDTO, CreateProductionOrderRequest } from '@effigenix/types';
export type Priority = 'LOW' | 'NORMAL' | 'HIGH' | 'URGENT';
export const PRIORITY_LABELS: Record<Priority, string> = {
LOW: 'Niedrig',
NORMAL: 'Normal',
HIGH: 'Hoch',
URGENT: 'Dringend',
};
export type { ProductionOrderDTO, CreateProductionOrderRequest };
const BASE = '/api/production/production-orders';
export function createProductionOrdersResource(client: AxiosInstance) {
return {
async create(request: CreateProductionOrderRequest): Promise<ProductionOrderDTO> {
const res = await client.post<ProductionOrderDTO>(BASE, request);
return res.data;
},
};
}
export type ProductionOrdersResource = ReturnType<typeof createProductionOrdersResource>;