feat(invoices): remove client-facing PDF generation

Phase 1 / commit 11 of 14 — invoices are client-facing documents, and
per the new "no CRM-generated client-facing PDFs" rule (see the design
spec), the in-app pdfme rendering is removed entirely.

Future invoice rendering will use the deferred AcroForm-fill admin-
template feature: admin uploads a PDF template with named form fields,
CRM fills them with invoice data via pdf-lib. Same pattern as the
in-app EOI pathway. Tracked in BACKLOG.md.

Deleted:
  - src/lib/services/invoices.ts:generateInvoicePdf (60 LOC)
  - src/lib/pdf/templates/invoice-template.ts (entire pdfme template)
  - src/app/api/v1/invoices/[id]/generate-pdf/route.ts
  - src/components/invoices/invoice-pdf-preview.tsx (regenerate UI)
  - "PDF Preview" tab on invoice detail page
  - 5 now-unused imports in invoices.ts (files, ports, buildStoragePath,
    getStorageBackend, env)

sendInvoice() retained: still queues the send-invoice email job, still
flips status to "sent", still emits the socket event. The PDF-attach
step is gone — downstream consumers either render externally or wait
for the AcroForm-fill feature. The `pdfFileId` column on invoices stays
so existing rows don't break, just never gets written by this code path.

1319/1319 vitest green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 21:04:49 +02:00
parent b7e010ff80
commit ed2424cc68
5 changed files with 6 additions and 335 deletions

View File

@@ -23,7 +23,6 @@ import {
SelectValue,
} from '@/components/ui/select';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { InvoicePdfPreview } from './invoice-pdf-preview';
import { apiFetch } from '@/lib/api/client';
import { toastError } from '@/lib/api/toast-error';
import { useMobileChrome } from '@/components/layout/mobile/mobile-layout-provider';
@@ -218,7 +217,6 @@ export function InvoiceDetail({ invoiceId }: InvoiceDetailProps) {
<TabsList>
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="expenses">Linked Expenses</TabsTrigger>
<TabsTrigger value="pdf">PDF Preview</TabsTrigger>
<TabsTrigger value="payment">Payment</TabsTrigger>
</TabsList>
@@ -360,11 +358,6 @@ export function InvoiceDetail({ invoiceId }: InvoiceDetailProps) {
)}
</TabsContent>
{/* PDF Preview */}
<TabsContent value="pdf" className="pt-4">
<InvoicePdfPreview invoiceId={invoiceId} pdfFileId={invoice.pdfFileId} />
</TabsContent>
{/* Payment */}
<TabsContent value="payment" className="pt-4">
{invoice.status === 'paid' ? (