feat: Enhance ticketing system with categories, templates, SLA tracking, and fix frontend integration

- Add ticket categories (billing, technical, feature_request, etc.) with type-specific options
- Add TicketTemplate and CannedResponse models for quick ticket creation
- Implement SLA tracking with due_at and first_response_at fields
- Add is_platform_admin and is_customer helper functions to fix permission checks
- Register models in Django admin with filters and fieldsets
- Enhance signals with error handling for WebSocket notifications
- Fix frontend API URLs for templates and canned responses
- Update PlatformSupport page to use real ticketing API
- Add comprehensive i18n translations for all ticket fields

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
poduck
2025-11-28 05:32:36 -05:00
parent 512d95ca2d
commit 200a6b3dd4
22 changed files with 1782 additions and 425 deletions

View File

@@ -179,9 +179,22 @@ export interface Metric {
// --- Platform Types ---
export type TicketType = 'PLATFORM' | 'CUSTOMER' | 'STAFF_REQUEST';
export type TicketStatus = 'OPEN' | 'IN_PROGRESS' | 'RESOLVED' | 'CLOSED';
export type TicketType = 'PLATFORM' | 'CUSTOMER' | 'STAFF_REQUEST' | 'INTERNAL';
export type TicketStatus = 'OPEN' | 'IN_PROGRESS' | 'RESOLVED' | 'CLOSED' | 'AWAITING_RESPONSE';
export type TicketPriority = 'LOW' | 'MEDIUM' | 'HIGH' | 'URGENT';
export type TicketCategory =
| 'BILLING'
| 'TECHNICAL'
| 'FEATURE_REQUEST'
| 'ACCOUNT'
| 'APPOINTMENT'
| 'REFUND'
| 'COMPLAINT'
| 'GENERAL_INQUIRY'
| 'TIME_OFF'
| 'SCHEDULE_CHANGE'
| 'EQUIPMENT'
| 'OTHER';
export interface TicketComment {
id: string;
@@ -208,13 +221,43 @@ export interface Ticket {
priority: TicketPriority;
subject: string;
description: string;
category?: string;
category: TicketCategory;
relatedAppointmentId?: string; // Appointment ID, optional
dueAt?: string; // Date string
firstResponseAt?: string; // Date string
isOverdue?: boolean;
createdAt: string; // Date string
updatedAt: string; // Date string
resolvedAt?: string; // Date string
comments?: TicketComment[]; // Nested comments
}
export interface TicketTemplate {
id: string;
tenant?: string; // Tenant ID, optional for platform templates
name: string;
description: string;
ticketType: TicketType;
category: TicketCategory;
defaultPriority: TicketPriority;
subjectTemplate: string;
descriptionTemplate: string;
isActive: boolean;
createdAt: string; // Date string
}
export interface CannedResponse {
id: string;
tenant?: string; // Tenant ID, optional for platform canned responses
title: string;
content: string;
category?: TicketCategory;
isActive: boolean;
useCount: number;
createdBy?: string; // User ID
createdAt: string; // Date string
}
export interface PlatformMetric {
label: string;
value: string;