Revised the code in the JavaScript initializeBaseAccountSelector function in the account form.

This commit is contained in:
依瑪貓 2023-03-11 23:36:07 +08:00
parent 1d6a53f7cd
commit 4299fd6fbd

View File

@ -47,7 +47,7 @@ function initializeBaseAccountSelector() {
const isOffsetNeeded = document.getElementById("accounting-is-offset-needed"); const isOffsetNeeded = document.getElementById("accounting-is-offset-needed");
const options = Array.from(document.getElementsByClassName("accounting-base-option")); const options = Array.from(document.getElementsByClassName("accounting-base-option"));
const btnClear = document.getElementById("accounting-btn-clear-base"); const btnClear = document.getElementById("accounting-btn-clear-base");
selector.addEventListener("show.bs.modal", () => { base.onclick = () => {
base.classList.add("accounting-not-empty"); base.classList.add("accounting-not-empty");
for (const option of options) { for (const option of options) {
option.classList.remove("active"); option.classList.remove("active");
@ -56,7 +56,7 @@ function initializeBaseAccountSelector() {
if (selected !== null) { if (selected !== null) {
selected.classList.add("active"); selected.classList.add("active");
} }
}); };
selector.addEventListener("hidden.bs.modal", () => { selector.addEventListener("hidden.bs.modal", () => {
if (baseCode.value === "") { if (baseCode.value === "") {
base.classList.remove("accounting-not-empty"); base.classList.remove("accounting-not-empty");