@extends('layouts.app') @section('title', 'Maintenance') @section('nav_maintenance', 'bg-teal-50 text-teal-700 font-semibold') @section('page_title', 'Maintenance') @section('page_subtitle', 'Work orders and facility issues') @section('content')
{{-- Header --}}
New Work Order
{{-- Stats --}}

Open

{{ $stats['open'] }}

Awaiting action

In Progress

{{ $stats['in_progress'] }}

Being worked on

Resolved MTD

{{ $stats['resolved_mtd'] }}

This month

Rooms Blocked

{{ $stats['rooms_blocked'] }}

Maintenance / OOO

{{-- Table Card --}}
{{-- Filter Tabs --}}
@php $tabs = ['open' => 'Open', 'in_progress' => 'In Progress', 'resolved' => 'Resolved', 'all' => 'All']; @endphp @foreach($tabs as $key => $label) {{ $label }} @if($key === 'open' && $stats['open'] > 0) {{ $stats['open'] }} @elseif($key === 'in_progress' && $stats['in_progress'] > 0) {{ $stats['in_progress'] }} @endif @endforeach
@if(session('success'))
{{ session('success') }}
@endif @if($requests->isEmpty())

No {{ $statusFilter !== 'all' ? str_replace('_', ' ', $statusFilter) . ' ' : '' }}work orders

@if(in_array($statusFilter, ['open', 'all']))

All clear. Create a new work order to report an issue.

@endif
@else
@foreach($requests as $req) @php $catColors = [ 'electrical' => 'bg-yellow-50 text-yellow-700 border-yellow-200', 'plumbing' => 'bg-cyan-50 text-cyan-700 border-cyan-200', 'hvac' => 'bg-indigo-50 text-indigo-700 border-indigo-200', 'furniture' => 'bg-amber-50 text-amber-700 border-amber-200', 'appliances' => 'bg-purple-50 text-purple-700 border-purple-200', 'structural' => 'bg-stone-50 text-stone-600 border-stone-200', 'other' => 'bg-gray-50 text-gray-500 border-gray-200', ]; $priColors = [ 'urgent' => 'bg-red-50 text-red-700 border-red-200', 'high' => 'bg-orange-50 text-orange-700 border-orange-200', 'normal' => 'bg-blue-50 text-blue-700 border-blue-200', 'low' => 'bg-gray-50 text-gray-500 border-gray-200', ]; $statusColors = [ 'open' => 'bg-red-50 text-red-700 border-red-200', 'in_progress' => 'bg-amber-50 text-amber-700 border-amber-200', 'resolved' => 'bg-green-50 text-green-700 border-green-200', ]; $statusLabels = [ 'open' => 'Open', 'in_progress' => 'In Progress', 'resolved' => 'Resolved', ]; $catLabel = $req->category === 'hvac' ? 'HVAC' : ucfirst($req->category); @endphp @endforeach
WO # Location Category Priority Description Status Reported
WO-{{ str_pad($req->id, 4, '0', STR_PAD_LEFT) }}

{{ $req->location }}

@if($req->reported_by)

{{ $req->reported_by }}

@endif
{{ $catLabel }} {{ ucfirst($req->priority) }}

{{ $req->description }}

{{ $statusLabels[$req->status] ?? ucfirst($req->status) }}

{{ $req->created_at->format('M j, Y') }}

@if($req->resolved_at)

Done {{ $req->resolved_at->format('M j') }}

@endif
View @if($req->status === 'open')
@csrf
@endif
@endif @if($requests->hasPages())
{{ $requests->links() }}
@endif
@endsection