diff --git a/src/pages/CustomersPage.jsx b/src/pages/CustomersPage.jsx index 791ff4b..d8c111c 100644 --- a/src/pages/CustomersPage.jsx +++ b/src/pages/CustomersPage.jsx @@ -203,7 +203,7 @@ function CreateLeadForm({ customers, onCancel, onDone }) { // Fester Kunde mit Zugang zum Kundenportal (nur Admins; legt den Login im Portal an) export function CreateCustomerForm({ customers, onCancel, onCreate }) { - const [form, setForm] = useState({ name: '', email: '', code: '', phone: '', location: '', password: '' }) + const [form, setForm] = useState({ name: '', email: '', code: '', phone: '', location: '', password: '', kundenart: '' }) const [busy, setBusy] = useState(false) const [error, setError] = useState(null) const matches = useMemo( @@ -215,6 +215,8 @@ export function CreateCustomerForm({ customers, onCancel, onCreate }) { const submit = async (e) => { e.preventDefault() if (form.password.length < 8) { setError('Das Portal-Passwort muss mindestens 8 Zeichen haben.'); return } + const f = kundenartPruefen(form.kundenart) + if (f) { setError(f); return } setBusy(true); setError(null) const r = await onCreate({ ...form, name: form.name.trim(), email: form.email.trim() }) if (!r.success) { @@ -263,6 +265,9 @@ export function CreateCustomerForm({ customers, onCancel, onCreate }) { + + setForm((f) => ({ ...f, kundenart: v }))} disabled={busy} /> + ) }