@if ($tabData === null || $tabData->isEmpty())
    <x-ui.operational.empty-state :title="__('recruitment.vacancies.empty_tab.applications')" />
@else
    <div class="table-responsive">
        <table class="table table-hover align-middle mb-0">
            <thead>
                <tr>
                    <th>{{ __('recruitment.applications.fields.reference') }}</th>
                    <th>{{ __('recruitment.applications.fields.candidate') }}</th>
                    <th>{{ __('recruitment.applications.fields.status') }}</th>
                    <th>{{ __('recruitment.applications.fields.applied_at') }}</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                @foreach ($tabData as $app)
                    <tr>
                        <td><code>{{ $app->reference_code }}</code></td>
                        <td>{{ $app->candidate?->full_name ?? '—' }}</td>
                        <td>{{ __('recruitment.applications.status.'.$app->status) }}</td>
                        <td>{{ $app->applied_at?->format('Y-m-d') ?? '—' }}</td>
                        <td class="text-end">
                            <a href="{{ route('hr.recruitment.applications.edit', $app) }}" class="small">{{ __('common.view') }}</a>
                        </td>
                    </tr>
                @endforeach
            </tbody>
        </table>
    </div>
    @if (method_exists($tabData, 'hasPages') && $tabData->hasPages())
        <div class="mt-3">{{ $tabData->links() }}</div>
    @endif
@endif
