import { redirect } from "next/navigation"; import { loadProfile } from "@/lib/auth/profile"; import { canManageUsers } from "@/lib/auth/roles"; import { listNutzer } from "@/lib/nutzerverwaltung/queries"; import { GUELTIGE_ROLLEN } from "@/lib/nutzerverwaltung/validate-nutzer"; import { erstelleNutzer } from "./actions"; import { NutzerTabelle } from "@/components/nutzerverwaltung/NutzerTabelle"; import { Card } from "@/components/ui/Card"; import { Button } from "@/components/ui/Button"; import { Alert } from "@/components/ui/Alert"; import { FormField, FIELD_CLASSES } from "@/components/ui/FormField"; export default async function NutzerverwaltungPage({ searchParams, }: { searchParams: Promise<{ error?: string }>; }) { const profileResult = await loadProfile(); if (profileResult.status !== "ok" || !canManageUsers(profileResult.profile.role)) { redirect(`/auftraege?error=${encodeURIComponent("Nur Admin darf die Nutzerverwaltung nutzen.")}`); } const { error } = await searchParams; const nutzerListe = await listNutzer(); return (