mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 08:44:25 +08:00
support changing account category order
This commit is contained in:
@@ -15,6 +15,9 @@ import {
|
||||
ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES
|
||||
} from '@/core/setting.ts';
|
||||
|
||||
|
||||
import { AccountCategory } from '@/core/account.ts';
|
||||
|
||||
import {
|
||||
isObject,
|
||||
isString,
|
||||
@@ -41,6 +44,8 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
|
||||
const enableApplicationCloudSync = computed<boolean>(() => getObjectOwnFieldCount(syncedAppSettings.value) > 0);
|
||||
|
||||
const accountCategoryDisplayOrders = computed<Record<number, number>>(() => AccountCategory.allDisplayOrders(appSettings.value.accountCategoryOrders));
|
||||
|
||||
function updateApplicationSettingsValueAndAppSettingsFromCloudSetting(key: string, value: string | number | boolean | Record<string, boolean>): void {
|
||||
const keyItems = key.split('.');
|
||||
const keyFirstPart = keyItems[0] as string;
|
||||
@@ -265,6 +270,12 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
updateUserApplicationCloudSettingValue('totalAmountExcludeAccountIds', value);
|
||||
}
|
||||
|
||||
function setAccountCategoryOrders(value: string): void {
|
||||
updateApplicationSettingsValue('accountCategoryOrders', value);
|
||||
appSettings.value.accountCategoryOrders = value;
|
||||
updateUserApplicationCloudSettingValue('accountCategoryOrders', value);
|
||||
}
|
||||
|
||||
function setHideCategoriesWithoutAccounts(value: boolean): void {
|
||||
updateApplicationSettingsValue('hideCategoriesWithoutAccounts', value);
|
||||
appSettings.value.hideCategoriesWithoutAccounts = value;
|
||||
@@ -459,6 +470,7 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
localeDefaultSettings,
|
||||
// computed states
|
||||
enableApplicationCloudSync,
|
||||
accountCategoryDisplayOrders,
|
||||
// functions
|
||||
// -- Basic Settings
|
||||
setTheme,
|
||||
@@ -491,6 +503,7 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
setShowTagInInsightsExplorerPage,
|
||||
// -- Account List Page
|
||||
setTotalAmountExcludeAccountIds,
|
||||
setAccountCategoryOrders,
|
||||
setHideCategoriesWithoutAccounts,
|
||||
// -- Exchange Rates Data Page
|
||||
setCurrencySortByInExchangeRatesPage,
|
||||
|
||||
Reference in New Issue
Block a user