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';
let allItems = [];
let currentAdminTab = 'critique';
let currentPage = 1;
const itemsPerPage = 12;
let selectedIds = new Set();
let pendingDeleteAction = null;
let allItems = [], currentAdminTab = 'critique', currentPage = 1, selectedIds = new Set();
function getStarsHTML(rating) {
let r = parseFloat(String(rating).replace(',', '.')) || 0;
r = Math.min(Math.max(r, 0), 5);
const full = Math.floor(r);
const hasHalf = (r - full) >= 0.5;
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;
}
// --- Utilitaires ---
const getStarsHTML = (rating) => {
let r = Math.min(Math.max(parseFloat(rating) || 0, 0), 5);
const full = Math.floor(r), hasHalf = (r - full) >= 0.5, empty = Math.max(0, 5 - Math.ceil(r));
return '★'.repeat(full) + (hasHalf ? '<span class="half-star">★</span>' : '') + `<span class="stars-muted">${'☆'.repeat(empty)}</span>`;
};
function parseCSV(text) {
if (text.charCodeAt(0) === 0xFEFF) text = text.slice(1);