Show selected devices notify instead page select
This commit is contained in:
parent
d4e6469ddf
commit
3da1bdcad1
|
@ -85,24 +85,26 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
function itemListCheckChanged() {
|
function itemListCheckChanged() {
|
||||||
const listDevices = TableController.getAllDevicesInCurrentPage()
|
const listDevices = TableController.getAllDevicesInCurrentPage()
|
||||||
const isAllChecked = listDevices.map(itm => itm.checked);
|
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)) {
|
if (isAllChecked.every(bool => bool == true)) {
|
||||||
btnSelectAll.checked = true;
|
btnSelectAll.checked = true;
|
||||||
btnSelectAll.indeterminate = false;
|
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)) {
|
} else if (isAllChecked.every(bool => bool == false)) {
|
||||||
btnSelectAll.checked = false;
|
btnSelectAll.checked = false;
|
||||||
btnSelectAll.indeterminate = false;
|
btnSelectAll.indeterminate = false;
|
||||||
alertInfoDevices.classList.add("d-none")
|
|
||||||
} else {
|
} else {
|
||||||
btnSelectAll.indeterminate = true;
|
btnSelectAll.indeterminate = true;
|
||||||
alertInfoDevices.classList.add("d-none")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue