From 1f9b22559f22f4ec94b7f53bdadfb72902fed56f Mon Sep 17 00:00:00 2001 From: Jonny Date: Mon, 2 Nov 2026 17:23:10 +0100 Subject: [PATCH] feat: Lesbare Foto-Bezeichnungen, Kamera direkt beim Fahrtbeginn, Ziffern-Tastatur fuer KM, Leerzustand mit Anlegen-Link Co-Authored-By: Claude Opus 5.5 --- web/app/auftraege/[id]/page.tsx | 36 +++++++++++------------ web/app/auftraege/page.tsx | 7 ++++- web/components/AuftragListe.tsx | 10 +++++++ web/lib/auftraege/foto-positionen.test.ts | 20 +++++++++++++ web/lib/auftraege/foto-positionen.ts | 16 ++++++++++ web/lib/auftraege/fotos.test.ts | 2 +- web/lib/auftraege/fotos.ts | 4 +-- 7 files changed, 73 insertions(+), 22 deletions(-) create mode 100644 web/lib/auftraege/foto-positionen.test.ts diff --git a/web/app/auftraege/[id]/page.tsx b/web/app/auftraege/[id]/page.tsx index ab36dc9..a4b87fa 100644 --- a/web/app/auftraege/[id]/page.tsx +++ b/web/app/auftraege/[id]/page.tsx @@ -7,7 +7,7 @@ import { istEinsatzrolle, kannAuftraegeVerwalten, personBezeichnung } from "@/li import { listEinsatzPersonen } from "@/lib/dashboard/queries"; import { fahrzeugBezeichnung } from "@/lib/orte-fahrzeuge/fahrzeug-bezeichnung"; import { finAbgleichText } from "@/lib/auftraege/fin-abgleich"; -import { STANDARD_FOTO_POSITIONEN } from "@/lib/auftraege/foto-positionen"; +import { fotoBezeichnung, STANDARD_FOTO_POSITIONEN } from "@/lib/auftraege/foto-positionen"; import { loadAuftragFotos, loadUnterschriftUrl } from "@/lib/auftraege/fotos"; import { FinFeld } from "@/components/fahrzeuge/FinFeld"; import { FotoGalerie } from "@/components/auftraege/FotoGalerie"; @@ -277,7 +277,7 @@ export default async function AuftragDetailPage({

Fahrt beginnen

- + {auftrag.start_fin_status === "abweichend" ? (
)} - {STANDARD_FOTO_POSITIONEN.map((position) => ( - - - - ))} +

Fahrzeugfotos (optional)

+
+ {STANDARD_FOTO_POSITIONEN.map((position) => ( + + + + ))} +
@@ -320,7 +320,7 @@ export default async function AuftragDetailPage({

Fahrt beenden

- + {kannAnlegen && meine.length > 0 && } - + )}
diff --git a/web/components/AuftragListe.tsx b/web/components/AuftragListe.tsx index 5172f31..759a073 100644 --- a/web/components/AuftragListe.tsx +++ b/web/components/AuftragListe.tsx @@ -10,10 +10,12 @@ export function AuftragListe({ titel, auftraege, filter, + anlegenLink = false, }: { titel: string; auftraege: Auftrag[]; filter?: StatusFilter; + anlegenLink?: boolean; }) { return (
@@ -30,6 +32,14 @@ export function AuftragListe({ ) : ( "Keine Aufträge." )} + {anlegenLink && ( + <> + {" "} + + Neuen Auftrag anlegen + + + )}

) : (
    diff --git a/web/lib/auftraege/foto-positionen.test.ts b/web/lib/auftraege/foto-positionen.test.ts new file mode 100644 index 0000000..16719d9 --- /dev/null +++ b/web/lib/auftraege/foto-positionen.test.ts @@ -0,0 +1,20 @@ +import { describe, expect, it } from "vitest"; +import { fotoBezeichnung, STANDARD_FOTO_POSITIONEN } from "./foto-positionen"; + +describe("fotoBezeichnung", () => { + it("liefert lesbare Namen fuer alle Standardpositionen", () => { + expect(STANDARD_FOTO_POSITIONEN.map(fotoBezeichnung)).toEqual([ + "Front", + "Seitlich rechts", + "Rechte Seite", + "Seitlich rechts Heck", + "Heck", + "Seitlich links Heck", + "Linke Seite", + "Seitlich vorne links", + ]); + }); + it("faellt bei unbekannten Positionen auf den Rohwert zurueck", () => { + expect(fotoBezeichnung("dach_hinten")).toBe("dach hinten"); + }); +}); diff --git a/web/lib/auftraege/foto-positionen.ts b/web/lib/auftraege/foto-positionen.ts index 87b16cf..00e9fc2 100644 --- a/web/lib/auftraege/foto-positionen.ts +++ b/web/lib/auftraege/foto-positionen.ts @@ -10,3 +10,19 @@ export const STANDARD_FOTO_POSITIONEN = [ ] as const; export type StandardFotoPosition = (typeof STANDARD_FOTO_POSITIONEN)[number]; + +// Lesbare Bezeichnungen (Wortlaut der Anforderungen in CLAUDE.md). +export const FOTO_BEZEICHNUNGEN: Record = { + front: "Front", + seitlich_rechts: "Seitlich rechts", + rechte_seite: "Rechte Seite", + seitlich_rechts_heck: "Seitlich rechts Heck", + heck: "Heck", + seitlich_links_heck: "Seitlich links Heck", + linke_seite: "Linke Seite", + seitlich_vorne_links: "Seitlich vorne links", +}; + +export function fotoBezeichnung(position: string): string { + return FOTO_BEZEICHNUNGEN[position as StandardFotoPosition] ?? position.replaceAll("_", " "); +} diff --git a/web/lib/auftraege/fotos.test.ts b/web/lib/auftraege/fotos.test.ts index 850d6b4..652a621 100644 --- a/web/lib/auftraege/fotos.test.ts +++ b/web/lib/auftraege/fotos.test.ts @@ -16,7 +16,7 @@ describe("sortiereUndBeschrifteFotos", () => { { position: "seitlich_rechts", storage_path: "a/seitlich_rechts.jpg", uploaded_at: "2026-01-01T09:00:00Z", beschreibung: null }, ]; const result = sortiereUndBeschrifteFotos(fotos); - expect(result[0].label).toBe("seitlich rechts"); + expect(result[0].label).toBe("Seitlich rechts"); }); it("laesst fehlende Pflicht-Positionen einfach weg", () => { diff --git a/web/lib/auftraege/fotos.ts b/web/lib/auftraege/fotos.ts index ef76551..33c3569 100644 --- a/web/lib/auftraege/fotos.ts +++ b/web/lib/auftraege/fotos.ts @@ -1,6 +1,6 @@ import type { SupabaseClient } from "@supabase/supabase-js"; import { createClient } from "@/lib/supabase/server"; -import { STANDARD_FOTO_POSITIONEN } from "./foto-positionen"; +import { STANDARD_FOTO_POSITIONEN, fotoBezeichnung } from "./foto-positionen"; import type { ProtokollFoto } from "./protokoll"; export type AuftragFoto = { @@ -29,7 +29,7 @@ export function sortiereUndBeschrifteFotos(fotos: FotoZeile[]): (FotoZeile & { l const beschriftetePflichtFotos = pflichtFotos.map((foto) => ({ ...foto, - label: foto.position.replaceAll("_", " "), + label: fotoBezeichnung(foto.position), })); const beschrifteteSchadenFotos = schadenFotos.map((foto, index) => ({