diff --git a/resources/assets/v2/src/pages/transactions/create.js b/resources/assets/v2/src/pages/transactions/create.js index f324555e5f..490e369388 100644 --- a/resources/assets/v2/src/pages/transactions/create.js +++ b/resources/assets/v2/src/pages/transactions/create.js @@ -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; diff --git a/resources/assets/v2/src/pages/transactions/edit.js b/resources/assets/v2/src/pages/transactions/edit.js index 2235068894..615a87401b 100644 --- a/resources/assets/v2/src/pages/transactions/edit.js +++ b/resources/assets/v2/src/pages/transactions/edit.js @@ -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() { diff --git a/resources/views/v2/components/transaction-split.blade.php b/resources/views/v2/components/transaction-split.blade.php index 2344dbca37..e03ae6837e 100644 --- a/resources/views/v2/components/transaction-split.blade.php +++ b/resources/views/v2/components/transaction-split.blade.php @@ -111,12 +111,12 @@