Unidades que no son departamentos
This commit is contained in:
@ -52,8 +52,12 @@
|
||||
draw(formatter, dateFormatter) {
|
||||
const tipo = this.estado.tipo_estado_venta.descripcion
|
||||
const date = new Date(this.fecha)
|
||||
let unidad = this.propiedad.unidades[0]
|
||||
if (this.propiedad.departamentos.length > 0) {
|
||||
unidad = this.propiedad.departamentos[0]
|
||||
}
|
||||
return $('<tr></tr>').append(
|
||||
$('<td></td>').attr('data-order', this.propiedad.departamentos[0].descripcion).append(
|
||||
$('<td></td>').attr('data-order', unidad.descripcion).append(
|
||||
$('<a></a>').attr('href', '{{$urls->base}}/venta/' + this.id).html(this.propiedad.summary)
|
||||
)
|
||||
).append(
|
||||
@ -63,9 +67,9 @@
|
||||
).append(
|
||||
$('<td></td>').html(formatter.format(this.valor) + ' UF')
|
||||
).append(
|
||||
$('<td></td>').html(this.propiedad.departamentos[0].proyecto_tipo_unidad.abreviacion + ' (' + formatter.format(this.propiedad.departamentos[0].proyecto_tipo_unidad.vendible) + ' m²)')
|
||||
$('<td></td>').html(unidad.proyecto_tipo_unidad.abreviacion + ' (' + formatter.format(unidad.proyecto_tipo_unidad.vendible) + ' m²)')
|
||||
).append(
|
||||
$('<td></td>').html(formatter.format(this.valor / this.propiedad.departamentos[0].proyecto_tipo_unidad.vendible) + ' UF/m²')
|
||||
$('<td></td>').html(formatter.format(this.valor / unidad.proyecto_tipo_unidad.vendible) + ' UF/m²')
|
||||
).append(
|
||||
$('<td></td>').attr('data-order', this.fecha).html(dateFormatter.format(date))
|
||||
).append(
|
||||
@ -237,7 +241,12 @@
|
||||
|
||||
const tbody = $('<tbody></tbody>')
|
||||
this.data.ventas.forEach(venta => {
|
||||
tbody.append(venta.draw(this.formatters.number, this.formatters.date))
|
||||
try {
|
||||
tbody.append(venta.draw(this.formatters.number, this.formatters.date))
|
||||
} catch (error) {
|
||||
console.debug(venta)
|
||||
console.error(error)
|
||||
}
|
||||
})
|
||||
table.append(this.draw().header()).append(tbody)
|
||||
table.show()
|
||||
|
Reference in New Issue
Block a user