add swap account and/or amount menu in transaction edit page
This commit is contained in:
@@ -957,6 +957,9 @@ export default {
|
||||
'Transfer In Amount': 'Transfer In Amount',
|
||||
'Show Amount': 'Show Amount',
|
||||
'Hide Amount': 'Hide Amount',
|
||||
'Swap Account': 'Swap Account',
|
||||
'Swap Amount': 'Swap Amount',
|
||||
'Swap Account and Amount': 'Swap Account and Amount',
|
||||
'Category': 'Category',
|
||||
'Account': 'Account',
|
||||
'Source Account': 'Source Account',
|
||||
|
||||
@@ -957,6 +957,9 @@ export default {
|
||||
'Transfer In Amount': '转入金额',
|
||||
'Show Amount': '显示金额',
|
||||
'Hide Amount': '隐藏金额',
|
||||
'Swap Account': '交换账户',
|
||||
'Swap Amount': '交换金额',
|
||||
'Swap Account and Amount': '交换账户和金额',
|
||||
'Category': '分类',
|
||||
'Account': '账户',
|
||||
'Source Account': '来源账户',
|
||||
|
||||
@@ -12,6 +12,19 @@
|
||||
<v-icon :icon="icons.more" />
|
||||
<v-menu activator="parent">
|
||||
<v-list>
|
||||
<v-list-item :prepend-icon="icons.swap"
|
||||
:title="$t('Swap Account')"
|
||||
v-if="transaction.type === allTransactionTypes.Transfer"
|
||||
@click="swapTransactionData(true, false)"></v-list-item>
|
||||
<v-list-item :prepend-icon="icons.swap"
|
||||
:title="$t('Swap Amount')"
|
||||
v-if="transaction.type === allTransactionTypes.Transfer"
|
||||
@click="swapTransactionData(false, true)"></v-list-item>
|
||||
<v-list-item :prepend-icon="icons.swap"
|
||||
:title="$t('Swap Account and Amount')"
|
||||
v-if="transaction.type === allTransactionTypes.Transfer"
|
||||
@click="swapTransactionData(true, true)"></v-list-item>
|
||||
<v-divider v-if="transaction.type === allTransactionTypes.Transfer" />
|
||||
<v-list-item :prepend-icon="icons.show"
|
||||
:title="$t('Show Amount')"
|
||||
v-if="transaction.hideAmount" @click="transaction.hideAmount = false"></v-list-item>
|
||||
@@ -338,6 +351,7 @@ import {
|
||||
mdiDotsVertical,
|
||||
mdiEyeOffOutline,
|
||||
mdiEyeOutline,
|
||||
mdiSwapHorizontal,
|
||||
mdiPound
|
||||
} from '@mdi/js';
|
||||
|
||||
@@ -371,6 +385,7 @@ export default {
|
||||
more: mdiDotsVertical,
|
||||
show: mdiEyeOutline,
|
||||
hide: mdiEyeOffOutline,
|
||||
swap: mdiSwapHorizontal,
|
||||
tag: mdiPound
|
||||
}
|
||||
};
|
||||
@@ -809,6 +824,19 @@ export default {
|
||||
this.geoLocationStatus = null;
|
||||
this.transaction.geoLocation = null;
|
||||
},
|
||||
swapTransactionData(swapAccount, swapAmount) {
|
||||
if (swapAccount) {
|
||||
const oldSourceAccountId = this.transaction.sourceAccountId;
|
||||
this.transaction.sourceAccountId = this.transaction.destinationAccountId;
|
||||
this.transaction.destinationAccountId = oldSourceAccountId;
|
||||
}
|
||||
|
||||
if (swapAmount) {
|
||||
const oldSourceAmount = this.transaction.sourceAmount;
|
||||
this.transaction.sourceAmount = this.transaction.destinationAmount;
|
||||
this.transaction.destinationAmount = oldSourceAmount;
|
||||
}
|
||||
},
|
||||
setTransaction(transaction, options, setContextData) {
|
||||
setTransactionModelByTransaction(
|
||||
this.transaction,
|
||||
|
||||
@@ -319,6 +319,11 @@
|
||||
</f7-actions>
|
||||
|
||||
<f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false">
|
||||
<f7-actions-group v-if="transaction.type === allTransactionTypes.Transfer">
|
||||
<f7-actions-button @click="swapTransactionData(true, false)">{{ $t('Swap Account') }}</f7-actions-button>
|
||||
<f7-actions-button @click="swapTransactionData(false, true)">{{ $t('Swap Amount') }}</f7-actions-button>
|
||||
<f7-actions-button @click="swapTransactionData(true, true)">{{ $t('Swap Account and Amount') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
<f7-actions-group>
|
||||
<f7-actions-button v-if="transaction.hideAmount" @click="transaction.hideAmount = false">{{ $t('Show Amount') }}</f7-actions-button>
|
||||
<f7-actions-button v-if="!transaction.hideAmount" @click="transaction.hideAmount = true">{{ $t('Hide Amount') }}</f7-actions-button>
|
||||
@@ -786,6 +791,19 @@ export default {
|
||||
this.geoLocationStatus = null;
|
||||
this.transaction.geoLocation = null;
|
||||
},
|
||||
swapTransactionData(swapAccount, swapAmount) {
|
||||
if (swapAccount) {
|
||||
const oldSourceAccountId = this.transaction.sourceAccountId;
|
||||
this.transaction.sourceAccountId = this.transaction.destinationAccountId;
|
||||
this.transaction.destinationAccountId = oldSourceAccountId;
|
||||
}
|
||||
|
||||
if (swapAmount) {
|
||||
const oldSourceAmount = this.transaction.sourceAmount;
|
||||
this.transaction.sourceAmount = this.transaction.destinationAmount;
|
||||
this.transaction.destinationAmount = oldSourceAmount;
|
||||
}
|
||||
},
|
||||
getFontClassByAmount(amount) {
|
||||
if (amount >= 100000000 || amount <= -100000000) {
|
||||
return 'ebk-small-amount';
|
||||
|
||||
Reference in New Issue
Block a user