FIX: onChange

This commit is contained in:
Juan Pablo Vial
2025-05-08 18:15:32 -04:00
parent 679b401101
commit 418becaeda
2 changed files with 10 additions and 4 deletions

View File

@ -18,6 +18,8 @@
</div> </div>
@endsection @endsection
@include('layout.body.scripts.rut')
@push('page_scripts') @push('page_scripts')
@include('ventas.facturacion.show.factura') @include('ventas.facturacion.show.factura')
@include('ventas.facturacion.show.propietario') @include('ventas.facturacion.show.propietario')

View File

@ -28,7 +28,11 @@
facturas.draw().facturas() facturas.draw().facturas()
}, },
rut: rut => { rut: rut => {
this.props.rut = rut rut = rut.replaceAll(/~\d|\.|-/g, '')
const digito = rut.slice(-1)
rut = rut.slice(0, -1)
this.props.rut = Rut.format(rut) + '-' + digito
document.getElementById('rut'+this.props.index).value = this.props.rut
facturas.venta.update().facturas() facturas.venta.update().facturas()
facturas.draw().facturas() facturas.draw().facturas()
}, },
@ -72,7 +76,7 @@
}) })
}, },
rut: () => { rut: () => {
document.getElementById('rut'+this.props.index).addEventListener('input', inputEvent => { document.getElementById('rut'+this.props.index).addEventListener('change', inputEvent => {
const rut = inputEvent.currentTarget.value const rut = inputEvent.currentTarget.value
if (rut === this.props.rut) { if (rut === this.props.rut) {
return return
@ -81,7 +85,7 @@
}) })
}, },
nombre: () => { nombre: () => {
document.getElementById('propietario'+this.props.index).addEventListener('input', inputEvent => { document.getElementById('propietario'+this.props.index).addEventListener('change', inputEvent => {
const nombre = inputEvent.currentTarget.value const nombre = inputEvent.currentTarget.value
if (nombre === this.props.nombre) { if (nombre === this.props.nombre) {
return return
@ -90,7 +94,7 @@
}) })
}, },
direccion: () => { direccion: () => {
document.getElementById('direccion_propietario'+this.props.index).addEventListener('input', inputEvent => { document.getElementById('direccion_propietario'+this.props.index).addEventListener('change', inputEvent => {
const direccion = inputEvent.currentTarget.value const direccion = inputEvent.currentTarget.value
if (direccion === this.props.direccion) { if (direccion === this.props.direccion) {
return return