Kunden: Kundenart ist beim Anlegen Pflicht
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cbf4b265e0
commit
463aaf1066
1 file changed
+6
-1
@@ -203,7 +203,7 @@ function CreateLeadForm({ customers, onCancel, onDone }) {
|
|||||||
|
|
||||||
// Fester Kunde mit Zugang zum Kundenportal (nur Admins; legt den Login im Portal an)
|
// Fester Kunde mit Zugang zum Kundenportal (nur Admins; legt den Login im Portal an)
|
||||||
export function CreateCustomerForm({ customers, onCancel, onCreate }) {
|
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 [busy, setBusy] = useState(false)
|
||||||
const [error, setError] = useState(null)
|
const [error, setError] = useState(null)
|
||||||
const matches = useMemo(
|
const matches = useMemo(
|
||||||
@@ -215,6 +215,8 @@ export function CreateCustomerForm({ customers, onCancel, onCreate }) {
|
|||||||
const submit = async (e) => {
|
const submit = async (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
if (form.password.length < 8) { setError('Das Portal-Passwort muss mindestens 8 Zeichen haben.'); return }
|
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)
|
setBusy(true); setError(null)
|
||||||
const r = await onCreate({ ...form, name: form.name.trim(), email: form.email.trim() })
|
const r = await onCreate({ ...form, name: form.name.trim(), email: form.email.trim() })
|
||||||
if (!r.success) {
|
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 />
|
<input id="customer-password" className="input" type="password" autoComplete="new-password" name="password" value={form.password} onChange={set('password')} required />
|
||||||
</Field>
|
</Field>
|
||||||
</div>
|
</div>
|
||||||
|
<Field label="Kundenart" hint={KUNDENART_AUSWAHL_HINWEIS}>
|
||||||
|
<KundenartAuswahl value={form.kundenart} onChange={(v) => setForm((f) => ({ ...f, kundenart: v }))} disabled={busy} />
|
||||||
|
</Field>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user