Actualiser js/admin.js
This commit is contained in:
+4
-6
@@ -168,6 +168,7 @@ function toggleSingleSelect(id, checkbox) {
|
|||||||
if (checkbox.checked) selectedIds.add(String(id));
|
if (checkbox.checked) selectedIds.add(String(id));
|
||||||
else selectedIds.delete(String(id));
|
else selectedIds.delete(String(id));
|
||||||
updateBulkBar();
|
updateBulkBar();
|
||||||
|
|
||||||
const filtered = allItems.filter(item => item.type === currentAdminTab);
|
const filtered = allItems.filter(item => item.type === currentAdminTab);
|
||||||
const selectAll = document.getElementById('select-all-checkbox');
|
const selectAll = document.getElementById('select-all-checkbox');
|
||||||
if (selectAll) {
|
if (selectAll) {
|
||||||
@@ -210,7 +211,6 @@ function renderPagination(totalPages, totalItems) {
|
|||||||
container.innerHTML = '<p style="color:var(--muted); text-align:center; width:100%;">Aucun élément trouvé.</p>';
|
container.innerHTML = '<p style="color:var(--muted); text-align:center; width:100%;">Aucun élément trouvé.</p>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (totalPages <= 1) return;
|
if (totalPages <= 1) return;
|
||||||
|
|
||||||
const info = document.createElement('span');
|
const info = document.createElement('span');
|
||||||
@@ -369,9 +369,9 @@ function openEditModal(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function closeAdminModal() { document.getElementById('admin-modal').classList.remove('open'); }
|
function closeAdminModal() { document.getElementById('admin-modal').classList.remove('open'); }
|
||||||
|
|
||||||
async function openConfigModal() {
|
async function openConfigModal() {
|
||||||
document.getElementById('config-modal').classList.add('open');
|
document.getElementById('config-modal').classList.add('open');
|
||||||
|
|
||||||
// Réinitialise les placeholders
|
// Réinitialise les placeholders
|
||||||
document.getElementById('tmdb-key-input').placeholder = 'Pour les critiques (réalisateur, streaming)';
|
document.getElementById('tmdb-key-input').placeholder = 'Pour les critiques (réalisateur, streaming)';
|
||||||
document.getElementById('ean-search-key-input').placeholder = 'Recherche par code-barres (Vidéothèque)';
|
document.getElementById('ean-search-key-input').placeholder = 'Recherche par code-barres (Vidéothèque)';
|
||||||
@@ -387,16 +387,12 @@ async function openConfigModal() {
|
|||||||
if (data.barcode_lookup_key) document.getElementById('barcode-lookup-key-input').placeholder = '✅ Clé configurée (laisser vide pour ne pas changer)';
|
if (data.barcode_lookup_key) document.getElementById('barcode-lookup-key-input').placeholder = '✅ Clé configurée (laisser vide pour ne pas changer)';
|
||||||
} catch(e) { console.error(e); }
|
} catch(e) { console.error(e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeConfigModal() { document.getElementById('config-modal').classList.remove('open'); }
|
function closeConfigModal() { document.getElementById('config-modal').classList.remove('open'); }
|
||||||
|
|
||||||
function openPasswordModal() {
|
function openPasswordModal() {
|
||||||
document.getElementById('pwd-error').style.display = 'none';
|
document.getElementById('pwd-error').style.display = 'none';
|
||||||
document.getElementById('password-modal').classList.add('open');
|
document.getElementById('password-modal').classList.add('open');
|
||||||
}
|
}
|
||||||
|
|
||||||
function closePasswordModal() { document.getElementById('password-modal').classList.remove('open'); }
|
function closePasswordModal() { document.getElementById('password-modal').classList.remove('open'); }
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
localStorage.removeItem('token');
|
localStorage.removeItem('token');
|
||||||
window.location.href = 'login.html';
|
window.location.href = 'login.html';
|
||||||
@@ -446,6 +442,7 @@ async function handleCsvUpload(input) {
|
|||||||
}
|
}
|
||||||
closeConfigModal();
|
closeConfigModal();
|
||||||
showProgressModal(allData.length);
|
showProgressModal(allData.length);
|
||||||
|
|
||||||
const batchSize = 5;
|
const batchSize = 5;
|
||||||
let processed = 0;
|
let processed = 0;
|
||||||
for (let i = 0; i < allData.length; i += batchSize) {
|
for (let i = 0; i < allData.length; i += batchSize) {
|
||||||
@@ -481,6 +478,7 @@ async function saveConfigKeys() {
|
|||||||
'ean_search_key': document.getElementById('ean-search-key-input')?.value || '',
|
'ean_search_key': document.getElementById('ean-search-key-input')?.value || '',
|
||||||
'barcode_lookup_key': document.getElementById('barcode-lookup-key-input')?.value || ''
|
'barcode_lookup_key': document.getElementById('barcode-lookup-key-input')?.value || ''
|
||||||
};
|
};
|
||||||
|
|
||||||
let successCount = 0;
|
let successCount = 0;
|
||||||
// Sauvegarde uniquement les champs qui ont été remplis/modifiés
|
// Sauvegarde uniquement les champs qui ont été remplis/modifiés
|
||||||
for (const [keyName, keyValue] of Object.entries(keys)) {
|
for (const [keyName, keyValue] of Object.entries(keys)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user