diff --git a/src/accounting/static/js/account-selector.js b/src/accounting/static/js/account-selector.js index 070d5e1..6ddc38f 100644 --- a/src/accounting/static/js/account-selector.js +++ b/src/accounting/static/js/account-selector.js @@ -105,7 +105,7 @@ class AccountSelector { AccountSelector.#formAccount.innerText = ""; AccountSelector.#formAccount.dataset.code = ""; AccountSelector.#formAccount.dataset.text = ""; - JournalEntryForm.validateAccount(); + JournalEntryEditor.validateAccount(); }; for (const option of this.#options) { option.onclick = () => { @@ -113,7 +113,7 @@ class AccountSelector { AccountSelector.#formAccount.innerText = option.dataset.content; AccountSelector.#formAccount.dataset.code = option.dataset.code; AccountSelector.#formAccount.dataset.text = option.dataset.content; - JournalEntryForm.validateAccount(); + JournalEntryEditor.validateAccount(); }; } this.#query.addEventListener("input", () => { @@ -246,9 +246,9 @@ class AccountSelector { * */ static initialize() { - this.#entryForm = document.getElementById("accounting-entry-form"); - this.#formAccountControl = document.getElementById("accounting-entry-form-account-control"); - this.#formAccount = document.getElementById("accounting-entry-form-account"); + this.#entryForm = document.getElementById("accounting-entry-editor"); + this.#formAccountControl = document.getElementById("accounting-entry-editor-account-control"); + this.#formAccount = document.getElementById("accounting-entry-editor-account"); const modals = Array.from(document.getElementsByClassName("accounting-account-selector-modal")); for (const modal of modals) { const selector = new AccountSelector(modal); diff --git a/src/accounting/static/js/summary-editor.js b/src/accounting/static/js/summary-editor.js index 8c3cd34..a2cb5e5 100644 --- a/src/accounting/static/js/summary-editor.js +++ b/src/accounting/static/js/summary-editor.js @@ -146,11 +146,11 @@ class SummaryEditor { this.#accountButtons = Array.from(document.getElementsByClassName(this.prefix + "-account")); // Things from the entry form - this.#entryFormModal = document.getElementById("accounting-entry-form-modal"); - this.#formAccountControl = document.getElementById("accounting-entry-form-account-control"); - this.#formAccount = document.getElementById("accounting-entry-form-account"); - this.#formSummaryControl = document.getElementById("accounting-entry-form-summary-control"); - this.#formSummary = document.getElementById("accounting-entry-form-summary"); + this.#entryFormModal = document.getElementById("accounting-entry-editor-modal"); + this.#formAccountControl = document.getElementById("accounting-entry-editor-account-control"); + this.#formAccount = document.getElementById("accounting-entry-editor-account"); + this.#formSummaryControl = document.getElementById("accounting-entry-editor-summary-control"); + this.#formSummary = document.getElementById("accounting-entry-editor-summary"); for (const cls of [GeneralTagTab, GeneralTripTab, BusTripTab, RegularPaymentTab, AnnotationTab]) { const tab = new cls(this); @@ -249,7 +249,7 @@ class SummaryEditor { this.#formAccount.dataset.code = this.#selectedAccount.dataset.code; this.#formAccount.dataset.text = this.#selectedAccount.dataset.text; this.#formAccount.innerText = this.#selectedAccount.dataset.text; - JournalEntryForm.validateAccount(); + JournalEntryEditor.validateAccount(); } this.#formSummary.dataset.value = this.summary.value; this.#formSummary.innerText = this.summary.value; @@ -291,8 +291,8 @@ class SummaryEditor { */ static initialize() { const forms = Array.from(document.getElementsByClassName("accounting-summary-editor")); - const entryForm = document.getElementById("accounting-entry-form"); - const formSummaryControl = document.getElementById("accounting-entry-form-summary-control"); + const entryForm = document.getElementById("accounting-entry-editor"); + const formSummaryControl = document.getElementById("accounting-entry-editor-summary-control"); for (const form of forms) { const editor = new SummaryEditor(form); this.#editors[editor.#entryType] = editor; diff --git a/src/accounting/static/js/transaction-form.js b/src/accounting/static/js/transaction-form.js index 30bf8ce..8ff9dcf 100644 --- a/src/accounting/static/js/transaction-form.js +++ b/src/accounting/static/js/transaction-form.js @@ -25,7 +25,7 @@ // Initializes the page JavaScript. document.addEventListener("DOMContentLoaded", () => { TransactionForm.initialize(); - JournalEntryForm.initialize(); + JournalEntryEditor.initialize(); }); /** @@ -479,7 +479,7 @@ class DebitCreditSideSubForm { this.#total = document.getElementById(this.#prefix + "-total"); this.#addEntryButton = document.getElementById(this.#prefix + "-add-entry"); this.#addEntryButton.onclick = () => { - JournalEntryForm.addNew(this); + JournalEntryEditor.addNew(this); AccountSelector.initializeJournalEntryForm(); SummaryEditor.initializeNewJournalEntry(entryType); }; @@ -726,7 +726,7 @@ class JournalEntrySubForm { this.#amountText = document.getElementById(this.#prefix + "-amount-text"); this.deleteButton = document.getElementById(this.#prefix + "-delete"); this.#control.onclick = () => { - JournalEntryForm.edit(this, this.#accountCode.value, this.#accountCode.dataset.text, this.#summary.value, this.amount.value); + JournalEntryEditor.edit(this, this.#accountCode.value, this.#accountCode.dataset.text, this.#summary.value, this.amount.value); AccountSelector.initializeJournalEntryForm(); }; this.deleteButton.onclick = () => { @@ -777,13 +777,13 @@ class JournalEntrySubForm { } /** - * The journal entry form. + * The journal entry editor. * */ -class JournalEntryForm { +class JournalEntryEditor { /** - * The journal entry form + * The journal entry editor * @type {HTMLFormElement} */ #element; @@ -855,20 +855,20 @@ class JournalEntryForm { #side; /** - * Constructs a new journal entry form. + * Constructs a new journal entry editor. * */ constructor() { - this.#element = document.getElementById("accounting-entry-form"); - this.#modal = document.getElementById("accounting-entry-form-modal"); - this.#accountControl = document.getElementById("accounting-entry-form-account-control"); - this.#account = document.getElementById("accounting-entry-form-account"); - this.#accountError = document.getElementById("accounting-entry-form-account-error") - this.#summaryControl = document.getElementById("accounting-entry-form-summary-control"); - this.#summary = document.getElementById("accounting-entry-form-summary"); - this.#summaryError = document.getElementById("accounting-entry-form-summary-error"); - this.#amount = document.getElementById("accounting-entry-form-amount"); - this.#amountError = document.getElementById("accounting-entry-form-amount-error"); + this.#element = document.getElementById("accounting-entry-editor"); + this.#modal = document.getElementById("accounting-entry-editor-modal"); + this.#accountControl = document.getElementById("accounting-entry-editor-account-control"); + this.#account = document.getElementById("accounting-entry-editor-account"); + this.#accountError = document.getElementById("accounting-entry-editor-account-error") + this.#summaryControl = document.getElementById("accounting-entry-editor-summary-control"); + this.#summary = document.getElementById("accounting-entry-editor-summary"); + this.#summaryError = document.getElementById("accounting-entry-editor-summary-error"); + this.#amount = document.getElementById("accounting-entry-editor-amount"); + this.#amountError = document.getElementById("accounting-entry-editor-amount-error"); this.#element.onsubmit = () => { if (this.#validate()) { if (this.#entry === null) { @@ -1002,17 +1002,17 @@ class JournalEntryForm { } /** - * The journal entry form - * @type {JournalEntryForm} + * The journal entry editor + * @type {JournalEntryEditor} */ - static #form; + static #editor; /** - * Initializes the journal entry form. + * Initializes the journal entry editor. * */ static initialize() { - this.#form = new JournalEntryForm(); + this.#editor = new JournalEntryEditor(); } /** @@ -1021,7 +1021,7 @@ class JournalEntryForm { * @param side {DebitCreditSideSubForm} the debit or credit side sub-form */ static addNew(side) { - this.#form.#onAddNew(side); + this.#editor.#onAddNew(side); } /** @@ -1034,7 +1034,7 @@ class JournalEntryForm { * @param amount {string} the amount */ static edit(entry, accountCode, accountText, summary, amount) { - this.#form.#onEdit(entry, accountCode, accountText, summary, amount); + this.#editor.#onEdit(entry, accountCode, accountText, summary, amount); } /** @@ -1042,7 +1042,7 @@ class JournalEntryForm { * */ static validateAccount() { - this.#form.#validateAccount(); + this.#editor.#validateAccount(); } } diff --git a/src/accounting/templates/accounting/transaction/expense/include/form-currency-item.html b/src/accounting/templates/accounting/transaction/expense/include/form-currency-item.html index 945e5db..3f55599 100644 --- a/src/accounting/templates/accounting/transaction/expense/include/form-currency-item.html +++ b/src/accounting/templates/accounting/transaction/expense/include/form-currency-item.html @@ -70,7 +70,7 @@ First written: 2023/2/25
- diff --git a/src/accounting/templates/accounting/transaction/include/account-selector-modal.html b/src/accounting/templates/accounting/transaction/include/account-selector-modal.html index 813c410..105da87 100644 --- a/src/accounting/templates/accounting/transaction/include/account-selector-modal.html +++ b/src/accounting/templates/accounting/transaction/include/account-selector-modal.html @@ -24,7 +24,7 @@ First written: 2023/2/25 diff --git a/src/accounting/templates/accounting/transaction/include/entry-form-modal.html b/src/accounting/templates/accounting/transaction/include/entry-form-modal.html deleted file mode 100644 index 16111d7..0000000 --- a/src/accounting/templates/accounting/transaction/include/entry-form-modal.html +++ /dev/null @@ -1,60 +0,0 @@ -{# -The Mia! Accounting Flask Project -entry-form-modal.html: The modal of the journal entry sub-form - - Copyright (c) 2023 imacat. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -Author: imacat@mail.imacat.idv.tw (imacat) -First written: 2023/2/25 -#} -
- -
diff --git a/src/accounting/templates/accounting/transaction/include/form-entry-item.html b/src/accounting/templates/accounting/transaction/include/form-entry-item.html index 89c3135..d25c7de 100644 --- a/src/accounting/templates/accounting/transaction/include/form-entry-item.html +++ b/src/accounting/templates/accounting/transaction/include/form-entry-item.html @@ -29,7 +29,7 @@ First written: 2023/2/25
-
+
{{ account_text }}
{{ summary_data }}
diff --git a/src/accounting/templates/accounting/transaction/include/form.html b/src/accounting/templates/accounting/transaction/include/form.html index 52a6fea..40af87b 100644 --- a/src/accounting/templates/accounting/transaction/include/form.html +++ b/src/accounting/templates/accounting/transaction/include/form.html @@ -86,7 +86,7 @@ First written: 2023/2/26
-{% include "accounting/transaction/include/entry-form-modal.html" %} +{% include "accounting/transaction/include/journal-entry-editor-modal.html" %} {% block form_modals %}{% endblock %} {% endblock %} diff --git a/src/accounting/templates/accounting/transaction/include/journal-entry-editor-modal.html b/src/accounting/templates/accounting/transaction/include/journal-entry-editor-modal.html new file mode 100644 index 0000000..a659b4c --- /dev/null +++ b/src/accounting/templates/accounting/transaction/include/journal-entry-editor-modal.html @@ -0,0 +1,60 @@ +{# +The Mia! Accounting Flask Project +journal-entry-editor-modal.html: The modal of the journal entry editor + + Copyright (c) 2023 imacat. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +Author: imacat@mail.imacat.idv.tw (imacat) +First written: 2023/2/25 +#} +
+ +
diff --git a/src/accounting/templates/accounting/transaction/include/summary-editor-modal.html b/src/accounting/templates/accounting/transaction/include/summary-editor-modal.html index aa2323d..9022e85 100644 --- a/src/accounting/templates/accounting/transaction/include/summary-editor-modal.html +++ b/src/accounting/templates/accounting/transaction/include/summary-editor-modal.html @@ -27,7 +27,7 @@ First written: 2023/2/28

- +
diff --git a/src/accounting/templates/accounting/transaction/income/include/form-currency-item.html b/src/accounting/templates/accounting/transaction/income/include/form-currency-item.html index e72c1e2..ae278cf 100644 --- a/src/accounting/templates/accounting/transaction/income/include/form-currency-item.html +++ b/src/accounting/templates/accounting/transaction/income/include/form-currency-item.html @@ -70,7 +70,7 @@ First written: 2023/2/25
- diff --git a/src/accounting/templates/accounting/transaction/transfer/include/form-currency-item.html b/src/accounting/templates/accounting/transaction/transfer/include/form-currency-item.html index a05796f..d855b73 100644 --- a/src/accounting/templates/accounting/transaction/transfer/include/form-currency-item.html +++ b/src/accounting/templates/accounting/transaction/transfer/include/form-currency-item.html @@ -72,7 +72,7 @@ First written: 2023/2/25
- @@ -112,7 +112,7 @@ First written: 2023/2/25
-