Renamed the journal entry form to journal entry editor, to be clear.
This commit is contained in:
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user