Repository navigation
feat: SCO-151 export any report as a PDF - #403
Merged
Merged
Conversation
Reports could only be exported as CSV. Export PDF builds the document on the server from the same filtered rows as the page: title, filter and date, the SCO-150 bar chart, then the table with its totals. The report loader moved into lib/server/reports/load-report.ts so the page and the PDF share one scoping path. Part of SCO-151 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /api/reports/[slug]/pdfwith the page's current filter (year, ordaysfor Product Performance).src/lib/server/report-pdf.tscomposes the document on the sharedpdf-layout.tscanvas (same page setup as order, invoice and credit memo PDFs): title, org, filter, generated date, then the SCO-150 bar chart drawn as PDF rectangles (top 3 values labelled, "Other" muted), then the table with a repeating header on page breaks and a totals row where the page has one. No Puppeteer.src/lib/utils/report-columns.tsdescribes each report's table as data, mirroring the page's tables column for column. Share snapshots (next PR) will reuse it.routes/reports/[slug]/+page.server.tsintosrc/lib/server/reports/load-report.ts, so the page and the PDF share one scoping path (brand scope, sales scope, Nx-BLSR). Bypass inventory and permissions map updated.Why
SCO-151: export any report as a PDF with the current filter baked in. Share links are the second half of the ticket and come in a separate PR.
Verification
bun run lintpassesbun run checkpasses (0 errors)bun run test:runpasses (2134), including new tests forreport-columns.tsand PDF smoke tests (single page, pagination, empty report, missing fields)tests/rls/admin-bypass.test.tspasses with the movedsupabaseAdmincall siteTest plan
Part of SCO-151
🤖 Generated with Claude Code