No description
Implements the wiki "Reports Mockup" as a Reports → Purchasing sidebar section, wired to real approved-PO spend. Two report families, each index → drill/detail: - Cost Centres (/reports/cost-centres) — spend compared across vessels; row opens a cost-centre report with a Top-accounting-codes breakdown re-pivotable by tier (Heading/Sub/Leaf) + Top-N. - Accounting Codes (/reports/accounting-codes) — drills the Account tree (headings → sub → leaves) via ?parent=; a leaf opens its report broken down by cost centre (or, for a non-leaf, by sub-account). Shared: a pinned filter toolbar (Granularity Monthly/Yearly, Financial Year, Show Top5/Top10/Bottom5/All) whose values live in the URL query so the server component re-renders — no client fetching. KPI tiles, recharts comparison/trend/ breakdown charts, per-row trend sparklines, and CSV export (/api/reports/spend). - lib/reports.ts: the pure, unit-tested aggregation core. Spend = a PO once it reaches POST_APPROVAL_STATUSES, dated by approvedAt, valued at totalAmount (the dashboard's basis); Indian Apr–Mar FY; each PO's leaf accountId rolled up to parents. One query in getReportDataset(), everything else pure. - Sidebar: new collapsible "Reports" section with a "Purchasing" subheading (subgroup support added to the Section model). Gated by view_analytics (Manager/SuperUser/Auditor/Admin); export by the same. Deferred (documented): synthetic Weekly granularity, the "Add to graph" custom multi-select, and line-item-level account allocation (v1 uses the PO-level account). Sites are not cost centres — only vessels. Tests: 11 unit cases for the aggregation core + 3 sidebar cases for the Reports section. Full unit suite 303 green; tsc clean. Smoke-tested all routes end to end against seed data (index/drill/detail/export 200; non-analytics role 307/403). Wiki: "Reports Mockup" marked implemented; "Pages and Navigation" lists the new routes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .claude | ||
| .forgejo | ||
| App | ||
| automation | ||
| Docs | ||
| EpfoService | ||
| GstService | ||
| PdfService | ||
| Progress | ||
| static | ||
| Wireframe | ||
| .gitattributes | ||
| .gitignore | ||
| CHANGELOG.md | ||
| ecosystem.config.js | ||
| generate_po.py | ||
| inspect_po.py | ||
| test-report-2026-05-17.md | ||
Docs — retired (moved to the wiki)
The design, architecture, and test documents that used to live here have been migrated to the project wiki and removed from the repo. The wiki is the living reference going forward.
Wiki: https://git.pelagiamarine.com/shad0w/pelagia-portal/wiki
(working clone: pelagia-portal.wiki/ alongside this repo).
Where each retired doc went
| Retired file | Now in the wiki |
|---|---|
01-design-document.md |
System/Architecture, Product/Workflows (user stories), Product/Design-System, Overview/Open-Questions |
02-architecture.md |
System/Architecture (+ System/Data-Model, Ops/Deployment-and-Operations, Build-and-Run/Environment-Variables) |
03-open-questions.md |
Overview/Open-Questions |
DESIGN.md |
Product/Workflows, Product/Pages-and-Navigation, Product/Design-System |
TEST_PLAN.md |
Quality/Test-Plan |
e2e-test-framework.md |
Quality/E2E-Test-Framework |
e2e-test-plan.md |
Quality/E2E-Test-Plan |
PLAYRIGHT_TEST_DESIGN.md |
Quality/Playwright-Test-Design |
The wiki's on-disk folder layout (Overview / Build-and-Run / System / Product / Quality / Ops) mirrors its sidebar hierarchy.
Keep current behaviour documented in the wiki, not here. Other authoritative in-repo sources remain:
App/CLAUDE.md,App/README.md,automation/README.md, andCHANGELOG.md.