diff --git a/CHANGELOG.md b/CHANGELOG.md index 35d175a6..806a01b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ml). ## master ## testing + +## [2.1.0] - 2022-05-11 - [added] #219 Add functionality to searchbar (Lots and devices). - [added] #222 Allow user to update its password. - [added] #233 Filter in out trades from lots selector. diff --git a/ereuse_devicehub/__init__.py b/ereuse_devicehub/__init__.py index 4bf535c4..28c957cd 100644 --- a/ereuse_devicehub/__init__.py +++ b/ereuse_devicehub/__init__.py @@ -1 +1 @@ -__version__ = "2.1.0.dev" +__version__ = "2.2.0.alpha0" diff --git a/ereuse_devicehub/static/js/main_inventory.js b/ereuse_devicehub/static/js/main_inventory.js index 848c72e4..1b911579 100644 --- a/ereuse_devicehub/static/js/main_inventory.js +++ b/ereuse_devicehub/static/js/main_inventory.js @@ -83,26 +83,33 @@ window.addEventListener("DOMContentLoaded", () => { const alertInfoDevices = document.getElementById("select-devices-info"); 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 + ? `Select all devices (${TableController.getAllDevices().length})` + : "Cancel selection" + }`; - 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 - ? `Select all devices (${TableController.getAllDevices().length})` - : "Cancel selection" - }`; - alertInfoDevices.classList.remove("d-none"); - } else if (isAllChecked.every(bool => bool == false)) { - btnSelectAll.checked = false; - btnSelectAll.indeterminate = false; + if (TableController.getSelectedDevices().length <= 0) { alertInfoDevices.classList.add("d-none") } else { + alertInfoDevices.classList.remove("d-none"); + } + + if (TableController.getAllDevices().length == TableController.getSelectedDevices().length) { + btnSelectAll.checked = true; + btnSelectAll.indeterminate = false; + } else if(TableController.getAllSelectedDevicesInCurrentPage().length > 0) { btnSelectAll.indeterminate = true; - alertInfoDevices.classList.add("d-none") + } else { + btnSelectAll.checked = false; + btnSelectAll.indeterminate = false; + } + + if (TableController.getAllDevices().length == 0) { + btnSelectAll.checked = false; + btnSelectAll.disabled = true; + } else { + btnSelectAll.disabled = false; } } @@ -126,6 +133,8 @@ window.addEventListener("DOMContentLoaded", () => { table.on("datatable.page", () => itemListCheckChanged()); table.on("datatable.perpage", () => itemListCheckChanged()); table.on("datatable.update", () => itemListCheckChanged()); + + itemListCheckChanged(); }) function deviceSelect() { diff --git a/ereuse_devicehub/templates/ereuse_devicehub/user_login.html b/ereuse_devicehub/templates/ereuse_devicehub/user_login.html index f010e3d7..f6423759 100644 --- a/ereuse_devicehub/templates/ereuse_devicehub/user_login.html +++ b/ereuse_devicehub/templates/ereuse_devicehub/user_login.html @@ -60,7 +60,7 @@
Don't have account? Create an account
+Don't have account? Create an account