diff --git a/src/lib/account.js b/src/lib/account.js
index 568cd274..37c5eb02 100644
--- a/src/lib/account.js
+++ b/src/lib/account.js
@@ -128,7 +128,7 @@ export function getCategorizedAccounts(allAccounts) {
return ret;
}
-export function getVisibleCategorizedAccounts(categorizedAccounts) {
+export function getCategorizedAccountsWithVisibleCount(categorizedAccounts) {
const ret = {};
for (let i = 0; i < accountConstants.allCategories.length; i++) {
@@ -139,8 +139,11 @@ export function getVisibleCategorizedAccounts(categorizedAccounts) {
}
const allAccounts = categorizedAccounts[accountCategory.id].accounts;
- const visibleAccounts = [];
- const allVisibleSubAccounts = {};
+ const allSubAccounts = {};
+ const allVisibleSubAccountCounts = {};
+ const allFirstVisibleSubAccountIndexes = {};
+ let allVisibleAccountCount = 0;
+ let firstVisibleAccountIndex = -1;
for (let j = 0; j < allAccounts.length; j++) {
const account = allAccounts[j];
@@ -149,36 +152,55 @@ export function getVisibleCategorizedAccounts(categorizedAccounts) {
continue;
}
- visibleAccounts.push(account);
+ allVisibleAccountCount++;
+
+ if (firstVisibleAccountIndex === -1) {
+ firstVisibleAccountIndex = j;
+ }
if (account.type === accountConstants.allAccountTypes.MultiSubAccounts && account.subAccounts) {
- const visibleSubAccounts = [];
+ const subAccounts = [];
+ let visibleSubAccountCount = 0;
+ let firstVisibleSubAccountIndex = -1;
for (let k = 0; k < account.subAccounts.length; k++) {
const subAccount = account.subAccounts[k];
+ subAccounts.push(subAccount);
if (!subAccount.hidden) {
- visibleSubAccounts.push(subAccount);
+ visibleSubAccountCount++;
+
+ if (firstVisibleSubAccountIndex === -1) {
+ firstVisibleSubAccountIndex = k;
+ }
}
}
- if (visibleSubAccounts.length > 0) {
- allVisibleSubAccounts[account.id] = visibleSubAccounts;
+ if (subAccounts.length > 0) {
+ allSubAccounts[account.id] = subAccounts;
+ allVisibleSubAccountCounts[account.id] = visibleSubAccountCount;
+ allFirstVisibleSubAccountIndexes[account.id] = firstVisibleSubAccountIndex;
}
}
}
- if (visibleAccounts.length > 0) {
+ if (allAccounts.length > 0) {
ret[accountCategory.id] = {
category: accountCategory.id,
name: accountCategory.name,
icon: accountCategory.defaultAccountIconId,
- visibleAccounts: visibleAccounts,
- visibleSubAccounts: allVisibleSubAccounts
+ allAccounts: allAccounts,
+ allVisibleAccountCount: allVisibleAccountCount,
+ firstVisibleAccountIndex: firstVisibleAccountIndex,
+ allSubAccounts: allSubAccounts,
+ allVisibleSubAccountCounts: allVisibleSubAccountCounts,
+ allFirstVisibleSubAccountIndexes: allFirstVisibleSubAccountIndexes
};
}
}
+ console.log(ret)
+
return ret;
}
diff --git a/src/views/desktop/common/cards/AccountFilterSettingsCard.vue b/src/views/desktop/common/cards/AccountFilterSettingsCard.vue
index 64d2566c..8e789b69 100644
--- a/src/views/desktop/common/cards/AccountFilterSettingsCard.vue
+++ b/src/views/desktop/common/cards/AccountFilterSettingsCard.vue
@@ -19,6 +19,13 @@
+
+
+
@@ -40,6 +47,13 @@
+
+
+
@@ -60,51 +74,53 @@
+ v-for="accountCategory in allCategorizedAccounts"
+ v-show="showHidden || accountCategory.allVisibleAccountCount > 0">
{{ $t(accountCategory.name) }}
-
+ v-for="(account, idx) in accountCategory.allAccounts">
+
+
+
-
+
{{ account.name }}
-
+
+ v-if="account.type === allAccountTypes.MultiSubAccounts && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])">
-
+ v-for="(subAccount, subIdx) in accountCategory.allSubAccounts[account.id]">
+
+
+
-
+
{{ subAccount.name }}
-
-
-
@@ -131,7 +147,7 @@ import { useStatisticsStore } from '@/stores/statistics.js';
import accountConstants from '@/consts/account.js';
import { copyObjectTo } from '@/lib/common.js';
import {
- getVisibleCategorizedAccounts,
+ getCategorizedAccountsWithVisibleCount,
selectAccountOrSubAccounts,
selectAll,
selectNone,
@@ -144,6 +160,8 @@ import {
mdiSelectAll,
mdiSelect,
mdiSelectInverse,
+ mdiEyeOutline,
+ mdiEyeOffOutline,
mdiDotsVertical
} from '@mdi/js';
@@ -161,10 +179,13 @@ export default {
loading: true,
expandAccountCategories: accountConstants.allCategories.map(category => category.id),
filterAccountIds: {},
+ showHidden: false,
icons: {
selectAll: mdiSelectAll,
selectNone: mdiSelect,
selectInverse: mdiSelectInverse,
+ show: mdiEyeOutline,
+ hide: mdiEyeOffOutline,
more: mdiDotsVertical
}
}
@@ -188,11 +209,11 @@ export default {
allAccountTypes() {
return accountConstants.allAccountTypes;
},
- allVisibleCategorizedAccounts() {
- return getVisibleCategorizedAccounts(this.accountsStore.allCategorizedAccounts);
+ allCategorizedAccounts() {
+ return getCategorizedAccountsWithVisibleCount(this.accountsStore.allCategorizedAccounts);
},
hasAnyAvailableAccount() {
- return this.accountsStore.allVisibleAccountsCount > 0;
+ return this.accountsStore.allAvailableAccountsCount > 0;
}
},
created() {
diff --git a/src/views/mobile/settings/AccountFilterSettingsPage.vue b/src/views/mobile/settings/AccountFilterSettingsPage.vue
index 53cd7bf4..ff9529a3 100644
--- a/src/views/mobile/settings/AccountFilterSettingsPage.vue
+++ b/src/views/mobile/settings/AccountFilterSettingsPage.vue
@@ -44,7 +44,8 @@
-
+
+
+
+
+
+ v-if="account.type === allAccountTypes.MultiSubAccounts && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])">
-
+
+
+
+
+
@@ -106,6 +117,10 @@
{{ $t('Select None') }}
{{ $t('Invert Selection') }}
+
+ {{ $t('Show Hidden Accounts') }}
+ {{ $t('Hide Hidden Accounts') }}
+
{{ $t('Cancel') }}
@@ -123,7 +138,7 @@ import { useStatisticsStore } from '@/stores/statistics.js';
import accountConstants from '@/consts/account.js';
import { copyObjectTo } from '@/lib/common.js';
import {
- getVisibleCategorizedAccounts,
+ getCategorizedAccountsWithVisibleCount,
selectAccountOrSubAccounts,
selectAll,
selectNone,
@@ -145,6 +160,7 @@ export default {
loadingError: null,
type: null,
filterAccountIds: {},
+ showHidden: false,
collapseStates: self.getCollapseStates(),
showMoreActionSheet: false
}
@@ -168,11 +184,11 @@ export default {
allAccountTypes() {
return accountConstants.allAccountTypes;
},
- allVisibleCategorizedAccounts() {
- return getVisibleCategorizedAccounts(this.accountsStore.allCategorizedAccounts);
+ allCategorizedAccounts() {
+ return getCategorizedAccountsWithVisibleCount(this.accountsStore.allCategorizedAccounts);
},
hasAnyAvailableAccount() {
- return this.accountsStore.allVisibleAccountsCount > 0;
+ return this.accountsStore.allAvailableAccountsCount > 0;
}
},
created() {