mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 01:34:24 +08:00
hide multiple accounts / categories item when there are no accounts / categories
This commit is contained in:
@@ -146,7 +146,8 @@
|
|||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-list-item key="multiple" value="multiple" class="text-sm" density="compact"
|
<v-list-item key="multiple" value="multiple" class="text-sm" density="compact"
|
||||||
:class="{ 'list-item-selected': query.categoryIds && queryAllFilterCategoryIdsCount > 1 }"
|
:class="{ 'list-item-selected': query.categoryIds && queryAllFilterCategoryIdsCount > 1 }"
|
||||||
:append-icon="(query.categoryIds && queryAllFilterCategoryIdsCount > 1 ? icons.check : null)">
|
:append-icon="(query.categoryIds && queryAllFilterCategoryIdsCount > 1 ? icons.check : null)"
|
||||||
|
v-if="allAvailableCategoriesCount > 0">
|
||||||
<v-list-item-title class="cursor-pointer"
|
<v-list-item-title class="cursor-pointer"
|
||||||
@click="showFilterCategoryDialog = true">
|
@click="showFilterCategoryDialog = true">
|
||||||
<div class="d-flex align-center">
|
<div class="d-flex align-center">
|
||||||
@@ -158,7 +159,7 @@
|
|||||||
|
|
||||||
<template :key="categoryType"
|
<template :key="categoryType"
|
||||||
v-for="(categories, categoryType) in allPrimaryCategories">
|
v-for="(categories, categoryType) in allPrimaryCategories">
|
||||||
<v-list-item density="compact">
|
<v-list-item density="compact" v-show="categories && categories.length">
|
||||||
<v-list-item-title>
|
<v-list-item-title>
|
||||||
<span class="text-sm">{{ getTransactionTypeName(getTransactionTypeFromCategoryType(categoryType), 'Type') }}</span>
|
<span class="text-sm">{{ getTransactionTypeName(getTransactionTypeFromCategoryType(categoryType), 'Type') }}</span>
|
||||||
</v-list-item-title>
|
</v-list-item-title>
|
||||||
@@ -290,7 +291,8 @@
|
|||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-list-item key="multiple" value="multiple" class="text-sm" density="compact"
|
<v-list-item key="multiple" value="multiple" class="text-sm" density="compact"
|
||||||
:class="{ 'list-item-selected': query.accountIds && queryAllFilterAccountIdsCount > 1 }"
|
:class="{ 'list-item-selected': query.accountIds && queryAllFilterAccountIdsCount > 1 }"
|
||||||
:append-icon="(query.accountIds && queryAllFilterAccountIdsCount > 1 ? icons.check : null)">
|
:append-icon="(query.accountIds && queryAllFilterAccountIdsCount > 1 ? icons.check : null)"
|
||||||
|
v-if="allAvailableAccountsCount > 0">
|
||||||
<v-list-item-title class="cursor-pointer"
|
<v-list-item-title class="cursor-pointer"
|
||||||
@click="showFilterAccountDialog = true">
|
@click="showFilterAccountDialog = true">
|
||||||
<div class="d-flex align-center">
|
<div class="d-flex align-center">
|
||||||
@@ -896,6 +898,9 @@ export default {
|
|||||||
allAccounts() {
|
allAccounts() {
|
||||||
return this.accountsStore.allAccountsMap;
|
return this.accountsStore.allAccountsMap;
|
||||||
},
|
},
|
||||||
|
allAvailableAccountsCount() {
|
||||||
|
return this.accountsStore.allAvailableAccountsCount;
|
||||||
|
},
|
||||||
allCategories() {
|
allCategories() {
|
||||||
return this.transactionCategoriesStore.allTransactionCategoriesMap;
|
return this.transactionCategoriesStore.allTransactionCategoriesMap;
|
||||||
},
|
},
|
||||||
@@ -916,6 +921,25 @@ export default {
|
|||||||
|
|
||||||
return primaryCategories;
|
return primaryCategories;
|
||||||
},
|
},
|
||||||
|
allAvailableCategoriesCount() {
|
||||||
|
let totalCount = 0;
|
||||||
|
|
||||||
|
for (const categoryType in this.transactionCategoriesStore.allTransactionCategories) {
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(this.transactionCategoriesStore.allTransactionCategories, categoryType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.query.type && this.getTransactionTypeFromCategoryType(categoryType) !== this.query.type) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.transactionCategoriesStore.allTransactionCategories[categoryType]) {
|
||||||
|
totalCount += this.transactionCategoriesStore.allTransactionCategories[categoryType].length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return totalCount;
|
||||||
|
},
|
||||||
allTransactionTags() {
|
allTransactionTags() {
|
||||||
return this.transactionTagsStore.allTransactionTagsMap;
|
return this.transactionTagsStore.allTransactionTagsMap;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -300,7 +300,10 @@
|
|||||||
<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="filterMultipleCategories()">
|
<f7-list-item :class="{ 'list-item-selected': query.categoryIds && queryAllFilterCategoryIdsCount > 1 }"
|
||||||
|
:title="$t('Multiple Categories')"
|
||||||
|
@click="filterMultipleCategories()"
|
||||||
|
v-if="allAvailableCategoriesCount > 0">
|
||||||
<template #media>
|
<template #media>
|
||||||
<f7-icon f7="rectangle_on_rectangle"></f7-icon>
|
<f7-icon f7="rectangle_on_rectangle"></f7-icon>
|
||||||
</template>
|
</template>
|
||||||
@@ -313,6 +316,7 @@
|
|||||||
class="no-margin-vertical"
|
class="no-margin-vertical"
|
||||||
:key="categoryType"
|
:key="categoryType"
|
||||||
v-for="(categories, categoryType) in allPrimaryCategories"
|
v-for="(categories, categoryType) in allPrimaryCategories"
|
||||||
|
v-show="categories && categories.length"
|
||||||
>
|
>
|
||||||
<f7-list-item divider :title="getTransactionTypeName(getTransactionTypeFromCategoryType(categoryType), 'Type')"></f7-list-item>
|
<f7-list-item divider :title="getTransactionTypeName(getTransactionTypeFromCategoryType(categoryType), 'Type')"></f7-list-item>
|
||||||
<f7-list-item accordion-item
|
<f7-list-item accordion-item
|
||||||
@@ -371,7 +375,10 @@
|
|||||||
<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="filterMultipleAccounts()">
|
<f7-list-item :class="{ 'list-item-selected': query.accountIds && queryAllFilterAccountIdsCount > 1 }"
|
||||||
|
:title="$t('Multiple Accounts')"
|
||||||
|
@click="filterMultipleAccounts()"
|
||||||
|
v-if="allAvailableAccountsCount > 0">
|
||||||
<template #media>
|
<template #media>
|
||||||
<f7-icon f7="rectangle_on_rectangle"></f7-icon>
|
<f7-icon f7="rectangle_on_rectangle"></f7-icon>
|
||||||
</template>
|
</template>
|
||||||
@@ -657,6 +664,9 @@ export default {
|
|||||||
allAccounts() {
|
allAccounts() {
|
||||||
return this.accountsStore.allAccountsMap;
|
return this.accountsStore.allAccountsMap;
|
||||||
},
|
},
|
||||||
|
allAvailableAccountsCount() {
|
||||||
|
return this.accountsStore.allAvailableAccountsCount;
|
||||||
|
},
|
||||||
allCategories() {
|
allCategories() {
|
||||||
return this.transactionCategoriesStore.allTransactionCategoriesMap;
|
return this.transactionCategoriesStore.allTransactionCategoriesMap;
|
||||||
},
|
},
|
||||||
@@ -677,6 +687,25 @@ export default {
|
|||||||
|
|
||||||
return primaryCategories;
|
return primaryCategories;
|
||||||
},
|
},
|
||||||
|
allAvailableCategoriesCount() {
|
||||||
|
let totalCount = 0;
|
||||||
|
|
||||||
|
for (const categoryType in this.transactionCategoriesStore.allTransactionCategories) {
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(this.transactionCategoriesStore.allTransactionCategories, categoryType)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.query.type && this.getTransactionTypeFromCategoryType(categoryType) !== this.query.type) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.transactionCategoriesStore.allTransactionCategories[categoryType]) {
|
||||||
|
totalCount += this.transactionCategoriesStore.allTransactionCategories[categoryType].length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return totalCount;
|
||||||
|
},
|
||||||
allTransactionTags() {
|
allTransactionTags() {
|
||||||
return this.transactionTagsStore.allTransactionTagsMap;
|
return this.transactionTagsStore.allTransactionTagsMap;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user