fix: allow entering a queen's hatch year and marking color/number

The backend has always accepted hatchYear/markingColor/markingNumber
(Queen DTOs, Prisma schema), and the queens list even already renders
a "Schlupfjahr" field - but neither the create nor the edit form ever
exposed inputs for them, so no user could actually set hatchYear
through the UI. That silently broke the OLD_QUEEN dashboard alert
just added: it can only ever fire for colonies whose queen has a
hatchYear, and there was no way to record one.

Both forms now include Schlupfjahr, Zeichenfarbe and Zeichennummer.
Marking color is auto-suggested from the hatch year using the
internationally standardized queen marking color convention (last
digit of the year -> white/yellow/red/green/blue), editable like any
other suggestion.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Sonnet 5 committed 2026-09-06 21:44:29 +02:00
1 parent edf13d3ae4
commit 985ea09556
5 files changed
+116 -1

No files matched your search

@@ -0,0 +1,20 @@
// Internationally standardized queen marking colors by the last digit of
// the hatch year (used across European beekeeping regardless of country):
// 1/6 white, 2/7 yellow, 3/8 red, 4/9 green, 5/0 blue.
const MARKING_COLORS_BY_LAST_DIGIT: Record<number, string> = {
1: "Weiß",
6: "Weiß",
2: "Gelb",
7: "Gelb",
3: "Rot",
8: "Rot",
4: "Grün",
9: "Grün",
5: "Blau",
0: "Blau",
};
export function suggestMarkingColorForYear(hatchYear: number): string {
const lastDigit = ((hatchYear % 10) + 10) % 10;
return MARKING_COLORS_BY_LAST_DIGIT[lastDigit];
}
+6
View File
@@ -32,15 +32,21 @@ export interface Queen {
export interface CreateQueenInput {
code: string;
hatchYear?: number;
breed?: string;
origin?: string;
markingColor?: string;
markingNumber?: string;
motherQueenId?: string;
notes?: string;
}
export interface UpdateQueenInput {
hatchYear?: number;
breed?: string;
origin?: string;
markingColor?: string;
markingNumber?: string;
motherQueenId?: string;
notes?: string;
status?: QueenStatus;