diff --git a/app/templates/login.html b/app/templates/login.html
index 22cdbbe..8423876 100644
--- a/app/templates/login.html
+++ b/app/templates/login.html
@@ -139,7 +139,13 @@
-
+
@@ -186,6 +192,7 @@
} else {
['am-name','am-company','am-email','am-phone','am-manager'].forEach(function(id){ var el=document.getElementById(id); if(el){el.value='';el.classList.remove('am-invalid');} });
document.querySelectorAll('#am-products input[type=checkbox]').forEach(function(cb){ cb.checked=false; });
+ var saBox = document.getElementById('am-select-all'); if (saBox) saBox.checked = false;
var err=document.getElementById('am-error'); if(err) err.style.display='none';
var btn=document.getElementById('am-submit'); if(btn){btn.disabled=false;btn.textContent='Запросить доступ';}
}
@@ -225,6 +232,21 @@
wrap.appendChild(group);
}
productsLoaded = true;
+ // Show "select all" checkbox
+ const saWrap = document.getElementById('am-select-all-wrap');
+ if (saWrap) saWrap.style.display = 'flex';
+ const saBox = document.getElementById('am-select-all');
+ if (saBox) {
+ saBox.addEventListener('change', function() {
+ document.querySelectorAll('#am-products input[type=checkbox]').forEach(function(cb){ cb.checked = saBox.checked; });
+ });
+ // Keep "select all" in sync when individual boxes change
+ wrap.addEventListener('change', function(e) {
+ if (e.target === saBox) return;
+ const all = [...document.querySelectorAll('#am-products input[type=checkbox]')];
+ saBox.checked = all.length > 0 && all.every(function(cb){ return cb.checked; });
+ });
+ }
} catch(e) {
wrap.innerHTML = '
Не удалось загрузить список
';
}