<!-- Path: app/Views/admin/incidents_pending.view.php -->
<div class="bg-slate-50 min-h-[calc(100vh-64px)] py-8">
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
        <div class="mb-6 flex justify-between items-center">
            <h1 class="text-2xl font-bold text-navy-900">Pending Dispatches</h1>
            <a href="{{APP_URL}}/admin" class="text-slate-500 hover:text-navy-900"><i class="fas fa-arrow-left"></i> Back to Dashboard</a>
        </div>

        <div class="bg-white rounded-xl shadow-sm border border-slate-200 overflow-hidden">
            <div class="overflow-x-auto">
                <table class="w-full text-left border-collapse">
                    <thead>
                        <tr class="bg-slate-50 text-slate-500 text-sm uppercase tracking-wider border-b border-slate-200">
                            <th class="p-4 font-semibold">ID</th>
                            <th class="p-4 font-semibold">Date/Time</th>
                            <th class="p-4 font-semibold">Victim Details</th>
                            <th class="p-4 font-semibold">Category</th>
                            <th class="p-4 font-semibold text-right">Action</th>
                        </tr>
                    </thead>
                    <tbody class="divide-y divide-slate-100 text-sm">
                        @if(empty($incidents))
                            <tr><td colspan="5" class="p-10 text-center text-slate-500 text-lg">No pending emergencies.</td></tr>
                        @else
                            @foreach($incidents as $incident)
                                <tr class="hover:bg-slate-50">
                                    <td class="p-4 font-mono font-medium text-navy-900">#{{ str_pad($incident['id'], 5, '0', STR_PAD_LEFT) }}</td>
                                    <td class="p-4 text-slate-600">{{ date('M d, Y h:i A', strtotime($incident['created_at'])) }}</td>
                                    <td class="p-4">
                                        <div class="font-bold text-slate-900">{{ $incident['victim_name'] }}</div>
                                        <div class="text-xs text-slate-500">{{ $incident['phone_number'] }}</div>
                                    </td>
                                    <td class="p-4 font-semibold text-alert">{{ $incident['category_name'] }}</td>
                                    <td class="p-4 text-right">
                                        <a href="{{APP_URL}}/admin/incidents/{{ $incident['id'] }}" class="bg-brandBlue-600 hover:bg-brandBlue-700 text-white px-4 py-2 rounded shadow-sm font-bold transition-colors">Open Dispatch</a>
                                    </td>
                                </tr>
                            @endforeach
                        @endif
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>