Separacion de objetos

This commit is contained in:
Juan Pablo Vial
2025-01-17 16:55:34 -03:00
parent d74beb5518
commit e031fd22d3
4 changed files with 31 additions and 36 deletions

View File

@ -59,16 +59,20 @@
p -= this.props.propietarios[index].props.proporcion
})
p /= diff
const propietarios = []
for (let i = 0; i < diff; i ++) {
this.add().propietario({
propietarios.push(this.add().propietario({
rut: '',
nombre: '',
proporcion: (p*100).toFixed(0)/100,
direccion: '',
comuna: ''
})
}))
}
document.getElementById('propietarios').innerHTML = this.draw().propietarios()
propietarios.forEach(propietario => {
this.add().factura(propietario)
})
this.watch().propietarios()
this.update().facturas()
return
@ -121,16 +125,7 @@
'</div>')
$total.find('.ui.message').css('display', 'inline-block')
this.props.facturas.forEach(factura => {
factura.update().unidades(this.props.unidades)
})
},
totalPropietarios: () => {
this.props.propietarios.forEach(propietario => {
const index = propietario.props.index
const factura = this.props.facturas.facturas.find(factura => factura.props.index === index)
factura.update().venta(this)
})
this.update().facturas()
},
terreno: newValue => {
const date = this.props.last.november
@ -250,7 +245,6 @@
return
}
this.update().propietarios(count)
this.update().totalPropietarios()
facturas.draw().facturas()
})
},
@ -396,7 +390,6 @@
const index = this.props.propietarios.length + 1
const propietario = new Propietario({index, proporcion, rut, nombre, direccion, comuna})
this.props.propietarios.push(propietario)
this.add().factura(propietario)
return propietario
},
factura: propietario => {
@ -455,7 +448,7 @@
this.remove().factura(index)
},
factura: index => {
this.props.facturas.splice(index, 1)
this.props.facturas.facturas.splice(index, 1)
document.getElementById('facturas').querySelectorAll("[data-index='"+(index+1)+"']").forEach(factura => {
factura.remove()
})
@ -465,7 +458,7 @@
save() {
return {
factura: ({index}) => {
const factura = this.props.facturas[index]
const factura = this.props.facturas.facturas[index]
return factura.save()
}
}