Actualiser js/admin.js

This commit is contained in:
2026-06-30 16:57:39 +02:00
parent d40b03641a
commit c387933371
+7 -17
View File
@@ -1,22 +1,12 @@
const API_URL = '../api.php'; const API_URL = '../api.php';
let allItems = []; let allItems = [], currentAdminTab = 'critique', currentPage = 1, selectedIds = new Set();
let currentAdminTab = 'critique';
let currentPage = 1;
const itemsPerPage = 12;
let selectedIds = new Set();
let pendingDeleteAction = null;
function getStarsHTML(rating) { // --- Utilitaires ---
let r = parseFloat(String(rating).replace(',', '.')) || 0; const getStarsHTML = (rating) => {
r = Math.min(Math.max(r, 0), 5); let r = Math.min(Math.max(parseFloat(rating) || 0, 0), 5);
const full = Math.floor(r); const full = Math.floor(r), hasHalf = (r - full) >= 0.5, empty = Math.max(0, 5 - Math.ceil(r));
const hasHalf = (r - full) >= 0.5; return '★'.repeat(full) + (hasHalf ? '<span class="half-star">★</span>' : '') + `<span class="stars-muted">${'☆'.repeat(empty)}</span>`;
const empty = Math.max(0, 5 - Math.ceil(r)); };
let html = '★'.repeat(full);
if (hasHalf) html += '<span class="half-star">★</span>';
html += `<span class="stars-muted">${'☆'.repeat(empty)}</span>`;
return html;
}
function parseCSV(text) { function parseCSV(text) {
if (text.charCodeAt(0) === 0xFEFF) text = text.slice(1); if (text.charCodeAt(0) === 0xFEFF) text = text.slice(1);