add search box in tag filter page / dialog (#382)

This commit is contained in:
MaysWind
2025-12-13 01:16:51 +08:00
parent 44039438e0
commit e9c3001c28
20 changed files with 89 additions and 175 deletions
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "Zurück", "Back": "Zurück",
"Load More": "Mehr laden", "Load More": "Mehr laden",
"Export Results": "Export Results", "Export Results": "Export Results",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "Back", "Back": "Back",
"Load More": "Load More", "Load More": "Load More",
"Export Results": "Export Results", "Export Results": "Export Results",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "Atrás", "Back": "Atrás",
"Load More": "Cargar Más", "Load More": "Cargar Más",
"Export Results": "Exportar Resultados", "Export Results": "Exportar Resultados",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "Retour", "Back": "Retour",
"Load More": "Charger plus", "Load More": "Charger plus",
"Export Results": "Exporter les résultats", "Export Results": "Exporter les résultats",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "Indietro", "Back": "Indietro",
"Load More": "Carica altro", "Load More": "Carica altro",
"Export Results": "Export Results", "Export Results": "Export Results",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "戻る", "Back": "戻る",
"Load More": "さらに読み込む", "Load More": "さらに読み込む",
"Export Results": "Export Results", "Export Results": "Export Results",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "ಎಲ್ಲವನ್ನು ಸೇರಿಸಲಾಗಿದೆ ಎನ್ನಿ", "Set All to Included": "ಎಲ್ಲವನ್ನು ಸೇರಿಸಲಾಗಿದೆ ಎನ್ನಿ",
"Set All to Default": "ಎಲ್ಲವನ್ನು ಡೀಫಾಲ್ಟ್‌ಗೆ ಸೆಟ್ ಮಾಡಿ", "Set All to Default": "ಎಲ್ಲವನ್ನು ಡೀಫಾಲ್ಟ್‌ಗೆ ಸೆಟ್ ಮಾಡಿ",
"Set All to Excluded": "ಎಲ್ಲವನ್ನು ಹೊರತುಪಡಿಸಿ ಎನ್ನಿ", "Set All to Excluded": "ಎಲ್ಲವನ್ನು ಹೊರತುಪಡಿಸಿ ಎನ್ನಿ",
"Set All Visible Items to Included": "ಗೋಚರಿಸುವ ಎಲ್ಲವನ್ನು ಸೇರಿಸಲಾಗಿದೆ ಎನ್ನಿ",
"Set All Visible Items to Default": "ಗೋಚರಿಸುವ ಎಲ್ಲವನ್ನು ಡೀಫಾಲ್ಟ್‌ಗೆ ಸೆಟ್ ಮಾಡಿ",
"Set All Visible Items to Excluded": "ಗೋಚರಿಸುವ ಎಲ್ಲವನ್ನು ಹೊರತುಪಡಿಸಿ",
"Back": "ಹಿಂದೆ", "Back": "ಹಿಂದೆ",
"Load More": "ಇನ್ನಷ್ಟು ಲೋಡ್ ಮಾಡಿ", "Load More": "ಇನ್ನಷ್ಟು ಲೋಡ್ ಮಾಡಿ",
"Export Results": "ಫಲಿತಾಂಶಗಳನ್ನು ರಫ್ತುಮಾಡಿ", "Export Results": "ಫಲಿತಾಂಶಗಳನ್ನು ರಫ್ತುಮಾಡಿ",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "뒤로", "Back": "뒤로",
"Load More": "더 불러오기", "Load More": "더 불러오기",
"Export Results": "결과 내보내기", "Export Results": "결과 내보내기",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "Terug", "Back": "Terug",
"Load More": "Meer laden", "Load More": "Meer laden",
"Export Results": "Resultaten exporteren", "Export Results": "Resultaten exporteren",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "Voltar", "Back": "Voltar",
"Load More": "Carregar Mais", "Load More": "Carregar Mais",
"Export Results": "Exportar Resultados", "Export Results": "Exportar Resultados",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "Назад", "Back": "Назад",
"Load More": "Загрузить еще", "Load More": "Загрузить еще",
"Export Results": "Export Results", "Export Results": "Export Results",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "กลับ", "Back": "กลับ",
"Load More": "โหลดเพิ่มเติม", "Load More": "โหลดเพิ่มเติม",
"Export Results": "ส่งออกผลลัพธ์", "Export Results": "ส่งออกผลลัพธ์",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Tümünü Dahil Et", "Set All to Included": "Tümünü Dahil Et",
"Set All to Default": "Tümünü Varsayılan Yap", "Set All to Default": "Tümünü Varsayılan Yap",
"Set All to Excluded": "Tümünü Hariç Tut", "Set All to Excluded": "Tümünü Hariç Tut",
"Set All Visible Items to Included": "Görünenlerin Tümünü Dahil Et",
"Set All Visible Items to Default": "Görünenlerin Tümünü Varsayılan Yap",
"Set All Visible Items to Excluded": "Görünenlerin Tümünü Hariç Tut",
"Back": "Geri", "Back": "Geri",
"Load More": "Daha Fazla Yükle", "Load More": "Daha Fazla Yükle",
"Export Results": "Sonuçları Dışa Aktar", "Export Results": "Sonuçları Dışa Aktar",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "Назад", "Back": "Назад",
"Load More": "Завантажити ще", "Load More": "Завантажити ще",
"Export Results": "Export Results", "Export Results": "Export Results",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "Set All to Included", "Set All to Included": "Set All to Included",
"Set All to Default": "Set All to Default", "Set All to Default": "Set All to Default",
"Set All to Excluded": "Set All to Excluded", "Set All to Excluded": "Set All to Excluded",
"Set All Visible Items to Included": "Set All Visible Items to Included",
"Set All Visible Items to Default": "Set All Visible Items to Default",
"Set All Visible Items to Excluded": "Set All Visible Items to Excluded",
"Back": "Quay lại", "Back": "Quay lại",
"Load More": "Tải thêm", "Load More": "Tải thêm",
"Export Results": "Export Results", "Export Results": "Export Results",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "全部设置为包含", "Set All to Included": "全部设置为包含",
"Set All to Default": "全部设置为默认", "Set All to Default": "全部设置为默认",
"Set All to Excluded": "全部设置为排除", "Set All to Excluded": "全部设置为排除",
"Set All Visible Items to Included": "全部可见项目设置为包含",
"Set All Visible Items to Default": "全部可见项目设置为默认",
"Set All Visible Items to Excluded": "全部可见项目设置为排除",
"Back": "返回", "Back": "返回",
"Load More": "加载更多", "Load More": "加载更多",
"Export Results": "导出结果", "Export Results": "导出结果",
-3
View File
@@ -1560,9 +1560,6 @@
"Set All to Included": "全部設為包含", "Set All to Included": "全部設為包含",
"Set All to Default": "全部設為預設", "Set All to Default": "全部設為預設",
"Set All to Excluded": "全部設為排除", "Set All to Excluded": "全部設為排除",
"Set All Visible Items to Included": "全部可見項目設為包含",
"Set All Visible Items to Default": "全部可見項目設為預設",
"Set All Visible Items to Excluded": "全部可見項目設為排除",
"Back": "返回", "Back": "返回",
"Load More": "載入更多", "Load More": "載入更多",
"Export Results": "匯出結果", "Export Results": "匯出結果",
@@ -24,6 +24,7 @@ export function useTransactionTagFilterSettingPageBase(type?: string) {
const loading = ref<boolean>(true); const loading = ref<boolean>(true);
const showHidden = ref<boolean>(false); const showHidden = ref<boolean>(false);
const filterContent = ref<string>('');
const filterTagIds = ref<Record<string, TransactionTagFilterState>>({}); const filterTagIds = ref<Record<string, TransactionTagFilterState>>({});
const includeTagFilterType = ref<number>(TransactionTagFilterType.HasAny.type); const includeTagFilterType = ref<number>(TransactionTagFilterType.HasAny.type);
const excludeTagFilterType = ref<number>(TransactionTagFilterType.NotHasAny.type); const excludeTagFilterType = ref<number>(TransactionTagFilterType.NotHasAny.type);
@@ -39,15 +40,23 @@ export function useTransactionTagFilterSettingPageBase(type?: string) {
return 'Apply'; return 'Apply';
}); });
const allTags = computed<TransactionTag[]>(() => transactionTagsStore.allTransactionTags); const allVisibleTags = computed<TransactionTag[]>(() => {
const hasAnyAvailableTag = computed<boolean>(() => transactionTagsStore.allAvailableTagsCount > 0); const ret: TransactionTag[] = [];
const hasAnyVisibleTag = computed<boolean>(() => { const allTags = showHidden.value ? transactionTagsStore.allTransactionTags : transactionTagsStore.allVisibleTags;
if (showHidden.value) { const lowercaseFilterContent = filterContent.value ? filterContent.value.toLowerCase() : '';
return transactionTagsStore.allAvailableTagsCount > 0;
} else { for (const tag of allTags) {
return transactionTagsStore.allVisibleTagsCount > 0; if (lowercaseFilterContent && !tag.name.toLowerCase().includes(lowercaseFilterContent)) {
continue;
}
ret.push(tag);
} }
return ret;
}); });
const hasAnyAvailableTag = computed<boolean>(() => transactionTagsStore.allAvailableTagsCount > 0);
const hasAnyVisibleTag = computed<boolean>(() => allVisibleTags.value.length > 0);
function loadFilterTagIds(): boolean { function loadFilterTagIds(): boolean {
let tagFilters: TransactionTagFilter[] = []; let tagFilters: TransactionTagFilter[] = [];
@@ -142,6 +151,7 @@ export function useTransactionTagFilterSettingPageBase(type?: string) {
// states // states
loading, loading,
showHidden, showHidden,
filterContent,
filterTagIds, filterTagIds,
includeTagFilterType, includeTagFilterType,
excludeTagFilterType, excludeTagFilterType,
@@ -150,7 +160,7 @@ export function useTransactionTagFilterSettingPageBase(type?: string) {
excludeTagsCount, excludeTagsCount,
title, title,
applyText, applyText,
allTags, allVisibleTags,
hasAnyAvailableTag, hasAnyAvailableTag,
hasAnyVisibleTag, hasAnyVisibleTag,
// functions // functions
@@ -1,95 +1,46 @@
<template> <template>
<v-card :class="{ 'pa-2 pa-sm-4 pa-md-8': dialogMode }"> <v-card :class="{ 'pa-2 pa-sm-4 pa-md-8': dialogMode }">
<template #title> <template #title>
<div class="d-flex align-center justify-center" v-if="dialogMode"> <v-row>
<div class="w-100 text-center"> <v-col cols="6">
<h4 class="text-h4">{{ tt(title) }}</h4> <div :class="{ 'text-h4': dialogMode }">
</div> {{ tt(title) }}
<v-btn density="comfortable" color="default" variant="text" class="ms-2" </div>
:disabled="loading || !hasAnyAvailableTag" :icon="true"> </v-col>
<v-icon :icon="mdiDotsVertical" /> <v-col cols="6" class="d-flex align-center">
<v-menu activator="parent"> <v-text-field eager ref="filterInput" density="compact"
<v-list> :prepend-inner-icon="mdiMagnify"
<v-list-item :prepend-icon="mdiSelectAll" :placeholder="tt('Find tag')"
:title="tt('Set All to Included')" v-model="filterContent"></v-text-field>
:disabled="!hasAnyVisibleTag" <v-btn density="comfortable" color="default" variant="text" class="ms-2"
@click="setAllTagsState(false, TransactionTagFilterState.Include)"></v-list-item> :disabled="loading || !hasAnyAvailableTag" :icon="true">
<v-list-item :prepend-icon="mdiSelectAll" <v-icon :icon="mdiDotsVertical" />
:title="tt('Set All to Default')" <v-menu activator="parent">
:disabled="!hasAnyVisibleTag" <v-list>
@click="setAllTagsState(false, TransactionTagFilterState.Default)"></v-list-item> <v-list-item :prepend-icon="mdiSelectAll"
<v-list-item :prepend-icon="mdiSelectAll" :title="tt('Set All to Included')"
:title="tt('Set All to Excluded')" :disabled="!hasAnyVisibleTag"
:disabled="!hasAnyVisibleTag" @click="setAllTagsState(TransactionTagFilterState.Include)"></v-list-item>
@click="setAllTagsState(false, TransactionTagFilterState.Exclude)"></v-list-item> <v-list-item :prepend-icon="mdiSelectAll"
<v-divider class="my-2"/> :title="tt('Set All to Default')"
<v-list-item :prepend-icon="mdiSelectAll" :disabled="!hasAnyVisibleTag"
:title="tt('Set All Visible Items to Included')" @click="setAllTagsState(TransactionTagFilterState.Default)"></v-list-item>
:disabled="!hasAnyVisibleTag" <v-list-item :prepend-icon="mdiSelectAll"
@click="setAllTagsState(true, TransactionTagFilterState.Include)"></v-list-item> :title="tt('Set All to Excluded')"
<v-list-item :prepend-icon="mdiSelectAll" :disabled="!hasAnyVisibleTag"
:title="tt('Set All Visible Items to Default')" @click="setAllTagsState(TransactionTagFilterState.Exclude)"></v-list-item>
:disabled="!hasAnyVisibleTag" <v-divider class="my-2"/>
@click="setAllTagsState(true, TransactionTagFilterState.Default)"></v-list-item> <v-list-item :prepend-icon="mdiEyeOutline"
<v-list-item :prepend-icon="mdiSelectAll" :title="tt('Show Hidden Transaction Tags')"
:title="tt('Set All Visible Items to Excluded')" v-if="!showHidden" @click="showHidden = true"></v-list-item>
:disabled="!hasAnyVisibleTag" <v-list-item :prepend-icon="mdiEyeOffOutline"
@click="setAllTagsState(true, TransactionTagFilterState.Exclude)"></v-list-item> :title="tt('Hide Hidden Transaction Tags')"
<v-divider class="my-2"/> v-if="showHidden" @click="showHidden = false"></v-list-item>
<v-list-item :prepend-icon="mdiEyeOutline" </v-list>
:title="tt('Show Hidden Transaction Tags')" </v-menu>
v-if="!showHidden" @click="showHidden = true"></v-list-item> </v-btn>
<v-list-item :prepend-icon="mdiEyeOffOutline" </v-col>
:title="tt('Hide Hidden Transaction Tags')" </v-row>
v-if="showHidden" @click="showHidden = false"></v-list-item>
</v-list>
</v-menu>
</v-btn>
</div>
<div class="d-flex align-center" v-else-if="!dialogMode">
<span>{{ tt(title) }}</span>
<v-spacer/>
<v-btn density="comfortable" color="default" variant="text" class="ms-2"
:disabled="loading" :icon="true">
<v-icon :icon="mdiDotsVertical" />
<v-menu activator="parent">
<v-list>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Set All to Included')"
:disabled="!hasAnyVisibleTag"
@click="setAllTagsState(false, TransactionTagFilterState.Include)"></v-list-item>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Set All to Default')"
:disabled="!hasAnyVisibleTag"
@click="setAllTagsState(false, TransactionTagFilterState.Default)"></v-list-item>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Set All to Excluded')"
:disabled="!hasAnyVisibleTag"
@click="setAllTagsState(false, TransactionTagFilterState.Exclude)"></v-list-item>
<v-divider class="my-2"/>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Set All Visible Items to Included')"
:disabled="!hasAnyVisibleTag"
@click="setAllTagsState(true, TransactionTagFilterState.Include)"></v-list-item>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Set All Visible Items to Default')"
:disabled="!hasAnyVisibleTag"
@click="setAllTagsState(true, TransactionTagFilterState.Default)"></v-list-item>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Set All Visible Items to Excluded')"
:disabled="!hasAnyVisibleTag"
@click="setAllTagsState(true, TransactionTagFilterState.Exclude)"></v-list-item>
<v-divider class="my-2"/>
<v-list-item :prepend-icon="mdiEyeOutline"
:title="tt('Show Hidden Transaction Tags')"
v-if="!showHidden" @click="showHidden = true"></v-list-item>
<v-list-item :prepend-icon="mdiEyeOffOutline"
:title="tt('Hide Hidden Transaction Tags')"
v-if="showHidden" @click="showHidden = false"></v-list-item>
</v-list>
</v-menu>
</v-btn>
</div>
</template> </template>
<div v-if="loading"> <div v-if="loading">
@@ -130,7 +81,7 @@
<v-expansion-panel-text> <v-expansion-panel-text>
<v-list rounded density="comfortable" class="pa-0"> <v-list rounded density="comfortable" class="pa-0">
<template :key="transactionTag.id" <template :key="transactionTag.id"
v-for="transactionTag in allTags"> v-for="transactionTag in allVisibleTags">
<v-list-item v-if="showHidden || !transactionTag.hidden"> <v-list-item v-if="showHidden || !transactionTag.hidden">
<template #prepend> <template #prepend>
<v-badge class="right-bottom-icon" color="secondary" <v-badge class="right-bottom-icon" color="secondary"
@@ -161,7 +112,7 @@
<v-card-text class="overflow-y-visible" v-if="dialogMode"> <v-card-text class="overflow-y-visible" v-if="dialogMode">
<div class="w-100 d-flex justify-center mt-2 mt-sm-4 mt-md-6 gap-4"> <div class="w-100 d-flex justify-center mt-2 mt-sm-4 mt-md-6 gap-4">
<v-btn :disabled="!hasAnyVisibleTag" @click="save">{{ tt(applyText) }}</v-btn> <v-btn :disabled="!hasAnyAvailableTag" @click="save">{{ tt(applyText) }}</v-btn>
<v-btn color="secondary" variant="tonal" @click="cancel">{{ tt('Cancel') }}</v-btn> <v-btn color="secondary" variant="tonal" @click="cancel">{{ tt('Cancel') }}</v-btn>
</div> </div>
</v-card-text> </v-card-text>
@@ -187,6 +138,7 @@ import { TransactionTagFilterType } from '@/core/transaction.ts';
import type { TransactionTag } from '@/models/transaction_tag.ts'; import type { TransactionTag } from '@/models/transaction_tag.ts';
import { import {
mdiMagnify,
mdiSelectAll, mdiSelectAll,
mdiEyeOutline, mdiEyeOutline,
mdiEyeOffOutline, mdiEyeOffOutline,
@@ -211,6 +163,7 @@ const { tt } = useI18n();
const { const {
loading, loading,
showHidden, showHidden,
filterContent,
filterTagIds, filterTagIds,
includeTagFilterType, includeTagFilterType,
excludeTagFilterType, excludeTagFilterType,
@@ -218,7 +171,7 @@ const {
excludeTagsCount, excludeTagsCount,
title, title,
applyText, applyText,
allTags, allVisibleTags,
hasAnyAvailableTag, hasAnyAvailableTag,
hasAnyVisibleTag, hasAnyVisibleTag,
loadFilterTagIds, loadFilterTagIds,
@@ -273,12 +226,8 @@ function updateTransactionTagExcludeType(value: number): void {
} }
} }
function setAllTagsState(onlyVisible: boolean, value: TransactionTagFilterState): void { function setAllTagsState(value: TransactionTagFilterState): void {
for (const tag of allTags.value) { for (const tag of allVisibleTags.value) {
if (onlyVisible && !showHidden.value && tag.hidden) {
continue;
}
filterTagIds.value[tag.id] = value; filterTagIds.value[tag.id] = value;
} }
@@ -1,12 +1,22 @@
<template> <template>
<f7-page @page:afterin="onPageAfterIn"> <f7-page with-subnavbar @page:beforein="onPageBeforeIn" @page:afterin="onPageAfterIn">
<f7-navbar> <f7-navbar>
<f7-nav-left :back-link="tt('Back')"></f7-nav-left> <f7-nav-left :back-link="tt('Back')"></f7-nav-left>
<f7-nav-title :title="tt(title)"></f7-nav-title> <f7-nav-title :title="tt(title)"></f7-nav-title>
<f7-nav-right class="navbar-compact-icons"> <f7-nav-right class="navbar-compact-icons">
<f7-link icon-f7="ellipsis" :class="{ 'disabled': !hasAnyAvailableTag }" @click="showMoreActionSheet = true"></f7-link> <f7-link icon-f7="ellipsis" :class="{ 'disabled': !hasAnyAvailableTag }" @click="showMoreActionSheet = true"></f7-link>
<f7-link icon-f7="checkmark_alt" :class="{ 'disabled': !hasAnyVisibleTag }" @click="save"></f7-link> <f7-link icon-f7="checkmark_alt" :class="{ 'disabled': !hasAnyAvailableTag }" @click="save"></f7-link>
</f7-nav-right> </f7-nav-right>
<f7-subnavbar :inner="false">
<f7-searchbar
custom-searchs
:value="filterContent"
:placeholder="tt('Find tag')"
:disable-button-text="tt('Cancel')"
@change="filterContent = $event.target.value"
></f7-searchbar>
</f7-subnavbar>
</f7-navbar> </f7-navbar>
<f7-block class="combination-list-wrapper margin-vertical skeleton-text" v-if="loading"> <f7-block class="combination-list-wrapper margin-vertical skeleton-text" v-if="loading">
@@ -85,7 +95,7 @@
:value="transactionTag.id" :value="transactionTag.id"
:key="transactionTag.id" :key="transactionTag.id"
:after="tt(filterTagIds[transactionTag.id] === TransactionTagFilterState.Include ? 'Included' : filterTagIds[transactionTag.id] === TransactionTagFilterState.Exclude ? 'Excluded' : 'Default')" :after="tt(filterTagIds[transactionTag.id] === TransactionTagFilterState.Include ? 'Included' : filterTagIds[transactionTag.id] === TransactionTagFilterState.Exclude ? 'Excluded' : 'Default')"
v-for="transactionTag in allTags" v-for="transactionTag in allVisibleTags"
v-show="showHidden || !transactionTag.hidden" v-show="showHidden || !transactionTag.hidden"
@click="currentTransactionTagId = transactionTag.id"> @click="currentTransactionTagId = transactionTag.id">
<template #media> <template #media>
@@ -122,14 +132,9 @@
<f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false"> <f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false">
<f7-actions-group> <f7-actions-group>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="setAllTagsState(false, TransactionTagFilterState.Include)">{{ tt('Set All to Included') }}</f7-actions-button> <f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="setAllTagsState(TransactionTagFilterState.Include)">{{ tt('Set All to Included') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="setAllTagsState(false, TransactionTagFilterState.Default)">{{ tt('Set All to Default') }}</f7-actions-button> <f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="setAllTagsState(TransactionTagFilterState.Default)">{{ tt('Set All to Default') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="setAllTagsState(false, TransactionTagFilterState.Exclude)">{{ tt('Set All to Excluded') }}</f7-actions-button> <f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="setAllTagsState(TransactionTagFilterState.Exclude)">{{ tt('Set All to Excluded') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="setAllTagsState(true, TransactionTagFilterState.Include)">{{ tt('Set All Visible Items to Included') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="setAllTagsState(true, TransactionTagFilterState.Default)">{{ tt('Set All Visible Items to Default') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="setAllTagsState(true, TransactionTagFilterState.Exclude)">{{ tt('Set All Visible Items to Excluded') }}</f7-actions-button>
</f7-actions-group> </f7-actions-group>
<f7-actions-group> <f7-actions-group>
<f7-actions-button v-if="!showHidden" @click="showHidden = true">{{ tt('Show Hidden Transaction Tags') }}</f7-actions-button> <f7-actions-button v-if="!showHidden" @click="showHidden = true">{{ tt('Show Hidden Transaction Tags') }}</f7-actions-button>
@@ -174,13 +179,14 @@ const { showToast, routeBackOnError } = useI18nUIComponents();
const { const {
loading, loading,
showHidden, showHidden,
filterContent,
filterTagIds, filterTagIds,
includeTagFilterType, includeTagFilterType,
excludeTagFilterType, excludeTagFilterType,
includeTagsCount, includeTagsCount,
excludeTagsCount, excludeTagsCount,
title, title,
allTags, allVisibleTags,
hasAnyAvailableTag, hasAnyAvailableTag,
hasAnyVisibleTag, hasAnyVisibleTag,
loadFilterTagIds, loadFilterTagIds,
@@ -224,12 +230,8 @@ function updateCurrentTransactionTagState(state: number): void {
currentTransactionTagId.value = ''; currentTransactionTagId.value = '';
} }
function setAllTagsState(onlyVisible: boolean, value: TransactionTagFilterState): void { function setAllTagsState(value: TransactionTagFilterState): void {
for (const tag of allTags.value) { for (const tag of allVisibleTags.value) {
if (onlyVisible && !showHidden.value && tag.hidden) {
continue;
}
filterTagIds.value[tag.id] = value; filterTagIds.value[tag.id] = value;
} }
} }
@@ -239,6 +241,10 @@ function save(): void {
props.f7router.back(); props.f7router.back();
} }
function onPageBeforeIn(): void {
filterContent.value = '';
}
function onPageAfterIn(): void { function onPageAfterIn(): void {
routeBackOnError(props.f7router, loadingError); routeBackOnError(props.f7router, loadingError);
} }