diff --git a/public/admin.html b/public/admin.html
index e95af7e..92b1cb0 100644
--- a/public/admin.html
+++ b/public/admin.html
@@ -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 = {