Actualiser js/admin.js

This commit is contained in:
2026-06-21 10:49:15 +02:00
parent 82017f29a9
commit 2ad68dcfd2
+4 -4
View File
@@ -112,7 +112,7 @@ async function loadDashboardData() {
} catch (err) { console.error('Erreur chargement :', err); } } catch (err) { console.error('Erreur chargement :', err); }
} }
// ── RENDU DU TABLEAU (SANS COLONNE AFFICHE) ── // ── RENDU DU TABLEAU (PAGINATION CORRIGÉE) ──
function renderAdminTable() { function renderAdminTable() {
const tbody = document.getElementById('admin-table-body'); const tbody = document.getElementById('admin-table-body');
if (!tbody) return; if (!tbody) return;
@@ -133,18 +133,18 @@ function renderAdminTable() {
const countLabel = document.getElementById('admin-count-label'); const countLabel = document.getElementById('admin-count-label');
if(countLabel) countLabel.textContent = `${filtered.length} élément(s)`; if(countLabel) countLabel.textContent = `${filtered.length} élément(s)`;
// --- PAGINATION LOGIC --- // --- LOGIQUE DE PAGINATION ---
const totalPages = Math.ceil(filtered.length / itemsPerPage) || 1; const totalPages = Math.ceil(filtered.length / itemsPerPage) || 1;
if (currentPage > totalPages) currentPage = totalPages; if (currentPage > totalPages) currentPage = totalPages;
const startIdx = (currentPage - 1) * itemsPerPage; const startIdx = (currentPage - 1) * itemsPerPage;
const pageItems = filtered.slice(startIdx, startIdx + itemsPerPage); const pageItems = filtered.slice(startIdx, startIdx + itemsPerPage);
// ------------------------ // -----------------------------
pageItems.forEach(f => { pageItems.forEach(f => {
const tr = document.createElement('tr'); const tr = document.createElement('tr');
const isChecked = selectedIds.has(String(f.id)) ? 'checked' : ''; const isChecked = selectedIds.has(String(f.id)) ? 'checked' : '';
// SEULEMENT 6 COLONNES (Plus d'affiche) // 6 COLONNES (Plus d'affiche)
tr.innerHTML = ` tr.innerHTML = `
<td style="text-align:center;"> <td style="text-align:center;">
<input type="checkbox" class="film-checkbox" value="${f.id}" ${isChecked} onclick="toggleSingleSelect('${f.id}', this)"> <input type="checkbox" class="film-checkbox" value="${f.id}" ${isChecked} onclick="toggleSingleSelect('${f.id}', this)">