don't show account balance when account balance is set to hidden

This commit is contained in:
MaysWind
2021-04-05 23:00:01 +08:00
parent cb0ea368f2
commit 668ece6490
2 changed files with 22 additions and 4 deletions
+2 -1
View File
@@ -59,7 +59,7 @@
<span class="skeleton-text" v-if="skeleton">Name</span>
<span v-else-if="!skeleton && selectedItem.name">{{ selectedItem.name }}</span>
<span class="skeleton-text" v-if="skeleton">Value</span>
<span v-else-if="!skeleton" :style="(selectedItem ? selectedItem.color : '') | iconStyle('default', 'var(--default-icon-color)')">{{ selectedItem.value | currency(selectedItem.currency || defaultCurrency) }}</span>
<span v-else-if="!skeleton && showValue" :style="(selectedItem ? selectedItem.color : '') | iconStyle('default', 'var(--default-icon-color)')">{{ selectedItem.value | currency(selectedItem.currency || defaultCurrency) }}</span>
<f7-icon class="item-navigate-icon" f7="chevron_right" v-if="enableClickItem"></f7-icon>
</f7-link>
<f7-link :no-link-class="true" v-else-if="!validItems || !validItems.length">
@@ -101,6 +101,7 @@ export default {
'hiddenField',
'minValidPercent',
'defaultCurrency',
'showValue',
'showCenterText',
'showSelectedItemInfo',
'enableClickItem',
+20 -3
View File
@@ -40,6 +40,7 @@
<pie-chart
:items="statisticsData.items"
:min-valid-percent="0.0001"
:show-value="showAmountInChart"
:show-center-text="true"
:show-selected-item-info="true"
:enable-click-item="true"
@@ -57,7 +58,7 @@
{{ query.chartDataType | totalAmountName(allChartDataTypes) | localized }}
</text>
<text class="statistics-pie-chart-total-amount-value" v-if="statisticsData.items && statisticsData.items.length">
{{ statisticsData.totalAmount | currency(defaultCurrency) | textLimit(16) }}
{{ statisticsData.totalAmount | currency(defaultCurrency) | finalAmount(showAccountBalance, query.chartDataType, allChartDataTypes) | textLimit(16) }}
</text>
<text class="statistics-pie-chart-total-no-data" cy="50%" v-if="!statisticsData.items || !statisticsData.items.length">
{{ $t('No data') }}
@@ -146,7 +147,7 @@
</div>
<div slot="title"
:class="{ 'statistics-list-item-overview-amount': true, 'text-color-teal': query.chartDataType === allChartDataTypes.ExpenseByAccount.type || query.chartDataType === allChartDataTypes.ExpenseByPrimaryCategory.type || query.chartDataType === allChartDataTypes.ExpenseBySecondaryCategory.type, 'text-color-red': query.chartDataType === allChartDataTypes.IncomeByAccount.type || query.chartDataType === allChartDataTypes.IncomeByPrimaryCategory.type || query.chartDataType === allChartDataTypes.IncomeBySecondaryCategory.type }">
{{ statisticsData.totalAmount | currency(defaultCurrency) }}
{{ statisticsData.totalAmount | currency(defaultCurrency) | finalAmount(showAccountBalance, query.chartDataType, allChartDataTypes) }}
</div>
</f7-list-item>
<f7-list-item v-for="(item, idx) in statisticsData.items" :key="idx"
@@ -172,7 +173,7 @@
</div>
<div slot="after">
<span>{{ item.totalAmount | currency(item.currency || defaultCurrency) }}</span>
<span>{{ item.totalAmount | currency(item.currency || defaultCurrency) | finalAmount(showAccountBalance, query.chartDataType, allChartDataTypes) }}</span>
</div>
<div slot="inner-end" class="statistics-item-end">
@@ -255,6 +256,7 @@ export default {
loading: true,
loadingError: null,
sortBy: self.$settings.getStatisticsSortingType(),
showAccountBalance: self.$settings.isShowAccountBalance(),
showChartDataTypePopover: false,
showDatePopover: false,
showCustomDateRangeSheet: false,
@@ -355,6 +357,14 @@ export default {
totalAmount: combinedData.totalAmount,
items: allStatisticsItems
};
},
showAmountInChart() {
if (!this.showAccountBalance
&& (this.query.chartDataType === this.allChartDataTypes.AccountTotalAssets.type || this.query.chartDataType === this.allChartDataTypes.AccountTotalLiabilities.type)) {
return false;
}
return true;
}
},
created() {
@@ -605,6 +615,13 @@ export default {
}
},
filters: {
finalAmount(amount, isShowAccountBalance, dataType, allChartDataTypes) {
if (!isShowAccountBalance && (dataType === allChartDataTypes.AccountTotalAssets.type || dataType === allChartDataTypes.AccountTotalLiabilities.type)) {
return '***';
}
return amount;
},
chartDataTypeName(dataType, allChartDataTypes) {
for (let chartDataTypeField in allChartDataTypes) {
if (!Object.prototype.hasOwnProperty.call(allChartDataTypes, chartDataTypeField)) {