65 lines
2.4 KiB
Markdown
65 lines
2.4 KiB
Markdown
# Phase 10: Support Ticket System
|
|
|
|
**Status:** Not started
|
|
**Depends on:** Phase 9 (Email Dispatcher — for email notifications)
|
|
|
|
## Goal
|
|
|
|
Polish and harden the existing ticket system with SLA tracking display, email notifications
|
|
on ticket create/reply, priority auto-escalation, and ticket assignment.
|
|
|
|
## Planned Scope
|
|
|
|
### Backend
|
|
|
|
**Email notifications** (using Phase 9 HTML templates)
|
|
- New ticket created → email to super admin(s)
|
|
- Super admin replies → email to school admin
|
|
- School admin replies → email to super admin(s)
|
|
- Template: `ticket_notification.html`
|
|
|
|
**SLA display**
|
|
- `first_response_at` already stored — compute SLA status in list endpoint:
|
|
- `sla_status`: `on_track` | `at_risk` (>24h no response) | `breached` (>48h no response)
|
|
- Add `sla_status` to ticket list response
|
|
|
|
**Priority auto-escalation** (new Celery task `tickets.escalate_stale`)
|
|
- Scheduled every hour
|
|
- Tickets open > 48h with `priority = normal` → set `priority = high`
|
|
- Tickets open > 72h with no reply → set `priority = urgent`
|
|
|
|
**Ticket assignment**
|
|
- `assigned_to: str | None` column already on model
|
|
- `PUT /api/tickets/{id}` already accepts `assigned_to`
|
|
- Add `GET /api/users?role=super_admin` filter for assignee picker
|
|
|
|
**Bulk actions**
|
|
- `POST /api/tickets/bulk-close` — close list of resolved ticket IDs (super admin)
|
|
|
|
### Frontend
|
|
|
|
**TicketsPage.vue** — super admin view enhancements
|
|
- SLA status column (green/amber/red badge)
|
|
- Assignee column + inline assign dropdown
|
|
- Priority badge
|
|
- Bulk close: checkbox selection + "Close Selected" button
|
|
- Status filter tabs (All / Open / In Progress / Resolved / Closed)
|
|
|
|
**TicketDetailPage.vue** — enhancements
|
|
- Assignee selector
|
|
- Priority selector
|
|
- SLA timer display (hours since opened, color-coded)
|
|
- Internal notes clearly marked with lock icon (super admin only)
|
|
|
|
**worker.py** — add `tickets.escalate_stale` to beat schedule (every hour)
|
|
|
|
## Key Files to Modify
|
|
|
|
- `backend/app/routers/tickets.py` — SLA status in response, bulk-close endpoint
|
|
- `backend/app/tasks/tickets.py` (new) — escalate_stale task
|
|
- `backend/app/worker.py` — add escalation task to beat schedule
|
|
- `backend/app/templates/email/ticket_notification.html` (new)
|
|
- `frontend/src/pages/TicketsPage.vue` — SLA, assign, bulk close
|
|
- `frontend/src/pages/TicketDetailPage.vue` — SLA timer, assign, priority
|
|
- `frontend/src/lib/api.ts` — bulkCloseTickets
|