verify whether required items is valid before submitting new transaction

This commit is contained in:
MaysWind
2024-08-09 00:18:52 +08:00
parent e4faf64ea3
commit 5c4a8e37c4
4 changed files with 68 additions and 0 deletions
+4
View File
@@ -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.", "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", "Tags": "Tags",
"Your transaction description (optional)": "Your transaction description (optional)", "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?", "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 retrieve transaction": "Unable to retrieve transaction",
"Unable to add transaction": "Unable to add transaction", "Unable to add transaction": "Unable to add transaction",
+4
View File
@@ -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 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的交易?", "Are you sure you want to save this transaction with a zero amount?": "您确定要保存这个金额为0的交易?",
"Unable to retrieve transaction": "无法获取交易", "Unable to retrieve transaction": "无法获取交易",
"Unable to add transaction": "无法添加交易", "Unable to add transaction": "无法添加交易",
@@ -598,6 +598,36 @@ export default {
return !!this.inputEmptyProblemMessage; return !!this.inputEmptyProblemMessage;
}, },
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.type === 'template') {
if (!this.transaction.name) { if (!this.transaction.name) {
return 'Template name cannot be blank'; return 'Template name cannot be blank';
@@ -636,6 +636,36 @@ export default {
return !!this.inputEmptyProblemMessage; return !!this.inputEmptyProblemMessage;
}, },
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.type === 'template') {
if (!this.transaction.name) { if (!this.transaction.name) {
return 'Template name cannot be blank'; return 'Template name cannot be blank';