support filtering account or category in statistics page

This commit is contained in:
MaysWind
2021-02-05 00:38:51 +08:00
parent 75b3c2ab4b
commit 47190a0725
7 changed files with 641 additions and 0 deletions
@@ -231,6 +231,10 @@
</date-range-selection-sheet>
<f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false">
<f7-actions-group>
<f7-actions-button @click="filterAccounts">{{ $t('Filter Accounts') }}</f7-actions-button>
<f7-actions-button @click="filterCategories">{{ $t('Filter Transaction Categories') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group>
<f7-actions-button @click="settings">{{ $t('Settings') }}</f7-actions-button>
</f7-actions-group>
@@ -535,6 +539,12 @@ export default {
clickPieChartItem(item) {
this.$f7router.navigate(this.$options.filters.itemLinkUrl(item, this.query, this.$constants.statistics.allChartDataTypes));
},
filterAccounts() {
this.$f7router.navigate('/statistic/filter/account');
},
filterCategories() {
this.$f7router.navigate('/statistic/filter/category');
},
settings() {
this.$f7router.navigate('/statistic/settings');
},
@@ -565,6 +575,14 @@ export default {
continue;
}
if (this.query.filterAccountIds && this.query.filterAccountIds[item.account.id]) {
continue;
}
if (this.query.filterCategoryIds && this.query.filterCategoryIds[item.category.id]) {
continue;
}
if (this.query.chartDataType === this.$constants.statistics.allChartDataTypes.ExpenseByAccount.type ||
this.query.chartDataType === this.$constants.statistics.allChartDataTypes.IncomeByAccount.type) {
if (this.$utilities.isNumber(item.amountInDefaultCurrency)) {
@@ -656,6 +674,10 @@ export default {
}
}
if (this.query.filterAccountIds && this.query.filterAccountIds[account.id]) {
continue;
}
let primaryAccount = this.$store.state.allAccountsMap[account.parentId];
if (!primaryAccount) {