Renamed all the is_XXX_needed properties to is_need_XXX. For example, especially the is_offset_needed property to is_need_offset, to be clear and understandable.
This commit is contained in:
@ -83,16 +83,16 @@ class AccountForm {
|
||||
#titleError;
|
||||
|
||||
/**
|
||||
* The control of the is-offset-needed option
|
||||
* The control of the is-need-offset option
|
||||
* @type {HTMLDivElement}
|
||||
*/
|
||||
#isOffsetNeededControl;
|
||||
#isNeedOffsetControl;
|
||||
|
||||
/**
|
||||
* The is-offset-needed option
|
||||
* The is-need-offset option
|
||||
* @type {HTMLInputElement}
|
||||
*/
|
||||
#isOffsetNeeded;
|
||||
#isNeedOffset;
|
||||
|
||||
/**
|
||||
* Constructs the account form.
|
||||
@ -107,8 +107,8 @@ class AccountForm {
|
||||
this.#baseError = document.getElementById("accounting-base-error");
|
||||
this.#title = document.getElementById("accounting-title");
|
||||
this.#titleError = document.getElementById("accounting-title-error");
|
||||
this.#isOffsetNeededControl = document.getElementById("accounting-is-offset-needed-control");
|
||||
this.#isOffsetNeeded = document.getElementById("accounting-is-offset-needed");
|
||||
this.#isNeedOffsetControl = document.getElementById("accounting-is-need-offset-control");
|
||||
this.#isNeedOffset = document.getElementById("accounting-is-need-offset");
|
||||
this.#formElement.onsubmit = () => {
|
||||
return this.#validateForm();
|
||||
};
|
||||
@ -138,12 +138,12 @@ class AccountForm {
|
||||
this.#baseCode.value = code;
|
||||
this.#base.innerText = text;
|
||||
if (["1", "2", "3"].includes(code.substring(0, 1))) {
|
||||
this.#isOffsetNeededControl.classList.remove("d-none");
|
||||
this.#isOffsetNeeded.disabled = false;
|
||||
this.#isNeedOffsetControl.classList.remove("d-none");
|
||||
this.#isNeedOffset.disabled = false;
|
||||
} else {
|
||||
this.#isOffsetNeededControl.classList.add("d-none");
|
||||
this.#isOffsetNeeded.disabled = true;
|
||||
this.#isOffsetNeeded.checked = false;
|
||||
this.#isNeedOffsetControl.classList.add("d-none");
|
||||
this.#isNeedOffset.disabled = true;
|
||||
this.#isNeedOffset.checked = false;
|
||||
}
|
||||
this.#validateBase();
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ class AccountSelector {
|
||||
};
|
||||
this.#clearButton.onclick = () => this.#entryEditor.clearAccount();
|
||||
for (const option of this.#options) {
|
||||
option.onclick = () => this.#entryEditor.saveAccount(option.dataset.code, option.dataset.content, option.classList.contains("accounting-account-is-offset-needed"));
|
||||
option.onclick = () => this.#entryEditor.saveAccount(option.dataset.code, option.dataset.content, option.classList.contains("accounting-account-is-need-offset"));
|
||||
}
|
||||
this.#query.addEventListener("input", () => {
|
||||
this.#filterOptions();
|
||||
|
@ -374,10 +374,10 @@ class JournalEntryEditor {
|
||||
*
|
||||
* @param code {string} the account code
|
||||
* @param text {string} the account text
|
||||
* @param isOffsetNeeded {boolean} true if the journal entries in the account need offset or false otherwise
|
||||
* @param isNeedOffset {boolean} true if the journal entries in the account need offset or false otherwise
|
||||
*/
|
||||
saveAccount(code, text, isOffsetNeeded) {
|
||||
this.isNeedOffset = isOffsetNeeded;
|
||||
saveAccount(code, text, isNeedOffset) {
|
||||
this.isNeedOffset = isNeedOffset;
|
||||
this.#accountControl.classList.add("accounting-not-empty");
|
||||
this.accountCode = code;
|
||||
this.accountText = text;
|
||||
|
@ -215,7 +215,7 @@ class SummaryEditor {
|
||||
#submit() {
|
||||
bootstrap.Modal.getOrCreateInstance(this.#modal).hide();
|
||||
if (this.#selectedAccount !== null) {
|
||||
this.#entryEditor.saveSummaryWithAccount(this.summary.value, this.#selectedAccount.dataset.code, this.#selectedAccount.dataset.text, this.#selectedAccount.classList.contains("accounting-account-is-offset-needed"));
|
||||
this.#entryEditor.saveSummaryWithAccount(this.summary.value, this.#selectedAccount.dataset.code, this.#selectedAccount.dataset.text, this.#selectedAccount.classList.contains("accounting-account-is-need-offset"));
|
||||
} else {
|
||||
this.#entryEditor.saveSummary(this.summary.value);
|
||||
}
|
||||
|
Reference in New Issue
Block a user