diff --git a/src/articles.php b/src/articles.php index 98e2cb0..417d7a4 100644 --- a/src/articles.php +++ b/src/articles.php @@ -620,29 +620,27 @@ document.addEventListener('DOMContentLoaded', function () { renderTable(); }); }); - } - filterText.addEventListener('input', renderTable); - filterCategory.addEventListener('change', renderTable); - filterManufacturer.addEventListener('change', renderTable); + // Bulk Selection Logic + document.querySelectorAll('.bulk-select-checkbox').forEach(cb => { + cb.checked = bulkSelectedArticles.has(cb.value); + cb.addEventListener('change', function(e) { + e.stopPropagation(); + if (this.checked) { + bulkSelectedArticles.add(this.value); + } else { + bulkSelectedArticles.delete(this.value); + } + updateBulkUI(); + }); + }); - document.getElementById('btn-expand-all').addEventListener('click', function() { - collapsedCategories.clear(); - renderTable(); - }); - - document.getElementById('btn-collapse-all').addEventListener('click', function() { - // Find all currently rendered categories - const visibleCategories = Array.from(document.querySelectorAll('.category-header')).map(el => el.getAttribute('data-category')); - visibleCategories.forEach(c => collapsedCategories.add(c)); - renderTable(); - }); - - renderTable(); -}); - - -tAll.checked = false; + const selectAllCb = document.getElementById('bulk-select-all'); + if (selectAllCb) { + // Remove old listeners if any by cloning + const newSelectAll = selectAllCb.cloneNode(true); + selectAllCb.parentNode.replaceChild(newSelectAll, selectAllCb); + newSelectAll.checked = false; newSelectAll.addEventListener('change', function() { const isChecked = this.checked; document.querySelectorAll('.bulk-select-checkbox').forEach(cb => { @@ -689,11 +687,4 @@ document.addEventListener('DOMContentLoaded', function () { }); -rTable(); - }); - - renderTable(); -}); - - \ No newline at end of file diff --git a/src/storage_locations.php b/src/storage_locations.php index 34a7563..e3ea380 100644 --- a/src/storage_locations.php +++ b/src/storage_locations.php @@ -208,10 +208,25 @@ foreach ($all_locations as $location) {
${item.name}
+