@if ($tabData === null || $tabData->isEmpty())
    <x-ui.operational.empty-state :title="__('employees.empty_tab.documents')" />
@else
    <x-ui.table.table :columns="[
        ['label' => __('employees.documents.category')],
        ['label' => __('employees.documents.expires_at')],
        ['label' => __('employees.documents.status')],
        ['label' => __('employees.documents.version')],
        ['label' => __('common.actions'), 'align' => 'end'],
    ]">
        @foreach ($tabData as $doc)
            <x-ui.table.row>
                <td>{{ __('employees.documents.'.$doc->type->value) }}</td>
                <td class="{{ $doc->expires_at && $doc->expires_at->isPast() ? 'text-danger' : '' }}">
                    {{ $doc->expires_at?->format('Y-m-d') ?: '—' }}
                </td>
                <td>{{ __('employees.documents.statuses.'.$doc->effectiveStatus()) }}</td>
                <td>{{ $doc->version }}</td>
                <td class="text-end">
                    @can('employees.documents.view', $employee)
                        <a href="{{ route('hr.employees.documents.download', [$employee, $doc]) }}">
                            {{ __('employees.documents.download') }}
                        </a>
                    @endcan
                </td>
            </x-ui.table.row>
        @endforeach
    </x-ui.table.table>
@endif

@can('update', $employee)
    <div class="mt-3">
        <x-ui.buttons.secondary size="sm" :href="route('hr.employees.edit', $employee)" icon="fe fe-upload">
            {{ __('employees.actions.manage_documents') }}
        </x-ui.buttons.secondary>
    </div>
@endcan
