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>
@endsection
@include('layout.body.scripts.rut')
@push('page_scripts')
@include('ventas.facturacion.show.factura')
@include('ventas.facturacion.show.propietario')

View File

@ -28,7 +28,11 @@
facturas.draw().facturas()
},
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.draw().facturas()
},
@ -72,7 +76,7 @@
})
},
rut: () => {
document.getElementById('rut'+this.props.index).addEventListener('input', inputEvent => {
document.getElementById('rut'+this.props.index).addEventListener('change', inputEvent => {
const rut = inputEvent.currentTarget.value
if (rut === this.props.rut) {
return
@ -81,7 +85,7 @@
})
},
nombre: () => {
document.getElementById('propietario'+this.props.index).addEventListener('input', inputEvent => {
document.getElementById('propietario'+this.props.index).addEventListener('change', inputEvent => {
const nombre = inputEvent.currentTarget.value
if (nombre === this.props.nombre) {
return
@ -90,7 +94,7 @@
})
},
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
if (direccion === this.props.direccion) {
return