Actualiser js/admin.js
This commit is contained in:
+15
-7
@@ -15,18 +15,26 @@ function renderAdminTable() {
|
|||||||
if (!tbody) return;
|
if (!tbody) return;
|
||||||
tbody.innerHTML = '';
|
tbody.innerHTML = '';
|
||||||
const filtered = allItems.filter(item => item.type === currentAdminTab);
|
const filtered = allItems.filter(item => item.type === currentAdminTab);
|
||||||
|
document.getElementById('admin-count-label').textContent = `${filtered.length} élément(s)`;
|
||||||
|
|
||||||
filtered.forEach(f => {
|
filtered.forEach(f => {
|
||||||
const tr = document.createElement('tr');
|
const tr = document.createElement('tr');
|
||||||
tr.innerHTML = `
|
tr.innerHTML = `
|
||||||
<td><input type="checkbox" class="film-checkbox" value="${f.id}"></td>
|
<td style="text-align:center;">
|
||||||
<td>${f.poster ? `<img src="${f.poster}" class="thumb" width="40">` : '-'}</td>
|
<input type="checkbox" class="film-checkbox" value="${f.id}">
|
||||||
|
</td>
|
||||||
|
<td style="text-align:center;">
|
||||||
|
${f.poster ? `<img src="${f.poster}" class="thumb" alt="Affiche">` : '<div class="thumb-ph"><i class="ti ti-photo"></i></div>'}
|
||||||
|
</td>
|
||||||
<td><strong>${f.title}</strong></td>
|
<td><strong>${f.title}</strong></td>
|
||||||
<td>${f.year || ''}</td>
|
<td>${f.year || '-'}</td>
|
||||||
<td>${f.director || ''}</td>
|
<td>${f.director || '-'}</td>
|
||||||
<td>${currentAdminTab === 'critique' ? (f.rating ? '★'.repeat(f.rating) : '☆') : (f.format || '-')}</td>
|
<td>${currentAdminTab === 'critique' ? `<span class="tbl-stars">${'★'.repeat(f.rating || 0)}</span>` : `<span class="badge-format">${f.format || '-'}</span>`}</td>
|
||||||
<td>
|
<td>
|
||||||
<button onclick="deleteSingleFilm('${f.id}')">Supprimer</button>
|
<div class="tbl-actions">
|
||||||
|
<button onclick="openEditModal('${f.id}')" title="Éditer"><i class="ti ti-edit"></i></button>
|
||||||
|
<button class="del" onclick="deleteSingleFilm('${f.id}')" title="Supprimer"><i class="ti ti-trash"></i></button>
|
||||||
|
</div>
|
||||||
</td>`;
|
</td>`;
|
||||||
tbody.appendChild(tr);
|
tbody.appendChild(tr);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user