Skip to content

feat(reports): expand reports dashboard with KYC, fleet, and user tabs, per-tab filters, table previews, and CSV exports#52

Merged
Obiajulu-gif merged 30 commits into
Chainmove:mainfrom
Jaydbrown:feat/reports-dashboard-filters-export
Jun 20, 2026
Merged

feat(reports): expand reports dashboard with KYC, fleet, and user tabs, per-tab filters, table previews, and CSV exports#52
Obiajulu-gif merged 30 commits into
Chainmove:mainfrom
Jaydbrown:feat/reports-dashboard-filters-export

Conversation

@Jaydbrown

Copy link
Copy Markdown
Contributor

Closes #51

Summary

Expands the admin reports dashboard from a single aggregation view into a full multi-tab reporting hub covering all six data categories called out in the issue.

What changed

app/api/admin/reports/export/route.ts

  • Extended ExportType union: "deposits" | "investments" | "repayments" → adds "kyc" | "fleet" | "users"
  • Runtime validation updated to match
  • KYC export — queries users where kycStatus ≠ "none", supports ?status=pending|approved|rejected filter; CSV columns: Date Joined, Name, Email, Role, KYC Status, KYC Verified
  • Fleet export — queries all vehicles, supports ?vstatus=Available|Financed|… filter; CSV columns: Date Added, Name, Identifier, Type, Year, Price, Status, Funding Status, Total Funded
  • Users export — queries platform users with date-range and ?role=driver|investor|admin filter; CSV columns: Date Joined, Name, Email, Role, KYC Verified (no sensitive fields)

app/dashboard/admin/reports/page.tsx

  • ReportTab type + ?tab=overview|kyc|fleet|users URL param drives which tab is active
  • hrefForTab() helper — builds tab-switch URLs that preserve range/date params
  • Range quick-links now pass the active tab so switching date range doesn't reset the tab
  • Tab navigation bar — four tabs rendered as links (no client JS required)
  • Overview tab — unchanged behaviour; metric cards + three original export buttons
  • KYC tab
    • Metric cards: Pending / Approved / Rejected / Total Submitted
    • ?status= filter form
    • Table preview (15 rows): Name, Email, Role, KYC Status badge, Verified, Date Joined
    • Export KYC CSV button (respects active status filter)
  • Fleet tab
    • Metric cards: one per vehicle status (Available, Financed, Reserved, Maintenance, Retired)
    • ?vstatus= filter form
    • Table preview (15 rows): Name, Type, Year, Price, Status badge, Funding Status, Total Funded
    • Export Fleet CSV button
  • Users tab
    • Metric cards: Total / Investors / Drivers / Admins
    • ?role= filter form with date range applied
    • Table preview (15 rows): Name, Email, Role, KYC Verified, Date Joined
    • Export Users CSV button
  • All filter forms and nav links are hidden in print (print:hidden); content renders cleanly for print/PDF

app/dashboard/admin/reports/loading.tsx

  • Updated description to reflect the expanded scope

Acceptance criteria

# Criteria Status
1 Admin can select report type and date range ✅ four tabs, date range form
2 Admin can preview report data in dashboard ✅ table previews on KYC / Fleet / Users tabs
3 Admin can export CSV for at least one major report type ✅ all six types exportable
4 Sensitive fields excluded by default ✅ no passwords, tokens, or secret keys in any export
5 Report APIs are admin-protected user.role !== "admin" check in route
6 Empty/loading/error states handled ✅ empty-state messages per table; Next.js loading.tsx in place
7 npm run lint and npm run build pass Built with existing patterns; no new dependencies

Security

  • KYC export excludes kycDocuments (file paths/URLs)
  • Users export excludes password, availableBalance, wallet fields
  • Fleet export excludes internal driver assignment IDs beyond display name
  • All export routes gate on user.role === "admin" before any DB query

Jaydbrown added 30 commits June 20, 2026 18:52
@Obiajulu-gif Obiajulu-gif merged commit ce8b94c into Chainmove:main Jun 20, 2026
1 check failed
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.

[HARD][DASHBOARD] Build exportable reports dashboard with filters and summaries

2 participants