diff --git a/app/(app)/tasks/[id].tsx b/app/(app)/tasks/[id].tsx index f3174e7..27c8b93 100644 --- a/app/(app)/tasks/[id].tsx +++ b/app/(app)/tasks/[id].tsx @@ -96,6 +96,7 @@ export default function TicketDetailScreen() { const who = user?.firstName ?? 'Staff'; await api.post(`/api/v1/tickets/${id}/messages`, { body: `Status changed to ${status.replace('_', ' ')} by ${who}`, + isSystemMessage: true, }).catch(() => {}); return updatedTicket; @@ -156,11 +157,15 @@ export default function TicketDetailScreen() { const note = instNotes.trim() ? `Installation confirmed. Location recorded: ${coordStr}. Notes: ${instNotes.trim()}` : `Installation confirmed. Location recorded: ${coordStr}`; - await api.post(`/api/v1/tickets/${id}/messages`, { body: note }).catch(() => {}); + await api.post(`/api/v1/tickets/${id}/messages`, { body: note, isSystemMessage: true }).catch(() => {}); // 4. Generate first invoice so it appears in Collect screen if (ticket?.clientId) { - await api.post(`/api/v1/invoices/generate/${ticket.clientId}`).catch(() => {}); + try { + await api.post(`/api/v1/invoices/generate/${ticket.clientId}`); + } catch (e: any) { + console.warn('Invoice generation failed:', e?.response?.data?.message ?? e?.message); + } } // 5. Create follow-up activation ticket (non-fatal)