<div class="mb-4">
    <h6 class="mb-3">{{ __('recruitment.onboarding.documents.employee_files') }}</h6>
    @if ($employeeDocuments->isEmpty())
        <p class="text-muted small">{{ __('recruitment.onboarding.documents.empty') }}</p>
    @else
        <div class="table-responsive mb-3">
            <table class="table table-sm align-middle">
                <thead>
                    <tr>
                        <th>{{ __('recruitment.onboarding.documents.type') }}</th>
                        <th>{{ __('recruitment.onboarding.documents.uploaded_at') }}</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($employeeDocuments as $doc)
                        <tr>
                            <td>{{ __('recruitment.onboarding.document_types.'.$doc->type) }}</td>
                            <td>{{ $doc->created_at?->format('Y-m-d H:i') }}</td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    @endif

    @can('manage', $case)
        <form method="POST" action="{{ route('hr.recruitment.onboarding.documents.store', $case) }}" enctype="multipart/form-data" class="row g-2 align-items-end">
            @csrf
            <div class="col-md-4">
                <label class="form-label">{{ __('recruitment.onboarding.documents.type') }}</label>
                <select name="type" class="form-select" required>
                    @foreach (\App\Modules\HR\Employees\Enums\EmployeeDocumentType::values() as $type)
                        <option value="{{ $type }}">{{ __('recruitment.onboarding.document_types.'.$type) }}</option>
                    @endforeach
                </select>
            </div>
            <div class="col-md-4">
                <label class="form-label">{{ __('recruitment.onboarding.fields.attachment') }}</label>
                <input type="file" name="document" class="form-control" required>
            </div>
            <div class="col-md-2">
                <label class="form-label">{{ __('recruitment.onboarding.documents.expires_at') }}</label>
                <input type="date" name="expires_at" class="form-control">
            </div>
            <div class="col-md-2">
                <x-ui.buttons.primary type="submit">{{ __('recruitment.onboarding.actions.upload') }}</x-ui.buttons.primary>
            </div>
        </form>
    @endcan
</div>

<hr>

<h6 class="mb-3">{{ __('recruitment.onboarding.documents.required_checklist') }}</h6>
@include('pages.hr.recruitment.onboarding.partials.task_board', [
    'case' => $case,
    'sectionTasks' => $sectionTasks,
    'assignees' => $assignees,
    'section' => 'documents',
])
