Agregar datos propietario

This commit is contained in:
Juan Pablo Vial
2025-05-15 15:23:34 -04:00
parent e33edc4d7b
commit 03317b3aa5
10 changed files with 441 additions and 132 deletions

View File

@ -153,7 +153,7 @@
@include('layout.body.scripts.rut')
@push('page_scripts')
<script type="text/javascript">
<script>
const regiones = [
@foreach ($regiones as $region)
'<div class="item" data-value="{{$region->id}}">{{$region->descripcion}}</div>',
@ -354,56 +354,65 @@
const lines = [
'<label for="rut">RUT</label>',
'<div class="inline field">',
'<input type="text" id="rut" name="rut" placeholder="00000000-0" required />',
'<span class="ui error message" id="alert_rut">',
'<i class="exclamation triangle icon"></i>',
'RUT Inválido',
'</span>',
'<input type="text" id="rut" name="rut" placeholder="00000000-0" required />',
'<span class="ui error message" id="alert_rut">',
'<i class="exclamation triangle icon"></i>',
'RUT Inválido',
'</span>',
'</div>',
'<label for="nombres">Nombre</label>',
'<div class="inline fields">',
'<div class="field">',
'<input type="text" name="nombres" id="nombres" placeholder="Nombre(s)" required />',
'</div>',
'<div class="field">',
'<input type="text" name="apellido_paterno" placeholder="Apellido Paterno" required />',
'</div>',
'<div class="field">',
'<input type="text" name="apellido_materno" placeholder="Apellido Materno" required />',
'</div>',
'<div class="field">',
'<input type="text" name="nombres" id="nombres" placeholder="Nombre(s)" required />',
'</div>',
'<div class="field">',
'<input type="text" name="apellido_paterno" placeholder="Apellido Paterno" required />',
'</div>',
'<div class="field">',
'<input type="text" name="apellido_materno" placeholder="Apellido Materno" required />',
'</div>',
'</div>',
'<label for="calle">Dirección</label>',
'<div class="inline fields">',
'<div class="eight wide field">',
'<input type="text" name="calle" id="calle" size="16" placeholder="Calle" required />',
'</div>',
'<div class="field">',
'<input type="text" name="numero" size="5" placeholder="Número" required />',
'</div>',
'<div class="field">',
'<input type="text" name="extra" placeholder="Otros Detalles" />',
'</div>',
'<div class="eight wide field">',
'<input type="text" name="calle" id="calle" size="16" placeholder="Calle" required />',
'</div>',
'<div class="field">',
'<input type="text" name="numero" size="5" placeholder="Número" required />',
'</div>',
'<div class="field">',
'<input type="text" name="extra" placeholder="Otros Detalles" />',
'</div>',
'</div>',
'<div class="inline fields">',
'<div class="two wide field"></div>',
'<div class="four wide field">',
'<div class="ui fluid search selection dropdown" id="comuna">',
'<input type="hidden" name="comuna" />',
'<i class="dropdown icon"></i>',
'<div class="default text">Comuna</div>',
'<div class="menu"></div>',
'</div>',
'</div>',
'<div class="six wide field">',
'<div class="ui fluid search selection dropdown" id="region">',
'<input type="hidden" name="region" />',
'<i class="dropdown icon"></i>',
'<div class="default text">Región</div>',
'<div class="menu">',
...regiones,
'</div>',
'</div>',
'<div class="two wide field"></div>',
'<div class="four wide field">',
'<div class="ui fluid search selection dropdown" id="comuna">',
'<input type="hidden" name="comuna" />',
'<i class="dropdown icon"></i>',
'<div class="default text">Comuna</div>',
'<div class="menu"></div>',
'</div>',
'</div>',
'<div class="six wide field">',
'<div class="ui fluid search selection dropdown" id="region">',
'<input type="hidden" name="region" />',
'<i class="dropdown icon"></i>',
'<div class="default text">Región</div>',
'<div class="menu">',
...regiones,
'</div>',
'</div>',
'</div>',
'</div>',
'<label>Otros Datos</label>',
'<div class="inline fields">',
'<div class="four wide field">',
'<input type="email" name="email" placeholder="Email" />',
'</div>',
'<div class="field">',
'<input type="text" name="telefono" placeholder="Teléfono" />',
'</div>',
'</div>'
]
return lines.join("\n")
@ -467,8 +476,10 @@
'</div>',
'</div>',
'<div>Representante Legal</div>',
'<div class="ui divider"></div>',
this.persona.draw()
]
return [lines.join("\n"), this.persona.draw()].join("\n")
return lines.join("\n")
}
activate() {
new RutHandler({id: '#rut_sociedad', alert_id: '#alert_rut_sociedad'})
@ -486,6 +497,7 @@
draw() {
let lines = [
this.persona.draw(),
'<div class="ui divider"></div>',
'<label for="rut">RUT Otro</label>',
'<div class="inline field">',
'<input type="text" id="rut_otro" name="rut_otro" required />',
@ -538,6 +550,15 @@
'</div>',
'</div>',
'</div>',
'</div>',
'<label>Otros Datos para Otro</label>',
'<div class="inline fields">',
'<div class="four wide field">',
'<input type="email" name="email_otro" placeholder="Email" />',
'</div>',
'<div class="field">',
'<input type="text" name="telefono_otro" placeholder="Teléfono" />',
'</div>',
'</div>'
]
return lines.join("\n")
@ -607,6 +628,8 @@
parent.find("[name='extra']").val(data.propietario.direccion.extra)
parent.find('#region').dropdown('set selected', data.propietario.direccion.comuna.provincia.region.id)
parent.find('#comuna').dropdown('set selected', data.propietario.direccion.comuna.id)
parent.find("[name='email']").val(data.propietario.email)
parent.find("[name='telefono']").val(data.propietario.telefono)
if (data.propietario.representante !== '') {
document.getElementById(this.ids.tipo).trigger('check')