Merged the code in the #initializeSummaryEditors method into the constructor in the JavaScript JournalEntryEditor class.

This commit is contained in:
依瑪貓 2023-03-18 20:37:06 +08:00
parent 403942dfc0
commit fd9eac06f6

View File

@ -200,7 +200,7 @@ class JournalEntryEditor {
* The summary editors * The summary editors
* @type {{debit: SummaryEditor, credit: SummaryEditor}} * @type {{debit: SummaryEditor, credit: SummaryEditor}}
*/ */
#summaryEditors; #summaryEditors = {};
/** /**
* The account selectors * The account selectors
@ -230,7 +230,9 @@ class JournalEntryEditor {
this.#accountError = document.getElementById(this.#prefix + "-account-error") this.#accountError = document.getElementById(this.#prefix + "-account-error")
this.#amount = document.getElementById(this.#prefix + "-amount"); this.#amount = document.getElementById(this.#prefix + "-amount");
this.#amountError = document.getElementById(this.#prefix + "-amount-error"); this.#amountError = document.getElementById(this.#prefix + "-amount-error");
this.#summaryEditors = this.#initializeSummaryEditors(); for (const entryType of ["debit", "credit"]) {
this.#summaryEditors[entryType] = new SummaryEditor(this, entryType);
}
for (const entryType of ["debit", "credit"]) { for (const entryType of ["debit", "credit"]) {
this.#accountSelectors[entryType] = new AccountSelector(this, entryType); this.#accountSelectors[entryType] = new AccountSelector(this, entryType);
} }
@ -252,19 +254,6 @@ class JournalEntryEditor {
}; };
} }
/**
* Initializes the summary editors.
*
* @return {{debit: SummaryEditor, credit: SummaryEditor}} the summary editors
*/
#initializeSummaryEditors() {
const editors = {};
for (const entryType of ["debit", "credit"]) {
editors[entryType] = new SummaryEditor(this, entryType);
}
return editors;
}
/** /**
* Saves the original entry from the original entry selector. * Saves the original entry from the original entry selector.
* *