feat(admin): sales summary, ticket activity and finance exports pages (#47, slice 2) #149

Merged
amiryahaya merged 7 commits from feat/admin-report-pages into main 2026-11-03 05:06:51 +01:00
Owner

Second slice of #47: admin pages for the report APIs that had none. This is web only, with no API change. Plan: docs/superpowers/plans/2026-11-03-admin-report-pages.md.

What changes

  • Sales summary (/reports/sales-summary, reports.view):
    • completed sales per day, week or month and per currency: count, grand total, waived and collected;
    • a "by park" table showing quantity and net before tax and fee, with an optional park filter.
  • Ticket activity (/reports/ticket-activities, reports.view):
    • the Park Entry report and its relatives (check-ins, check-outs, cancellations), paged with Load more and exportable to .xlsx;
    • filters for kind, park, currency, payment method and invoice or check-in number;
    • ticket codes are never shown (the API does not return them).
  • Finance exports (/reports/finance, finance.manage): choose the days, then download Daily sales, QR income, Payment exceptions, Daily invoice or Pax and revenue. Each download has one line saying what it holds.
  • Shared code:
    • usePagedReport now serves both Transactions and Ticket activity: rows without repeats, a fresh first page on Apply, and Retry and Load more.
    • One .xlsx helper keeps the server's file name only when it is a plain safe name.
    • Park dropdowns use the public GET /v1/parks, because reports.view alone cannot read the admin list.
  • Bad values in a link: a value that fails its rule (for example currency=usd, an unknown status, or a park id that is not a uuid) is now a field error and nothing is fetched. Before this, the value was left out and the page showed and exported unfiltered rows. This also changes the existing Transactions page.
  • Money stays a string, with digit grouping and right alignment. Nothing is added in the browser, and currencies are never mixed.

Verification

  • make cover: 91.6 % total (minimum 80 %). There is no Go change.
  • Web unit tests: admin 434, ticket 304, ui 52, auth 45, all passing; typecheck is clean.
  • scripts/web-e2e.sh: ticket 207, admin 140. The admin count includes a new journey over the three pages at 320, 768 and 1280 px, with axe checks and no sideways scrolling.
  • Review:
    • Pass 1 (complexity): the paging code is shared in one hook (-80 lines), a pointless wrapper is gone, the sales summary announces a failure once, and the code error names both kinds of number.
    • Pass 2 (correctness): ready with fixes; both Important findings are fixed:
      • a bad filter in a link quietly showed unfiltered rows;
      • a sales summary 422 did not mark its field.
    • Also fixed from Pass 2's minors:
      • Apply on the sales summary refreshes;
      • Retry is disabled while it runs (a test fails without this);
      • ticket activity codes are capped at 50 characters, as the spec says;
      • a 429 test was added.
    • The Pass 1 re-check of the fixes found nothing.
  • Only mocked responses were used: these pages have not been tried against the real API.

My calls, for the owner (the design questions were skipped)

  1. Ticket activity has no gate filter. It would need a second dropdown driven by the park choice.
  2. Park dropdowns list active parks only. Rows of inactive parks still show in the results.
  3. Currency is a three-letter text field, not a list.
  4. The finance page asks only for the dates. Each export's extra filters (park, gate, currency, provider, status, reason) are not offered yet.
  5. The sales summary has no export, because the API has none.

Deferred minors

  • When the park list arrives, the filter form is rebuilt, which clears anything typed before then. A failed park list is not reported.
  • The sales summary captions name only the dates, not the grouping or park.
  • The five finance reports are listed twice (FINANCE_REPORTS and the page's list), and each hint is not tied to its button with aria-describedby.
  • The kit's export text says "Too many rows" for any 422; that text predates this branch.

🤖 Generated with Claude Code

Second slice of #47: admin pages for the report APIs that had none. This is web only, with no API change. Plan: `docs/superpowers/plans/2026-11-03-admin-report-pages.md`. ## What changes - **Sales summary** (`/reports/sales-summary`, `reports.view`): - completed sales per day, week or month and per currency: count, grand total, waived and collected; - a "by park" table showing quantity and net before tax and fee, with an optional park filter. - **Ticket activity** (`/reports/ticket-activities`, `reports.view`): - the Park Entry report and its relatives (check-ins, check-outs, cancellations), paged with Load more and exportable to `.xlsx`; - filters for kind, park, currency, payment method and invoice or check-in number; - ticket codes are never shown (the API does not return them). - **Finance exports** (`/reports/finance`, `finance.manage`): choose the days, then download Daily sales, QR income, Payment exceptions, Daily invoice or Pax and revenue. Each download has one line saying what it holds. - **Shared code:** - `usePagedReport` now serves both Transactions and Ticket activity: rows without repeats, a fresh first page on Apply, and Retry and Load more. - One `.xlsx` helper keeps the server's file name only when it is a plain safe name. - Park dropdowns use the public `GET /v1/parks`, because `reports.view` alone cannot read the admin list. - **Bad values in a link:** a value that fails its rule (for example `currency=usd`, an unknown `status`, or a park id that is not a uuid) is now a field error and nothing is fetched. Before this, the value was left out and the page showed and exported unfiltered rows. **This also changes the existing Transactions page.** - Money stays a string, with digit grouping and right alignment. Nothing is added in the browser, and currencies are never mixed. ## Verification - `make cover`: **91.6 %** total (minimum 80 %). There is no Go change. - Web unit tests: admin 434, ticket 304, ui 52, auth 45, all passing; typecheck is clean. - `scripts/web-e2e.sh`: ticket 207, admin 140. The admin count includes a new journey over the three pages at 320, 768 and 1280 px, with axe checks and no sideways scrolling. - **Review:** - Pass 1 (complexity): the paging code is shared in one hook (-80 lines), a pointless wrapper is gone, the sales summary announces a failure once, and the code error names both kinds of number. - Pass 2 (correctness): ready with fixes; both Important findings are fixed: - a bad filter in a link quietly showed unfiltered rows; - a sales summary 422 did not mark its field. - Also fixed from Pass 2's minors: - Apply on the sales summary refreshes; - Retry is disabled while it runs (a test fails without this); - ticket activity codes are capped at 50 characters, as the spec says; - a 429 test was added. - The Pass 1 re-check of the fixes found nothing. - Only mocked responses were used: these pages have not been tried against the real API. ## My calls, for the owner (the design questions were skipped) 1. Ticket activity has no gate filter. It would need a second dropdown driven by the park choice. 2. Park dropdowns list active parks only. Rows of inactive parks still show in the results. 3. Currency is a three-letter text field, not a list. 4. The finance page asks only for the dates. Each export's extra filters (park, gate, currency, provider, status, reason) are not offered yet. 5. The sales summary has no export, because the API has none. ## Deferred minors - When the park list arrives, the filter form is rebuilt, which clears anything typed before then. A failed park list is not reported. - The sales summary captions name only the dates, not the grouping or park. - The five finance reports are listed twice (`FINANCE_REPORTS` and the page's list), and each hint is not tied to its button with `aria-describedby`. - The kit's export text says "Too many rows" for any 422; that text predates this branch. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Transactions and Ticket activity share usePagedReport (rows without repeats,
fresh page 1 on Apply, Retry and Load more). The sales summary announces a
failure once, and the ticket activity code error names both kinds of number.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fix(admin): a bad filter in the link blocks the report; summary 422 fields (#47)
All checks were successful
ci / changes (pull_request) Successful in 12s
ci / api (pull_request) Has been skipped
ci / clients (pull_request) Has been skipped
ci / web (pull_request) Successful in 9m1s
ci / ci-gate (pull_request) Successful in 2s
44c9056050
A link value that fails its rule was left out of the request, so the page
showed (and exported) unfiltered rows. It is now a field error and nothing
is asked, on Transactions, Ticket activity and Sales summary. Park ids must
be uuids, ticket activity codes at most 50 characters (as the spec says).
The sales summary marks the field a 422 names and asks again on Apply;
Retry is disabled while its request runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/kws!149
No description provided.