fix: mobile dashboard priority labels now join priorities table

- API: replaced hardcoded wrong map (1=Critical etc) with JOIN on priorities table
- API: sorted by count DESC instead of priority value
- Frontend: PRIORITY_COLOR/TEXT maps updated to cover all 10 actual Autotask values (1-11)
- Middleware: added /api/mobile to publicRoutes (was getting auth-redirected)
This commit is contained in:
lorentz 2026-03-17 23:44:00 -04:00
parent 5be7b22953
commit 5719daa84b
3 changed files with 26 additions and 6 deletions

View file

@ -17,10 +17,28 @@ interface DashboardData {
}
const PRIORITY_COLOR: Record<number, string> = {
1: 'bg-red-500', 2: 'bg-orange-400', 3: 'bg-yellow-400', 4: 'bg-slate-300',
1: 'bg-slate-300', // Standard
2: 'bg-slate-300', // Medium
3: 'bg-slate-300', // Standard
4: 'bg-red-500', // Critical
6: 'bg-orange-400', // High
7: 'bg-purple-500', // Security Event
8: 'bg-yellow-400', // Minor Service
9: 'bg-orange-500', // Major Service
10: 'bg-blue-400', // Installation
11: 'bg-pink-400', // Fast Track
};
const PRIORITY_TEXT: Record<number, string> = {
1: 'text-red-600', 2: 'text-orange-500', 3: 'text-yellow-600', 4: 'text-slate-500',
1: 'text-slate-500', // Standard
2: 'text-slate-500', // Medium
3: 'text-slate-500', // Standard
4: 'text-red-600', // Critical
6: 'text-orange-500', // High
7: 'text-purple-600', // Security Event
8: 'text-yellow-600', // Minor Service
9: 'text-orange-600', // Major Service
10: 'text-blue-600', // Installation
11: 'text-pink-600', // Fast Track
};
function pct(n: number, d: number) {