From d292d122c948776659aca9a21403c3eb3749c5cd Mon Sep 17 00:00:00 2001 From: Jonny Date: Sun, 5 Jul 2026 21:45:27 +0200 Subject: [PATCH] feat: add auftraege list page with role-aware sections --- web/app/auftraege/page.tsx | 30 ++++++++++++++++++++++++++++++ web/components/AuftragListe.tsx | 29 +++++++++++++++++++++++++++++ web/components/NavLinks.tsx | 1 + 3 files changed, 60 insertions(+) create mode 100644 web/app/auftraege/page.tsx create mode 100644 web/components/AuftragListe.tsx diff --git a/web/app/auftraege/page.tsx b/web/app/auftraege/page.tsx new file mode 100644 index 0000000..fbb739e --- /dev/null +++ b/web/app/auftraege/page.tsx @@ -0,0 +1,30 @@ +import Link from "next/link"; +import { loadProfile } from "@/lib/auth/profile"; +import { listAuftraegeFuerListe } from "@/lib/auftraege/queries"; +import { AuftragListe } from "@/components/AuftragListe"; + +export default async function AuftraegePage() { + const profileResult = await loadProfile(); + if (profileResult.status !== "ok") { + return null; + } + + const { meine, offene, alle } = await listAuftraegeFuerListe(profileResult.profile); + const istFahrer = profileResult.profile.role === "fahrer"; + const kannAnlegen = profileResult.profile.role === "admin" || profileResult.profile.role === "disponent"; + + return ( +
+

Aufträge

+ {kannAnlegen && Neuen Auftrag anlegen} + {istFahrer ? ( + <> + + + + ) : ( + + )} +
+ ); +} diff --git a/web/components/AuftragListe.tsx b/web/components/AuftragListe.tsx new file mode 100644 index 0000000..a40af1a --- /dev/null +++ b/web/components/AuftragListe.tsx @@ -0,0 +1,29 @@ +import Link from "next/link"; +import type { Auftrag } from "@/lib/auftraege/queries"; + +export function AuftragListe({ titel, auftraege }: { titel: string; auftraege: Auftrag[] }) { + if (auftraege.length === 0) { + return ( +
+

{titel}

+

Keine Aufträge.

+
+ ); + } + + return ( +
+

{titel}

+ +
+ ); +} diff --git a/web/components/NavLinks.tsx b/web/components/NavLinks.tsx index 7e0f2e0..fd4b41d 100644 --- a/web/components/NavLinks.tsx +++ b/web/components/NavLinks.tsx @@ -5,6 +5,7 @@ export function NavLinks({ role }: { role: Role }) { return ( );