From 4df0cca67591c57f64a2fd55ce89534778efda39 Mon Sep 17 00:00:00 2001 From: Juan Pablo Vial Date: Fri, 4 Apr 2025 11:53:25 -0300 Subject: [PATCH] Filtro en excel --- .../brokers/contracts/show/unidades.blade.php | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) 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 c8e6839..1538f6e 100644 --- a/app/resources/views/proyectos/brokers/contracts/show/unidades.blade.php +++ b/app/resources/views/proyectos/brokers/contracts/show/unidades.blade.php @@ -59,23 +59,21 @@ extend: 'excelHtml5', className: 'green', text: 'Exportar a Excel ', - 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>/, '$2') + if (typeof data === 'string' && data.includes('(.*)<\/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 ? 'Vendida' : 'Disponible', 'UF ' + formatters.ufs.format(price.base ?? 0), formatters.percent.format(price.amount ?? 0), 'UF ' + formatters.ufs.format(price.final ?? 0),