<x-filament-widgets::widget>
    <x-filament::section>
        <x-slot name="heading">
            Pengajuan Menunggu Approval
        </x-slot>

        <div class="space-y-4">
            @php
                $requests = $this->getPendingRequests();
            @endphp

            @if(count($requests) > 0)
                <div class="overflow-x-auto">
                    <table class="w-full text-sm">
                        <thead>
                            <tr class="border-b border-gray-200 dark:border-gray-700">
                                <th class="text-left py-2 px-4 font-semibold text-gray-700 dark:text-gray-300">Jenis</th>
                                <th class="text-left py-2 px-4 font-semibold text-gray-700 dark:text-gray-300">Karyawan</th>
                                <th class="text-left py-2 px-4 font-semibold text-gray-700 dark:text-gray-300">Tanggal</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach($requests as $request)
                                <tr class="border-b border-gray-100 dark:border-gray-800">
                                    <td class="py-2 px-4">
                                        <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
                                            @if($request['type'] === 'correction') bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200
                                            @elseif($request['type'] === 'late_arrival') bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200
                                            @else bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200
                                            @endif">
                                            {{ $request['request_type'] }}
                                        </span>
                                    </td>
                                    <td class="py-2 px-4 text-gray-900 dark:text-gray-100">{{ $request['user_name'] }}</td>
                                    <td class="py-2 px-4 text-gray-600 dark:text-gray-400">
                                        {{ \Carbon\Carbon::parse($request['created_at'])->format('d M Y H:i') }}
                                    </td>
                                </tr>
                            @endforeach
                        </tbody>
                    </table>
                </div>
            @else
                <div class="text-center py-8 text-gray-500 dark:text-gray-400">
                    <p>Tidak ada pengajuan yang menunggu approval</p>
                </div>
            @endif
        </div>
    </x-filament::section>
</x-filament-widgets::widget>
