From dcff5163757af6360211fa6cbc91ba0fbcfb7f90 Mon Sep 17 00:00:00 2001 From: Nemo Date: Tue, 24 Mar 2026 13:53:43 +0800 Subject: [PATCH] feat: add address field to lead form --- app/(app)/leads/index.tsx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/(app)/leads/index.tsx b/app/(app)/leads/index.tsx index 813147a..a9a1ac3 100644 --- a/app/(app)/leads/index.tsx +++ b/app/(app)/leads/index.tsx @@ -22,10 +22,11 @@ export default function LeadsScreen() { const qc = useQueryClient(); const [search, setSearch] = useState(''); const [showAdd, setShowAdd] = useState(false); - const [newName, setNewName] = useState(''); - const [newPhone, setNewPhone] = useState(''); - const [newNotes, setNewNotes] = useState(''); - const [saving, setSaving] = useState(false); + const [newName, setNewName] = useState(''); + const [newPhone, setNewPhone] = useState(''); + const [newAddress, setNewAddress] = useState(''); + const [newNotes, setNewNotes] = useState(''); + const [saving, setSaving] = useState(false); const { data, isLoading, refetch, isRefetching } = useQuery({ queryKey: ['leads'], @@ -47,10 +48,11 @@ export default function LeadsScreen() { await api.post('/api/v1/leads', { firstName, lastName, phone: newPhone.trim(), - ...(newNotes.trim() ? { notes: newNotes.trim() } : {}), + ...(newAddress.trim() ? { address: newAddress.trim() } : {}), + ...(newNotes.trim() ? { notes: newNotes.trim() } : {}), }); setShowAdd(false); - setNewName(''); setNewPhone(''); setNewNotes(''); + setNewName(''); setNewPhone(''); setNewAddress(''); setNewNotes(''); qc.invalidateQueries({ queryKey: ['leads'] }); refetch(); } catch (e: any) { @@ -169,6 +171,13 @@ export default function LeadsScreen() { style={{ borderWidth: 1.5, borderColor: '#E2E8F0', borderRadius: 12, paddingHorizontal: 14, paddingVertical: 13, fontSize: 16, color: '#1E293B', marginBottom: 14 }} /> + Address (optional) + + Notes (optional)