diff --git a/app/resources/views/proyectos/brokers/contracts/show.blade.php b/app/resources/views/proyectos/brokers/contracts/show.blade.php
index 7fb35c2..84cba59 100644
--- a/app/resources/views/proyectos/brokers/contracts/show.blade.php
+++ b/app/resources/views/proyectos/brokers/contracts/show.blade.php
@@ -20,12 +20,18 @@
prices(units) {
const prices = []
units.forEach(unit => {
- const price = unit.precio?.valor ?? 0
+ let price = unit.precio?.valor ?? 0
let amount = 1
+ let diff = 0
unit.promotions?.forEach(promotion => {
+ if (promotion.type === 1) {
+ diff += promotion.amount
+ return
+ }
amount /= 1/(1 - promotion.amount)
})
amount = 1 - amount
+ price += diff
prices.push({
id: unit.id,
base: price,
diff --git a/app/resources/views/proyectos/brokers/contracts/show/unidades.blade.php b/app/resources/views/proyectos/brokers/contracts/show/unidades.blade.php
index 50cacac..0ab6fc5 100644
--- a/app/resources/views/proyectos/brokers/contracts/show/unidades.blade.php
+++ b/app/resources/views/proyectos/brokers/contracts/show/unidades.blade.php
@@ -1,15 +1,19 @@
+ Estado |
Tipo |
Tipo Order |
Unidad |
Unidad Orden |
+ Tipología |
+ Piso |
+ Orientación |
m² |
- Estado |
Precio Base |
Comisión |
Precio Operador |
+ UF/m² |
Porcentaje |
Precio Final |
@@ -24,15 +28,19 @@
units: 'unidades',
}
columns = [
+ 'estado',
'tipo',
'tipo_order',
'unidad',
'unidad_order',
+ 'tipologia',
+ 'piso',
+ 'orientacion',
'metros',
- 'estado',
'precio_base',
'commission',
'precio_operador',
+ 'UF/m²',
'porcentaje',
'precio_final',
]
@@ -43,24 +51,24 @@
dto.pageLength = 100
dto.columnDefs = [
{
- target: [1, 3],
+ target: ['tipo_order', 'unidad_order', 'tipologia', 'piso', 'orientacion', 'metros'].map(column => this.columns.indexOf(column)),
visible: false
},
{
- target: 0,
- orderData: 1
+ target: ['tipo'].map(column => this.columns.indexOf(column)),
+ orderData: ['tipo_order'].map(column => this.columns.indexOf(column)),
},
{
- target: 2,
- orderData: 3
+ target: ['unidad'].map(column => this.columns.indexOf(column)),
+ orderData: ['unidad_order'].map(column => this.columns.indexOf(column)),
},
{
- target: ['metros', 'precio_base', 'commission', 'precio_operador', 'porcentaje', 'precio_final']
+ target: ['unidad', 'precio_base', 'commission', 'precio_operador', 'UF/m²', 'porcentaje', 'precio_final']
.map(column => this.columns.indexOf(column)),
className: 'dt-right right aligned'
}
]
- dto.order = [[1, 'asc'], [3, 'asc']]
+ dto.order = ['tipo_order', 'unidad_order'].map(column => [this.columns.indexOf(column), 'asc'])
dto.language.searchBuilder = searchBuilder
dto.layout = {
top1Start: {
@@ -78,17 +86,17 @@
title: 'Lista de Precios - {{ $contract->broker->name }} - {{ $contract->project->descripcion }} - {{ (new DateTime())->format('Y-m-d') }}',
download: 'open',
exportOptions: {
- columns: ['tipo', 'unidad', 'metros', 'commission', 'precio_operador', 'porcentaje', 'precio_final']
+ columns: ['tipo', 'unidad', 'tipologia', 'piso', 'orientacion', 'metros', 'commission', 'precio_operador', 'porcentaje', 'precio_final']
.map(column => this.columns.indexOf(column)),
rows: (idx, data, node) => {
- return data[this.columns.indexOf('estado')] === 'Disponible'
+ return data[this.columns.indexOf('estado')] === 'Libre'
},
format: {
body: (data, row, columnIdx, node) => {
if (typeof data === 'string' && data.includes('(.*)<\/span>/, '$1')
}
- if (columnIdx === this.columns.indexOf('metros')) {
+ if (['metros'].map(column => this.columns.indexOf(column)).includes(columnIdx)) {
return data.replaceAll('.', '').replaceAll(',', '.')
}
return data
@@ -110,15 +118,19 @@
const tipo = unidad.proyecto_tipo_unidad.tipo_unidad.descripcion
const price = prices.find(p => p.id === unidad.id)
tableData.push([
+ unidad.sold ? 'Vendida' : 'Libre',
tipo.charAt(0).toUpperCase() + tipo.slice(1),
unidad.proyecto_tipo_unidad.tipo_unidad.orden,
unidad.descripcion,
unidad.descripcion.padStart(4, '0'),
+ unidad.proyecto_tipo_unidad.tipologia,
+ unidad.piso,
+ unidad.orientacion,
formatters.ufs.format(unidad.proyecto_tipo_unidad.vendible) ?? 0,
- unidad.sold ? 'Vendida' : 'Disponible',
'UF ' + formatters.ufs.format(price.base ?? 0),
formatters.percent.format(price.commission ?? 0),
'UF ' + formatters.ufs.format(price.broker ?? 0),
+ formatters.ufs.format(price.broker / unidad.proyecto_tipo_unidad.vendible),
formatters.percent.format(price.amount ?? 0),
'UF ' + formatters.ufs.format(price.final ?? 0),
unidad.promotion?.start_date ?? '',