support setting account categories hidden which has no accounts

This commit is contained in:
MaysWind
2026-01-04 14:05:52 +08:00
parent fb25f589fb
commit 6e369f39a4
24 changed files with 53 additions and 3 deletions
+2 -1
View File
@@ -33,7 +33,8 @@ var ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES = map[string]UserApplicationClo
"insightsExplorerDefaultDateRangeType": USER_APPLICATION_CLOUD_SETTING_TYPE_NUMBER,
"showTagInInsightsExplorerPage": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN,
// Account List Page
"totalAmountExcludeAccountIds": USER_APPLICATION_CLOUD_SETTING_TYPE_STRING_BOOLEAN_MAP,
"totalAmountExcludeAccountIds": USER_APPLICATION_CLOUD_SETTING_TYPE_STRING_BOOLEAN_MAP,
"hideCategoriesWithoutAccounts": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN,
// Exchange Rates Data Page
"currencySortByInExchangeRatesPage": USER_APPLICATION_CLOUD_SETTING_TYPE_NUMBER,
// Statistics Settings
+3
View File
@@ -55,6 +55,7 @@ export interface ApplicationSettings extends BaseApplicationSetting {
showTagInInsightsExplorerPage: boolean;
// Account List Page
totalAmountExcludeAccountIds: Record<string, boolean>;
hideCategoriesWithoutAccounts: boolean;
// Exchange Rates Data Page
currencySortByInExchangeRatesPage: number;
// Statistics Settings
@@ -120,6 +121,7 @@ export const ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES: Record<string, UserAp
'showTagInInsightsExplorerPage': UserApplicationCloudSettingType.Boolean,
// Account List Page
'totalAmountExcludeAccountIds': UserApplicationCloudSettingType.StringBooleanMap,
'hideCategoriesWithoutAccounts': UserApplicationCloudSettingType.Boolean,
// Exchange Rates Data Page
'currencySortByInExchangeRatesPage': UserApplicationCloudSettingType.Number,
// Statistics Settings
@@ -170,6 +172,7 @@ export const DEFAULT_APPLICATION_SETTINGS: ApplicationSettings = {
showTagInInsightsExplorerPage: true,
// Account List Page
totalAmountExcludeAccountIds: {},
hideCategoriesWithoutAccounts: false,
// Exchange Rates Data Page
currencySortByInExchangeRatesPage: CurrencySortingType.Default.type,
// Statistics Settings
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Wechselkursdatenseite",
"Exchange Rate": "Wechselkurs",
"Enable Swipe Back": "Enable Swipe Back",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Exchange Rates Data Page",
"Exchange Rate": "Exchange Rate",
"Enable Swipe Back": "Enable Swipe Back",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Página de Cuentas",
"Accounts Included in Total": "Cuentas Incluidas en el Total",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Página de Tipos de Cambio",
"Exchange Rate": "Tipo de Cambio",
"Enable Swipe Back": "Deslizar para Regresar",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Page de liste des comptes",
"Accounts Included in Total": "Comptes inclus dans le total",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Page des données de taux de change",
"Exchange Rate": "Taux de change",
"Enable Swipe Back": "Activer le balayage de retour",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Pagina dati tassi di cambio",
"Exchange Rate": "Tasso di cambio",
"Enable Swipe Back": "Enable Swipe Back",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "為替レートデータページ",
"Exchange Rate": "為替レート",
"Enable Swipe Back": "Enable Swipe Back",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "ಖಾತೆ ಪಟ್ಟಿ ಪುಟ",
"Accounts Included in Total": "ಒಟ್ಟು ಮೊತ್ತದಲ್ಲಿ ಒಳಗೊಂಡ ಖಾತೆಗಳು",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "ವಿನಿಮಯ ದರಗಳ ಪುಟ",
"Exchange Rate": "ವಿನಿಮಯ ದರ",
"Enable Swipe Back": "ಸ್ವೈಪ್ ಬ್ಯಾಕ್ ಸಕ್ರಿಯಗೊಳಿಸಿ",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "계좌 목록 페이지",
"Accounts Included in Total": "총계에 포함된 계좌",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "환율 데이터 페이지",
"Exchange Rate": "환율",
"Enable Swipe Back": "스와이프 뒤로 가기 활성화",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Rekeningenpagina",
"Accounts Included in Total": "Rekeningen opgenomen in totaal",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Wisselkoersgegevenspagina",
"Exchange Rate": "Wisselkoers",
"Enable Swipe Back": "Enable Swipe Back",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Página de Dados de Taxas de Câmbio",
"Exchange Rate": "Taxa de Câmbio",
"Enable Swipe Back": "Enable Swipe Back",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Страница данных о курсах валют",
"Exchange Rate": "Курс обмена",
"Enable Swipe Back": "Enable Swipe Back",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Stran za vpoglede in raziskovanje",
"Account List Page": "Stran s seznamom računov",
"Accounts Included in Total": "Računi vključeni v skupno vsoto",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Stran z menjalnimi tečaji",
"Exchange Rate": "Menjalni tečaj",
"Enable Swipe Back": "Omogoči podrsanje nazaj",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "หน้าบัญชี",
"Accounts Included in Total": "บัญชีที่รวมในผลรวม",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "หน้าข้อมูลอัตราแลกเปลี่ยน",
"Exchange Rate": "อัตราแลกเปลี่ยน",
"Enable Swipe Back": "เปิดใช้งานปัดย้อนกลับ",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Hesap Listesi Sayfası",
"Accounts Included in Total": "Toplama Dahil Edilen Hesaplar",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Döviz Kuru Verileri Sayfası",
"Exchange Rate": "Döviz Kuru",
"Enable Swipe Back": "Geri Kaydırmayı Etkinleştir",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Сторінка курсів валют",
"Exchange Rate": "Курс обміну",
"Enable Swipe Back": "Enable Swipe Back",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "Insights Explorer Page",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
"Exchange Rates Data Page": "Trang dữ liệu tỷ giá hối đoái",
"Exchange Rate": "Tỷ giá hối đoái",
"Enable Swipe Back": "Enable Swipe Back",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "洞察探索页面",
"Account List Page": "账户列表页面",
"Accounts Included in Total": "计入总金额的账户",
"Hide Categories Without Accounts": "隐藏没有账户的分类",
"Exchange Rates Data Page": "汇率数据页面",
"Exchange Rate": "汇率",
"Enable Swipe Back": "启用侧滑返回",
+1
View File
@@ -2190,6 +2190,7 @@
"Insights Explorer Page": "洞察探索頁面",
"Account List Page": "帳戶清單頁面",
"Accounts Included in Total": "計入總金額的帳戶",
"Hide Categories Without Accounts": "隱藏沒有帳戶的分類",
"Exchange Rates Data Page": "匯率資料頁面",
"Exchange Rate": "匯率",
"Enable Swipe Back": "啟用滑動返回",
+7
View File
@@ -265,6 +265,12 @@ export const useSettingsStore = defineStore('settings', () => {
updateUserApplicationCloudSettingValue('totalAmountExcludeAccountIds', value);
}
function setHideCategoriesWithoutAccounts(value: boolean): void {
updateApplicationSettingsValue('hideCategoriesWithoutAccounts', value);
appSettings.value.hideCategoriesWithoutAccounts = value;
updateUserApplicationCloudSettingValue('hideCategoriesWithoutAccounts', value);
}
// Exchange Rates Data Page
function setCurrencySortByInExchangeRatesPage(value: number): void {
updateApplicationSettingsValue('currencySortByInExchangeRatesPage', value);
@@ -485,6 +491,7 @@ export const useSettingsStore = defineStore('settings', () => {
setShowTagInInsightsExplorerPage,
// -- Account List Page
setTotalAmountExcludeAccountIds,
setHideCategoriesWithoutAccounts,
// -- Exchange Rates Data Page
setCurrencySortByInExchangeRatesPage,
// -- Statistics Settings
@@ -60,7 +60,8 @@ export const ALL_APPLICATION_CLOUD_SETTINGS: CategorizedApplicationCloudSettingI
{
categoryName: 'Account List Page',
items: [
{ settingKey: 'totalAmountExcludeAccountIds', settingName: 'Accounts Included in Total', mobile: true, desktop: true }
{ settingKey: 'totalAmountExcludeAccountIds', settingName: 'Accounts Included in Total', mobile: true, desktop: true },
{ settingKey: 'hideCategoriesWithoutAccounts', settingName: 'Hide Categories Without Accounts', mobile: false, desktop: true }
]
},
{
+5 -1
View File
@@ -31,7 +31,8 @@
<v-tabs show-arrows class="account-category-tabs my-4" direction="vertical"
:disabled="loading" v-model="activeAccountCategoryType">
<v-tab class="tab-text-truncate" :key="accountCategory.type" :value="accountCategory.type"
v-for="accountCategory in AccountCategory.values()">
v-for="accountCategory in AccountCategory.values()"
v-show="!hideAccountCategoriesWithoutAccounts || (allCategorizedAccountsMap[accountCategory.type] && allCategorizedAccountsMap[accountCategory.type]!.accounts.length > 0)">
<ItemIcon icon-type="account" :icon-id="accountCategory.defaultAccountIconId" />
<div class="d-flex flex-column text-truncate ms-2">
<small class="text-truncate text-start smaller" v-if="!loading || allAccountCount > 0">{{ accountCategoryTotalBalance(accountCategory) }}</small>
@@ -327,6 +328,7 @@ import { useDisplay } from 'vuetify';
import { useI18n } from '@/locales/helpers.ts';
import { useAccountListPageBase } from '@/views/base/accounts/AccountListPageBase.ts';
import { useSettingsStore } from '@/stores/setting.ts';
import { useAccountsStore } from '@/stores/account.ts';
import { DateRange, DateRangeScene, type LocalizedDateRange, type TimeRangeAndDateType } from '@/core/datetime.ts';
@@ -382,6 +384,7 @@ const {
accountBalance
} = useAccountListPageBase();
const settingsStore = useSettingsStore();
const accountsStore = useAccountsStore();
const confirmDialog = useTemplateRef<ConfirmDialogType>('confirmDialog');
@@ -400,6 +403,7 @@ const showNav = ref<boolean>(display.mdAndUp.value);
const showAccountsIncludedInTotalDialog = ref<boolean>(false);
const showCustomDateRangeDialog = ref<boolean>(false);
const hideAccountCategoriesWithoutAccounts = computed<boolean>(() => settingsStore.appSettings.hideCategoriesWithoutAccounts);
const hasAnyVisibleAccount = computed<boolean>(() => accountsStore.allVisibleAccountsCount > 0);
const activeAccountCategory = computed<AccountCategory | undefined>(() => AccountCategory.valueOf(activeAccountCategoryType.value));
const activeAccountCategoryTotalBalance = computed<string>(() => accountCategoryTotalBalance(activeAccountCategory.value));
@@ -277,6 +277,17 @@
@click="showAccountsIncludedInTotalDialog = true"
/>
</v-col>
<v-col cols="12" md="6">
<v-select
item-title="displayName"
item-value="value"
persistent-placeholder
:label="tt('Hide Categories Without Accounts')"
:placeholder="tt('Hide Categories Without Accounts')"
:items="enableDisableOptions"
v-model="hideCategoriesWithoutAccounts"
/>
</v-col>
</v-row>
</v-card-text>
</v-form>
@@ -421,6 +432,11 @@ const showTagInInsightsExplorerPage = computed<boolean>({
set: (value) => settingsStore.setShowTagInInsightsExplorerPage(value)
});
const hideCategoriesWithoutAccounts = computed<boolean>({
get: () => settingsStore.appSettings.hideCategoriesWithoutAccounts,
set: (value) => settingsStore.setHideCategoriesWithoutAccounts(value)
});
function init(): void {
loadingAccounts.value = true;