<div>
    <x-title>
        Status Report
        <x-slot:buttons>
            <button wire:click="$refresh" class="btn btn-primary btn-sm">
                <i class="mdi mdi-sync"></i>
            </button>
        </x-slot:buttons>
    </x-title>
    <div class="container-sm">
        <div class="card shadow-sm border-0">
            <div class="card-body p-0">
                <div class="table-responsive">
                    <table class="table table-hover align-middle mb-0">
                        <thead class="table-light">
                        <tr>
                            <th class="ps-4 py-3 border-0" style="width: 60%">Status</th>
                            <th class="text-center border-0">Total Claims</th>
                            <th class="pe-4 text-end border-0">Action</th>
                        </tr>
                        </thead>
                        <tbody>
                        @forelse($statusCounts as $id => $data)
                            <tr>
                                <td class="ps-4">
                                    <span class="fw-semibold text-dark">{{ $data['display_name'] }}</span>
                                </td>
                                <td class="text-center">
                                    <span class="fw-bold">{{ number_format($data['claims_count']) }}</span>
                                </td>
                                <td class="pe-4 text-end">
                                    @can('reports.status.claims')
                                        <a wire:navigate href="{{ route('clients.index', ['status_id' => $id]) }}"
                                           class="btn btn-sm">
                                            <i class="mdi mdi-search-web text-primary"></i>
                                        </a>
                                    @endcan
                                </td>
                            </tr>
                        @empty
                            <tr>
                                <td colspan="3" class="text-center py-5 text-muted">
                                    <i class="bi bi-folder-x d-block mb-2 fs-2"></i>
                                    No status data available.
                                </td>
                            </tr>
                        @endforelse
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>