Cambios solicitados
This commit is contained in:
@ -5,12 +5,13 @@
|
||||
<th>Tipo Order</th>
|
||||
<th class="right aligned">Unidad</th>
|
||||
<th>Unidad Orden</th>
|
||||
<th>m²</th>
|
||||
<th>Estado</th>
|
||||
<th class="right aligned">Precio Lista</th>
|
||||
<th class="right aligned">Precio Base</th>
|
||||
<th class="right aligned">Comisión</th>
|
||||
<th class="right aligned">Precio Operador</th>
|
||||
<th class="right aligned">Porcentaje</th>
|
||||
<th class="right aligned">Precio Final</th>
|
||||
<th>Fecha Inicio</th>
|
||||
<th>Fecha Término</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
@ -22,6 +23,19 @@
|
||||
ids = {
|
||||
units: 'unidades',
|
||||
}
|
||||
columns = [
|
||||
'tipo',
|
||||
'tipo_order',
|
||||
'unidad',
|
||||
'unidad_order',
|
||||
'metros',
|
||||
'estado',
|
||||
'precio_base',
|
||||
'commission',
|
||||
'precio_operador',
|
||||
'porcentaje',
|
||||
'precio_final',
|
||||
]
|
||||
constructor(commission) {
|
||||
super(commission)
|
||||
|
||||
@ -41,7 +55,8 @@
|
||||
orderData: 3
|
||||
},
|
||||
{
|
||||
target: [2, 5, 6, 7],
|
||||
target: ['metros', 'precio_base', 'commission', 'precio_operador', 'porcentaje', 'precio_final']
|
||||
.map(column => this.columns.indexOf(column)),
|
||||
className: 'dt-right right aligned'
|
||||
}
|
||||
]
|
||||
@ -50,7 +65,8 @@
|
||||
dto.layout = {
|
||||
top1Start: {
|
||||
searchBuilder: {
|
||||
columns: [0, 2, 4, 5, 6, 7, 8, 9],
|
||||
columns: this.columns.filter(column => !['tipo_order', 'unidad_order'].includes(column))
|
||||
.map(column => this.columns.indexOf(column)),
|
||||
}
|
||||
},
|
||||
top1End: {
|
||||
@ -62,31 +78,23 @@
|
||||
title: 'Lista de Precios - {{ $contract->broker->name }} - {{ $contract->project->descripcion }} - {{ (new DateTime())->format('Y-m-d') }}',
|
||||
download: 'open',
|
||||
exportOptions: {
|
||||
columns: [0, 2, 5, 6, 7],
|
||||
columns: ['tipo', 'unidad', 'metros', 'commission', 'precio_operador', 'porcentaje', 'precio_final']
|
||||
.map(column => this.columns.indexOf(column)),
|
||||
rows: (idx, data, node) => {
|
||||
return data[4] === 'Disponible'
|
||||
return data[this.columns.indexOf('estado')] === 'Disponible'
|
||||
},
|
||||
format: {
|
||||
body: (data, row, columnIdx, node) => {
|
||||
if (typeof data === 'string' && data.includes('<span')) {
|
||||
return data.replace(/<span.*>(.*)<\/span>/, '$1')
|
||||
}
|
||||
if (columnIdx === this.columns.indexOf('metros')) {
|
||||
return data.replaceAll('.', '').replaceAll(',', '.')
|
||||
}
|
||||
return data
|
||||
}
|
||||
}
|
||||
},
|
||||
customize: xlsx => {
|
||||
const sheet = xlsx.xl.worksheets['sheet1.xml']
|
||||
const columns = Object.values($('row[r="2"] t', sheet).map((idx, column) => column.textContent))
|
||||
const columnStylesMap = {
|
||||
Valor: '63',
|
||||
Fecha: '15'
|
||||
}
|
||||
Object.entries(columnStylesMap).forEach((column, style) => {
|
||||
const columnIndex = String.fromCharCode('A'.charCodeAt(0) + columns.indexOf(column))
|
||||
$(`c[r^="${columnIndex}"]`, sheet).attr('s', style)
|
||||
})
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -106,8 +114,11 @@
|
||||
unidad.proyecto_tipo_unidad.tipo_unidad.orden,
|
||||
unidad.descripcion,
|
||||
unidad.descripcion.padStart(4, '0'),
|
||||
formatters.ufs.format(unidad.proyecto_tipo_unidad.vendible) ?? 0,
|
||||
unidad.sold ? '<span class="ui yellow text">Vendida</span>' : 'Disponible',
|
||||
'UF ' + formatters.ufs.format(price.base ?? 0),
|
||||
formatters.percent.format(price.commission ?? 0),
|
||||
'UF ' + formatters.ufs.format(price.broker ?? 0),
|
||||
formatters.percent.format(price.amount ?? 0),
|
||||
'UF ' + formatters.ufs.format(price.final ?? 0),
|
||||
unidad.promotion?.start_date ?? '',
|
||||
|
Reference in New Issue
Block a user