<div wire:ignore.self class="modal fade" tabindex="-1" role="dialog" id="theModal-NF">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header bg-primary">
                <h5 class="modal-title">
                    <b>{{ $componentName }}</b> | {{ $selected_NF_id > 0 ? 'EDITAR' : 'CREAR' }}
                </h5>
                <h6 class="text-center text-warning" wire:loading>ESPERE UN MOMENTO POR FAVOR</h6>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label for="name">Parentesco</label>
                            <select class="form-select" wire:model="type" id="type" name="type">
                                <option value="">Seleccione una opción</option>
                                <option value="Pareja">Pareja</option>
                                <option value="Hijo">Hijo</option>
                            </select>
                            @error('type')
                                <span class="text-danger">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">

                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label for="name">Nombre</label>
                            <input type="text" class="form-control" id="first_name" wire:model.lazy="first_name" placeholder="ej: Pedro">
                            @error('first_name')
                                <span class="text-danger">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label for="name">Apellido</label>
                            <input type="text" class="form-control" id="last_name" wire:model.lazy="last_name" placeholder="ej: Perez">
                            @error('last_name')
                                <span class="text-danger">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label for="name">Tipo de documento</label>
                            <select class="form-control" wire:model="document_type" id="document_type" name="document_type">
                                <option value="Seleccionar">Seleccionar</option>
                                @foreach (DataTypeDocument() as $key => $value)
                                    <option value="{{ $key }}">{{ $value }}</option>
                                @endforeach
                            </select>
                            @error('document_type')
                                <span class="text-danger">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label for="name">Número de documento</label>
                            <input type="text" class="form-control" id="document" wire:model.lazy="document" placeholder="ej: 12345678">
                            @error('document')
                                <span class="text-danger">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label for="name">Fecha de nacimiento</label>
                            <input type="date" class="form-control" id="birth_date" wire:model.lazy="birth_date" placeholder="ej: Pedro">
                            @error('birth_date')
                                <span class="text-danger">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label>Ocupación</label>
                            <input type="text" class="form-control" id="occupation" wire:model.lazy="occupation" placeholder="ej: Auxiliar de contabilidad">
                            @error('occupation')
                                <span class="text-danger">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label>Teléfono de contacto</label>
                            <input type="text" class="form-control" id="phone" wire:model.lazy="phone" placeholder="ej: 0987654321">
                            @error('phone')
                                <span class="text-danger">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label>Eps</label>
                            <select class="form-control form-select" wire:model.lazy="eps_id" name="eps_id">
                                <option value="">No afiliado</option>
                                @foreach ($epss as $eps)
                                    <option value="{{ $eps->id }}">{{ $eps->name }}</option>
                                @endforeach
                            </select>
                            @error('eps_id')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>

                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label>Nivel Educativo</label>
                            <select class="form-control form-select" wire:model.lazy="education_level" name="education_level">
                                <option value="">No aplica</option>
                                @foreach ($education_levels as $education_level)
                                    <option value="{{ $education_level->id }}">{{ $education_level->name }}</option>
                                @endforeach
                            </select>
                            @error('education_level')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label>Certificado</label>
                            <small class="text-muted">(Formatos: .jpg | .png | .pdf)</small>
                            <input type="file" class="form-control" name="support_document" wire:model.lazy="support_document" accept=".png, .jpg .pdf">
                            @if ($support_document_view != null)
                                <a href="{{ asset('storage/users/'.$user_sel_id.'/family_users/' . $support_document_view) }}"
                                    target="_blank">Ver archivo</a>
                            @endif
                            @error('support_document')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>

                </div><!-- row -->
            </div><!-- modal-body -->
            <div class="modal-footer">
                <button type="button" class="btn btn-outline-primary" wire:click.prevent="resetUI()"
                    data-bs-dismiss="modal">CERRAR</button>

                @if ($selected_NF_id < 1)
                    <button type="button" class="btn btn-primary close-modal"
                        wire:click.prevent="StoreNF()">GUARDAR</button>
                @else
                    <button type="button" class="btn btn-primary close-modal"
                        wire:click.prevent="UpdateNF()">ACTUALIZAR</button>
                @endif
            </div>
        </div><!-- modal-content -->

    </div>
</div>
