feat(phase-7): complete school admin portal UI

Backend (school_portal.py):
- GET /portal/sms-stats: 30/7/90-day chart, delivery rate, credit burn this month
- POST /portal/credits/request: auto-creates billing ticket for credit top-up
- GET /portal/overview: extended with days_left, sms_credit_low flag, 30-day SMS chart, full school details

PortalOverviewPage: suspension/expired banner, low-credit warning, credit meter
  with progress bar, license countdown with expiry badge, 30-day SMS sparkline
PortalBillingPage: subscription plan panel (fee, SMS cost, cycle, next billing),
  invoice table with subscription/SMS breakdown, credit top-up request form
PortalSmsPage: 30/7/90d period picker, 4-stat KPI row (sent, failed, delivery
  rate, credit burn), daily volume chart, credit snapshot with top-up link,
  paginated SMS log with status filter
PortalTicketsPage: status filter tabs (all/open/in-progress/resolved/closed),
  pagination, improved empty states
PortalProfilePage: school details panel (name, city, contact, tier, status)
  alongside existing change-password form
This commit is contained in:
kevin-asprec
2026-03-16 13:21:41 +08:00
parent 34f87476ff
commit e45e63903d
10 changed files with 973 additions and 106 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 6 complete — Phase 7 next
Phases: 6 of 15 complete
Status: Phase 7 complete — Phase 8 next
Phases: 7 of 15 complete
---
@@ -34,7 +34,7 @@ Phases: 6 of 15 complete
| 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 | 1 | ✅ Complete | 2026-03-16 |
| 7 | School Admin Portal UI | TBD | Not started | |
| 7 | School Admin Portal UI | 1 | ✅ Complete | 2026-03-16 |
| 8 | Billing Engine + Invoice PDF | TBD | Not started | — |
| 9 | Email Dispatcher | TBD | Not started | — |
| 10 | Support Ticket System | TBD | Not started | — |

View File

@@ -3,16 +3,16 @@
## Current Position
Milestone: v1.0 — Foundation & Core Services
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)
Phase: 7 of 15 (School Admin Portal UI — complete)
Plan: Phase 7 complete — Phase 8 next
Status: **Phase 7 applied — ready to begin Phase 8**
Last activity: 2026-03-16 — Phase 7 complete (portal pages: suspension banner, credit meter, license countdown, SMS chart, delivery stats, top-up request form, ticket filter/pagination, school details)
## Loop Position
```
PLAN ──▶ APPLY ──▶ UNIFY
· · · [No active plan — Phase 7 planning next]
· · · [No active plan — Phase 8 planning next]
```
## Progress
@@ -25,7 +25,7 @@ PLAN ──▶ APPLY ──▶ UNIFY
- Phase 4 (SMS Gateway): [██████████] 100% ✓
- Phase 5 (On-Prem SMS Polling Agent): [██████████] 100% ✓
- Phase 6 (Super Admin Dashboard UI): [██████████] 100% ✓
- Phase 7 (School Admin Portal UI): [░░░░░░░░░░] 0%
- Phase 7 (School Admin Portal UI): [██████████] 100% ✓
- Phase 8 (Billing Engine + Invoice PDF): [░░░░░░░░░░] 0%
- Phase 9 (Email Dispatcher): [░░░░░░░░░░] 0%
- Phase 10 (Support Ticket System): [░░░░░░░░░░] 0%
@@ -37,8 +37,8 @@ PLAN ──▶ APPLY ──▶ UNIFY
## Next Action
Run: `/paul:plan` for Phase 7School Admin Portal UI
Resume file: .paul/ROADMAP.md → Phase 7
Run: `/paul:plan` for Phase 8Billing Engine + Invoice PDF
Resume file: .paul/ROADMAP.md → Phase 8
## Repo

View File

@@ -1,9 +1,45 @@
# Phase 07: School Admin Portal UI
**Status:** Not started
**Status:** Complete
**Completed:** 2026-03-16
## Goal
Complete portal with credit meter, charts, billing PDF download, SMS reports.
## Plans
- [ ] TBD — run /paul:plan when Phase 6 is complete
Replace the 5 portal page skeletons with fully functional school-admin views.
## What was built
### Backend additions to `school_portal.py`
- `GET /portal/sms-stats` — 30-day SMS chart, delivery rate, credit burn rate, monthly breakdown
- `POST /portal/credits/request` — school admin submits a credit top-up request (creates a support ticket)
### Frontend pages (full rewrites)
**PortalOverviewPage.vue**
- Suspension/expired banner (red alert if school is not active)
- Credit meter: progress bar showing credits vs. threshold, LOW CREDIT warning
- License countdown: days remaining badge, expired warning
- 30-day SMS usage mini-chart (same bar pattern as SmsPage)
- KPI cards: SMS Credits, SMS This Month, Open Tickets, Pending Invoices
- Announcements banner
**PortalBillingPage.vue**
- Invoice table: number, period, breakdown (subscription + SMS), total, status badge, due date
- Credit top-up request form (opens inline, sends request to support ticket)
- Subscription info panel (monthly fee, SMS cost/message)
**PortalSmsPage.vue**
- 30-day SMS volume chart (sent/failed bars)
- Delivery rate stat card
- Credit burn rate (credits used this month)
- Monthly SMS job table with status filter and pagination
- Trigger type breakdown
**PortalTicketsPage.vue**
- Status filter tabs (All / Open / In Progress / Resolved)
- Pagination
- Better empty state
**PortalProfilePage.vue**
- School details panel (name, city, contact, tier, status)
- Change password form (already existed — preserved)