Actualiser js/admin.js
This commit is contained in:
+18
@@ -94,6 +94,14 @@ function initEventListeners() {
|
||||
e.target.classList.remove('open');
|
||||
}
|
||||
});
|
||||
|
||||
const physicalFilter = document.getElementById('admin-physical-checkbox');
|
||||
if (physicalFilter) {
|
||||
physicalFilter.addEventListener('change', () => {
|
||||
currentPage = 1;
|
||||
renderAdminTable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function loadDashboardData() {
|
||||
@@ -115,9 +123,15 @@ function renderAdminTable() {
|
||||
|
||||
const searchInput = document.getElementById('search-input');
|
||||
const currentSearch = searchInput ? searchInput.value.toLowerCase() : '';
|
||||
const physicalFilter = document.getElementById('admin-physical-checkbox');
|
||||
|
||||
let filtered = allItems.filter(item => item.type === currentAdminTab);
|
||||
|
||||
// Nouveau : Filtrage des formats dématérialisés
|
||||
if (physicalFilter && physicalFilter.checked) {
|
||||
filtered = filtered.filter(f => f.format && !['dématérialisé', 'vod', 'digital', 'streaming'].includes(f.format.toLowerCase()));
|
||||
}
|
||||
|
||||
if (currentSearch) {
|
||||
filtered = filtered.filter(f =>
|
||||
f.title.toLowerCase().includes(currentSearch) ||
|
||||
@@ -329,6 +343,10 @@ function switchAdminTab(tabName) {
|
||||
selectedIds.clear();
|
||||
const searchInput = document.getElementById('search-input');
|
||||
if (searchInput) searchInput.value = '';
|
||||
|
||||
const physicalFilter = document.getElementById('admin-physical-checkbox');
|
||||
if (physicalFilter) physicalFilter.checked = false;
|
||||
|
||||
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
|
||||
const btn = document.getElementById(`btn-tab-${tabName}`);
|
||||
if (btn) btn.classList.add('active');
|
||||
|
||||
Reference in New Issue
Block a user