@extends('layouts.admin') @section('title', 'Maintenance Requests – Beltway Office Park') @section('breadcrumb', 'Maintenance') @section('content')

{{ $totalRequests }}

Total Request

{{ $kritisRequests }}

Kritis

{{ $prossesRequests }}

Dalam Proses

{{ $completedRequests }}

Selesai

@if(request('search') || request('building_id') || request('category') || request('priority') || request('status')) Reset @endif

Daftar Maintenance Request

@forelse($maintenanceRequests as $req) @php $priorityColors = [ 'Kritis' => ['bg' => 'bg-rose-50', 'text' => 'text-rose-600', 'border' => 'border-rose-100', 'circle' => 'bg-rose-500 text-white'], 'Tinggi' => ['bg' => 'bg-orange-50', 'text' => 'text-orange-600', 'border' => 'border-orange-100', 'circle' => 'bg-orange-500 text-white'], 'Sedang' => ['bg' => 'bg-amber-50', 'text' => 'text-amber-600', 'border' => 'border-amber-100', 'circle' => 'bg-amber-500 text-white'], 'Rendah' => ['bg' => 'bg-slate-50', 'text' => 'text-slate-600', 'border' => 'border-slate-100', 'circle' => 'bg-slate-500 text-white'] ]; $statusColors = [ 'Menunggu' => 'bg-amber-50 text-amber-600 border border-amber-200', 'Dalam Proses' => 'bg-blue-50 text-blue-600 border border-blue-200', 'Selesai' => 'bg-emerald-50 text-emerald-600 border border-emerald-200', 'Dibatalkan' => 'bg-slate-50 text-slate-600 border border-slate-200' ]; $pColors = $priorityColors[$req->priority] ?? $priorityColors['Rendah']; $sColor = $statusColors[$req->status] ?? $statusColors['Menunggu']; // Get building & unit names: use specific values if saved, otherwise fall back to all tenant's space allocations (historical records) if ($req->building_id && $req->unit) { $buildingsStr = $req->building->name; $unitsStr = $req->unit; } else { $allocations = $req->tenant->spaceAllocations; $buildingsStr = $allocations->map(fn($a) => $a->building->name)->unique()->implode(', ') ?: '—'; $unitsStr = $allocations->map(fn($a) => ($a->floor_number ? 'Lt. ' . $a->floor_number . ' - ' : '') . $a->unit_number)->implode(', ') ?: '—'; } @endphp
{{ $req->tenant->company_name }}
{{ $req->title }}

{{ Str::limit($req->description, 130) }}

{{ $buildingsStr }} {{ $unitsStr }} {{ $req->category }} {{ $req->requested_at ? $req->requested_at->format('d M Y') : '—' }} {{ $req->assigned_to }}
• {{ $req->priority }} {{ $req->status }}
@if($req->status === 'Selesai') @else @endif
@csrf @method('DELETE')
@empty
Tidak ada maintenance request ditemukan.
@endforelse
@if($maintenanceRequests->hasPages())
{{ $maintenanceRequests->links() }}
@endif
@endsection @section('scripts') @endsection