diff --git a/src/locales/en.json b/src/locales/en.json index ff8d724b..bc403793 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1400,6 +1400,10 @@ "Please refresh the page and try again. If the error persists, ensure that the server's map settings are correctly configured.": "Please refresh the page and try again. If the error persists, ensure that the server's map settings are correctly configured.", "Tags": "Tags", "Your transaction description (optional)": "Your transaction description (optional)", + "Transaction category cannot be blank": "Transaction category cannot be blank", + "Transaction account cannot be blank": "Transaction account cannot be blank", + "Source account cannot be blank": "Source account cannot be blank", + "Destination account cannot be blank": "Destination account cannot be blank", "Are you sure you want to save this transaction with a zero amount?": "Are you sure you want to save this transaction with a zero amount?", "Unable to retrieve transaction": "Unable to retrieve transaction", "Unable to add transaction": "Unable to add transaction", diff --git a/src/locales/zh_Hans.json b/src/locales/zh_Hans.json index 518d1927..d7880eee 100644 --- a/src/locales/zh_Hans.json +++ b/src/locales/zh_Hans.json @@ -1400,6 +1400,10 @@ "Please refresh the page and try again. If the error persists, ensure that the server's map settings are correctly configured.": "请刷新页面并重试。如果仍然显示错误,请确保正确设置了服务器地图设置。", "Tags": "标签", "Your transaction description (optional)": "你的交易描述 (可选)", + "Transaction category cannot be blank": "交易分类不能为空", + "Transaction account cannot be blank": "交易账户不能为空", + "Source account cannot be blank": "来源账户不能为空", + "Destination account cannot be blank": "目标账户不能为空", "Are you sure you want to save this transaction with a zero amount?": "您确定要保存这个金额为0的交易?", "Unable to retrieve transaction": "无法获取交易", "Unable to add transaction": "无法添加交易", diff --git a/src/views/desktop/transactions/list/dialogs/EditDialog.vue b/src/views/desktop/transactions/list/dialogs/EditDialog.vue index 99ddfc09..eb0890ad 100644 --- a/src/views/desktop/transactions/list/dialogs/EditDialog.vue +++ b/src/views/desktop/transactions/list/dialogs/EditDialog.vue @@ -598,6 +598,36 @@ export default { return !!this.inputEmptyProblemMessage; }, inputEmptyProblemMessage() { + if (this.transaction.type === this.allTransactionTypes.Expense) { + if (!this.transaction.expenseCategory || this.transaction.expenseCategory === '') { + return 'Transaction category cannot be blank'; + } + + if (!this.transaction.sourceAccountId || this.transaction.sourceAccountId === '') { + return 'Transaction account cannot be blank'; + } + } else if (this.transaction.type === this.allTransactionTypes.Income) { + if (!this.transaction.incomeCategory || this.transaction.incomeCategory === '') { + return 'Transaction category cannot be blank'; + } + + if (!this.transaction.sourceAccountId || this.transaction.sourceAccountId === '') { + return 'Transaction account cannot be blank'; + } + } else if (this.transaction.type === this.allTransactionTypes.Transfer) { + if (!this.transaction.transferCategory || this.transaction.transferCategory === '') { + return 'Transaction category cannot be blank'; + } + + if (!this.transaction.sourceAccountId || this.transaction.sourceAccountId === '') { + return 'Source account cannot be blank'; + } + + if (!this.transaction.destinationAccountId || this.transaction.destinationAccountId === '') { + return 'Destination account cannot be blank'; + } + } + if (this.type === 'template') { if (!this.transaction.name) { return 'Template name cannot be blank'; diff --git a/src/views/mobile/transactions/EditPage.vue b/src/views/mobile/transactions/EditPage.vue index 80a21291..38a66d1c 100644 --- a/src/views/mobile/transactions/EditPage.vue +++ b/src/views/mobile/transactions/EditPage.vue @@ -636,6 +636,36 @@ export default { return !!this.inputEmptyProblemMessage; }, inputEmptyProblemMessage() { + if (this.transaction.type === this.allTransactionTypes.Expense) { + if (!this.transaction.expenseCategory || this.transaction.expenseCategory === '') { + return 'Transaction category cannot be blank'; + } + + if (!this.transaction.sourceAccountId || this.transaction.sourceAccountId === '') { + return 'Transaction account cannot be blank'; + } + } else if (this.transaction.type === this.allTransactionTypes.Income) { + if (!this.transaction.incomeCategory || this.transaction.incomeCategory === '') { + return 'Transaction category cannot be blank'; + } + + if (!this.transaction.sourceAccountId || this.transaction.sourceAccountId === '') { + return 'Transaction account cannot be blank'; + } + } else if (this.transaction.type === this.allTransactionTypes.Transfer) { + if (!this.transaction.transferCategory || this.transaction.transferCategory === '') { + return 'Transaction category cannot be blank'; + } + + if (!this.transaction.sourceAccountId || this.transaction.sourceAccountId === '') { + return 'Source account cannot be blank'; + } + + if (!this.transaction.destinationAccountId || this.transaction.destinationAccountId === '') { + return 'Destination account cannot be blank'; + } + } + if (this.type === 'template') { if (!this.transaction.name) { return 'Template name cannot be blank';