From 84186d14299a340c15925e26380e8f2e972323c9 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 6 Oct 2026 10:00:46 +0000 Subject: [PATCH] Design: Vertrags- und Versions-Formular als Dialoge, Fehler im Dialog Co-Authored-By: Claude Sonnet 5.5 --- src/components/legal/ContractForm.jsx | 109 +++++++++++++------------- src/components/legal/VersionForm.jsx | 78 +++++++++--------- src/styles/global.css | 4 +- 3 files changed, 96 insertions(+), 95 deletions(-) diff --git a/src/components/legal/ContractForm.jsx b/src/components/legal/ContractForm.jsx index cc42ba8..42c9c70 100644 --- a/src/components/legal/ContractForm.jsx +++ b/src/components/legal/ContractForm.jsx @@ -1,6 +1,6 @@ -import { useState } from 'react' -import { FaTimes } from 'react-icons/fa' -import { Button } from '../ui' +import { useRef, useState } from 'react' +import { useScrollIntoView } from '../../hooks/useScrollIntoView' +import { Button, Dialog, Field } from '../ui' const FIELDS = ['provider', 'purpose', 'cost', 'costInterval', 'startDate', 'termMonths', 'renewalMonths', 'noticeValue', 'noticeUnit', 'note'] const NUMBERS = ['termMonths', 'renewalMonths', 'noticeValue'] @@ -31,6 +31,8 @@ export default function ContractForm({ contract, onSave, onClose }) { const [files, setFiles] = useState([]) const [saving, setSaving] = useState(false) const [error, setError] = useState(null) + const errorRef = useRef(null) + useScrollIntoView(errorRef, error) const set = (key) => (e) => setForm((f) => ({ ...f, [key]: e.target.value })) const submit = async (e) => { @@ -47,60 +49,59 @@ export default function ContractForm({ contract, onSave, onClose }) { } const input = (key, label, props = {}) => ( -
- - -
+ + + ) return ( -
- -
-

{contract ? 'Vertrag bearbeiten' : 'Neuer Vertrag'}

- {error &&
{error}
} -
- {input('provider', 'Anbieter', { required: true })} - {input('purpose', 'Wofür')} -
- {input('cost', 'Kosten (€)', { inputMode: 'decimal' })} -
- - -
-
- {input('startDate', 'Vertragsbeginn', { type: 'date' })} -
- {input('termMonths', 'Laufzeit (Monate, 0 = jederzeit kündbar)', { type: 'number', min: 0 })} - {input('renewalMonths', 'Verlängert sich um (Monate, 0 = endet)', { type: 'number', min: 0 })} -
-
- {input('noticeValue', 'Kündigungsfrist', { type: 'number', min: 0 })} -
- - -
-
-
- -