2.4 KiB
2.4 KiB
Next Section Prompt — Reports: Envelope, Phone Book (variants), Rolodex Info
Implement the next set of reports building on existing report infrastructure.
Context:
- Phone Book HTML/CSV/PDF is already implemented at
/reports/phone-bookusingbuild_phone_book_pdfandreport_phone_book.html. - Bulk selection from
rolodex.htmlposts to/reports/phone-book.
Goals:
- Envelope report (PDF)
- Endpoint:
GET /reports/envelope?client_ids=...&q=...&format=pdf - Input: either selected
client_ids(from rolodex bulk) or current filterq. - Output: PDF of #10 envelope mailing blocks, one per client, paginated. Address format:
- Line 1:
First Last(orCompanyif present and person name is blank) - Line 2:
Company(optional if name already used) - Line 3:
Address - Line 4:
City, ST ZIP
- Line 1:
- Implementation:
build_envelope_pdf(clients)inapp/reporting.pyusing fpdf2 with sensible margins and font sizes.
- Phone Book — Address & Phone variant (HTML/CSV/PDF)
- Extend existing
GET /reports/phone-bookto supportvariant=address_phone. - Columns: Name, Company, Address, City, State, Zip, Phone Type, Phone Number.
- CSV: include all columns above.
- PDF: tabular layout similar to current phone book, trimmed to fit page width.
- Rolodex Info report (PDF)
- Endpoint:
GET /reports/rolodex-info?client_ids=...&q=...&format=pdf - Output: Per-client summary blocks showing key details:
- Name (Last, First), Company
- Address, City/State/Zip
- All phone numbers (type + number)
- Implementation:
build_rolodex_info_pdf(clients)inapp/reporting.py, multi-column or stacked blocks with clear headings and light separators.
UI wiring:
- In
rolodex.htmlbulk actions, add buttons/links for:- Envelope (Selected) → POST to
/reports/envelopeor GET withclient_ids - Phone Book CSV/PDF (Current Filter) with
variant=address_phone - Rolodex Info (Selected)
- Envelope (Selected) → POST to
Acceptance Criteria:
- All endpoints require auth; respect
client_idsorqfiltering similar to phone book. - CSV downloads set
Content-Dispositionwith meaningful filenames. - PDFs render at least one page with legible typography and pagination.
- Logging: add structured logs for render/export start/end with counts.
Non-goals (for this pass):
- Advanced formatting (duplex, custom fonts), i18n, or bulk email generation.
Test notes:
- Use existing seed/import flows to populate clients and phones.
- Validate downloads via browser and ensure no server errors in logs.