Leads: Kundenart ist beim Anlegen Pflicht
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
45b2b145b0
commit
cbf4b265e0
2 files changed
+15
-3
No files matched your search
@@ -7,6 +7,8 @@ import { CUSTOMER_TABS, customerBadges, customerTitle, filterCustomers, stageCou
|
||||
import { isRowActivation } from '../lib/rowClick'
|
||||
import { findDuplicates } from '../lib/leadDuplicates'
|
||||
import DuplicateWarning from '../components/customer/DuplicateWarning'
|
||||
import KundenartAuswahl from '../components/KundenartAuswahl'
|
||||
import { kundenartPruefen, KUNDENART_AUSWAHL_HINWEIS } from '../lib/kundenFelder'
|
||||
import { PageHeader, Tabs, Button, Badge, EmptyState, Field, Dialog } from '../components/ui'
|
||||
|
||||
export default function CustomersPage() {
|
||||
@@ -138,6 +140,7 @@ function CreateLeadForm({ customers, onCancel, onDone }) {
|
||||
const [company, setCompany] = useState('')
|
||||
const [email, setEmail] = useState('')
|
||||
const [phone, setPhone] = useState('')
|
||||
const [kundenart, setKundenart] = useState('')
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [error, setError] = useState(null)
|
||||
// Abgleich mit allen Kunden (auch archivierten und abgesagten), damit niemand doppelt angerufen wird
|
||||
@@ -146,9 +149,11 @@ function CreateLeadForm({ customers, onCancel, onDone }) {
|
||||
const submit = async (e) => {
|
||||
e.preventDefault()
|
||||
if (!company.trim()) { setError('Unternehmen erforderlich'); return }
|
||||
const f = kundenartPruefen(kundenart)
|
||||
if (f) { setError(f); return }
|
||||
setBusy(true); setError(null)
|
||||
try {
|
||||
await onDone({ company: company.trim(), email: email.trim(), phone: phone.trim() })
|
||||
await onDone({ company: company.trim(), email: email.trim(), phone: phone.trim(), kundenart })
|
||||
} catch (err) {
|
||||
setError(err.message || 'Fehler')
|
||||
setBusy(false)
|
||||
@@ -189,6 +194,9 @@ function CreateLeadForm({ customers, onCancel, onDone }) {
|
||||
<input id="lead-phone" className="input" type="tel" value={phone} onChange={(e) => setPhone(e.target.value)} />
|
||||
</Field>
|
||||
</div>
|
||||
<Field label="Kundenart" hint={KUNDENART_AUSWAHL_HINWEIS}>
|
||||
<KundenartAuswahl value={kundenart} onChange={setKundenart} disabled={busy} />
|
||||
</Field>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user