'use client' import React from 'react' import { LoeschfristPolicy, LegalHold, StorageLocation, } from '@/lib/sdk/loeschfristen-types' import { renderStatusBadge } from './UebersichtTab' import { DataObjectSection, DeletionLogicSection, StorageSection, ResponsibilitySection, VVTLinkSection, ReviewSection, } from './EditorSections' // --------------------------------------------------------------------------- // Types // --------------------------------------------------------------------------- interface EditorTabProps { policies: LoeschfristPolicy[] editingId: string | null editingPolicy: LoeschfristPolicy | null vvtActivities: any[] saving: boolean setEditingId: (id: string | null) => void setTab: (tab: 'uebersicht' | 'editor' | 'generator' | 'export') => void updatePolicy: (id: string, updater: (p: LoeschfristPolicy) => LoeschfristPolicy) => void createNewPolicy: () => void deletePolicy: (policyId: string) => void addLegalHold: (policyId: string) => void removeLegalHold: (policyId: string, idx: number) => void addStorageLocation: (policyId: string) => void removeStorageLocation: (policyId: string, idx: number) => void handleSaveAndClose: () => void } // --------------------------------------------------------------------------- // No-selection view // --------------------------------------------------------------------------- function EditorNoSelection({ policies, setEditingId, createNewPolicy, }: Pick) { return (

Loeschfrist zum Bearbeiten waehlen

{policies.length === 0 ? (

Noch keine Loeschfristen vorhanden.{' '}

) : (
{policies.map((p) => ( ))}
)}
) } // --------------------------------------------------------------------------- // Editor form // --------------------------------------------------------------------------- function EditorForm({ policy, vvtActivities, saving, setEditingId, setTab, updatePolicy, deletePolicy, addLegalHold, removeLegalHold, addStorageLocation, removeStorageLocation, handleSaveAndClose, }: Omit & { policy: LoeschfristPolicy }) { const pid = policy.policyId const set = (key: K, val: LoeschfristPolicy[K]) => { updatePolicy(pid, (p) => ({ ...p, [key]: val })) } const updateLegalHoldItem = (idx: number, updater: (h: LegalHold) => LegalHold) => { updatePolicy(pid, (p) => ({ ...p, legalHolds: p.legalHolds.map((h, i) => (i === idx ? updater(h) : h)), })) } const updateStorageLocationItem = (idx: number, updater: (s: StorageLocation) => StorageLocation) => { updatePolicy(pid, (p) => ({ ...p, storageLocations: p.storageLocations.map((s, i) => (i === idx ? updater(s) : s)), })) } return (
{/* Header with back button */}

{policy.dataObjectName || 'Neue Loeschfrist'}

{policy.policyId}
{renderStatusBadge(policy.status)}
{/* Action buttons */}
) } // --------------------------------------------------------------------------- // Main export // --------------------------------------------------------------------------- export function EditorTab(props: EditorTabProps) { if (!props.editingId || !props.editingPolicy) { return ( ) } return }