@extends('layouts.admin')

@section('content')

<h2 style="margin-bottom:20px;">Inbox Laporan Kerusakan</h2>

<div class="card">

<table>
<tr>
<th>Tanggal</th>
<th>Pengguna</th>
<th>Kendaraan</th>
<th>Waktu Kejadian</th>
<th>Tingkat Kerusakan</th>
<th>Status</th>
<th>Foto</th>
</tr>

@forelse($reports as $report)
<tr>

<td>{{ $report->created_at->format('d M Y') }}</td>

<td>
{{ \App\Models\User::find($report->user_id)->name ?? '-' }}
</td>

<td>
{{ \App\Models\Vehicle::find($report->vehicle_id)->vehicle_name ?? '-' }}
</td>

<td>{{ ucfirst($report->timing) }}</td>

<td>
@if($report->severity == 'critical')
<span class="badge rejected">Parah</span>

@elseif($report->severity == 'medium')
<span class="badge pending">Sedang</span>

@else
<span class="badge approved">Ringan</span>
@endif
</td>

<td>{{ ucfirst($report->status) }}</td>

<td>
@if($report->photo)
<a href="{{ asset('reports/'.$report->photo) }}"
target="_blank"
style="
background:linear-gradient(135deg,#7c3aed,#6d28d9);
color:white;
padding:8px 14px;
border-radius:10px;
text-decoration:none;
font-size:13px;
font-weight:700;
display:inline-block;
box-shadow:0 4px 10px rgba(124,58,237,0.20);
">
Lihat
</a>
@else
-
@endif
</td>

</tr>

<tr>
<td colspan="7" style="background:#f8fafc;">
<strong>Keterangan:</strong>
{{ $report->description }}
</td>
</tr>

@empty
<tr>
<td colspan="7">Tidak ada Laporan saat ini</td>
</tr>
@endforelse

</table>

</div>

@endsection