diff --git a/js/admin.js b/js/admin.js index 425035c..5b12ecf 100644 --- a/js/admin.js +++ b/js/admin.js @@ -145,61 +145,59 @@ function renderAdminTable() { const countLabel = document.getElementById('admin-count-label'); if (countLabel) countLabel.textContent = `${filtered.length} élément(s)`; - // 4. Gestion de la pagination + // 4. Pagination const totalPages = Math.ceil(filtered.length / itemsPerPage) || 1; if (currentPage > totalPages) currentPage = totalPages; const startIdx = (currentPage - 1) * itemsPerPage; const pageItems = filtered.slice(startIdx, startIdx + itemsPerPage); - // 5. Rendu des lignes + // 5. Rendu pageItems.forEach(f => { const tr = document.createElement('tr'); let infoHtml = ''; if (currentAdminTab === 'critique') { - // Étoiles avec demi-étoiles + badge numérique infoHtml = `
${getStarsHTML(f.rating)} ${parseFloat(f.rating).toFixed(1)}
`; - // Badge streaming ou physique if (f.streaming && f.streaming !== 'Disponible en support physique ou Cinéma') { infoHtml += `${f.streaming}`; } else { infoHtml += `🎟️ Cinéma / Physique`; } } else { - // Vidéothèque : format + durée infoHtml = `${f.format || '-'}`; if (f.length) infoHtml += `${f.length}`; } tr.innerHTML = ` - + - + ${f.poster ? `Affiche` : '
'} ${f.title} - ${f.year || '-'} - ${f.director || '-'} + ${f.year || '-'} + ${f.director || '-'}
${infoHtml}
- - - + +
+ + +
`; tbody.appendChild(tr); }); - // 6. Synchronisation des checkboxes avec selectedIds + // Synchronisation checkboxes document.querySelectorAll('.film-checkbox').forEach(cb => { cb.checked = selectedIds.has(cb.value); }); - // 7. Rendu de la pagination renderPagination(totalPages, filtered.length); }