fix the incorrect display type name of transaction categories

This commit is contained in:
MaysWind
2025-11-13 23:59:56 +08:00
parent 32cb2b2354
commit 8b34750426
8 changed files with 24 additions and 26 deletions
+4 -4
View File
@@ -146,7 +146,7 @@
</f7-navbar>
<f7-block class="no-padding no-margin"
:key="categoryType" v-for="(categories, categoryType) in allPresetCategories">
<f7-block-title class="margin-top margin-horizontal">{{ getCategoryTypeName(categoryType) }}</f7-block-title>
<f7-block-title class="margin-top margin-horizontal">{{ getCategoryTypeName(parseInt(categoryType)) }}</f7-block-title>
<f7-list strong inset dividers v-if="showPresetCategories">
<f7-list-item :title="category.name"
:accordion-item="!!category.subCategories.length"
@@ -203,9 +203,9 @@ import { useSignupPageBase } from '@/views/base/SignupPageBase.ts';
import { useRootStore } from '@/stores/index.ts';
import type { PartialRecord, TypeAndDisplayName } from '@/core/base.ts';
import type { TypeAndDisplayName } from '@/core/base.ts';
import type { LocalizedCurrencyInfo } from '@/core/currency.ts';
import { type LocalizedPresetCategory, CategoryType } from '@/core/category.ts';
import { type LocalizedPresetCategory } from '@/core/category.ts';
import { findDisplayNameByType, categorizedArrayToPlainArray } from '@/lib/common.ts';
import { isUserLogined } from '@/lib/userstate.ts';
@@ -244,7 +244,7 @@ const showPresetCategoriesChangeLocaleSheet = ref<boolean>(false);
const allLanguages = computed<LanguageOption[]>(() => getAllLanguageOptions(false));
const allCurrencies = computed<LocalizedCurrencyInfo[]>(() => getAllCurrencies());
const allWeekDays = computed<TypeAndDisplayName[]>(() => getAllWeekDays());
const allPresetCategories = computed<PartialRecord<CategoryType, LocalizedPresetCategory[]>>(() => getAllTransactionDefaultCategories(0, currentLocale.value));
const allPresetCategories = computed<Record<string, LocalizedPresetCategory[]>>(() => getAllTransactionDefaultCategories(0, currentLocale.value));
const currentDayOfWeekName = computed<string | null>(() => findDisplayNameByType(allWeekDays.value, user.value.firstDayOfWeek));
function submit(): void {
+3 -4
View File
@@ -10,7 +10,7 @@
</f7-navbar>
<f7-block class="no-padding no-margin" :key="categoryType" v-for="(categories, categoryType) in allPresetCategories">
<f7-block-title class="margin-top margin-horizontal">{{ getCategoryTypeName(categoryType) }}</f7-block-title>
<f7-block-title class="margin-top margin-horizontal">{{ getCategoryTypeName(parseInt(categoryType)) }}</f7-block-title>
<f7-list strong inset dividers class="margin-top">
<f7-list-item :title="category.name"
@@ -64,7 +64,6 @@ import type { Router } from 'framework7/types';
import { useI18n } from '@/locales/helpers.ts';
import { useI18nUIComponents, showLoading, hideLoading } from '@/lib/ui/mobile.ts';
import type { PartialRecord } from '@/core/base.ts';
import type { LanguageOption } from '@/locales/index.ts';
import { type LocalizedPresetCategory, CategoryType } from '@/core/category.ts';
import { getObjectOwnFieldCount, categorizedArrayToPlainArray } from '@/lib/common.ts';
@@ -88,10 +87,10 @@ const showMoreActionSheet = ref<boolean>(false);
const showChangeLocaleSheet = ref<boolean>(false);
const allLanguages = computed<LanguageOption[]>(() => getAllLanguageOptions(false));
const allPresetCategories = computed<PartialRecord<CategoryType, LocalizedPresetCategory[]>>(() => getAllTransactionDefaultCategories(categoryType.value, currentLocale.value));
const allPresetCategories = computed<Record<string, LocalizedPresetCategory[]>>(() => getAllTransactionDefaultCategories(categoryType.value, currentLocale.value));
const isPresetHasCategories = computed<boolean>(() => getObjectOwnFieldCount(allPresetCategories.value) > 0);
function getCategoryTypeName(categoryType: CategoryType): string {
function getCategoryTypeName(categoryType: number): string {
switch (categoryType) {
case CategoryType.Income:
return tt('Income Categories');