mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 08:14:25 +08:00
filter transaction description keywords in statistics & analysis page
This commit is contained in:
@@ -313,6 +313,10 @@
|
||||
<f7-actions-button @click="filterCategories">{{ tt('Filter Transaction Categories') }}</f7-actions-button>
|
||||
<f7-actions-button @click="filterTags">{{ tt('Filter Transaction Tags') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
<f7-actions-group>
|
||||
<f7-actions-label v-if="query.keyword">{{ query.keyword }}</f7-actions-label>
|
||||
<f7-actions-button @click="filterDescription">{{ tt('Filter transaction description') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
<f7-actions-group>
|
||||
<f7-actions-button @click="settings">{{ tt('Settings') }}</f7-actions-button>
|
||||
</f7-actions-group>
|
||||
@@ -360,7 +364,7 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const { tt, getAllCategoricalChartTypes, formatPercent } = useI18n();
|
||||
const { showToast, routeBackOnError } = useI18nUIComponents();
|
||||
const { showPrompt, showToast, routeBackOnError } = useI18nUIComponents();
|
||||
|
||||
const {
|
||||
loading,
|
||||
@@ -697,6 +701,30 @@ function filterTags(): void {
|
||||
props.f7router.navigate('/settings/filter/tag?type=statisticsCurrent');
|
||||
}
|
||||
|
||||
function filterDescription(): void {
|
||||
showPrompt('Filter transaction description', query.value.keyword, value => {
|
||||
if (query.value.keyword === value) {
|
||||
return;
|
||||
}
|
||||
|
||||
let changed = false;
|
||||
|
||||
if (analysisType.value === StatisticsAnalysisType.CategoricalAnalysis) {
|
||||
changed = statisticsStore.updateTransactionStatisticsFilter({
|
||||
keyword: value
|
||||
});
|
||||
} else if (analysisType.value === StatisticsAnalysisType.TrendAnalysis) {
|
||||
changed = statisticsStore.updateTransactionStatisticsFilter({
|
||||
keyword: value
|
||||
});
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function settings(): void {
|
||||
props.f7router.navigate('/statistic/settings');
|
||||
}
|
||||
|
||||
@@ -941,7 +941,8 @@ function init(): void {
|
||||
categoryIds: initQuery['categoryIds'],
|
||||
accountIds: initQuery['accountIds'],
|
||||
tagIds: initQuery['tagIds'],
|
||||
tagFilterType: initQuery['tagFilterType'] && parseInt(initQuery['tagFilterType']) >= 0 ? parseInt(initQuery['tagFilterType']) : undefined
|
||||
tagFilterType: initQuery['tagFilterType'] && parseInt(initQuery['tagFilterType']) >= 0 ? parseInt(initQuery['tagFilterType']) : undefined,
|
||||
keyword: initQuery['keyword']
|
||||
});
|
||||
|
||||
reload();
|
||||
|
||||
Reference in New Issue
Block a user