diff --git a/public/index.php b/public/index.php index b62af5f..a7581b5 100644 --- a/public/index.php +++ b/public/index.php @@ -119,10 +119,17 @@ if ($route === 'dashboard') { $slaRowsStmt->execute(['user' => $user['id']]); $slaRows = $slaRowsStmt->fetchAll(); } + $urgentJobcards = []; + 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(); + } + $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'); ?>

Dashboard

Your operational overview.

New jobcards
Open jobcards
Hours this week
SLA warnings

Operations

Use Jobcards to manage assignments, status, technician notes and time entries. SLA threshold metrics will activate after period and rollover rules are configured.

Dashboard

Your operational overview.

New jobcards
Open jobcards
Hours this week
SLA warnings

Operations

Use Jobcards to manage assignments, status, technician notes and time entries. SLA threshold metrics will activate after period and rollover rules are configured.

Urgent jobcards

High and critical priority work assigned to you.

No urgent active jobcards.

'clients.view','jobcards'=>'jobcards.view','reports'=>'reports.view','users'=>'users.manage','audit'=>'audit.view'];