fix: 5 issues - leads 500, prepaid amount/invoice, install RESOLVED, dup tickets, confirm fail
This commit is contained in:
@@ -72,14 +72,13 @@ export default function LeadDetailScreen() {
|
||||
});
|
||||
const client = clientRes.data;
|
||||
|
||||
// Create installation ticket
|
||||
const ticketRes = await api.post('/api/v1/tickets', {
|
||||
clientId: client.id,
|
||||
subject: `New Installation — ${lead.firstName} ${lead.lastName !== '—' ? lead.lastName : ''}`.trim(),
|
||||
type: 'INSTALLATION',
|
||||
priority: 'NORMAL',
|
||||
});
|
||||
const ticket = ticketRes.data;
|
||||
// Fetch the auto-created installation ticket (API creates one on client creation)
|
||||
let ticket: any = null;
|
||||
try {
|
||||
const tRes = await api.get(`/api/v1/tickets?clientId=${client.id}&type=INSTALLATION&limit=1`);
|
||||
const items = tRes.data?.data ?? tRes.data ?? [];
|
||||
ticket = items[0] ?? null;
|
||||
} catch {}
|
||||
|
||||
// Mark lead as CONVERTED
|
||||
await api.patch(`/api/v1/leads/${id}`, {
|
||||
|
||||
Reference in New Issue
Block a user