Revised the JavaScript DebitCreditSubForm to have a better visual effect when the line item editor is opened and closed with no line items.
This commit is contained in:
parent
dc432da398
commit
7c512b1c15
@ -631,6 +631,16 @@ class DebitCreditSubForm {
|
||||
this.#initializeDragAndDropReordering();
|
||||
}
|
||||
|
||||
/**
|
||||
* The callback when the line item editor is closed.
|
||||
*
|
||||
*/
|
||||
onLineItemEditorClosed() {
|
||||
if (this.lineItems.length === 0) {
|
||||
this.#element.classList.remove("accounting-not-empty");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new line item sub-form
|
||||
*
|
||||
@ -691,7 +701,10 @@ class DebitCreditSubForm {
|
||||
this.#element.classList.add("accounting-clickable");
|
||||
this.#element.dataset.bsToggle = "modal"
|
||||
this.#element.dataset.bsTarget = "#" + this.currency.form.lineItemEditor.modal.id;
|
||||
this.#element.onclick = () => this.currency.form.lineItemEditor.onAddNew(this);
|
||||
this.#element.onclick = () => {
|
||||
this.#element.classList.add("accounting-not-empty");
|
||||
this.currency.form.lineItemEditor.onAddNew(this);
|
||||
};
|
||||
this.#content.classList.add("d-none");
|
||||
} else {
|
||||
this.#element.classList.add("accounting-not-empty");
|
||||
|
@ -249,6 +249,7 @@ class JournalEntryLineItemEditor {
|
||||
}
|
||||
return false;
|
||||
};
|
||||
this.modal.addEventListener("hidden.bs.modal", () => this.#debitCreditSubForm.onLineItemEditorClosed());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user