Fixed the JavaScript filterAccountOptions function in the transaction form so that the accounting list is not hidden when there is no account in use.

This commit is contained in:
依瑪貓 2023-02-27 23:00:49 +08:00
parent 26bb16dd40
commit 5613657c8f

View File

@ -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 {