feat(ui): article stock overview and production batch editing

- New article page /products/[id]: remaining stock summed over all
  production batches (or bottlings for honey), each batch linked to its
  own page for withdrawals and counts; "Bestand ansehen" in the list.
- Production batches can be corrected (lot number, date, quantity,
  best-before date, note) via PATCH; the article stays fixed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Opus 5.5 committed 2026-10-05 21:28:15 +02:00
1 parent f57db97578
commit 41c2af7284
7 files changed
+626 -21

No files matched your search

@@ -3,6 +3,7 @@ import {
CreateProductionBatchInput,
ProductionBatch,
ProductionBatchFilter,
UpdateProductionBatchInput,
} from "./types";
export function fetchProductionBatches(
@@ -29,6 +30,16 @@ export function createProductionBatch(
});
}
export function updateProductionBatch(
id: string,
input: UpdateProductionBatchInput,
): Promise<ProductionBatch> {
return apiFetch<ProductionBatch>(`/production-batches/${id}`, {
method: "PATCH",
body: JSON.stringify(input),
});
}
export function deleteProductionBatch(id: string): Promise<{ id: string }> {
return apiFetch<{ id: string }>(`/production-batches/${id}`, {
method: "DELETE",
@@ -20,6 +20,15 @@ export interface CreateProductionBatchInput {
notes?: string;
}
export interface UpdateProductionBatchInput {
lotNumber?: string;
date?: string;
quantity?: number;
/** `null` removes the date, `undefined` leaves it untouched. */
bestBeforeDate?: string | null;
notes?: string;
}
export interface ProductionBatchFilter {
productId?: string;
}