Implement Workstream M: Admin Pages (Frontend)

Add superuser admin interface for managing organizations and users:
- Admin layout with access control (redirects non-superusers)
- Admin dashboard with org/user counts and quick actions
- Org management: list, create, view/edit details, manage sites
- User management: list, view details, toggle superuser, confirm email
- SuperuserBadge component for consistent superuser indication
- Sidebar shows admin link (shield icon) for superusers only
- Centralized date formatting utility at $lib/utils/format-date.ts
- Test plan documentation at docs/test-plans/admin.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
RevIQ
2026-01-09 18:18:36 +08:00
parent 41b52750d8
commit c8152ce86e
25 changed files with 2068 additions and 86 deletions

View File

@@ -2363,14 +2363,24 @@ _Depends on: J1-J6, C3_
- Reusable components: `$lib/components/org/role-badge.svelte`, `confirm-dialog.svelte`
- Sidebar updated with "Organizations" nav item
#### Workstream M: Admin Pages (Frontend)
#### Workstream M: Admin Pages (Frontend)
_Depends on: K1-K5, C3_
_Can run parallel to L_
- [ ] **M1**: Create `/admin` dashboard page
- [ ] **M2**: Create `/admin/orgs` pages (list, new, details)
- [ ] **M3**: Create `/admin/users` pages (list, details)
- [x] **M1**: Create `/admin` dashboard page
- [x] **M2**: Create `/admin/orgs` pages (list, new, details)
- [x] **M3**: Create `/admin/users` pages (list, details)
**Implementation notes:**
- Admin layout at `/routes/admin/+layout.svelte` provides superuser access control
- Redirects non-superusers to `/dashboard` with toast error
- Admin dashboard shows org/user counts with quick action links
- Org management: list all orgs, create new with owner email, view/edit details, manage sites
- User management: list all users, view details, toggle superuser status, confirm email
- Sidebar shows admin link (shield icon) only for superusers
- Reusable component: `$lib/components/admin/superuser-badge.svelte`
- All destructive actions use ConfirmDialog
---