'use client' import { CompanyProfile } from '@/lib/sdk/types' import { CertificationEntry } from './types' import { CERTIFICATIONS } from './constants' export function StepLegalFramework({ data, onChange, }: { data: Partial onChange: (updates: Record) => void }) { const contacts = (data as any).technicalContacts || [] const existingCerts: CertificationEntry[] = (data as any).existingCertifications || [] const targetCerts: string[] = (data as any).targetCertifications || [] const targetCertOther: string = (data as any).targetCertificationOther || '' const toggleExistingCert = (certId: string) => { const exists = existingCerts.find((c: CertificationEntry) => c.certId === certId) if (exists) { onChange({ existingCertifications: existingCerts.filter((c: CertificationEntry) => c.certId !== certId) }) } else { onChange({ existingCertifications: [...existingCerts, { certId }] }) } } const updateExistingCert = (certId: string, updates: Partial) => { onChange({ existingCertifications: existingCerts.map((c: CertificationEntry) => c.certId === certId ? { ...c, ...updates } : c) }) } const toggleTargetCert = (certId: string) => { if (targetCerts.includes(certId)) { onChange({ targetCertifications: targetCerts.filter((c: string) => c !== certId) }) } else { onChange({ targetCertifications: [...targetCerts, certId] }) } } const addContact = () => { onChange({ technicalContacts: [...contacts, { name: '', role: '', email: '' }] }) } const removeContact = (i: number) => { onChange({ technicalContacts: contacts.filter((_: { name: string; role: string; email: string }, idx: number) => idx !== i) }) } const updateContact = (i: number, updates: Partial<{ name: string; role: string; email: string }>) => { const updated = [...contacts] updated[i] = { ...updated[i], ...updates } onChange({ technicalContacts: updated }) } return (
{/* Bestehende Zertifizierungen */}

Bestehende Zertifizierungen

Ueber welche Zertifizierungen verfuegt Ihr Unternehmen aktuell? Mehrfachauswahl moeglich.

{CERTIFICATIONS.map(cert => { const selected = existingCerts.some((c: CertificationEntry) => c.certId === cert.id) return ( ) })}
{existingCerts.length > 0 && (
{existingCerts.map((entry: CertificationEntry) => { const cert = CERTIFICATIONS.find(c => c.id === entry.certId) const label = cert?.label || entry.certId return (
{entry.certId === 'other' ? 'Sonstige Zertifizierung' : label}
{entry.certId === 'other' && ( updateExistingCert(entry.certId, { customName: e.target.value })} placeholder="Name der Zertifizierung" className="px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" /> )} updateExistingCert(entry.certId, { certifier: e.target.value })} placeholder="Zertifizierer (z.B. T\u00DCV, DEKRA)" className="px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" /> updateExistingCert(entry.certId, { lastDate: e.target.value })} title="Datum der letzten Zertifizierung" className="px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" />
) })}
)}
{/* Angestrebte Zertifizierungen */}

Streben Sie eine Zertifizierung an?

Welche Zertifizierungen planen Sie? Mehrfachauswahl moeglich.

{CERTIFICATIONS.map(cert => { const selected = targetCerts.includes(cert.id) const alreadyHas = existingCerts.some((c: CertificationEntry) => c.certId === cert.id) return ( ) })}
{targetCerts.includes('other') && (
onChange({ targetCertificationOther: e.target.value })} placeholder="Name der angestrebten Zertifizierung" className="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-transparent" />
)}
{/* Technical Contacts */}

Technische Ansprechpartner

CISO, IT-Manager, DSB etc.

{contacts.length === 0 && (
Noch keine Kontakte
)}
{contacts.map((c: { name: string; role: string; email: string }, i: number) => (
updateContact(i, { name: e.target.value })} placeholder="Name" className="flex-1 px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" /> updateContact(i, { role: e.target.value })} placeholder="Rolle (z.B. CISO)" className="flex-1 px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" /> updateContact(i, { email: e.target.value })} placeholder="E-Mail" className="flex-1 px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" />
))}
) }