feat(phase-6): rich super admin dashboard UI

Full DashboardPage rewrite with:
- 5-KPI row (total/active schools, expiring licenses, open tickets, SMS today)
- 30-day SMS volume bar chart (reuses SmsPage chart pattern)
- Revenue snapshot: MRR, paid this month, outstanding + overdue invoices
- School health table: status, tier, credit balance with LOW badge, license
  expiry countdown, last-seen relative time — sortable + search + status filter
- Quick actions panel with open-ticket badge counter
- Mini stats: SMS queue depth, suspended school count
- Refresh button with last-updated timestamp
- api.ts: getDashboardSchoolHealth + getDashboardRevenue
This commit is contained in:
kevin-asprec
2026-03-16 12:38:38 +08:00
parent 132290957c
commit 34f87476ff
5 changed files with 411 additions and 51 deletions

View File

@@ -19,8 +19,8 @@ SMS flow: On-prem TapTrack polls Hub every 30s → Hub queues SMS jobs → Hub s
## Current Milestone
**v1.0 — Foundation & Core Services**
Status: Phase 5 complete — Phase 6 next
Phases: 5 of 15 complete
Status: Phase 6 complete — Phase 7 next
Phases: 6 of 15 complete
---
@@ -33,7 +33,7 @@ Phases: 5 of 15 complete
| 3 | On-Prem License Validation | 1 | ✅ Complete | 2026-03-15 |
| 4 | SMS Gateway (credits + queue) | 2 | ✅ Complete | 2026-03-15 |
| 5 | On-Prem SMS Polling Agent | 1 | ✅ Complete | 2026-03-16 |
| 6 | Super Admin Dashboard UI | TBD | Not started | |
| 6 | Super Admin Dashboard UI | 1 | ✅ Complete | 2026-03-16 |
| 7 | School Admin Portal UI | TBD | Not started | — |
| 8 | Billing Engine + Invoice PDF | TBD | Not started | — |
| 9 | Email Dispatcher | TBD | Not started | — |

View File

@@ -3,16 +3,16 @@
## Current Position
Milestone: v1.0 — Foundation & Core Services
Phase: 5 of 15 (On-Prem SMS Polling Agent — complete)
Plan: Phase 5 complete — Phase 6 next
Status: **Phase 5 applied — ready to begin Phase 6**
Last activity: 2026-03-16 — Phase 5 complete (sync/poll hardening: credit deduction, failed job reporting, feature flags, suspension flag, stale job reclaim)
Phase: 6 of 15 (Super Admin Dashboard UI — complete)
Plan: Phase 6 complete — Phase 7 next
Status: **Phase 6 applied — ready to begin Phase 7**
Last activity: 2026-03-16 — Phase 6 complete (rich dashboard: KPI row, SMS volume chart, revenue snapshot, school health table with sort/filter, quick actions, refresh button)
## Loop Position
```
PLAN ──▶ APPLY ──▶ UNIFY
· · · [No active plan — Phase 6 planning next]
· · · [No active plan — Phase 7 planning next]
```
## Progress
@@ -24,7 +24,7 @@ PLAN ──▶ APPLY ──▶ UNIFY
- Phase 3 (On-Prem License Validation): [██████████] 100% ✓
- Phase 4 (SMS Gateway): [██████████] 100% ✓
- Phase 5 (On-Prem SMS Polling Agent): [██████████] 100% ✓
- Phase 6 (Super Admin Dashboard UI): [░░░░░░░░░░] 0%
- Phase 6 (Super Admin Dashboard UI): [██████████] 100% ✓
- Phase 7 (School Admin Portal UI): [░░░░░░░░░░] 0%
- Phase 8 (Billing Engine + Invoice PDF): [░░░░░░░░░░] 0%
- Phase 9 (Email Dispatcher): [░░░░░░░░░░] 0%
@@ -37,8 +37,8 @@ PLAN ──▶ APPLY ──▶ UNIFY
## Next Action
Run: `/paul:plan` for Phase 6 — Super Admin Dashboard UI
Resume file: .paul/ROADMAP.md → Phase 6
Run: `/paul:plan` for Phase 7 — School Admin Portal UI
Resume file: .paul/ROADMAP.md → Phase 7
## Repo

View File

@@ -1,9 +1,29 @@
# Phase 06: Super Admin Dashboard UI
**Status:** Not started
**Status:** Complete
**Completed:** 2026-03-16
## Goal
Rich dashboard with KPI cards, school health table, SMS volume chart, revenue snapshot.
## Plans
- [ ] TBD — run /paul:plan when Phase 5 is complete
Replace the minimal DashboardPage skeleton with a rich, data-driven super admin dashboard.
## What was built
### Backend (already existed from Phase 1/4 scaffolding)
- `GET /api/dashboard/summary` — KPI counts
- `GET /api/dashboard/school-health` — school list with license/credit health
- `GET /api/dashboard/revenue` — MRR, outstanding, overdue, paid this month
### Frontend — DashboardPage.vue (full rewrite)
1. **KPI row (5 cards):** Total Schools, Active, Expiring Licenses, Open Tickets, SMS Today
2. **School Health Table:** name, status badge, tier, SMS credits (with low-credit warning), license expiry countdown, last seen timestamp — sortable columns, status filter, search
3. **SMS Volume Chart:** 30-day bar chart (sent/failed), reused from SmsPage pattern
4. **Revenue Snapshot panel:** MRR, Paid This Month, Outstanding (count), Overdue (count + red highlight)
5. **Quick Actions:** Add School (→ /schools), SMS Gateway (→ /sms), Billing (→ /billing)
6. **Refresh button** with last-updated timestamp
### api.ts additions
- `getDashboardSchoolHealth(params)` — calls `/dashboard/school-health`
- `getDashboardRevenue()` — calls `/dashboard/revenue`
- `getDashboardSmsChart()` — calls `/sms/stats?days=30` (reuse existing)