@extends('garage.layouts.app') @section('title', 'Job Card Queue') @push('styles') @endpush @section('content') @php $minutesToText = function ($minutes) { $m = (int) $minutes; $h = intdiv($m, 60); $r = $m % 60; if ($h <= 0) return $r . 'm'; if ($r <= 0) return $h . 'h'; return $h . 'h ' . $r . 'm'; }; @endphp

Job Card Queue & Timing

Shows what’s running, what’s late, and how much time is left.
Job cards
{{ number_format((int)($kpis['count_total'] ?? 0)) }}
Running tasks
{{ number_format((int)($kpis['count_running'] ?? 0)) }}
Out of time
{{ number_format((int)($kpis['count_out_of_time'] ?? 0)) }}
Estimated
{{ $minutesToText((int)($kpis['sum_estimated'] ?? 0)) }}
Left
{{ $minutesToText((int)($kpis['sum_pending'] ?? 0)) }}
Delay
{{ $minutesToText((int)($kpis['sum_delay'] ?? 0)) }}
Job cards
Shows totals from tasks table (updates when you update time)
@forelse($workOrders as $wo) @php $open = (int)($wo->tasks_open ?? 0); $delay = (int)($wo->total_delay_minutes ?? 0); $chip = ($open > 0 && $delay > 0 && (string)$wo->status !== 'completed') ? 'danger' : (($open > 0) ? 'ok' : 'warn'); $chipText = ($open <= 0) ? 'No open tasks' : (($delay > 0) ? 'Out of time' : 'On time'); $total = max(0, (int)($wo->tasks_total ?? 0)); $done = max(0, (int)($wo->tasks_completed ?? 0)); $pct = $total > 0 ? min(100, (int) round(($done / max(1,$total)) * 100)) : 0; @endphp @php $st = (string)($wo->status ?? ''); @endphp @empty @endforelse
Job card Date Customer / Vehicle Slot Status Tasks Est. Actual Left Delay Open
{{ $wo->work_order_number }}
{{ $chipText }}
{{ $wo->work_order_date }}
{{ $wo->customer_name ?? '—' }}
{{ $wo->vehicle_registration ?? '—' }} @if($wo->vehicle_make || $wo->vehicle_model) ({{ trim(($wo->vehicle_make ?? '').' '.($wo->vehicle_model ?? '')) }}) @endif
{{ $wo->slot_name ?? '—' }}{{ str_replace('_',' ', $st) }} {{ (int)($wo->tasks_completed ?? 0) }}/{{ (int)($wo->tasks_total ?? 0) }} done @if((int)($wo->tasks_running ?? 0) > 0) Running {{ (int)($wo->tasks_running ?? 0) }} @endif
{{ $minutesToText((int)($wo->total_estimated_minutes ?? 0)) }} {{ $minutesToText((int)($wo->total_actual_minutes ?? 0)) }} {{ $minutesToText((int)($wo->total_pending_minutes ?? 0)) }} {{ $minutesToText($delay) }} {{ $open }}
No job cards found.
@if($workOrders->hasPages())
{{ $workOrders->links() }}
@endif
Task queue (latest 200)
Sorted: running → paused → assigned → pending
@forelse($tasks as $t) @php $delay = (int)($t->delay_minutes ?? 0); $left = (int)($t->pending_minutes ?? max(0, (int)($t->estimated_minutes ?? 0) - (int)($t->actual_minutes ?? 0))); @endphp @php $ts = (string)($t->status ?? ''); @endphp @empty @endforelse
Job card Task Assigned Status Est. Actual Left Delay
{{ $t->work_order_number }}
{{ $t->task_name }}
@if(!empty($t->source_item_type)) {{ str_replace('_',' ', $t->source_item_type) }} @endif
{{ $t->assigned_to_name ?: '—' }}{{ str_replace('_',' ', $ts) }} {{ $minutesToText((int)($t->estimated_minutes ?? 0)) }} {{ $minutesToText((int)($t->actual_minutes ?? 0)) }} {{ $minutesToText($left) }} {{ $minutesToText($delay) }}
No tasks found.
@endsection