Kunden: Kundenart ist beim Anlegen Pflicht

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Sonnet 5.5 committed 2026-10-16 13:23:28 +00:00
1 parent cbf4b265e0
commit 463aaf1066
1 file changed
+6 -1
+6 -1
View File
@@ -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 }) {
<input id="customer-password" className="input" type="password" autoComplete="new-password" name="password" value={form.password} onChange={set('password')} required />
</Field>
</div>
<Field label="Kundenart" hint={KUNDENART_AUSWAHL_HINWEIS}>
<KundenartAuswahl value={form.kundenart} onChange={(v) => setForm((f) => ({ ...f, kundenart: v }))} disabled={busy} />
</Field>
</Dialog>
)
}