Better button response in category overview.

This commit is contained in:
James Cole
2024-04-20 17:08:30 +02:00
parent bd7fe92818
commit dcea6b757b
4 changed files with 24 additions and 5 deletions

View File

@@ -69,6 +69,7 @@ let transactions = function () {
resetButton: false,
rulesButton: true,
webhooksButton: true,
categorySelectVisible: false
},
// form behaviour during transaction
@@ -343,7 +344,13 @@ let transactions = function () {
// destination can never be revenue account
this.filters.destination = ['Expense account', 'Loan', 'Debt', 'Mortgage', 'Asset account'];
},
keyUpFromCategory(e) {
if (e.key === 'Enter' && false === this.formStates.categorySelectVisible) {
this.submitTransaction();
return;
}
this.formStates.categorySelectVisible = document.querySelector('input.ac-category').nextSibling.classList.contains('show');
},
submitTransaction() {
// reset all messages:
this.notifications.error.show = false;
@@ -422,7 +429,10 @@ let transactions = function () {
if (this.formStates.returnHereButton) {
this.notifications.success.show = true;
this.notifications.success.url = 'transactions/show/' + this.groupProperties.id;
this.notifications.success.text = i18next.t('firefly.stored_journal_js', {description: this.groupProperties.title, interpolation: { escapeValue: false }});
this.notifications.success.text = i18next.t('firefly.stored_journal_js', {
description: this.groupProperties.title,
interpolation: {escapeValue: false}
});
this.formStates.isSubmitting = false;
// reset group title again
this.groupProperties.title = null;

View File

@@ -72,6 +72,7 @@ let transactions = function () {
resetButton: true,
rulesButton: true,
webhooksButton: true,
categorySelectVisible: false,
},
// form behaviour during transaction
@@ -111,6 +112,14 @@ let transactions = function () {
}
},
keyUpFromCategory(e) {
if (e.key === 'Enter' && false === this.formStates.categorySelectVisible) {
this.submitTransaction();
return;
}
this.formStates.categorySelectVisible = document.querySelector('input.ac-category').nextSibling.classList.contains('show');
},
// submit the transaction form.
// TODO pretty much duplicate of create.js
submitTransaction() {