fix: resolve DataTables and Chart.js errors from restored original

- Removed invalid chart.min.css link (Chart.js 4.x has no separate CSS)
- Fixed DataTables initialization:
  - leadsTable: 7 columns, sort by date (column 3), no pagination
  - fullLeadsTable: 10 columns, sort by date (column 6), with pagination
- Tables initialized separately to avoid column index mismatch
- Fixed Uncaught TypeError: aDataSort undefined
This commit is contained in:
TenerifeProp Dev
2026-04-06 23:57:19 +01:00
parent 46e0068007
commit a649ff502f

View File

@@ -14,7 +14,6 @@
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<!-- Chart.js -->
<link href="https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.min.css" rel="stylesheet">
<!-- DataTables -->
<link href="https://cdn.jsdelivr.net/npm/datatables.net-bs5@1.13.8/css/dataTables.bootstrap5.min.css" rel="stylesheet">
<!-- Lightpick -->
@@ -2830,15 +2829,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: [[6, 'desc']]
});
// Initialize DataTables separately for each table
// leadsTable: 7 columns (Cliente, Email, Teléfono, Fecha, Estado, Acciones + hidden)
// fullLeadsTable: 10 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']],
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']]
});
}
// ============ CHARTS ============
const chartColors = {