Screen Recording 2026-05-06 at 3.00.43 PM.mov
Frontend
attik-frontend/src/components/invoice/InvoicePDF.tsx — Renders the PDF used in previews and downloads; "Invoice to" comes from optional invoiceContactOverride, otherwise the first inspection.people row whose role name contains "buyer" or "client" (case-insensitive substring match).attik-frontend/src/components/invoice/InvoiceDrawer.tsx — Drives preview/download, builds invoiceContactOverride from the user's selected contact, and persists _invoiceContactId on the inspection via PATCH inspection/:id when staff save the invoice contact.attik-frontend/src/app/tools/inspections/[id]/components/ServicesPayments.tsx (tools work order), attik-frontend/src/app/client/job/[slug]/components/JobAccordion.tsx (client portal job accordion), and attik-frontend/src/app/client/job/[slug]/pay-beta/PaymentBetaClient.tsx (pay flow).Backend
attik-backend/src/util/functions/pdf/templates/InvoiceAttachmentPDF.tsx — Server-side invoice PDF used for email attachments and other backend generation; resolves invoiceContactEffective from optional override, else resolveInvoiceContactFromInspection (walks people for _invoiceContactId), else the same substring "buyer" / "client" fallback as the frontend PDF.attik-backend/src/util/functions/emailBuilder/buildTemplateEmailAttachments.ts — When attachInvoicePdf is enabled on an email template, builds the attachment with InvoiceAttachmentPDF (same resolution rules as above).Data / product
_invoiceContactId is defined on the inspection type (attik-frontend/src/util/types/serverTypeCollection/inspection.ts) and patched in attik-backend/src/routes/inspection.ts when body fields are applied to the inspection document.Decision needed
_invoiceContactId vs role ordering)—not prescribed here; the dev should choose after reproducing on the linked inspections.attik-frontend/src/app/tools/inspections/[id]/components/ServicesPayments.tsxattik-frontend/src/app/client/job/[slug]/components/JobAccordion.tsxattik-backend/src/util/functions/emailBuilder/buildTemplateEmailAttachments.tsPlease authenticate to join the conversation.
Completed
Main App
2 months ago
Linear
Get notified by email when there are changes.
Completed
Main App
2 months ago
Linear
Get notified by email when there are changes.