Filtro en excel

This commit is contained in:
Juan Pablo Vial
2025-04-04 11:53:25 -03:00
parent 00a0adb4ac
commit 4df0cca675

View File

@ -59,23 +59,21 @@
extend: 'excelHtml5',
className: 'green',
text: 'Exportar a Excel <i class="file excel icon"></i>',
title: 'Lista de Precios {{ $contract->broker->name }} {{ $contract->project->descripcion }} {{ (new DateTime())->format('Y-m-d') }}',
title: 'Lista de Precios - {{ $contract->broker->name }} - {{ $contract->project->descripcion }} - {{ (new DateTime())->format('Y-m-d') }}',
download: 'open',
exportOptions: {
columns: [0, 2, 4, 5, 6, 7],
/*format: {
columns: [0, 2, 5, 6, 7],
rows: (idx, data, node) => {
return data[4] === 'Disponible'
},
format: {
body: (data, row, columnIdx, node) => {
const formats = this.columns.filter(columnDef => columnDef.format)
const match = formats.map(({title}) => title).indexOf(this.columns[columnIdx].title)
if (match > -1) {
return formats[match].format(data)
}
if (typeof data === 'string' && data.includes('<span data-tooltip')) {
return data.replace(/<span data-tooltip="(.*)">(.*)<\/span>/, '$2')
if (typeof data === 'string' && data.includes('<span')) {
return data.replace(/<span.*>(.*)<\/span>/, '$1')
}
return data
}
}*/
}
},
customize: xlsx => {
const sheet = xlsx.xl.worksheets['sheet1.xml']
@ -108,7 +106,7 @@
unidad.proyecto_tipo_unidad.tipo_unidad.orden,
unidad.descripcion,
unidad.descripcion.padStart(4, '0'),
unidad.sold ? 'Vendida' : 'Disponible',
unidad.sold ? '<span class="ui yellow text">Vendida</span>' : 'Disponible',
'UF ' + formatters.ufs.format(price.base ?? 0),
formatters.percent.format(price.amount ?? 0),
'UF ' + formatters.ufs.format(price.final ?? 0),