@php
    $personalFieldScope = $personalFieldScope ?? 'pagina';
    $inputPrefix = $personalFieldScope === 'modal' ? 'modal_' : '';
    $personalRequiredColumns = $personalRequiredColumns ?? ['cedula', 'password', 'nombre', 'cargo', 'fechaIngreso'];
    $isImportantField = $isImportantField ?? static fn (string $column): bool => in_array($column, $personalRequiredColumns, true);
    $fieldLabel = $fieldLabel ?? static fn (string $column): string => $formColumnLabels[$column] ?? ucfirst(str_replace('_', ' ', $column));
@endphp

@foreach ($credentialColumns as $column)
    @php
        $inputType = $column === 'password' ? 'password' : 'text';
        $inputId = $inputPrefix . $column;
        $inputClass = 'form-control' . ($personalFieldScope === 'modal' && $errors->has($column) ? ' is-invalid' : '');
        $inputValue = $personalFieldScope === 'modal'
            ? null
            : ($column === 'password' ? '' : old($column, data_get($record, $column, $defaultValues[$column] ?? '')));
    @endphp

    <div class="{{ $personalFieldScope === 'modal' ? 'modal-field' : 'col-12 col-md-6' }}">
        <label class="form-label" for="{{ $inputId }}">{{ $fieldLabel($column) }}@if ($isImportantField($column))<span class="text-danger"> *</span>@endif</label>
        <input
            class="{{ $inputClass }}"
            id="{{ $inputId }}"
            name="{{ $column }}"
            type="{{ $inputType }}"
            placeholder="{{ $placeholders[$column] ?? '' }}"
            @if ($personalFieldScope !== 'modal') value="{{ $inputValue }}" @endif
            autocomplete="off"
        >
        @if ($column === 'password')
            <div class="form-text">La clave debe tener minimo 8 caracteres y solo usar letras y numeros.</div>
        @endif
        @if ($personalFieldScope === 'modal' && $errors->has($column))
            <div class="invalid-feedback d-block">{{ $errors->first($column) }}</div>
        @endif
    </div>
@endforeach