feat: unanswered ticket badges, dashboard counts, cross-department ticket creation
- Add /tickets/unanswered-counts API endpoint for staff/admin - Show red badge with unanswered count on sidebar nav (staff tickets, admin tickets) - Add summary cards (unanswered/answered/total) to staff tickets page - Highlight unanswered count in admin tickets stats cards - Staff can create tickets to OTHER departments only (not their own) - Frontend hides own department from ticket creation dropdown - Sidebar badges auto-refresh every 30 seconds
This commit is contained in:
@@ -119,6 +119,19 @@ export class TicketsService {
|
||||
await this.ticketsRepo.update(ticketId, data);
|
||||
}
|
||||
|
||||
// ─── Unanswered ticket counts ───
|
||||
async getUnansweredCounts(): Promise<{ technical: number; sales: number; total: number }> {
|
||||
const unanswered = await this.ticketsRepo.find({
|
||||
where: [
|
||||
{ status: TicketStatus.OPEN },
|
||||
{ status: TicketStatus.WAITING },
|
||||
],
|
||||
});
|
||||
const technical = unanswered.filter((t) => t.department === TicketDepartment.TECHNICAL).length;
|
||||
const sales = unanswered.filter((t) => t.department === TicketDepartment.SALES).length;
|
||||
return { technical, sales, total: technical + sales };
|
||||
}
|
||||
|
||||
// ─── Staff: List department tickets ───
|
||||
async findByDepartment(department: TicketDepartment, status?: TicketStatus): Promise<Ticket[]> {
|
||||
const where: any = { department };
|
||||
|
||||
Reference in New Issue
Block a user