From 5613657c8f9fd7f5fffb9e25ec5bc9e97091f712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 27 Feb 2023 23:00:49 +0800 Subject: [PATCH] Fixed the JavaScript filterAccountOptions function in the transaction form so that the accounting list is not hidden when there is no account in use. --- src/accounting/static/js/transaction-form.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/accounting/static/js/transaction-form.js b/src/accounting/static/js/transaction-form.js index e96a742..5bc183e 100644 --- a/src/accounting/static/js/transaction-form.js +++ b/src/accounting/static/js/transaction-form.js @@ -530,17 +530,17 @@ function filterAccountOptions(prefix) { const more = document.getElementById(prefix + "-more"); const queryNoResult = document.getElementById(prefix + "-option-no-result"); const codesInUse = getAccountCodeUsedInForm(); - let hasAnyMatched = false; + let shouldAnyShow = false; options.forEach(function (option) { - const isMatched = shouldAccountOptionShow(option, more, codesInUse, query); - if (isMatched) { + const shouldShow = shouldAccountOptionShow(option, more, codesInUse, query); + if (shouldShow) { option.classList.remove("d-none"); - hasAnyMatched = true; + shouldAnyShow = true; } else { option.classList.add("d-none"); } }); - if (!hasAnyMatched) { + if (!shouldAnyShow && more.classList.contains("d-none")) { optionList.classList.add("d-none"); queryNoResult.classList.remove("d-none"); } else {