@extends('layouts.app') @section('title', 'Maintenance Backlog & MTTR') @section('nav_reports', 'bg-teal-50 text-teal-700 font-semibold') @section('page_title', 'Reports') @section('page_subtitle', 'Maintenance Backlog & MTTR') @section('content') @php $prioBadge = [ 'urgent' => 'bg-red-50 text-red-600 border-red-200', 'high' => 'bg-orange-50 text-orange-600 border-orange-200', 'normal' => 'bg-teal-50 text-teal-700 border-teal-200', 'low' => 'bg-gray-50 text-gray-500 border-gray-200', ]; $statusBadge = [ 'open' => 'bg-red-50 text-red-600 border-red-200', 'in_progress' => 'bg-amber-50 text-amber-700 border-amber-200', ]; $fmtHours = fn($h) => $h === null ? '—' : ($h >= 48 ? round($h / 24, 1) . 'd' : $h . 'h'); @endphp @include('reports._filter', [ 'active' => 'reports.maintenance-backlog', 'mode' => 'range', 'from' => $from, 'to' => $to, 'title' => 'Maintenance Backlog & MTTR', 'subtitle' => 'Live backlog · resolve times for ' . \Carbon\Carbon::parse($from)->format('M j') . ' – ' . \Carbon\Carbon::parse($to)->format('M j, Y'), ]) {{-- Summary tiles --}}
Open Backlog
{{ $openCount + $inProgressCount }}
{{ $openCount }} open · {{ $inProgressCount }} in progress
Overdue
{{ $overdueCount }}
past target by priority
Oldest Open
{{ $oldestAge }}d
days since reported
Avg Resolve (MTTR)
{{ $fmtHours($mttrHours) }}
{{ $resolvedCount }} resolved in range
Urgent first, then oldest · overdue rows highlighted
No open work orders — backlog is clear. 🔧
@else| Location | Category | Priority | Status | Issue | Age |
|---|---|---|---|---|---|
| {{ $r['room_no'] ? 'Room ' . $r['room_no'] : ($r['location'] ?: 'Common area') }} | {{ $r['category'] }} | {{ ucfirst($r['priority']) }} | {{ \Illuminate\Support\Str::headline($r['status']) }} | {{ $r['description'] }} | {{ $r['age_days'] }}d @if($r['overdue'])Overdue@endif |
By Priority
@forelse($byPriority as $prio => $count)—
@endforelseBy Category
@forelse($byCategory as $cat => $count)—
@endforelseResolved in the selected range
No work orders resolved in this range.
@else| Category | Resolved | Avg Time |
|---|---|---|
| {{ $cat }} | {{ $m['count'] }} | {{ $fmtHours($m['hours']) }} |