diff --git a/public/index.php b/public/index.php index 0826dfc..120a95f 100644 --- a/public/index.php +++ b/public/index.php @@ -130,16 +130,21 @@ if ($route === 'dashboard') { $slaRows = $slaRowsStmt->fetchAll(); } $urgentJobcards = []; + $assignedJobcards = []; + $inProgressJobcards = []; if ($user['role_name'] === 'Technician') { $urgentStmt = db()->prepare("SELECT DISTINCT j.id, j.reference_no, j.status, j.priority, c.name AS client_name FROM jobcards j JOIN clients c ON c.id = j.client_id JOIN jobcard_assignments ja ON ja.jobcard_id = j.id AND ja.user_id = :user WHERE j.priority IN ('high', 'critical') AND j.status <> 'closed' ORDER BY FIELD(j.priority, 'critical', 'high'), j.created_at ASC LIMIT 10"); $urgentStmt->execute(['user' => $user['id']]); $urgentJobcards = $urgentStmt->fetchAll(); + $workloadStmt = db()->prepare("SELECT DISTINCT j.id, j.reference_no, j.status, j.priority, c.name AS client_name FROM jobcards j JOIN clients c ON c.id = j.client_id JOIN jobcard_assignments ja ON ja.jobcard_id = j.id AND ja.user_id = :user WHERE j.status IN ('assigned', 'in_progress') ORDER BY FIELD(j.status, 'in_progress', 'assigned'), j.created_at ASC LIMIT 50"); + $workloadStmt->execute(['user' => $user['id']]); + foreach ($workloadStmt->fetchAll() as $workItem) { if ($workItem['status'] === 'assigned') $assignedJobcards[] = $workItem; else $inProgressJobcards[] = $workItem; } } $slaClassifier = new \App\Domain\SLA\SlaThresholdClassifier(); $slaWarnings = 0; foreach ($slaRows as $slaRow) if (in_array($slaClassifier->classify((float)$slaRow['used_hours'], (float)$slaRow['allocated_hours']), ['warning', 'critical', 'exceeded'], true)) $slaWarnings++; - render_header('Dashboard'); ?>
Your operational overview.
Use Jobcards to manage assignments, status, technician notes and time entries. SLA threshold metrics will activate after period and rollover rules are configured.
High and critical priority work assigned to you.
No urgent active jobcards.
Your operational overview.
Use Jobcards to manage assignments, status, technician notes and time entries. SLA threshold metrics will activate after period and rollover rules are configured.
High and critical priority work assigned to you.
No urgent active jobcards.
= e($panel['description']) ?>
None currently.