"use client"; import React from "react"; import Link from "next/link"; import { useAuth } from "@/components/auth/authContext"; import { branchPath, homePath } from "@/lib/frontend/routes"; import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, } from "@/components/ui/card"; /** * ForbiddenView (RHL-021) * * Reusable UI block for "authenticated, but not allowed here". * * UX rule: * - All user-facing text must be German. */ export default function ForbiddenView({ attemptedBranch = null }) { const { status, user } = useAuth(); const isAuthed = status === "authenticated" && user; const isBranchUser = isAuthed && user.role === "branch" && user.branchId; const overviewHref = homePath(); const primaryHref = isBranchUser ? branchPath(user.branchId) : overviewHref; const primaryLabel = isBranchUser ? "Zu meiner Niederlassung" : "Zur Übersicht"; const showSecondaryOverview = isBranchUser; return ( Zugriff verweigert Sie haben keine Berechtigung, diese Ressource zu öffnen. Keine Berechtigung {attemptedBranch ? ( Ihr Konto darf die Niederlassung{" "} {attemptedBranch} nicht öffnen. ) : ( Ihr Konto darf diese Seite nicht öffnen. )}

Wenn Sie glauben, dass das ein Fehler ist, wenden Sie sich an Ihren Administrator.

{showSecondaryOverview ? ( ) : null}
); }