Skip to content

feat(api,ui): send-report, mobile fixes, admin month selector, data retention - #7

Merged
arudaev merged 17 commits into
mainfrom
feat/send-report-pdf-mobile
May 9, 2026
Merged

feat(api,ui): send-report, mobile fixes, admin month selector, data retention#7
arudaev merged 17 commits into
mainfrom
feat/send-report-pdf-mobile

Conversation

@FaresM7

@FaresM7 FaresM7 commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • /api/send-report — branded PDF (puppeteer) + Excel (exceljs) attachments via Resend; PIN-protected; accepts month param for historical reports
  • /api/cron/monthly-report — Vercel Cron wrapper with Authorization: Bearer check and last-day-of-month guard
  • Month selector — admin dashboard now filters all views (log, summary, CSV export) to the selected month; manual report trigger uses selected month; cron always uses current month
  • Data retention — transactions are no longer deleted after a report; last 3 months kept in transactions table; pruneOldTransactions() cleans anything older after each report send
  • Mobile fixes — item grid, member grid, FlowShell padding, start screen hero, SuccessScreen all responsive
  • Auth fixessend-report was unprotected (added PIN header check); cron was checking wrong header (now Authorization: Bearer {CRON_SECRET})
  • Excel fix — switch from xlsx (no cell styling in community edition) to exceljs; header rows created explicitly so styling is applied correctly; bgColor added to fills to prevent Excel repair dialog
  • PDF — simplified design: flat amber-600 header, white KPI strip, clean stone-grey tables matching the app's minimal aesthetic

Checklist

  • Bugfix (cron auth, send-report auth, Excel styling)
  • Feature (month selector, data retention, PDF/Excel improvements)
  • My code follows the code style of this project
  • Self-reviewed
  • No new TypeScript warnings (npm run typecheck passes)
  • CI green

- Add /api/send-report: HTML-to-PDF via puppeteer+chromium-min,
  Excel via SheetJS, email with both attachments via Resend,
  archive+clear transactions after send
- Add /api/cron/monthly-report: last-day-of-month guard + CRON_SECRET
  verification; schedule 0 22 28-31 * * in vercel.json
- Fix member flow mobile layout: item grid cols-3→responsive,
  member grid, FlowShell padding, start screen hero sizing,
  SuccessScreen scaling
@vercel

vercel Bot commented May 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kaffeelisten Ready Ready Preview, Comment May 9, 2026 1:31am

- Add live Vercel screenshots for the member flow and admin views

- Embed the key member and admin captures in the README screenshots section
…fix report page-top spacing; restore original section layout
arudaev added 2 commits May 9, 2026 02:16
- /api/send-report now requires x-admin-pin header matching ADMIN_PIN env var
- /api/cron/monthly-report now checks Authorization: Bearer header (Vercel
  Cron standard) instead of the custom x-cron-secret header that never fired
- AdminLogin stores adminPin in sessionStorage after successful PIN verify
- AdminDashboard passes x-admin-pin header when triggering the report
PDF changes:
- Gradient amber header with coffee cup SVG mark
- Dark KPI strip (entries / total / consumers / companies)
- Company overview table with dark header and amber total row
- Amber section labels with accent pill
- Amber-on-cream column headers inside each company block
- Footer border is now 2px amber accent

Excel changes:
- Switch from xlsx to exceljs for full cell-style support
- Amber header rows (white text) on all sheets
- Alternating stone-50 row fill for readability
- Amber total/subtotal rows on all sheets
- Per-company sheet added (sheet 2) showing member breakdown with subtotals
- All euro columns formatted with German locale number format
- Tab colors: amber-600 / amber-700 / stone-500
UI:
- MonthSelector is now a real <select> showing the last 3 months
- AdminDashboard filters all data (summary cards, log, company table) by
  the selected month; switching month clears log filters automatically
- handleSendReport passes the selected month in the POST body
- Modal text updated: no longer says "Tabelle zurückgesetzt" (data kept)

API:
- fetchAndEnrich() and runMonthlyReport() accept an optional forMonth param
  ("2026-05"); defaults to current calendar month if omitted
- send-report reads month from request body and forwards it
- pruneOldTransactions() deletes rows older than 3 months after each report
  so the transactions table stays lean without losing current-period data

PDF:
- Column headers inside company blocks reverted from amber-cream to plain
  stone-100 / stone-500 — the double amber band was visually heavy
- Gesamt row border restored to solid amber-600 (was amber-200)
PDF: remove dark KPI strip and gradient header; replace with flat
amber-600 header and white KPI row matching the app's minimal aesthetic.

Excel: switch from columns.header shortcut to explicit addRow() for
headers so cells exist before styling; add bgColor to all fill
definitions to prevent Excel repair warnings.
@arudaev arudaev changed the title feat(api,ui): monthly report email with PDF/Excel + mobile fixes feat(api,ui): send-report, mobile fixes, admin month selector, data retention May 9, 2026
@arudaev
arudaev merged commit 3f73a81 into main May 9, 2026
4 checks passed
@arudaev arudaev assigned FaresM7 and unassigned FaresM7 May 9, 2026
@arudaev
arudaev deleted the feat/send-report-pdf-mobile branch June 27, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants