
<div wire:ignore.self class="modal fade" tabindex="-1" role="dialog" id="theModal-WE">
    <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_WE_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-8">
                        <div class="form-group">
                            <label>Empresa</label>
                            <input type="text" wire:model.lazy="company" class="form-control" placeholder="ej: Alira"
                                maxlength="99">
                            @error('company')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-4">
                        <div class="form-group">
                            <label>Tipo de Empresa</label>
                            <select class="form-control form-select" wire:model.lazy="type_company" name="modality">
                                <option value="Seleccionar">Seleccionar</option>
                                <option value="1">Pública</option>
                                <option value="2">Privada</option>
                            </select>
                            @error('type_company')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label>Departamento</label>
                            <input type="text" wire:model.lazy="department" class="form-control"
                                placeholder="ej: Ingeniería y Diseño" maxlength="99">
                            @error('department')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label>Cargo</label>
                            <input type="text" wire:model.lazy="title_position" class="form-control"
                                placeholder="ej: Ingeniero de Desarrollo" maxlength="99">
                            @error('title_position')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>


                    <div class="col-sm-12 col-md-8">
                        <div class="form-group">
                            <label>Dirección </label>
                            <input type="text" wire:model.lazy="direction" class="form-control"
                                placeholder="ej: Carrera 17 #65- 32" maxlength="99">
                            @error('direction')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-4">
                        <div class="form-group">
                            <label>Teléfono de contacto</label>
                            <input type="text" wire:model.lazy="phone" class="form-control"
                                placeholder="ej: 3202568745" maxlength="15">
                            @error('phone')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>

                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label>Fecha de ingreso</label>
                            <input type="date" wire:model.lazy="date_entry" class="form-control"
                                placeholder="ej: 01/01/2020" maxlength="99">
                            @error('date_entry')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label>Fecha de retiro</label>
                            <input type="date" wire:model.lazy="date_retirement" class="form-control"
                                placeholder="ej: 01/01/2020" maxlength="99">
                            @error('date_retirement')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-12">
                        <div class="form-group">
                            <label>Funciones y/o responsabilidades</label>
                            <textarea class="form-control" wire:model.lazy="responsibilities"
                                placeholder="ej: Diseño de la página web" cols="30" rows="10"></textarea>
                            @error('responsibilities')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6">
                        <div class="form-group">
                            <label>Actualmente Trabajando?</label>
                            <select class="form-control form-select" wire:model.lazy="is_currently_working_here" name="is_currently_working_here">
                                <option value="Seleccionar">Seleccionar</option>
                                <option value="0">No</option>
                                <option value="1">SI</option>
                            </select>
                            @error('is_currently_working_here')
                                <span class="text-danger er">{{ $message }}</span>
                            @enderror
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-6">
                        <div class="form-group">
                            <label>Soporte / certificado laboral</label>
                            <small class="text-muted">(Formatos: .jpg | .png | .pdf)</small>
                            <input type="file" wire:model="document_upload" class="form-control"
                                accept=".png, .jpg .pdf">
                            @if ($document_upload_view != null)
                                <a href="{{ asset('storage/users/'.$user_sel_id.'/work_experiences/' . $document_upload_view) }}"
                                    target="_blank">Ver archivo</a>
                            @endif

                            @error('document_upload')
                                <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_WE_id < 1)
                    <button type="button" class="btn btn-primary close-modal"
                        wire:click.prevent="StoreWE()">GUARDAR</button>
                @else
                    <button type="button" class="btn btn-primary close-modal"
                        wire:click.prevent="UpdateWE()">ACTUALIZAR</button>
                @endif
            </div>
        </div><!-- modal-content -->
    </div>
</div>
