feat: add address field to lead form
This commit is contained in:
@@ -22,10 +22,11 @@ export default function LeadsScreen() {
|
|||||||
const qc = useQueryClient();
|
const qc = useQueryClient();
|
||||||
const [search, setSearch] = useState('');
|
const [search, setSearch] = useState('');
|
||||||
const [showAdd, setShowAdd] = useState(false);
|
const [showAdd, setShowAdd] = useState(false);
|
||||||
const [newName, setNewName] = useState('');
|
const [newName, setNewName] = useState('');
|
||||||
const [newPhone, setNewPhone] = useState('');
|
const [newPhone, setNewPhone] = useState('');
|
||||||
const [newNotes, setNewNotes] = useState('');
|
const [newAddress, setNewAddress] = useState('');
|
||||||
const [saving, setSaving] = useState(false);
|
const [newNotes, setNewNotes] = useState('');
|
||||||
|
const [saving, setSaving] = useState(false);
|
||||||
|
|
||||||
const { data, isLoading, refetch, isRefetching } = useQuery({
|
const { data, isLoading, refetch, isRefetching } = useQuery({
|
||||||
queryKey: ['leads'],
|
queryKey: ['leads'],
|
||||||
@@ -47,10 +48,11 @@ export default function LeadsScreen() {
|
|||||||
await api.post('/api/v1/leads', {
|
await api.post('/api/v1/leads', {
|
||||||
firstName, lastName,
|
firstName, lastName,
|
||||||
phone: newPhone.trim(),
|
phone: newPhone.trim(),
|
||||||
...(newNotes.trim() ? { notes: newNotes.trim() } : {}),
|
...(newAddress.trim() ? { address: newAddress.trim() } : {}),
|
||||||
|
...(newNotes.trim() ? { notes: newNotes.trim() } : {}),
|
||||||
});
|
});
|
||||||
setShowAdd(false);
|
setShowAdd(false);
|
||||||
setNewName(''); setNewPhone(''); setNewNotes('');
|
setNewName(''); setNewPhone(''); setNewAddress(''); setNewNotes('');
|
||||||
qc.invalidateQueries({ queryKey: ['leads'] });
|
qc.invalidateQueries({ queryKey: ['leads'] });
|
||||||
refetch();
|
refetch();
|
||||||
} catch (e: any) {
|
} 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 }}
|
style={{ borderWidth: 1.5, borderColor: '#E2E8F0', borderRadius: 12, paddingHorizontal: 14, paddingVertical: 13, fontSize: 16, color: '#1E293B', marginBottom: 14 }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Text style={{ fontSize: 13, fontWeight: '600', color: '#64748B', marginBottom: 6 }}>Address (optional)</Text>
|
||||||
|
<TextInput
|
||||||
|
value={newAddress} onChangeText={setNewAddress}
|
||||||
|
placeholder="Sitio, Barangay, Municipality..."
|
||||||
|
style={{ borderWidth: 1.5, borderColor: '#E2E8F0', borderRadius: 12, paddingHorizontal: 14, paddingVertical: 13, fontSize: 16, color: '#1E293B', marginBottom: 14 }}
|
||||||
|
/>
|
||||||
|
|
||||||
<Text style={{ fontSize: 13, fontWeight: '600', color: '#64748B', marginBottom: 6 }}>Notes (optional)</Text>
|
<Text style={{ fontSize: 13, fontWeight: '600', color: '#64748B', marginBottom: 6 }}>Notes (optional)</Text>
|
||||||
<TextInput
|
<TextInput
|
||||||
value={newNotes} onChangeText={setNewNotes}
|
value={newNotes} onChangeText={setNewNotes}
|
||||||
|
|||||||
Reference in New Issue
Block a user