mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 01:04:25 +08:00
add confirm dialog when saving a transaction whose amount is 0
This commit is contained in:
@@ -565,6 +565,7 @@ export default {
|
|||||||
'Transaction Time': 'Transaction Time',
|
'Transaction Time': 'Transaction Time',
|
||||||
'Tags': 'Tags',
|
'Tags': 'Tags',
|
||||||
'Your transaction description (optional)': 'Your transaction description (optional)',
|
'Your transaction description (optional)': 'Your transaction description (optional)',
|
||||||
|
'Are you sure you want to save this transaction whose amount is 0?': 'Are you sure you want to save this transaction whose amount is 0?',
|
||||||
'Unable to get transaction': 'Unable to get transaction',
|
'Unable to get transaction': 'Unable to get transaction',
|
||||||
'Unable to add transaction': 'Unable to add transaction',
|
'Unable to add transaction': 'Unable to add transaction',
|
||||||
'Unable to save transaction': 'Unable to save transaction',
|
'Unable to save transaction': 'Unable to save transaction',
|
||||||
|
|||||||
@@ -565,6 +565,7 @@ export default {
|
|||||||
'Transaction Time': '交易时间',
|
'Transaction Time': '交易时间',
|
||||||
'Tags': '标签',
|
'Tags': '标签',
|
||||||
'Your transaction description (optional)': '你的交易描述 (可选)',
|
'Your transaction description (optional)': '你的交易描述 (可选)',
|
||||||
|
'Are you sure you want to save this transaction whose amount is 0?': '您确定要保存这个金额为0的交易?',
|
||||||
'Unable to get transaction': '无法获取交易',
|
'Unable to get transaction': '无法获取交易',
|
||||||
'Unable to add transaction': '无法添加交易',
|
'Unable to add transaction': '无法添加交易',
|
||||||
'Unable to save transaction': '无法保存交易',
|
'Unable to save transaction': '无法保存交易',
|
||||||
|
|||||||
@@ -640,9 +640,6 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.submitting = true;
|
|
||||||
self.$showLoading(() => self.submitting);
|
|
||||||
|
|
||||||
const submitTransaction = {
|
const submitTransaction = {
|
||||||
type: self.transaction.type,
|
type: self.transaction.type,
|
||||||
time: self.transaction.unixTime,
|
time: self.transaction.unixTime,
|
||||||
@@ -671,27 +668,40 @@ export default {
|
|||||||
submitTransaction.id = self.transaction.id;
|
submitTransaction.id = self.transaction.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.$store.dispatch('saveTransaction', {
|
const doSubmit = function () {
|
||||||
transaction: submitTransaction
|
self.submitting = true;
|
||||||
}).then(() => {
|
self.$showLoading(() => self.submitting);
|
||||||
self.submitting = false;
|
|
||||||
self.$hideLoading();
|
|
||||||
|
|
||||||
if (self.mode === 'add') {
|
self.$store.dispatch('saveTransaction', {
|
||||||
self.$toast('You have added a new transaction');
|
transaction: submitTransaction
|
||||||
} else if (self.mode === 'edit') {
|
}).then(() => {
|
||||||
self.$toast('You have saved this transaction');
|
self.submitting = false;
|
||||||
}
|
self.$hideLoading();
|
||||||
|
|
||||||
router.back();
|
if (self.mode === 'add') {
|
||||||
}).catch(error => {
|
self.$toast('You have added a new transaction');
|
||||||
self.submitting = false;
|
} else if (self.mode === 'edit') {
|
||||||
self.$hideLoading();
|
self.$toast('You have saved this transaction');
|
||||||
|
}
|
||||||
|
|
||||||
if (!error.processed) {
|
router.back();
|
||||||
self.$toast(error.message || error);
|
}).catch(error => {
|
||||||
}
|
self.submitting = false;
|
||||||
});
|
self.$hideLoading();
|
||||||
|
|
||||||
|
if (!error.processed) {
|
||||||
|
self.$toast(error.message || error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (submitTransaction.sourceAmount === 0) {
|
||||||
|
self.$confirm('Are you sure you want to save this transaction whose amount is 0?', () => {
|
||||||
|
doSubmit();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
doSubmit();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
autoChangeCommentTextareaSize() {
|
autoChangeCommentTextareaSize() {
|
||||||
const app = this.$f7;
|
const app = this.$f7;
|
||||||
|
|||||||
Reference in New Issue
Block a user