mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 10:14:26 +08:00
code refactor
This commit is contained in:
@@ -14,6 +14,14 @@ import {
|
|||||||
getFirstAvaiableSubCategoryId
|
getFirstAvaiableSubCategoryId
|
||||||
} from './category.js';
|
} from './category.js';
|
||||||
|
|
||||||
|
function getDisplayAmount(amount, currency, hideAmount, formatAmountWithCurrencyFunc) {
|
||||||
|
if (hideAmount) {
|
||||||
|
return formatAmountWithCurrencyFunc('***', currency);
|
||||||
|
}
|
||||||
|
|
||||||
|
return formatAmountWithCurrencyFunc(amount, currency);
|
||||||
|
}
|
||||||
|
|
||||||
export function setTransactionModelByTransaction(transaction, transaction2, allCategories, allCategoriesMap, allVisibleAccounts, allAccountsMap, defaultAccountId, options, setContextData, convertContextTime) {
|
export function setTransactionModelByTransaction(transaction, transaction2, allCategories, allCategoriesMap, allVisibleAccounts, allAccountsMap, defaultAccountId, options, setContextData, convertContextTime) {
|
||||||
if ((!options.type || options.type === '0') && options.categoryId && options.categoryId !== '0' && allCategoriesMap[options.categoryId]) {
|
if ((!options.type || options.type === '0') && options.categoryId && options.categoryId !== '0' && allCategoriesMap[options.categoryId]) {
|
||||||
const category = allCategoriesMap[options.categoryId];
|
const category = allCategoriesMap[options.categoryId];
|
||||||
@@ -148,3 +156,33 @@ export function setTransactionModelByTransaction(transaction, transaction2, allC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getTransactionDisplayAmount(transaction, allFilterAccountIdsCount, allFilterAccountIds, formatAmountWithCurrencyFunc) {
|
||||||
|
if (allFilterAccountIdsCount < 1) {
|
||||||
|
if (transaction.sourceAccount) {
|
||||||
|
return getDisplayAmount(transaction.sourceAmount, transaction.sourceAccount.currency, transaction.hideAmount, formatAmountWithCurrencyFunc);
|
||||||
|
}
|
||||||
|
} else if (allFilterAccountIdsCount === 1) {
|
||||||
|
if (transaction.sourceAccount && (allFilterAccountIds[transaction.sourceAccount.id] || allFilterAccountIds[transaction.sourceAccount.parentId])) {
|
||||||
|
return getDisplayAmount(transaction.sourceAmount, transaction.sourceAccount.currency, transaction.hideAmount , formatAmountWithCurrencyFunc);
|
||||||
|
} else if (transaction.destinationAccount && (allFilterAccountIds[transaction.destinationAccount.id] || allFilterAccountIds[transaction.destinationAccount.parentId])) {
|
||||||
|
return getDisplayAmount(transaction.destinationAmount, transaction.destinationAccount.currency, transaction.hideAmount , formatAmountWithCurrencyFunc);
|
||||||
|
}
|
||||||
|
} else { // allFilterAccountIdsCount > 1
|
||||||
|
if (transaction.sourceAccount && transaction.destinationAccount) {
|
||||||
|
if ((allFilterAccountIds[transaction.sourceAccount.id] || allFilterAccountIds[transaction.sourceAccount.parentId])
|
||||||
|
&& !allFilterAccountIds[transaction.destinationAccount.id] && !allFilterAccountIds[transaction.destinationAccount.parentId]) {
|
||||||
|
return getDisplayAmount(transaction.sourceAmount, transaction.sourceAccount.currency, transaction.hideAmount , formatAmountWithCurrencyFunc);
|
||||||
|
} else if ((allFilterAccountIds[transaction.destinationAccount.id] || allFilterAccountIds[transaction.destinationAccount.parentId])
|
||||||
|
&& !allFilterAccountIds[transaction.sourceAccount.id] && !allFilterAccountIds[transaction.sourceAccount.parentId]) {
|
||||||
|
return getDisplayAmount(transaction.destinationAmount, transaction.destinationAccount.currency, transaction.hideAmount , formatAmountWithCurrencyFunc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (transaction.sourceAccount) {
|
||||||
|
return getDisplayAmount(transaction.sourceAmount, transaction.sourceAccount.currency, transaction.hideAmount, formatAmountWithCurrencyFunc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|||||||
@@ -133,6 +133,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</v-list-item-title>
|
</v-list-item-title>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
<v-list-item key="multiple" value="multiple" class="text-sm" density="compact"
|
||||||
|
:class="{ 'list-item-selected': query.categoryIds && queryAllFilterCategoryIdsCount > 1 }"
|
||||||
|
:append-icon="(query.categoryIds && queryAllFilterCategoryIdsCount > 1 ? icons.check : null)">
|
||||||
|
<v-list-item-title class="cursor-pointer"
|
||||||
|
@click="showMultipleCategoriesDialog()">
|
||||||
|
<div class="d-flex align-center">
|
||||||
|
<v-icon :icon="icons.multiple" />
|
||||||
|
<span class="text-sm ml-3">{{ $t('Multiple Categories') }}</span>
|
||||||
|
</div>
|
||||||
|
</v-list-item-title>
|
||||||
|
</v-list-item>
|
||||||
|
|
||||||
<template :key="categoryType"
|
<template :key="categoryType"
|
||||||
v-for="(categories, categoryType) in allPrimaryCategories">
|
v-for="(categories, categoryType) in allPrimaryCategories">
|
||||||
@@ -160,7 +171,7 @@
|
|||||||
<v-divider />
|
<v-divider />
|
||||||
<v-list-item class="text-sm" density="compact"
|
<v-list-item class="text-sm" density="compact"
|
||||||
:value="category.id"
|
:value="category.id"
|
||||||
:append-icon="(query.categoryIds === category.id ? icons.check : null)">
|
:append-icon="(queryAllFilterCategoryIds[category.id] ? icons.check : null)">
|
||||||
<v-list-item-title class="cursor-pointer"
|
<v-list-item-title class="cursor-pointer"
|
||||||
@click="changeCategoryFilter(category.id)">
|
@click="changeCategoryFilter(category.id)">
|
||||||
<div class="d-flex align-center">
|
<div class="d-flex align-center">
|
||||||
@@ -175,8 +186,8 @@
|
|||||||
<v-divider v-if="!subCategory.hidden" />
|
<v-divider v-if="!subCategory.hidden" />
|
||||||
<v-list-item class="text-sm" density="compact"
|
<v-list-item class="text-sm" density="compact"
|
||||||
:value="subCategory.id"
|
:value="subCategory.id"
|
||||||
:class="{ 'list-item-selected': query.categoryIds === subCategory.id }"
|
:class="{ 'list-item-selected': queryAllFilterCategoryIds[subCategory.id] }"
|
||||||
:append-icon="(query.categoryIds === subCategory.id ? icons.check : null)"
|
:append-icon="(queryAllFilterCategoryIds[subCategory.id] ? icons.check : null)"
|
||||||
v-if="!subCategory.hidden">
|
v-if="!subCategory.hidden">
|
||||||
<v-list-item-title class="cursor-pointer"
|
<v-list-item-title class="cursor-pointer"
|
||||||
@click="changeCategoryFilter(subCategory.id)">
|
@click="changeCategoryFilter(subCategory.id)">
|
||||||
@@ -265,13 +276,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</v-list-item-title>
|
</v-list-item-title>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
<v-list-item key="multiple" value="multiple" class="text-sm" density="compact"
|
||||||
|
:class="{ 'list-item-selected': query.accountIds && queryAllFilterAccountIdsCount > 1 }"
|
||||||
|
:append-icon="(query.accountIds && queryAllFilterAccountIdsCount > 1 ? icons.check : null)">
|
||||||
|
<v-list-item-title class="cursor-pointer"
|
||||||
|
@click="showMultipleAccountsDialog()">
|
||||||
|
<div class="d-flex align-center">
|
||||||
|
<v-icon :icon="icons.multiple" />
|
||||||
|
<span class="text-sm ml-3">{{ $t('Multiple Accounts') }}</span>
|
||||||
|
</div>
|
||||||
|
</v-list-item-title>
|
||||||
|
</v-list-item>
|
||||||
<template :key="account.id"
|
<template :key="account.id"
|
||||||
v-for="account in allAccounts">
|
v-for="account in allAccounts">
|
||||||
<v-divider v-if="!account.hidden" />
|
<v-divider v-if="!account.hidden" />
|
||||||
<v-list-item class="text-sm" density="compact"
|
<v-list-item class="text-sm" density="compact"
|
||||||
:value="account.id"
|
:value="account.id"
|
||||||
:class="{ 'list-item-selected': query.accountIds === account.id }"
|
:class="{ 'list-item-selected': queryAllFilterAccountIds[account.id] }"
|
||||||
:append-icon="(query.accountIds === account.id ? icons.check : null)"
|
:append-icon="(queryAllFilterAccountIds[account.id] ? icons.check : null)"
|
||||||
v-if="!account.hidden">
|
v-if="!account.hidden">
|
||||||
<v-list-item-title class="cursor-pointer"
|
<v-list-item-title class="cursor-pointer"
|
||||||
@click="changeAccountFilter(account.id)">
|
@click="changeAccountFilter(account.id)">
|
||||||
@@ -347,9 +369,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="transaction-table-column-amount" :class="{ 'text-expense': transaction.type === allTransactionTypes.Expense, 'text-income': transaction.type === allTransactionTypes.Income }">
|
<td class="transaction-table-column-amount" :class="{ 'text-expense': transaction.type === allTransactionTypes.Expense, 'text-income': transaction.type === allTransactionTypes.Income }">
|
||||||
<div v-if="transaction.sourceAccount">
|
<div v-if="transaction.sourceAccount">
|
||||||
<span v-if="!query.accountIds || (transaction.sourceAccount && (transaction.sourceAccount.id === query.accountIds || transaction.sourceAccount.parentId === query.accountIds))">{{ getDisplayAmount(transaction.sourceAmount, transaction.sourceAccount.currency, transaction.hideAmount) }}</span>
|
<span>{{ getTransactionDisplayAmount(transaction) }}</span>
|
||||||
<span v-else-if="query.accountIds && transaction.destinationAccount && (transaction.destinationAccount.id === query.accountIds || transaction.destinationAccount.parentId === query.accountIds)">{{ getDisplayAmount(transaction.destinationAmount, transaction.destinationAccount.currency, transaction.hideAmount) }}</span>
|
|
||||||
<span v-else></span>
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="transaction-table-column-account">
|
<td class="transaction-table-column-account">
|
||||||
@@ -431,12 +451,14 @@ import {
|
|||||||
transactionTypeToCategoryType
|
transactionTypeToCategoryType
|
||||||
} from '@/lib/category.js';
|
} from '@/lib/category.js';
|
||||||
import { getUnifiedSelectedAccountsCurrencyOrDefaultCurrency } from '@/lib/account.js';
|
import { getUnifiedSelectedAccountsCurrencyOrDefaultCurrency } from '@/lib/account.js';
|
||||||
|
import { getTransactionDisplayAmount } from '@/lib/transaction.js';
|
||||||
import { scrollToSelectedItem } from '@/lib/ui.desktop.js';
|
import { scrollToSelectedItem } from '@/lib/ui.desktop.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
mdiMagnify,
|
mdiMagnify,
|
||||||
mdiCheck,
|
mdiCheck,
|
||||||
mdiTextBoxCheckOutline,
|
mdiViewGridOutline,
|
||||||
|
mdiVectorArrangeBelow,
|
||||||
mdiRefresh,
|
mdiRefresh,
|
||||||
mdiMenu,
|
mdiMenu,
|
||||||
mdiMenuDown,
|
mdiMenuDown,
|
||||||
@@ -485,7 +507,8 @@ export default {
|
|||||||
icons: {
|
icons: {
|
||||||
search: mdiMagnify,
|
search: mdiMagnify,
|
||||||
check: mdiCheck,
|
check: mdiCheck,
|
||||||
all: mdiTextBoxCheckOutline,
|
all: mdiViewGridOutline,
|
||||||
|
multiple: mdiVectorArrangeBelow,
|
||||||
refresh: mdiRefresh,
|
refresh: mdiRefresh,
|
||||||
menu: mdiMenu,
|
menu: mdiMenu,
|
||||||
dropdownMenu: mdiMenuDown,
|
dropdownMenu: mdiMenuDown,
|
||||||
@@ -502,11 +525,7 @@ export default {
|
|||||||
return getUnifiedSelectedAccountsCurrencyOrDefaultCurrency(this.allAccounts, this.queryAllFilterAccountIds, this.userStore.currentUserDefaultCurrency);
|
return getUnifiedSelectedAccountsCurrencyOrDefaultCurrency(this.allAccounts, this.queryAllFilterAccountIds, this.userStore.currentUserDefaultCurrency);
|
||||||
},
|
},
|
||||||
canAddTransaction() {
|
canAddTransaction() {
|
||||||
if (this.queryAllFilterCategoryIdsCount > 1 || this.queryAllFilterAccountIdsCount > 1) {
|
if (this.query.accountIds && this.queryAllFilterAccountIdsCount === 1) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.query.accountIds) {
|
|
||||||
const account = this.allAccounts[this.query.accountIds];
|
const account = this.allAccounts[this.query.accountIds];
|
||||||
|
|
||||||
if (account && account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
|
if (account && account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
|
||||||
@@ -1040,14 +1059,20 @@ export default {
|
|||||||
this.currentPageTransactions = [];
|
this.currentPageTransactions = [];
|
||||||
this.transactionsStore.clearTransactions();
|
this.transactionsStore.clearTransactions();
|
||||||
this.$router.push(this.getFilterLinkUrl());
|
this.$router.push(this.getFilterLinkUrl());
|
||||||
|
},
|
||||||
|
showMultipleCategoriesDialog() {
|
||||||
|
|
||||||
|
},
|
||||||
|
showMultipleAccountsDialog() {
|
||||||
|
|
||||||
},
|
},
|
||||||
add() {
|
add() {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
self.$refs.editDialog.open({
|
self.$refs.editDialog.open({
|
||||||
type: self.query.type,
|
type: self.query.type,
|
||||||
categoryId: self.query.categoryIds,
|
categoryId: self.queryAllFilterCategoryIdsCount === 1 ? self.query.categoryIds : '',
|
||||||
accountId: self.query.accountIds
|
accountId: self.queryAllFilterAccountIdsCount === 1 ? self.query.accountIds : ''
|
||||||
}).then(result => {
|
}).then(result => {
|
||||||
if (result && result.message) {
|
if (result && result.message) {
|
||||||
self.$refs.snackbar.showMessage(result.message);
|
self.$refs.snackbar.showMessage(result.message);
|
||||||
@@ -1134,13 +1159,6 @@ export default {
|
|||||||
getDisplayTimezone(transaction) {
|
getDisplayTimezone(transaction) {
|
||||||
return `UTC${getUtcOffsetByUtcOffsetMinutes(transaction.utcOffset)}`;
|
return `UTC${getUtcOffsetByUtcOffsetMinutes(transaction.utcOffset)}`;
|
||||||
},
|
},
|
||||||
getDisplayAmount(amount, currency, hideAmount) {
|
|
||||||
if (hideAmount) {
|
|
||||||
return this.getDisplayCurrency('***', currency);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.getDisplayCurrency(amount, currency);
|
|
||||||
},
|
|
||||||
getDisplayMonthTotalAmount(amount, currency, symbol, incomplete) {
|
getDisplayMonthTotalAmount(amount, currency, symbol, incomplete) {
|
||||||
const displayAmount = this.getDisplayCurrency(amount, currency);
|
const displayAmount = this.getDisplayCurrency(amount, currency);
|
||||||
return symbol + displayAmount + (incomplete ? '+' : '');
|
return symbol + displayAmount + (incomplete ? '+' : '');
|
||||||
@@ -1172,6 +1190,9 @@ export default {
|
|||||||
getTransactionTypeFromCategoryType(categoryType) {
|
getTransactionTypeFromCategoryType(categoryType) {
|
||||||
return categoryTypeToTransactionType(parseInt(categoryType));
|
return categoryTypeToTransactionType(parseInt(categoryType));
|
||||||
},
|
},
|
||||||
|
getTransactionDisplayAmount(transaction) {
|
||||||
|
return getTransactionDisplayAmount(transaction, this.queryAllFilterAccountIdsCount, this.queryAllFilterAccountIds, this.getDisplayCurrency);
|
||||||
|
},
|
||||||
getCategoryListItemCheckedClass(category, queryCategoryIds) {
|
getCategoryListItemCheckedClass(category, queryCategoryIds) {
|
||||||
if (queryCategoryIds && queryCategoryIds[category.id]) {
|
if (queryCategoryIds && queryCategoryIds[category.id]) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<f7-nav-left :back-link="$t('Back')"></f7-nav-left>
|
<f7-nav-left :back-link="$t('Back')"></f7-nav-left>
|
||||||
<f7-nav-title :title="$t('Transaction List')"></f7-nav-title>
|
<f7-nav-title :title="$t('Transaction List')"></f7-nav-title>
|
||||||
<f7-nav-right class="navbar-compact-icons">
|
<f7-nav-right class="navbar-compact-icons">
|
||||||
<f7-link icon-f7="plus" :class="{ 'disabled': !canAddTransaction }" :href="`/transaction/add?type=${query.type}&categoryId=${query.categoryIds}&accountId=${query.accountIds}`"></f7-link>
|
<f7-link icon-f7="plus" :class="{ 'disabled': !canAddTransaction }" :href="`/transaction/add?type=${query.type}&categoryId=${queryAllFilterCategoryIdsCount === 1 ? query.categoryIds : ''}&accountId=${queryAllFilterAccountIdsCount === 1 ? query.accountIds : ''}`"></f7-link>
|
||||||
</f7-nav-right>
|
</f7-nav-right>
|
||||||
|
|
||||||
<f7-subnavbar :inner="false">
|
<f7-subnavbar :inner="false">
|
||||||
@@ -200,9 +200,7 @@
|
|||||||
<div class="item-after">
|
<div class="item-after">
|
||||||
<div class="transaction-amount" v-if="transaction.sourceAccount"
|
<div class="transaction-amount" v-if="transaction.sourceAccount"
|
||||||
:class="{ 'text-color-teal': transaction.type === allTransactionTypes.Expense, 'text-color-red': transaction.type === allTransactionTypes.Income }">
|
:class="{ 'text-color-teal': transaction.type === allTransactionTypes.Expense, 'text-color-red': transaction.type === allTransactionTypes.Income }">
|
||||||
<span v-if="!query.accountIds || (transaction.sourceAccount && (transaction.sourceAccount.id === query.accountIds || transaction.sourceAccount.parentId === query.accountIds))">{{ getDisplayAmount(transaction.sourceAmount, transaction.sourceAccount.currency, transaction.hideAmount) }}</span>
|
<span>{{ getTransactionDisplayAmount(transaction) }}</span>
|
||||||
<span v-else-if="query.accountIds && transaction.destinationAccount && (transaction.destinationAccount.id === query.accountIds || transaction.destinationAccount.parentId === query.accountIds)">{{ getDisplayAmount(transaction.destinationAmount, transaction.destinationAccount.currency, transaction.hideAmount) }}</span>
|
|
||||||
<span v-else></span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -286,12 +284,20 @@
|
|||||||
<f7-list dividers accordion-list>
|
<f7-list dividers accordion-list>
|
||||||
<f7-list-item :class="{ 'list-item-selected': !query.categoryIds }" :title="$t('All')" @click="changeCategoryFilter('')">
|
<f7-list-item :class="{ 'list-item-selected': !query.categoryIds }" :title="$t('All')" @click="changeCategoryFilter('')">
|
||||||
<template #media>
|
<template #media>
|
||||||
<f7-icon f7="rectangle_badge_checkmark"></f7-icon>
|
<f7-icon f7="rectangle_grid_2x2"></f7-icon>
|
||||||
</template>
|
</template>
|
||||||
<template #after>
|
<template #after>
|
||||||
<f7-icon class="list-item-checked-icon" f7="checkmark_alt" v-if="!query.categoryIds"></f7-icon>
|
<f7-icon class="list-item-checked-icon" f7="checkmark_alt" v-if="!query.categoryIds"></f7-icon>
|
||||||
</template>
|
</template>
|
||||||
</f7-list-item>
|
</f7-list-item>
|
||||||
|
<f7-list-item :class="{ 'list-item-selected': query.categoryIds && queryAllFilterCategoryIdsCount > 1 }" :title="$t('Multiple Categories')" @click="showMultipleCategoriesPopup()">
|
||||||
|
<template #media>
|
||||||
|
<f7-icon f7="rectangle_on_rectangle"></f7-icon>
|
||||||
|
</template>
|
||||||
|
<template #after>
|
||||||
|
<f7-icon class="list-item-checked-icon" f7="checkmark_alt" v-if="query.categoryIds && queryAllFilterCategoryIdsCount > 1"></f7-icon>
|
||||||
|
</template>
|
||||||
|
</f7-list-item>
|
||||||
</f7-list>
|
</f7-list>
|
||||||
<f7-list dividers accordion-list
|
<f7-list dividers accordion-list
|
||||||
class="no-margin-vertical"
|
class="no-margin-vertical"
|
||||||
@@ -311,16 +317,16 @@
|
|||||||
</template>
|
</template>
|
||||||
<f7-accordion-content>
|
<f7-accordion-content>
|
||||||
<f7-list dividers class="padding-left">
|
<f7-list dividers class="padding-left">
|
||||||
<f7-list-item :class="{ 'list-item-selected': query.categoryIds === category.id }" :title="$t('All')" @click="changeCategoryFilter(category.id)">
|
<f7-list-item :class="{ 'list-item-selected': queryAllFilterCategoryIds[category.id] }" :title="$t('All')" @click="changeCategoryFilter(category.id)">
|
||||||
<template #media>
|
<template #media>
|
||||||
<f7-icon f7="rectangle_badge_checkmark"></f7-icon>
|
<f7-icon f7="rectangle_grid_2x2"></f7-icon>
|
||||||
</template>
|
</template>
|
||||||
<template #after>
|
<template #after>
|
||||||
<f7-icon class="list-item-checked-icon" f7="checkmark_alt" v-if="query.categoryIds === category.id"></f7-icon>
|
<f7-icon class="list-item-checked-icon" f7="checkmark_alt" v-if="queryAllFilterCategoryIds[category.id]"></f7-icon>
|
||||||
</template>
|
</template>
|
||||||
</f7-list-item>
|
</f7-list-item>
|
||||||
<f7-list-item :title="subCategory.name"
|
<f7-list-item :title="subCategory.name"
|
||||||
:class="{ 'list-item-selected': query.categoryIds === subCategory.id }"
|
:class="{ 'list-item-selected': queryAllFilterCategoryIds[subCategory.id] }"
|
||||||
:key="subCategory.id"
|
:key="subCategory.id"
|
||||||
v-for="subCategory in category.subCategories"
|
v-for="subCategory in category.subCategories"
|
||||||
v-show="!subCategory.hidden"
|
v-show="!subCategory.hidden"
|
||||||
@@ -332,7 +338,7 @@
|
|||||||
<template #after>
|
<template #after>
|
||||||
<f7-icon class="list-item-checked-icon"
|
<f7-icon class="list-item-checked-icon"
|
||||||
f7="checkmark_alt"
|
f7="checkmark_alt"
|
||||||
v-if="query.categoryIds === subCategory.id">
|
v-if="queryAllFilterCategoryIds[subCategory.id]">
|
||||||
</f7-icon>
|
</f7-icon>
|
||||||
</template>
|
</template>
|
||||||
</f7-list-item>
|
</f7-list-item>
|
||||||
@@ -348,14 +354,22 @@
|
|||||||
<f7-list dividers>
|
<f7-list dividers>
|
||||||
<f7-list-item :class="{ 'list-item-selected': !query.accountIds }" :title="$t('All')" @click="changeAccountFilter('')">
|
<f7-list-item :class="{ 'list-item-selected': !query.accountIds }" :title="$t('All')" @click="changeAccountFilter('')">
|
||||||
<template #media>
|
<template #media>
|
||||||
<f7-icon f7="rectangle_badge_checkmark"></f7-icon>
|
<f7-icon f7="rectangle_grid_2x2"></f7-icon>
|
||||||
</template>
|
</template>
|
||||||
<template #after>
|
<template #after>
|
||||||
<f7-icon class="list-item-checked-icon" f7="checkmark_alt" v-if="!query.accountIds"></f7-icon>
|
<f7-icon class="list-item-checked-icon" f7="checkmark_alt" v-if="!query.accountIds"></f7-icon>
|
||||||
</template>
|
</template>
|
||||||
</f7-list-item>
|
</f7-list-item>
|
||||||
|
<f7-list-item :class="{ 'list-item-selected': query.accountIds && queryAllFilterAccountIdsCount > 1 }" :title="$t('Multiple Accounts')" @click="showMultipleAccountsPopup()">
|
||||||
|
<template #media>
|
||||||
|
<f7-icon f7="rectangle_on_rectangle"></f7-icon>
|
||||||
|
</template>
|
||||||
|
<template #after>
|
||||||
|
<f7-icon class="list-item-checked-icon" f7="checkmark_alt" v-if="query.accountIds && queryAllFilterAccountIdsCount > 1"></f7-icon>
|
||||||
|
</template>
|
||||||
|
</f7-list-item>
|
||||||
<f7-list-item :title="account.name"
|
<f7-list-item :title="account.name"
|
||||||
:class="{ 'list-item-selected': query.accountIds === account.id }"
|
:class="{ 'list-item-selected': queryAllFilterAccountIds[account.id] }"
|
||||||
:key="account.id"
|
:key="account.id"
|
||||||
v-for="account in allAccounts"
|
v-for="account in allAccounts"
|
||||||
v-show="!account.hidden"
|
v-show="!account.hidden"
|
||||||
@@ -367,7 +381,7 @@
|
|||||||
<template #after>
|
<template #after>
|
||||||
<f7-icon class="list-item-checked-icon"
|
<f7-icon class="list-item-checked-icon"
|
||||||
f7="checkmark_alt"
|
f7="checkmark_alt"
|
||||||
v-if="query.accountIds === account.id">
|
v-if="queryAllFilterAccountIds[account.id]">
|
||||||
</f7-icon>
|
</f7-icon>
|
||||||
</template>
|
</template>
|
||||||
</f7-list-item>
|
</f7-list-item>
|
||||||
@@ -461,6 +475,7 @@ import {
|
|||||||
} from '@/lib/datetime.js';
|
} from '@/lib/datetime.js';
|
||||||
import { categoryTypeToTransactionType, transactionTypeToCategoryType } from '@/lib/category.js';
|
import { categoryTypeToTransactionType, transactionTypeToCategoryType } from '@/lib/category.js';
|
||||||
import { getUnifiedSelectedAccountsCurrencyOrDefaultCurrency } from '@/lib/account.js';
|
import { getUnifiedSelectedAccountsCurrencyOrDefaultCurrency } from '@/lib/account.js';
|
||||||
|
import { getTransactionDisplayAmount } from '@/lib/transaction.js';
|
||||||
import { onSwipeoutDeleted, scrollToSelectedItem } from '@/lib/ui.mobile.js';
|
import { onSwipeoutDeleted, scrollToSelectedItem } from '@/lib/ui.mobile.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -490,11 +505,7 @@ export default {
|
|||||||
return getUnifiedSelectedAccountsCurrencyOrDefaultCurrency(this.allAccounts, this.queryAllFilterAccountIds, this.userStore.currentUserDefaultCurrency);
|
return getUnifiedSelectedAccountsCurrencyOrDefaultCurrency(this.allAccounts, this.queryAllFilterAccountIds, this.userStore.currentUserDefaultCurrency);
|
||||||
},
|
},
|
||||||
canAddTransaction() {
|
canAddTransaction() {
|
||||||
if (this.queryAllFilterCategoryIdsCount > 1 || this.queryAllFilterAccountIdsCount > 1) {
|
if (this.query.accountIds && this.queryAllFilterAccountIdsCount === 1) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.query.accountIds) {
|
|
||||||
const account = this.allAccounts[this.query.accountIds];
|
const account = this.allAccounts[this.query.accountIds];
|
||||||
|
|
||||||
if (account && account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
|
if (account && account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
|
||||||
@@ -868,6 +879,12 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.reload(null);
|
this.reload(null);
|
||||||
|
},
|
||||||
|
showMultipleCategoriesPopup() {
|
||||||
|
|
||||||
|
},
|
||||||
|
showMultipleAccountsPopup() {
|
||||||
|
|
||||||
},
|
},
|
||||||
duplicate(transaction) {
|
duplicate(transaction) {
|
||||||
this.f7router.navigate(`/transaction/add?id=${transaction.id}&type=${transaction.type}`);
|
this.f7router.navigate(`/transaction/add?id=${transaction.id}&type=${transaction.type}`);
|
||||||
@@ -936,13 +953,6 @@ export default {
|
|||||||
getDisplayTimezone(transaction) {
|
getDisplayTimezone(transaction) {
|
||||||
return `UTC${getUtcOffsetByUtcOffsetMinutes(transaction.utcOffset)}`;
|
return `UTC${getUtcOffsetByUtcOffsetMinutes(transaction.utcOffset)}`;
|
||||||
},
|
},
|
||||||
getDisplayAmount(amount, currency, hideAmount) {
|
|
||||||
if (hideAmount) {
|
|
||||||
return this.getDisplayCurrency('***', currency);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.getDisplayCurrency(amount, currency);
|
|
||||||
},
|
|
||||||
getDisplayMonthTotalAmount(amount, currency, symbol, incomplete) {
|
getDisplayMonthTotalAmount(amount, currency, symbol, incomplete) {
|
||||||
const displayAmount = this.getDisplayCurrency(amount, currency);
|
const displayAmount = this.getDisplayCurrency(amount, currency);
|
||||||
return symbol + displayAmount + (incomplete ? '+' : '');
|
return symbol + displayAmount + (incomplete ? '+' : '');
|
||||||
@@ -970,6 +980,9 @@ export default {
|
|||||||
getTransactionTypeFromCategoryType(categoryType) {
|
getTransactionTypeFromCategoryType(categoryType) {
|
||||||
return categoryTypeToTransactionType(parseInt(categoryType));
|
return categoryTypeToTransactionType(parseInt(categoryType));
|
||||||
},
|
},
|
||||||
|
getTransactionDisplayAmount(transaction) {
|
||||||
|
return getTransactionDisplayAmount(transaction, this.queryAllFilterAccountIdsCount, this.queryAllFilterAccountIds, this.getDisplayCurrency);
|
||||||
|
},
|
||||||
getTransactionDomId(transaction) {
|
getTransactionDomId(transaction) {
|
||||||
return 'transaction_' + transaction.id;
|
return 'transaction_' + transaction.id;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user