feat(frontend): Honigchargen-Ansichten (Modul 11)

Chargenliste mit Anlage-Dialog sowie Detailseite mit
Honigmessungen und Rückverfolgbarkeits-Ansicht bis zu den
Ursprungsvölkern.
This commit is contained in:
Nick Szaunig committed 2026-08-22 04:58:47 +02:00
1 parent cf625552d1
commit f3d99524ff
8 files changed
+525 -1

No files matched your search

@@ -0,0 +1,36 @@
import { apiFetch } from "@/lib/auth/api-client";
import {
CreateHoneyBatchInput,
CreateHoneyMeasurementInput,
HoneyBatch,
Traceability,
} from "./types";
export function fetchHoneyBatches(): Promise<HoneyBatch[]> {
return apiFetch<HoneyBatch[]>("/honey-batches");
}
export function fetchHoneyBatch(id: string): Promise<HoneyBatch> {
return apiFetch<HoneyBatch>(`/honey-batches/${id}`);
}
export function fetchHoneyBatchTraceability(id: string): Promise<Traceability> {
return apiFetch<Traceability>(`/honey-batches/${id}/traceability`);
}
export function createHoneyBatch(input: CreateHoneyBatchInput): Promise<HoneyBatch> {
return apiFetch<HoneyBatch>("/honey-batches", {
method: "POST",
body: JSON.stringify(input),
});
}
export function addHoneyMeasurement(
id: string,
input: CreateHoneyMeasurementInput,
): Promise<HoneyBatch> {
return apiFetch<HoneyBatch>(`/honey-batches/${id}/measurements`, {
method: "POST",
body: JSON.stringify(input),
});
}
@@ -0,0 +1,68 @@
export type HoneyBatchStatus =
| "RAW"
| "EXTRACTED"
| "CLARIFIED"
| "CREAMED"
| "STORED"
| "BOTTLED"
| "SOLD"
| "CONSUMED";
export interface HoneyMeasurement {
id: string;
waterContent: number;
measuredAt: string;
device: string | null;
temperature: number | null;
notes: string | null;
}
export interface HoneyBatch {
id: string;
batchNumber: string;
extractionId: string;
honeyType: string | null;
amount: number | null;
waterContent: number | null;
storageContainerId: string | null;
status: HoneyBatchStatus;
createdAt: string;
measurements: HoneyMeasurement[];
}
export interface Traceability {
honeyBatch: {
id: string;
batchNumber: string;
honeyType: string | null;
amount: number | null;
status: HoneyBatchStatus;
};
extraction: {
id: string;
date: string;
room: string | null;
};
harvests: {
id: string;
date: string;
apiaryId: string;
colonies: { id: string; code: string }[];
}[];
}
export interface CreateHoneyBatchInput {
batchNumber: string;
extractionId: string;
honeyType?: string;
amount?: number;
waterContent?: number;
}
export interface CreateHoneyMeasurementInput {
waterContent: number;
measuredAt: string;
device?: string;
temperature?: number;
notes?: string;
}