import Link from "next/link"; import { getTranslations } from "next-intl/server"; import type { Asset, AssetType } from "@prisma/client"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { SegmentedRating } from "@/components/segmented-rating"; const ASSET_TYPES = ["INFORMATION", "SYSTEM", "APPLICATION", "LOCATION", "SUPPLIER", "IT_SERVICE", "PERSON", "DATA"] as const; const ASSET_STATUS = ["ACTIVE", "PLANNED", "RETIRED"] as const; /** Formular für Anlegen/Bearbeiten eines Assets (Server-Action wird übergeben). */ export async function AssetForm({ action, asset, users, cancelHref, defaultType = "SYSTEM", }: { action: (formData: FormData) => Promise; asset?: Asset; users: { id: string; name: string }[]; cancelHref: string; /** Vorbelegter Typ beim Anlegen (z. B. INFORMATION im BIA-Popup Schritt 1). */ defaultType?: AssetType; }) { const t = await getTranslations("assets"); const tType = await getTranslations("assetType"); const tStatus = await getTranslations("assetStatus"); const tLevel = await getTranslations("protectionLevel"); const tc = await getTranslations("common"); const selectClass = "h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm"; return (