fix: initialize DataTables separately for each table with correct column indices

- leadsTable (dashboard): 6 columns, sort by date (column 3)
- fullLeadsTable (leads section): 9 columns with checkbox, sort by date (column 6)
- Fixed JavaScript error from wrong column index
- Added separate initialization for each table
This commit is contained in:
TenerifeProp Dev
2026-04-06 21:17:52 +01:00
parent df682d8add
commit c92ff6a155

View File

@@ -2847,15 +2847,35 @@ Ver todos
}
});
// Initialize DataTables
$('#leadsTable, #fullLeadsTable').DataTable({
language: {
url: 'https://cdn.datatables.net/plug-ins/1.13.8/i18n/es-ES.json'
},
pageLength: 10,
ordering: true,
order: [[3, 'desc']] // Sort by date column (0-indexed)
});
// Initialize DataTables (separately for each table with correct column indices)
// leadsTable: 6 columns (Cliente, Propiedad, Fuente, Fecha, Estado, Acciones)
// fullLeadsTable: 9 columns (checkbox, Cliente, Contacto, Propiedad, Presupuesto, Fuente, Fecha, Estado, Acciones)
if ($('#leadsTable').length) {
$('#leadsTable').DataTable({
language: {
url: 'https://cdn.datatables.net/plug-ins/1.13.8/i18n/es-ES.json'
},
pageLength: 5,
ordering: true,
order: [[3, 'desc']], // Fecha column
searching: false,
lengthChange: false,
info: false,
paging: false
});
}
if ($('#fullLeadsTable').length) {
$('#fullLeadsTable').DataTable({
language: {
url: 'https://cdn.datatables.net/plug-ins/1.13.8/i18n/es-ES.json'
},
pageLength: 10,
ordering: true,
order: [[6, 'desc']] // Fecha column (after checkbox = column 0)
});
}
// ============ CHARTS ============
const chartColors = {