Actualiser js/admin.js
This commit is contained in:
+19
-1
@@ -94,6 +94,14 @@ function initEventListeners() {
|
|||||||
e.target.classList.remove('open');
|
e.target.classList.remove('open');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const physicalFilter = document.getElementById('admin-physical-checkbox');
|
||||||
|
if (physicalFilter) {
|
||||||
|
physicalFilter.addEventListener('change', () => {
|
||||||
|
currentPage = 1;
|
||||||
|
renderAdminTable();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadDashboardData() {
|
async function loadDashboardData() {
|
||||||
@@ -115,9 +123,15 @@ function renderAdminTable() {
|
|||||||
|
|
||||||
const searchInput = document.getElementById('search-input');
|
const searchInput = document.getElementById('search-input');
|
||||||
const currentSearch = searchInput ? searchInput.value.toLowerCase() : '';
|
const currentSearch = searchInput ? searchInput.value.toLowerCase() : '';
|
||||||
|
const physicalFilter = document.getElementById('admin-physical-checkbox');
|
||||||
|
|
||||||
let filtered = allItems.filter(item => item.type === currentAdminTab);
|
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) {
|
if (currentSearch) {
|
||||||
filtered = filtered.filter(f =>
|
filtered = filtered.filter(f =>
|
||||||
f.title.toLowerCase().includes(currentSearch) ||
|
f.title.toLowerCase().includes(currentSearch) ||
|
||||||
@@ -324,11 +338,15 @@ function toggleFormFields() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function switchAdminTab(tabName) {
|
function switchAdminTab(tabName) {
|
||||||
currentAdminTab = tabName;
|
currentAdminTab = tabName;
|
||||||
currentPage = 1;
|
currentPage = 1;
|
||||||
selectedIds.clear();
|
selectedIds.clear();
|
||||||
const searchInput = document.getElementById('search-input');
|
const searchInput = document.getElementById('search-input');
|
||||||
if (searchInput) searchInput.value = '';
|
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'));
|
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
|
||||||
const btn = document.getElementById(`btn-tab-${tabName}`);
|
const btn = document.getElementById(`btn-tab-${tabName}`);
|
||||||
if (btn) btn.classList.add('active');
|
if (btn) btn.classList.add('active');
|
||||||
|
|||||||
Reference in New Issue
Block a user