Show selected devices notify instead page select

This commit is contained in:
RubenPX 2022-05-09 14:40:28 +02:00
parent d4e6469ddf
commit 3da1bdcad1
1 changed files with 11 additions and 9 deletions

View File

@ -85,24 +85,26 @@ window.addEventListener("DOMContentLoaded", () => {
function itemListCheckChanged() {
const listDevices = TableController.getAllDevicesInCurrentPage()
const isAllChecked = listDevices.map(itm => itm.checked);
alertInfoDevices.innerHTML = `Selected devices: ${TableController.getSelectedDevices().length}
${TableController.getAllDevices().length != TableController.getSelectedDevices().length
? `<a href="#" class="ml-3">Select all devices (${TableController.getAllDevices().length})</a>`
: "<a href=\"#\" class=\"ml-3\">Cancel selection</a>"
}`;
if (TableController.getAllDevices().length > 0) {
alertInfoDevices.classList.remove("d-none");
} else {
alertInfoDevices.classList.add("d-none")
}
if (isAllChecked.every(bool => bool == true)) {
btnSelectAll.checked = true;
btnSelectAll.indeterminate = false;
alertInfoDevices.innerHTML = `Selected devices: ${TableController.getSelectedDevices().length}
${
TableController.getAllDevices().length != TableController.getSelectedDevices().length
? `<a href="#" class="ml-3">Select all devices (${TableController.getAllDevices().length})</a>`
: "<a href=\"#\" class=\"ml-3\">Cancel selection</a>"
}`;
alertInfoDevices.classList.remove("d-none");
} else if (isAllChecked.every(bool => bool == false)) {
btnSelectAll.checked = false;
btnSelectAll.indeterminate = false;
alertInfoDevices.classList.add("d-none")
} else {
btnSelectAll.indeterminate = true;
alertInfoDevices.classList.add("d-none")
}
}