Unidades que no son departamentos
This commit is contained in:
@ -52,8 +52,12 @@
|
|||||||
draw(formatter, dateFormatter) {
|
draw(formatter, dateFormatter) {
|
||||||
const tipo = this.estado.tipo_estado_venta.descripcion
|
const tipo = this.estado.tipo_estado_venta.descripcion
|
||||||
const date = new Date(this.fecha)
|
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(
|
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)
|
$('<a></a>').attr('href', '{{$urls->base}}/venta/' + this.id).html(this.propiedad.summary)
|
||||||
)
|
)
|
||||||
).append(
|
).append(
|
||||||
@ -63,9 +67,9 @@
|
|||||||
).append(
|
).append(
|
||||||
$('<td></td>').html(formatter.format(this.valor) + ' UF')
|
$('<td></td>').html(formatter.format(this.valor) + ' UF')
|
||||||
).append(
|
).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(
|
).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(
|
).append(
|
||||||
$('<td></td>').attr('data-order', this.fecha).html(dateFormatter.format(date))
|
$('<td></td>').attr('data-order', this.fecha).html(dateFormatter.format(date))
|
||||||
).append(
|
).append(
|
||||||
@ -237,7 +241,12 @@
|
|||||||
|
|
||||||
const tbody = $('<tbody></tbody>')
|
const tbody = $('<tbody></tbody>')
|
||||||
this.data.ventas.forEach(venta => {
|
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.append(this.draw().header()).append(tbody)
|
||||||
table.show()
|
table.show()
|
||||||
|
Reference in New Issue
Block a user