Renamed the JavaScript AccountSelector class to JournalEntryAccountSelector, to avoid confusion. There is a RecurringAccountSelector in the option form now.
This commit is contained in:
parent
eb5a7bef7e
commit
30e0c7682c
@ -1,5 +1,5 @@
|
|||||||
/* The Mia! Accounting Flask Project
|
/* The Mia! Accounting Flask Project
|
||||||
* account-selector.js: The JavaScript for the account selector
|
* journal-entry-account-selector.js: The JavaScript for the account selector of the journal entry form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Copyright (c) 2023 imacat.
|
/* Copyright (c) 2023 imacat.
|
||||||
@ -26,7 +26,7 @@
|
|||||||
* The account selector.
|
* The account selector.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class AccountSelector {
|
class JournalEntryAccountSelector {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The line item editor
|
* The line item editor
|
||||||
@ -66,7 +66,7 @@ class AccountSelector {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The options
|
* The options
|
||||||
* @type {AccountOption[]}
|
* @type {JournalEntryAccountOption[]}
|
||||||
*/
|
*/
|
||||||
#options;
|
#options;
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ class AccountSelector {
|
|||||||
this.#query = document.getElementById(prefix + "-query");
|
this.#query = document.getElementById(prefix + "-query");
|
||||||
this.#queryNoResult = document.getElementById(prefix + "-option-no-result");
|
this.#queryNoResult = document.getElementById(prefix + "-option-no-result");
|
||||||
this.#optionList = document.getElementById(prefix + "-option-list");
|
this.#optionList = document.getElementById(prefix + "-option-list");
|
||||||
this.#options = Array.from(document.getElementsByClassName(prefix + "-option")).map((element) => new AccountOption(this, element));
|
this.#options = Array.from(document.getElementsByClassName(prefix + "-option")).map((element) => new JournalEntryAccountOption(this, element));
|
||||||
this.#more = document.getElementById(prefix + "-more");
|
this.#more = document.getElementById(prefix + "-more");
|
||||||
this.#clearButton = document.getElementById(prefix + "-btn-clear");
|
this.#clearButton = document.getElementById(prefix + "-btn-clear");
|
||||||
|
|
||||||
@ -172,13 +172,13 @@ class AccountSelector {
|
|||||||
* Returns the account selector instances.
|
* Returns the account selector instances.
|
||||||
*
|
*
|
||||||
* @param lineItemEditor {JournalEntryLineItemEditor} the line item editor
|
* @param lineItemEditor {JournalEntryLineItemEditor} the line item editor
|
||||||
* @return {{debit: AccountSelector, credit: AccountSelector}}
|
* @return {{debit: JournalEntryAccountSelector, credit: JournalEntryAccountSelector}}
|
||||||
*/
|
*/
|
||||||
static getInstances(lineItemEditor) {
|
static getInstances(lineItemEditor) {
|
||||||
const selectors = {}
|
const selectors = {}
|
||||||
const modals = Array.from(document.getElementsByClassName("accounting-account-selector"));
|
const modals = Array.from(document.getElementsByClassName("accounting-account-selector"));
|
||||||
for (const modal of modals) {
|
for (const modal of modals) {
|
||||||
selectors[modal.dataset.debitCredit] = new AccountSelector(lineItemEditor, modal.dataset.debitCredit);
|
selectors[modal.dataset.debitCredit] = new JournalEntryAccountSelector(lineItemEditor, modal.dataset.debitCredit);
|
||||||
}
|
}
|
||||||
return selectors;
|
return selectors;
|
||||||
}
|
}
|
||||||
@ -188,11 +188,11 @@ class AccountSelector {
|
|||||||
* An account option
|
* An account option
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class AccountOption {
|
class JournalEntryAccountOption {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The account selector
|
* The account selector
|
||||||
* @type {AccountSelector}
|
* @type {JournalEntryAccountSelector}
|
||||||
*/
|
*/
|
||||||
#selector;
|
#selector;
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ class AccountOption {
|
|||||||
/**
|
/**
|
||||||
* Constructs the account in the account selector.
|
* Constructs the account in the account selector.
|
||||||
*
|
*
|
||||||
* @param selector {AccountSelector} the account selector
|
* @param selector {JournalEntryAccountSelector} the account selector
|
||||||
* @param element {HTMLLIElement} the element
|
* @param element {HTMLLIElement} the element
|
||||||
*/
|
*/
|
||||||
constructor(selector, element) {
|
constructor(selector, element) {
|
@ -198,7 +198,7 @@ class JournalEntryLineItemEditor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The account selectors
|
* The account selectors
|
||||||
* @type {{debit: AccountSelector, credit: AccountSelector}}
|
* @type {{debit: JournalEntryAccountSelector, credit: JournalEntryAccountSelector}}
|
||||||
*/
|
*/
|
||||||
#accountSelectors;
|
#accountSelectors;
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ class JournalEntryLineItemEditor {
|
|||||||
this.#amountInput = document.getElementById(this.#prefix + "-amount");
|
this.#amountInput = document.getElementById(this.#prefix + "-amount");
|
||||||
this.#amountError = document.getElementById(this.#prefix + "-amount-error");
|
this.#amountError = document.getElementById(this.#prefix + "-amount-error");
|
||||||
this.#descriptionEditors = DescriptionEditor.getInstances(this);
|
this.#descriptionEditors = DescriptionEditor.getInstances(this);
|
||||||
this.#accountSelectors = AccountSelector.getInstances(this);
|
this.#accountSelectors = JournalEntryAccountSelector.getInstances(this);
|
||||||
this.originalLineItemSelector = new OriginalLineItemSelector(this);
|
this.originalLineItemSelector = new OriginalLineItemSelector(this);
|
||||||
this.#originalLineItemControl.onclick = () => this.originalLineItemSelector.onOpen()
|
this.#originalLineItemControl.onclick = () => this.originalLineItemSelector.onOpen()
|
||||||
this.#originalLineItemDelete.onclick = () => this.clearOriginalLineItem();
|
this.#originalLineItemDelete.onclick = () => this.clearOriginalLineItem();
|
||||||
@ -370,7 +370,7 @@ class JournalEntryLineItemEditor {
|
|||||||
/**
|
/**
|
||||||
* Saves the selected account.
|
* Saves the selected account.
|
||||||
*
|
*
|
||||||
* @param account {AccountOption} the selected account
|
* @param account {JournalEntryAccountOption} the selected account
|
||||||
*/
|
*/
|
||||||
saveAccount(account) {
|
saveAccount(account) {
|
||||||
this.isNeedOffset = account.isNeedOffset;
|
this.isNeedOffset = account.isNeedOffset;
|
||||||
|
@ -25,7 +25,7 @@ First written: 2023/2/26
|
|||||||
<script src="{{ url_for("accounting.static", filename="js/drag-and-drop-reorder.js") }}"></script>
|
<script src="{{ url_for("accounting.static", filename="js/drag-and-drop-reorder.js") }}"></script>
|
||||||
<script src="{{ url_for("accounting.static", filename="js/journal-entry-form.js") }}"></script>
|
<script src="{{ url_for("accounting.static", filename="js/journal-entry-form.js") }}"></script>
|
||||||
<script src="{{ url_for("accounting.static", filename="js/journal-entry-line-item-editor.js") }}"></script>
|
<script src="{{ url_for("accounting.static", filename="js/journal-entry-line-item-editor.js") }}"></script>
|
||||||
<script src="{{ url_for("accounting.static", filename="js/account-selector.js") }}"></script>
|
<script src="{{ url_for("accounting.static", filename="js/journal-entry-account-selector.js") }}"></script>
|
||||||
<script src="{{ url_for("accounting.static", filename="js/original-line-item-selector.js") }}"></script>
|
<script src="{{ url_for("accounting.static", filename="js/original-line-item-selector.js") }}"></script>
|
||||||
<script src="{{ url_for("accounting.static", filename="js/description-editor.js") }}"></script>
|
<script src="{{ url_for("accounting.static", filename="js/description-editor.js") }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user