show transaction template count in data management page
This commit is contained in:
@@ -86,7 +86,7 @@ func (a *DataManagementsApi) DataStatisticsHandler(c *core.Context) (any, *errs.
|
||||
return nil, errs.ErrOperationFailed
|
||||
}
|
||||
|
||||
totalTransactionTemplateCount, err := a.templates.GetTotalTemplateCountByUid(c, uid)
|
||||
totalTransactionTemplateCount, err := a.templates.GetTotalNormalTemplateCountByUid(c, uid)
|
||||
|
||||
if err != nil {
|
||||
log.ErrorfWithRequestId(c, "[data_managements.DataStatisticsHandler] failed to get total transaction template count for user \"uid:%d\", because %s", uid, err.Error())
|
||||
|
||||
@@ -29,13 +29,13 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// GetTotalTemplateCountByUid returns total template count of user
|
||||
func (s *TransactionTemplateService) GetTotalTemplateCountByUid(c *core.Context, uid int64) (int64, error) {
|
||||
// GetTotalNormalTemplateCountByUid returns total template count of user
|
||||
func (s *TransactionTemplateService) GetTotalNormalTemplateCountByUid(c *core.Context, uid int64) (int64, error) {
|
||||
if uid <= 0 {
|
||||
return 0, errs.ErrUserIdInvalid
|
||||
}
|
||||
|
||||
count, err := s.UserDataDB(uid).NewSession(c).Where("uid=? AND deleted=?", uid, false).Count(&models.TransactionTemplate{})
|
||||
count, err := s.UserDataDB(uid).NewSession(c).Where("uid=? AND deleted=? AND template_type=?", uid, false, models.TRANSACTION_TEMPLATE_TYPE_NORMAL).Count(&models.TransactionTemplate{})
|
||||
|
||||
return count, err
|
||||
}
|
||||
|
||||
@@ -18,63 +18,49 @@
|
||||
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col cols="6" sm="3">
|
||||
<v-col cols="6" sm="3" v-for="item in [
|
||||
{
|
||||
title: 'Transactions',
|
||||
count: displayDataStatistics ? displayDataStatistics.totalTransactionCount : '-',
|
||||
icon: icons.transactions,
|
||||
color: 'info-darken-1'
|
||||
},
|
||||
{
|
||||
title: 'Accounts',
|
||||
count: displayDataStatistics ? displayDataStatistics.totalAccountCount : '-',
|
||||
icon: icons.accounts,
|
||||
color: 'primary'
|
||||
},
|
||||
{
|
||||
title: 'Transaction Categories',
|
||||
count: displayDataStatistics ? displayDataStatistics.totalTransactionCategoryCount : '-',
|
||||
icon: icons.categories,
|
||||
color: 'teal'
|
||||
},
|
||||
{
|
||||
title: 'Transaction Tags',
|
||||
count: displayDataStatistics ? displayDataStatistics.totalTransactionTagCount : '-',
|
||||
icon: icons.tags,
|
||||
color: 'secondary'
|
||||
},
|
||||
{
|
||||
title: 'Transaction Templates',
|
||||
count: displayDataStatistics ? displayDataStatistics.totalTransactionTemplateCount : '-',
|
||||
icon: icons.templates,
|
||||
color: 'secondary-darken-1'
|
||||
}
|
||||
]">
|
||||
<div class="d-flex align-center">
|
||||
<div class="me-3">
|
||||
<v-avatar rounded color="info" size="42" class="elevation-1">
|
||||
<v-icon size="24" :icon="icons.transactions"/>
|
||||
<v-avatar rounded :color="item.color" size="42" class="elevation-1">
|
||||
<v-icon size="24" :icon="item.icon"/>
|
||||
</v-avatar>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-column">
|
||||
<span class="text-caption">{{ $t('Transaction') }}</span>
|
||||
<span class="text-caption">{{ $t(item.title) }}</span>
|
||||
<v-skeleton-loader class="skeleton-no-margin pt-2 pb-2" type="text" style="width: 60px" :loading="true" v-if="loadingDataStatistics"></v-skeleton-loader>
|
||||
<span class="text-xl" v-if="!loadingDataStatistics">{{ displayDataStatistics ? displayDataStatistics.totalTransactionCount : '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="6" sm="3">
|
||||
<div class="d-flex align-center">
|
||||
<div class="me-3">
|
||||
<v-avatar rounded color="primary" size="42" class="elevation-1">
|
||||
<v-icon size="24" :icon="icons.accounts"/>
|
||||
</v-avatar>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-column">
|
||||
<span class="text-caption">{{ $t('Accounts') }}</span>
|
||||
<v-skeleton-loader class="skeleton-no-margin pt-2 pb-2" type="text" style="width: 60px" :loading="true" v-if="loadingDataStatistics"></v-skeleton-loader>
|
||||
<span class="text-xl" v-if="!loadingDataStatistics">{{ displayDataStatistics ? displayDataStatistics.totalAccountCount : '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="6" sm="3">
|
||||
<div class="d-flex align-center">
|
||||
<div class="me-3">
|
||||
<v-avatar rounded color="success" size="42" class="elevation-1">
|
||||
<v-icon size="24" :icon="icons.categories"/>
|
||||
</v-avatar>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-column">
|
||||
<span class="text-caption">{{ $t('Transaction Categories') }}</span>
|
||||
<v-skeleton-loader class="skeleton-no-margin pt-2 pb-2" type="text" style="width: 60px" :loading="true" v-if="loadingDataStatistics"></v-skeleton-loader>
|
||||
<span class="text-xl" v-if="!loadingDataStatistics">{{ displayDataStatistics ? displayDataStatistics.totalTransactionCategoryCount : '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="6" sm="3">
|
||||
<div class="d-flex align-center">
|
||||
<div class="me-3">
|
||||
<v-avatar rounded color="secondary" size="42" class="elevation-1">
|
||||
<v-icon size="24" :icon="icons.tags"/>
|
||||
</v-avatar>
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-column">
|
||||
<span class="text-caption">{{ $t('Transaction Tags') }}</span>
|
||||
<v-skeleton-loader class="skeleton-no-margin pt-2 pb-2" type="text" style="width: 60px" :loading="true" v-if="loadingDataStatistics"></v-skeleton-loader>
|
||||
<span class="text-xl" v-if="!loadingDataStatistics">{{ displayDataStatistics ? displayDataStatistics.totalTransactionTagCount : '-' }}</span>
|
||||
<span class="text-xl" v-if="!loadingDataStatistics">{{ item.count }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</v-col>
|
||||
@@ -174,6 +160,7 @@ import {
|
||||
mdiCreditCardOutline,
|
||||
mdiViewDashboardOutline,
|
||||
mdiTagOutline,
|
||||
mdiClipboardTextOutline,
|
||||
mdiAlert
|
||||
} from '@mdi/js';
|
||||
|
||||
@@ -191,6 +178,7 @@ export default {
|
||||
accounts: mdiCreditCardOutline,
|
||||
categories: mdiViewDashboardOutline,
|
||||
tags: mdiTagOutline,
|
||||
templates: mdiClipboardTextOutline,
|
||||
alert: mdiAlert
|
||||
}
|
||||
}
|
||||
@@ -205,10 +193,11 @@ export default {
|
||||
}
|
||||
|
||||
return {
|
||||
totalTransactionCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionCount),
|
||||
totalAccountCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalAccountCount),
|
||||
totalTransactionCategoryCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionCategoryCount),
|
||||
totalTransactionTagCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionTagCount),
|
||||
totalTransactionCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionCount)
|
||||
totalTransactionTemplateCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionTemplateCount)
|
||||
};
|
||||
},
|
||||
isDataExportingEnabled() {
|
||||
|
||||
@@ -3,17 +3,19 @@
|
||||
<f7-navbar :title="$t('Data Management')" :back-link="$t('Back')"></f7-navbar>
|
||||
|
||||
<f7-list strong inset dividers class="margin-vertical skeleton-text" v-if="loading">
|
||||
<f7-list-item title="Transactions" after="Count"></f7-list-item>
|
||||
<f7-list-item title="Accounts" after="Count"></f7-list-item>
|
||||
<f7-list-item title="Transaction Categories" after="Count"></f7-list-item>
|
||||
<f7-list-item title="Transaction Tags" after="Count"></f7-list-item>
|
||||
<f7-list-item title="Transactions" after="Count"></f7-list-item>
|
||||
<f7-list-item title="Transaction Templates" after="Count"></f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-list strong inset dividers class="margin-vertical" v-else-if="!loading">
|
||||
<f7-list-item :title="$t('Transactions')" :after="displayDataStatistics.totalTransactionCount"></f7-list-item>
|
||||
<f7-list-item :title="$t('Accounts')" :after="displayDataStatistics.totalAccountCount"></f7-list-item>
|
||||
<f7-list-item :title="$t('Transaction Categories')" :after="displayDataStatistics.totalTransactionCategoryCount"></f7-list-item>
|
||||
<f7-list-item :title="$t('Transaction Tags')" :after="displayDataStatistics.totalTransactionTagCount"></f7-list-item>
|
||||
<f7-list-item :title="$t('Transactions')" :after="displayDataStatistics.totalTransactionCount"></f7-list-item>
|
||||
<f7-list-item :title="$t('Transaction Templates')" :after="displayDataStatistics.totalTransactionTemplateCount"></f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<f7-list strong inset dividers class="margin-vertical" :class="{ 'disabled': loading }">
|
||||
@@ -103,10 +105,11 @@ export default {
|
||||
}
|
||||
|
||||
return {
|
||||
totalTransactionCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionCount),
|
||||
totalAccountCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalAccountCount),
|
||||
totalTransactionCategoryCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionCategoryCount),
|
||||
totalTransactionTagCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionTagCount),
|
||||
totalTransactionCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionCount)
|
||||
totalTransactionTemplateCount: self.$locale.appendDigitGroupingSymbol(self.userStore, self.dataStatistics.totalTransactionTemplateCount)
|
||||
};
|
||||
},
|
||||
isDataExportingEnabled() {
|
||||
|
||||
Reference in New Issue
Block a user