From 80031ae7a4c397410879b567963e790cdc33ffb9 Mon Sep 17 00:00:00 2001 From: Marco0300 Date: Wed, 2 Sep 2026 00:08:55 +0200 Subject: [PATCH] feat: add assigned and in-progress technician dashboard panels --- public/index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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'); ?>

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.

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.

'Assigned jobcards', 'items' => $assignedJobcards, 'description' => 'Newly assigned work waiting to be started.', 'border' => 'border-primary', 'badge' => 'primary'], ['title' => 'In-progress jobcards', 'items' => $inProgressJobcards, 'description' => 'Work currently being handled by you.', 'border' => 'border-info', 'badge' => 'info']] as $panel): ?>

None currently.

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