Merged the code in the #initializeAccountSelectors method into the constructor in the JavaScript JournalEntryEditor class.
This commit is contained in:
parent
8c10f1e96a
commit
01861f0b6a
@ -206,7 +206,7 @@ class JournalEntryEditor {
|
||||
* The account selectors
|
||||
* @type {{debit: AccountSelector, credit: AccountSelector}}
|
||||
*/
|
||||
#accountSelectors;
|
||||
#accountSelectors = {};
|
||||
|
||||
/**
|
||||
* Constructs a new journal entry editor.
|
||||
@ -231,7 +231,9 @@ class JournalEntryEditor {
|
||||
this.#amount = document.getElementById(this.#prefix + "-amount");
|
||||
this.#amountError = document.getElementById(this.#prefix + "-amount-error");
|
||||
this.#summaryEditors = this.#initializeSummaryEditors();
|
||||
this.#accountSelectors = this.#initializeAccountSelectors();
|
||||
for (const entryType of ["debit", "credit"]) {
|
||||
this.#accountSelectors[entryType] = new AccountSelector(this, entryType);
|
||||
}
|
||||
this.#originalEntryControl.onclick = () => OriginalEntrySelector.start(this, this.originalEntryId);
|
||||
this.#originalEntryDelete.onclick = () => this.clearOriginalEntry();
|
||||
this.#summaryControl.onclick = () => this.#summaryEditors[this.entryType].onOpen();
|
||||
@ -265,19 +267,6 @@ class JournalEntryEditor {
|
||||
return editors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the account selectors.
|
||||
*
|
||||
* @return {{debit: AccountSelector, credit: AccountSelector}} the account selectors
|
||||
*/
|
||||
#initializeAccountSelectors() {
|
||||
const selectors = {};
|
||||
for (const entryType of ["debit", "credit"]) {
|
||||
selectors[entryType] = new AccountSelector(this, entryType);
|
||||
}
|
||||
return selectors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the original entry from the original entry selector.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user