From 5b164221ae10613ebff82cced241179fc701b95b Mon Sep 17 00:00:00 2001 From: RubenPX Date: Mon, 30 May 2022 19:28:16 +0200 Subject: [PATCH] hotfix lots search not working --- ereuse_devicehub/static/js/main_inventory.build.js | 8 +++++--- ereuse_devicehub/static/js/main_inventory.js | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ereuse_devicehub/static/js/main_inventory.build.js b/ereuse_devicehub/static/js/main_inventory.build.js index 34dd7bfa..4ee7afe9 100644 --- a/ereuse_devicehub/static/js/main_inventory.build.js +++ b/ereuse_devicehub/static/js/main_inventory.build.js @@ -348,10 +348,12 @@ class lotsSearcher { const lots = this.getListLots(); for (let i = 0; i < lots.length; i++) { + const lot = lots[i]; + if (lot.innerText.toLowerCase().includes(inputSearch.toLowerCase())) { - lot.parentElement.style.display = ""; + lot.style.display = ""; } else { - lot.parentElement.style.display = "none"; + lot.style.display = "none"; } } } @@ -363,7 +365,7 @@ _defineProperty(lotsSearcher, "lots", []); _defineProperty(lotsSearcher, "lotsSearchElement", null); _defineProperty(lotsSearcher, "getListLots", () => { - let lotsList = document.getElementById("LotsSelector"); + const lotsList = document.getElementById("LotsSelector"); if (lotsList) { // Apply filter to get only labels diff --git a/ereuse_devicehub/static/js/main_inventory.js b/ereuse_devicehub/static/js/main_inventory.js index bfd88858..f59bf588 100644 --- a/ereuse_devicehub/static/js/main_inventory.js +++ b/ereuse_devicehub/static/js/main_inventory.js @@ -345,10 +345,11 @@ class lotsSearcher { static doSearch(inputSearch) { const lots = this.getListLots(); for (let i = 0; i < lots.length; i++) { + const lot = lots[i] if (lot.innerText.toLowerCase().includes(inputSearch.toLowerCase())) { - lot.parentElement.style.display = ""; + lot.style.display = ""; } else { - lot.parentElement.style.display = "none"; + lot.style.display = "none"; } } }