support changing account category order
This commit is contained in:
@@ -34,6 +34,7 @@ var ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES = map[string]UserApplicationClo
|
|||||||
"showTagInInsightsExplorerPage": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN,
|
"showTagInInsightsExplorerPage": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN,
|
||||||
// Account List Page
|
// Account List Page
|
||||||
"totalAmountExcludeAccountIds": USER_APPLICATION_CLOUD_SETTING_TYPE_STRING_BOOLEAN_MAP,
|
"totalAmountExcludeAccountIds": USER_APPLICATION_CLOUD_SETTING_TYPE_STRING_BOOLEAN_MAP,
|
||||||
|
"accountCategoryOrders": USER_APPLICATION_CLOUD_SETTING_TYPE_STRING,
|
||||||
"hideCategoriesWithoutAccounts": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN,
|
"hideCategoriesWithoutAccounts": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN,
|
||||||
// Exchange Rates Data Page
|
// Exchange Rates Data Page
|
||||||
"currencySortByInExchangeRatesPage": USER_APPLICATION_CLOUD_SETTING_TYPE_NUMBER,
|
"currencySortByInExchangeRatesPage": USER_APPLICATION_CLOUD_SETTING_TYPE_NUMBER,
|
||||||
|
|||||||
+39
-6
@@ -1,4 +1,4 @@
|
|||||||
import type { TypeAndName, TypeAndDisplayName } from './base.ts';
|
import { type TypeAndName, type TypeAndDisplayName, itemAndIndex } from './base.ts';
|
||||||
|
|
||||||
export class AccountType implements TypeAndName {
|
export class AccountType implements TypeAndName {
|
||||||
private static readonly allInstances: AccountType[] = [];
|
private static readonly allInstances: AccountType[] = [];
|
||||||
@@ -38,15 +38,15 @@ export class AccountCategory implements TypeAndName {
|
|||||||
public static readonly Default = AccountCategory.Cash;
|
public static readonly Default = AccountCategory.Cash;
|
||||||
|
|
||||||
public readonly type: number;
|
public readonly type: number;
|
||||||
public readonly displayOrder: number;
|
public readonly defaultDisplayOrder: number;
|
||||||
public readonly name: string;
|
public readonly name: string;
|
||||||
public readonly isAsset: boolean;
|
public readonly isAsset: boolean;
|
||||||
public readonly isLiability: boolean
|
public readonly isLiability: boolean
|
||||||
public readonly defaultAccountIconId: string;
|
public readonly defaultAccountIconId: string;
|
||||||
|
|
||||||
private constructor(type: number, displayOrder: number, name: string, isAsset: boolean, isLiability: boolean, defaultAccountIconId: string) {
|
private constructor(type: number, defaultDisplayOrder: number, name: string, isAsset: boolean, isLiability: boolean, defaultAccountIconId: string) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.displayOrder = displayOrder;
|
this.defaultDisplayOrder = defaultDisplayOrder;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.isAsset = isAsset;
|
this.isAsset = isAsset;
|
||||||
this.isLiability = isLiability;
|
this.isLiability = isLiability;
|
||||||
@@ -56,8 +56,41 @@ export class AccountCategory implements TypeAndName {
|
|||||||
AccountCategory.allInstancesByType[type] = this;
|
AccountCategory.allInstancesByType[type] = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static values(): AccountCategory[] {
|
public static values(customAccountCategoryOrder?: string): AccountCategory[] {
|
||||||
return AccountCategory.allInstances;
|
if (!customAccountCategoryOrder) {
|
||||||
|
return [...AccountCategory.allInstances];
|
||||||
|
}
|
||||||
|
|
||||||
|
const typeOrders: string[] = customAccountCategoryOrder.split(',');
|
||||||
|
const orderedCategories: AccountCategory[] = [];
|
||||||
|
const addedTypes: Record<string, boolean> = {};
|
||||||
|
|
||||||
|
for (const type of typeOrders) {
|
||||||
|
const category = AccountCategory.valueOf(parseInt(type.trim()));
|
||||||
|
|
||||||
|
if (category) {
|
||||||
|
orderedCategories.push(category);
|
||||||
|
addedTypes[type] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const category of AccountCategory.allInstances) {
|
||||||
|
if (!addedTypes[category.type]) {
|
||||||
|
orderedCategories.push(category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return orderedCategories;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static allDisplayOrders(customAccountCategoryOrder: string): Record<number, number> {
|
||||||
|
const displayOrders: Record<number, number> = {};
|
||||||
|
|
||||||
|
for (const [category, index] of itemAndIndex(AccountCategory.values(customAccountCategoryOrder))) {
|
||||||
|
displayOrders[category.type] = index + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return displayOrders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static valueOf(type: number): AccountCategory | undefined {
|
public static valueOf(type: number): AccountCategory | undefined {
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export interface ApplicationSettings extends BaseApplicationSetting {
|
|||||||
showTagInInsightsExplorerPage: boolean;
|
showTagInInsightsExplorerPage: boolean;
|
||||||
// Account List Page
|
// Account List Page
|
||||||
totalAmountExcludeAccountIds: Record<string, boolean>;
|
totalAmountExcludeAccountIds: Record<string, boolean>;
|
||||||
|
accountCategoryOrders: string;
|
||||||
hideCategoriesWithoutAccounts: boolean;
|
hideCategoriesWithoutAccounts: boolean;
|
||||||
// Exchange Rates Data Page
|
// Exchange Rates Data Page
|
||||||
currencySortByInExchangeRatesPage: number;
|
currencySortByInExchangeRatesPage: number;
|
||||||
@@ -121,6 +122,7 @@ export const ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES: Record<string, UserAp
|
|||||||
'showTagInInsightsExplorerPage': UserApplicationCloudSettingType.Boolean,
|
'showTagInInsightsExplorerPage': UserApplicationCloudSettingType.Boolean,
|
||||||
// Account List Page
|
// Account List Page
|
||||||
'totalAmountExcludeAccountIds': UserApplicationCloudSettingType.StringBooleanMap,
|
'totalAmountExcludeAccountIds': UserApplicationCloudSettingType.StringBooleanMap,
|
||||||
|
'accountCategoryOrders': UserApplicationCloudSettingType.String,
|
||||||
'hideCategoriesWithoutAccounts': UserApplicationCloudSettingType.Boolean,
|
'hideCategoriesWithoutAccounts': UserApplicationCloudSettingType.Boolean,
|
||||||
// Exchange Rates Data Page
|
// Exchange Rates Data Page
|
||||||
'currencySortByInExchangeRatesPage': UserApplicationCloudSettingType.Number,
|
'currencySortByInExchangeRatesPage': UserApplicationCloudSettingType.Number,
|
||||||
@@ -172,6 +174,7 @@ export const DEFAULT_APPLICATION_SETTINGS: ApplicationSettings = {
|
|||||||
showTagInInsightsExplorerPage: true,
|
showTagInInsightsExplorerPage: true,
|
||||||
// Account List Page
|
// Account List Page
|
||||||
totalAmountExcludeAccountIds: {},
|
totalAmountExcludeAccountIds: {},
|
||||||
|
accountCategoryOrders: '',
|
||||||
hideCategoriesWithoutAccounts: false,
|
hideCategoriesWithoutAccounts: false,
|
||||||
// Exchange Rates Data Page
|
// Exchange Rates Data Page
|
||||||
currencySortByInExchangeRatesPage: CurrencySortingType.Default.type,
|
currencySortByInExchangeRatesPage: CurrencySortingType.Default.type,
|
||||||
|
|||||||
+9
-9
@@ -31,9 +31,9 @@ export function getCategorizedAccountsMap(allAccounts: Account[]): Record<number
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCategorizedAccounts(allAccounts: Account[]): CategorizedAccount[] {
|
export function getCategorizedAccounts(allAccounts: Account[], customAccountCategoryOrder: string): CategorizedAccount[] {
|
||||||
const ret: CategorizedAccount[] = [];
|
const ret: CategorizedAccount[] = [];
|
||||||
const allCategories = AccountCategory.values();
|
const allCategories = AccountCategory.values(customAccountCategoryOrder);
|
||||||
const categorizedAccounts = getCategorizedAccountsMap(allAccounts);
|
const categorizedAccounts = getCategorizedAccountsMap(allAccounts);
|
||||||
|
|
||||||
for (const category of allCategories) {
|
for (const category of allCategories) {
|
||||||
@@ -71,9 +71,9 @@ export function getAccountMapByName(allAccounts: Account[]): Record<string, Acco
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function filterCategorizedAccounts(categorizedAccountsMap: Record<number, CategorizedAccount>, allowAccountName?: string, showHidden?: boolean): Record<number, CategorizedAccount> {
|
export function filterCategorizedAccounts(categorizedAccountsMap: Record<number, CategorizedAccount>, customAccountCategoryOrder: string, allowAccountName?: string, showHidden?: boolean): CategorizedAccount[] {
|
||||||
const ret: Record<number, CategorizedAccount> = {};
|
const ret: CategorizedAccount[] = [];
|
||||||
const allCategories = AccountCategory.values();
|
const allCategories = AccountCategory.values(customAccountCategoryOrder);
|
||||||
const lowercaseFilterContent = allowAccountName ? allowAccountName.toLowerCase() : '';
|
const lowercaseFilterContent = allowAccountName ? allowAccountName.toLowerCase() : '';
|
||||||
|
|
||||||
for (const accountCategory of allCategories) {
|
for (const accountCategory of allCategories) {
|
||||||
@@ -122,20 +122,20 @@ export function filterCategorizedAccounts(categorizedAccountsMap: Record<number,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (allFilteredAccounts.length > 0) {
|
if (allFilteredAccounts.length > 0) {
|
||||||
ret[accountCategory.type] = {
|
ret.push({
|
||||||
category: categorizedAccount.category,
|
category: categorizedAccount.category,
|
||||||
name: categorizedAccount.name,
|
name: categorizedAccount.name,
|
||||||
icon: categorizedAccount.icon,
|
icon: categorizedAccount.icon,
|
||||||
accounts: allFilteredAccounts
|
accounts: allFilteredAccounts
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAllFilteredAccountsBalance(categorizedAccounts: Record<number, CategorizedAccount>, accountFilter: (account: Account) => boolean): AccountBalance[] {
|
export function getAllFilteredAccountsBalance(categorizedAccounts: Record<number, CategorizedAccount>, customAccountCategoryOrder: string, accountFilter: (account: Account) => boolean): AccountBalance[] {
|
||||||
const allAccountCategories = AccountCategory.values();
|
const allAccountCategories = AccountCategory.values(customAccountCategoryOrder);
|
||||||
const ret: AccountBalance[] = [];
|
const ret: AccountBalance[] = [];
|
||||||
|
|
||||||
for (const accountCategory of allAccountCategories) {
|
for (const accountCategory of allAccountCategories) {
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Anwenden",
|
"Apply": "Anwenden",
|
||||||
"Save": "Speichern",
|
"Save": "Speichern",
|
||||||
"Save Changes": "Änderungen speichern",
|
"Save Changes": "Änderungen speichern",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Zurücksetzen",
|
"Reset": "Zurücksetzen",
|
||||||
"Update": "Aktualisieren",
|
"Update": "Aktualisieren",
|
||||||
"Refresh": "Aktualisieren",
|
"Refresh": "Aktualisieren",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Account List Page",
|
"Account List Page": "Account List Page",
|
||||||
"Accounts Included in Total": "Accounts Included in Total",
|
"Accounts Included in Total": "Accounts Included in Total",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Wechselkursdatenseite",
|
"Exchange Rates Data Page": "Wechselkursdatenseite",
|
||||||
"Exchange Rate": "Wechselkurs",
|
"Exchange Rate": "Wechselkurs",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Apply",
|
"Apply": "Apply",
|
||||||
"Save": "Save",
|
"Save": "Save",
|
||||||
"Save Changes": "Save Changes",
|
"Save Changes": "Save Changes",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Reset",
|
"Reset": "Reset",
|
||||||
"Update": "Update",
|
"Update": "Update",
|
||||||
"Refresh": "Refresh",
|
"Refresh": "Refresh",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Account List Page",
|
"Account List Page": "Account List Page",
|
||||||
"Accounts Included in Total": "Accounts Included in Total",
|
"Accounts Included in Total": "Accounts Included in Total",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Exchange Rates Data Page",
|
"Exchange Rates Data Page": "Exchange Rates Data Page",
|
||||||
"Exchange Rate": "Exchange Rate",
|
"Exchange Rate": "Exchange Rate",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Aplicar",
|
"Apply": "Aplicar",
|
||||||
"Save": "Guardar",
|
"Save": "Guardar",
|
||||||
"Save Changes": "Guardar Cambios",
|
"Save Changes": "Guardar Cambios",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Reiniciar",
|
"Reset": "Reiniciar",
|
||||||
"Update": "Actualizar",
|
"Update": "Actualizar",
|
||||||
"Refresh": "Refrescar",
|
"Refresh": "Refrescar",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Página de Cuentas",
|
"Account List Page": "Página de Cuentas",
|
||||||
"Accounts Included in Total": "Cuentas Incluidas en el Total",
|
"Accounts Included in Total": "Cuentas Incluidas en el Total",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Página de Tipos de Cambio",
|
"Exchange Rates Data Page": "Página de Tipos de Cambio",
|
||||||
"Exchange Rate": "Tipo de Cambio",
|
"Exchange Rate": "Tipo de Cambio",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Appliquer",
|
"Apply": "Appliquer",
|
||||||
"Save": "Enregistrer",
|
"Save": "Enregistrer",
|
||||||
"Save Changes": "Enregistrer les modifications",
|
"Save Changes": "Enregistrer les modifications",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Réinitialiser",
|
"Reset": "Réinitialiser",
|
||||||
"Update": "Mettre à jour",
|
"Update": "Mettre à jour",
|
||||||
"Refresh": "Actualiser",
|
"Refresh": "Actualiser",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Page de liste des comptes",
|
"Account List Page": "Page de liste des comptes",
|
||||||
"Accounts Included in Total": "Comptes inclus dans le total",
|
"Accounts Included in Total": "Comptes inclus dans le total",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Page des données de taux de change",
|
"Exchange Rates Data Page": "Page des données de taux de change",
|
||||||
"Exchange Rate": "Taux de change",
|
"Exchange Rate": "Taux de change",
|
||||||
|
|||||||
@@ -1349,9 +1349,9 @@ export function useI18n() {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAllAccountCategories(): LocalizedAccountCategory[] {
|
function getAllAccountCategories(customAccountCategoryOrder: string): LocalizedAccountCategory[] {
|
||||||
const ret: LocalizedAccountCategory[] = [];
|
const ret: LocalizedAccountCategory[] = [];
|
||||||
const allCategories = AccountCategory.values();
|
const allCategories = AccountCategory.values(customAccountCategoryOrder);
|
||||||
|
|
||||||
for (const accountCategory of allCategories) {
|
for (const accountCategory of allCategories) {
|
||||||
ret.push({
|
ret.push({
|
||||||
@@ -2094,10 +2094,10 @@ export function useI18n() {
|
|||||||
return getAmountPrependAndAppendCurrencySymbol(currencyDisplayType, currencyCode, currencyUnit, currencyName, isPlural);
|
return getAmountPrependAndAppendCurrencySymbol(currencyDisplayType, currencyCode, currencyUnit, currencyName, isPlural);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCategorizedAccountsWithDisplayBalance(allVisibleAccounts: Account[], showAccountBalance: boolean): CategorizedAccountWithDisplayBalance[] {
|
function getCategorizedAccountsWithDisplayBalance(allVisibleAccounts: Account[], showAccountBalance: boolean, customAccountCategoryOrder: string): CategorizedAccountWithDisplayBalance[] {
|
||||||
const ret: CategorizedAccountWithDisplayBalance[] = [];
|
const ret: CategorizedAccountWithDisplayBalance[] = [];
|
||||||
const defaultCurrency = userStore.currentUserDefaultCurrency;
|
const defaultCurrency = userStore.currentUserDefaultCurrency;
|
||||||
const allCategories = AccountCategory.values();
|
const allCategories = AccountCategory.values(customAccountCategoryOrder);
|
||||||
const categorizedAccounts: Record<number, CategorizedAccount> = getCategorizedAccountsMap(Account.cloneAccounts(allVisibleAccounts));
|
const categorizedAccounts: Record<number, CategorizedAccount> = getCategorizedAccountsMap(Account.cloneAccounts(allVisibleAccounts));
|
||||||
|
|
||||||
for (const category of allCategories) {
|
for (const category of allCategories) {
|
||||||
@@ -2128,7 +2128,8 @@ export function useI18n() {
|
|||||||
let finalTotalBalance = '';
|
let finalTotalBalance = '';
|
||||||
|
|
||||||
if (showAccountBalance) {
|
if (showAccountBalance) {
|
||||||
const accountsBalance = getAllFilteredAccountsBalance(categorizedAccounts, account => account.category === accountCategory.category);
|
const accountsBalance = getAllFilteredAccountsBalance(categorizedAccounts, customAccountCategoryOrder,
|
||||||
|
account => account.category === accountCategory.category);
|
||||||
let totalBalance = 0;
|
let totalBalance = 0;
|
||||||
let hasUnCalculatedAmount = false;
|
let hasUnCalculatedAmount = false;
|
||||||
|
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Applica",
|
"Apply": "Applica",
|
||||||
"Save": "Salva",
|
"Save": "Salva",
|
||||||
"Save Changes": "Salva modifiche",
|
"Save Changes": "Salva modifiche",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Reimposta",
|
"Reset": "Reimposta",
|
||||||
"Update": "Aggiorna",
|
"Update": "Aggiorna",
|
||||||
"Refresh": "Aggiorna",
|
"Refresh": "Aggiorna",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Account List Page",
|
"Account List Page": "Account List Page",
|
||||||
"Accounts Included in Total": "Accounts Included in Total",
|
"Accounts Included in Total": "Accounts Included in Total",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Pagina dati tassi di cambio",
|
"Exchange Rates Data Page": "Pagina dati tassi di cambio",
|
||||||
"Exchange Rate": "Tasso di cambio",
|
"Exchange Rate": "Tasso di cambio",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "適用",
|
"Apply": "適用",
|
||||||
"Save": "保存",
|
"Save": "保存",
|
||||||
"Save Changes": "変更を保存",
|
"Save Changes": "変更を保存",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "リセット",
|
"Reset": "リセット",
|
||||||
"Update": "アップデート",
|
"Update": "アップデート",
|
||||||
"Refresh": "リフレッシュ",
|
"Refresh": "リフレッシュ",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Account List Page",
|
"Account List Page": "Account List Page",
|
||||||
"Accounts Included in Total": "Accounts Included in Total",
|
"Accounts Included in Total": "Accounts Included in Total",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "為替レートデータページ",
|
"Exchange Rates Data Page": "為替レートデータページ",
|
||||||
"Exchange Rate": "為替レート",
|
"Exchange Rate": "為替レート",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "ಅನ್ವಯಿಸು",
|
"Apply": "ಅನ್ವಯಿಸು",
|
||||||
"Save": "ಉಳಿಸು",
|
"Save": "ಉಳಿಸು",
|
||||||
"Save Changes": "ಬದಲಾವಣೆಗಳನ್ನು ಉಳಿಸು",
|
"Save Changes": "ಬದಲಾವಣೆಗಳನ್ನು ಉಳಿಸು",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "ಮರುಹೊಂದಿಸು",
|
"Reset": "ಮರುಹೊಂದಿಸು",
|
||||||
"Update": "ನವೀಕರಿಸು",
|
"Update": "ನವೀಕರಿಸು",
|
||||||
"Refresh": "ರಿಫ್ರೆಶ್",
|
"Refresh": "ರಿಫ್ರೆಶ್",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "ಖಾತೆ ಪಟ್ಟಿ ಪುಟ",
|
"Account List Page": "ಖಾತೆ ಪಟ್ಟಿ ಪುಟ",
|
||||||
"Accounts Included in Total": "ಒಟ್ಟು ಮೊತ್ತದಲ್ಲಿ ಒಳಗೊಂಡ ಖಾತೆಗಳು",
|
"Accounts Included in Total": "ಒಟ್ಟು ಮೊತ್ತದಲ್ಲಿ ಒಳಗೊಂಡ ಖಾತೆಗಳು",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "ವಿನಿಮಯ ದರಗಳ ಪುಟ",
|
"Exchange Rates Data Page": "ವಿನಿಮಯ ದರಗಳ ಪುಟ",
|
||||||
"Exchange Rate": "ವಿನಿಮಯ ದರ",
|
"Exchange Rate": "ವಿನಿಮಯ ದರ",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "적용",
|
"Apply": "적용",
|
||||||
"Save": "저장",
|
"Save": "저장",
|
||||||
"Save Changes": "변경사항 저장",
|
"Save Changes": "변경사항 저장",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "재설정",
|
"Reset": "재설정",
|
||||||
"Update": "업데이트",
|
"Update": "업데이트",
|
||||||
"Refresh": "새로고침",
|
"Refresh": "새로고침",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "계좌 목록 페이지",
|
"Account List Page": "계좌 목록 페이지",
|
||||||
"Accounts Included in Total": "총계에 포함된 계좌",
|
"Accounts Included in Total": "총계에 포함된 계좌",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "환율 데이터 페이지",
|
"Exchange Rates Data Page": "환율 데이터 페이지",
|
||||||
"Exchange Rate": "환율",
|
"Exchange Rate": "환율",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Toepassen",
|
"Apply": "Toepassen",
|
||||||
"Save": "Opslaan",
|
"Save": "Opslaan",
|
||||||
"Save Changes": "Wijzigingen opslaan",
|
"Save Changes": "Wijzigingen opslaan",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Resetten",
|
"Reset": "Resetten",
|
||||||
"Update": "Bijwerken",
|
"Update": "Bijwerken",
|
||||||
"Refresh": "Vernieuwen",
|
"Refresh": "Vernieuwen",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Rekeningenpagina",
|
"Account List Page": "Rekeningenpagina",
|
||||||
"Accounts Included in Total": "Rekeningen opgenomen in totaal",
|
"Accounts Included in Total": "Rekeningen opgenomen in totaal",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Wisselkoersgegevenspagina",
|
"Exchange Rates Data Page": "Wisselkoersgegevenspagina",
|
||||||
"Exchange Rate": "Wisselkoers",
|
"Exchange Rate": "Wisselkoers",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Aplicar",
|
"Apply": "Aplicar",
|
||||||
"Save": "Salvar",
|
"Save": "Salvar",
|
||||||
"Save Changes": "Salvar Alterações",
|
"Save Changes": "Salvar Alterações",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Redefinir",
|
"Reset": "Redefinir",
|
||||||
"Update": "Atualizar",
|
"Update": "Atualizar",
|
||||||
"Refresh": "Atualizar",
|
"Refresh": "Atualizar",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Account List Page",
|
"Account List Page": "Account List Page",
|
||||||
"Accounts Included in Total": "Accounts Included in Total",
|
"Accounts Included in Total": "Accounts Included in Total",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Página de Dados de Taxas de Câmbio",
|
"Exchange Rates Data Page": "Página de Dados de Taxas de Câmbio",
|
||||||
"Exchange Rate": "Taxa de Câmbio",
|
"Exchange Rate": "Taxa de Câmbio",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Применить",
|
"Apply": "Применить",
|
||||||
"Save": "Сохранить",
|
"Save": "Сохранить",
|
||||||
"Save Changes": "Сохранить изменения",
|
"Save Changes": "Сохранить изменения",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Сбросить",
|
"Reset": "Сбросить",
|
||||||
"Update": "Обновить",
|
"Update": "Обновить",
|
||||||
"Refresh": "Обновить",
|
"Refresh": "Обновить",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Account List Page",
|
"Account List Page": "Account List Page",
|
||||||
"Accounts Included in Total": "Accounts Included in Total",
|
"Accounts Included in Total": "Accounts Included in Total",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Страница данных о курсах валют",
|
"Exchange Rates Data Page": "Страница данных о курсах валют",
|
||||||
"Exchange Rate": "Курс обмена",
|
"Exchange Rate": "Курс обмена",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Uporabi",
|
"Apply": "Uporabi",
|
||||||
"Save": "Shrani",
|
"Save": "Shrani",
|
||||||
"Save Changes": "Shrani spremembe",
|
"Save Changes": "Shrani spremembe",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Ponastavi",
|
"Reset": "Ponastavi",
|
||||||
"Update": "Posodobi",
|
"Update": "Posodobi",
|
||||||
"Refresh": "Osveži",
|
"Refresh": "Osveži",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Stran za vpoglede in raziskovanje",
|
"Insights Explorer Page": "Stran za vpoglede in raziskovanje",
|
||||||
"Account List Page": "Stran s seznamom računov",
|
"Account List Page": "Stran s seznamom računov",
|
||||||
"Accounts Included in Total": "Računi vključeni v skupno vsoto",
|
"Accounts Included in Total": "Računi vključeni v skupno vsoto",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Stran z menjalnimi tečaji",
|
"Exchange Rates Data Page": "Stran z menjalnimi tečaji",
|
||||||
"Exchange Rate": "Menjalni tečaj",
|
"Exchange Rate": "Menjalni tečaj",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "ใช้",
|
"Apply": "ใช้",
|
||||||
"Save": "บันทึก",
|
"Save": "บันทึก",
|
||||||
"Save Changes": "บันทึกการเปลี่ยนแปลง",
|
"Save Changes": "บันทึกการเปลี่ยนแปลง",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "รีเซ็ต",
|
"Reset": "รีเซ็ต",
|
||||||
"Update": "อัปเดต",
|
"Update": "อัปเดต",
|
||||||
"Refresh": "รีเฟรช",
|
"Refresh": "รีเฟรช",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "หน้าบัญชี",
|
"Account List Page": "หน้าบัญชี",
|
||||||
"Accounts Included in Total": "บัญชีที่รวมในผลรวม",
|
"Accounts Included in Total": "บัญชีที่รวมในผลรวม",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "หน้าข้อมูลอัตราแลกเปลี่ยน",
|
"Exchange Rates Data Page": "หน้าข้อมูลอัตราแลกเปลี่ยน",
|
||||||
"Exchange Rate": "อัตราแลกเปลี่ยน",
|
"Exchange Rate": "อัตราแลกเปลี่ยน",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Uygula",
|
"Apply": "Uygula",
|
||||||
"Save": "Kaydet",
|
"Save": "Kaydet",
|
||||||
"Save Changes": "Değişiklikleri Kaydet",
|
"Save Changes": "Değişiklikleri Kaydet",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Sıfırla",
|
"Reset": "Sıfırla",
|
||||||
"Update": "Güncelle",
|
"Update": "Güncelle",
|
||||||
"Refresh": "Yenile",
|
"Refresh": "Yenile",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Hesap Listesi Sayfası",
|
"Account List Page": "Hesap Listesi Sayfası",
|
||||||
"Accounts Included in Total": "Toplama Dahil Edilen Hesaplar",
|
"Accounts Included in Total": "Toplama Dahil Edilen Hesaplar",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Döviz Kuru Verileri Sayfası",
|
"Exchange Rates Data Page": "Döviz Kuru Verileri Sayfası",
|
||||||
"Exchange Rate": "Döviz Kuru",
|
"Exchange Rate": "Döviz Kuru",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Застосувати",
|
"Apply": "Застосувати",
|
||||||
"Save": "Зберегти",
|
"Save": "Зберегти",
|
||||||
"Save Changes": "Зберегти зміни",
|
"Save Changes": "Зберегти зміни",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Скинути",
|
"Reset": "Скинути",
|
||||||
"Update": "Оновити",
|
"Update": "Оновити",
|
||||||
"Refresh": "Оновити",
|
"Refresh": "Оновити",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Account List Page",
|
"Account List Page": "Account List Page",
|
||||||
"Accounts Included in Total": "Accounts Included in Total",
|
"Accounts Included in Total": "Accounts Included in Total",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Сторінка курсів валют",
|
"Exchange Rates Data Page": "Сторінка курсів валют",
|
||||||
"Exchange Rate": "Курс обміну",
|
"Exchange Rate": "Курс обміну",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "Áp dụng",
|
"Apply": "Áp dụng",
|
||||||
"Save": "Lưu",
|
"Save": "Lưu",
|
||||||
"Save Changes": "Lưu thay đổi",
|
"Save Changes": "Lưu thay đổi",
|
||||||
|
"Reset to Default": "Reset to Default",
|
||||||
"Reset": "Đặt lại",
|
"Reset": "Đặt lại",
|
||||||
"Update": "Cập nhật",
|
"Update": "Cập nhật",
|
||||||
"Refresh": "Làm mới",
|
"Refresh": "Làm mới",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "Insights Explorer Page",
|
"Insights Explorer Page": "Insights Explorer Page",
|
||||||
"Account List Page": "Account List Page",
|
"Account List Page": "Account List Page",
|
||||||
"Accounts Included in Total": "Accounts Included in Total",
|
"Accounts Included in Total": "Accounts Included in Total",
|
||||||
|
"Account Category Order": "Account Category Order",
|
||||||
|
"Account category order saved": "Account category order saved",
|
||||||
|
"Unable to move account category": "Unable to move account category",
|
||||||
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
"Hide Categories Without Accounts": "Hide Categories Without Accounts",
|
||||||
"Exchange Rates Data Page": "Trang dữ liệu tỷ giá hối đoái",
|
"Exchange Rates Data Page": "Trang dữ liệu tỷ giá hối đoái",
|
||||||
"Exchange Rate": "Tỷ giá hối đoái",
|
"Exchange Rate": "Tỷ giá hối đoái",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "应用",
|
"Apply": "应用",
|
||||||
"Save": "保存",
|
"Save": "保存",
|
||||||
"Save Changes": "保存修改",
|
"Save Changes": "保存修改",
|
||||||
|
"Reset to Default": "恢复为默认值",
|
||||||
"Reset": "重置",
|
"Reset": "重置",
|
||||||
"Update": "更新",
|
"Update": "更新",
|
||||||
"Refresh": "刷新",
|
"Refresh": "刷新",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "洞察探索页面",
|
"Insights Explorer Page": "洞察探索页面",
|
||||||
"Account List Page": "账户列表页面",
|
"Account List Page": "账户列表页面",
|
||||||
"Accounts Included in Total": "计入总金额的账户",
|
"Accounts Included in Total": "计入总金额的账户",
|
||||||
|
"Account Category Order": "账户分类顺序",
|
||||||
|
"Account category order saved": "账户分类顺序已保存",
|
||||||
|
"Unable to move account category": "无法移动账户分类",
|
||||||
"Hide Categories Without Accounts": "隐藏没有账户的分类",
|
"Hide Categories Without Accounts": "隐藏没有账户的分类",
|
||||||
"Exchange Rates Data Page": "汇率数据页面",
|
"Exchange Rates Data Page": "汇率数据页面",
|
||||||
"Exchange Rate": "汇率",
|
"Exchange Rate": "汇率",
|
||||||
|
|||||||
@@ -1435,6 +1435,7 @@
|
|||||||
"Apply": "套用",
|
"Apply": "套用",
|
||||||
"Save": "儲存",
|
"Save": "儲存",
|
||||||
"Save Changes": "儲存修改",
|
"Save Changes": "儲存修改",
|
||||||
|
"Reset to Default": "重設為預設值",
|
||||||
"Reset": "重置",
|
"Reset": "重置",
|
||||||
"Update": "更新",
|
"Update": "更新",
|
||||||
"Refresh": "重新載入",
|
"Refresh": "重新載入",
|
||||||
@@ -2190,6 +2191,9 @@
|
|||||||
"Insights Explorer Page": "洞察探索頁面",
|
"Insights Explorer Page": "洞察探索頁面",
|
||||||
"Account List Page": "帳戶清單頁面",
|
"Account List Page": "帳戶清單頁面",
|
||||||
"Accounts Included in Total": "計入總金額的帳戶",
|
"Accounts Included in Total": "計入總金額的帳戶",
|
||||||
|
"Account Category Order": "帳戶分類順序",
|
||||||
|
"Account category order saved": "帳戶分類順序已儲存",
|
||||||
|
"Unable to move account category": "無法移動帳戶分類",
|
||||||
"Hide Categories Without Accounts": "隱藏沒有帳戶的分類",
|
"Hide Categories Without Accounts": "隱藏沒有帳戶的分類",
|
||||||
"Exchange Rates Data Page": "匯率資料頁面",
|
"Exchange Rates Data Page": "匯率資料頁面",
|
||||||
"Exchange Rate": "匯率",
|
"Exchange Rate": "匯率",
|
||||||
|
|||||||
+9
-10
@@ -2,7 +2,6 @@ import type { HiddenAmount, NumberWithSuffix } from '@/core/numeral.ts';
|
|||||||
import type { ColorValue } from '@/core/color.ts';
|
import type { ColorValue } from '@/core/color.ts';
|
||||||
import { AccountType, AccountCategory } from '@/core/account.ts';
|
import { AccountType, AccountCategory } from '@/core/account.ts';
|
||||||
import { PARENT_ACCOUNT_CURRENCY_PLACEHOLDER } from '@/consts/currency.ts';
|
import { PARENT_ACCOUNT_CURRENCY_PLACEHOLDER } from '@/consts/currency.ts';
|
||||||
import { DEFAULT_ACCOUNT_ICON_ID } from '@/consts/icon.ts';
|
|
||||||
import { DEFAULT_ACCOUNT_COLOR } from '@/consts/color.ts';
|
import { DEFAULT_ACCOUNT_COLOR } from '@/consts/color.ts';
|
||||||
|
|
||||||
export class Account implements AccountInfoResponse {
|
export class Account implements AccountInfoResponse {
|
||||||
@@ -410,14 +409,14 @@ export class Account implements AccountInfoResponse {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createNewAccount(currency: string, balanceTime: number): Account {
|
public static createNewAccount(accountCategory: AccountCategory, currency: string, balanceTime: number): Account {
|
||||||
return new Account(
|
return new Account(
|
||||||
'', // id
|
'', // id
|
||||||
'', // name
|
'', // name
|
||||||
'', // parentId
|
'', // parentId
|
||||||
AccountCategory.Cash.type, // category
|
accountCategory.type, // category
|
||||||
AccountType.SingleAccount.type, // type
|
AccountType.SingleAccount.type, // type
|
||||||
DEFAULT_ACCOUNT_ICON_ID, // icon
|
accountCategory.defaultAccountIconId, // icon
|
||||||
DEFAULT_ACCOUNT_COLOR, // color
|
DEFAULT_ACCOUNT_COLOR, // color
|
||||||
currency, // currency
|
currency, // currency
|
||||||
0, // balance
|
0, // balance
|
||||||
@@ -481,25 +480,25 @@ export class Account implements AccountInfoResponse {
|
|||||||
return clonedAccounts;
|
return clonedAccounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static sortAccounts(accounts: Account[], allAccountsMap?: Record<string, Account>): Account[] {
|
public static sortAccounts(accounts: Account[], accountCategoryDisplayOrders: Record<number, number>, allAccountsMap?: Record<string, Account>): Account[] {
|
||||||
if (!accounts || !accounts.length) {
|
if (!accounts || !accounts.length) {
|
||||||
return accounts;
|
return accounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
return accounts.sort(function (account1, account2) {
|
return accounts.sort(function (account1, account2) {
|
||||||
if (account1.category !== account2.category) {
|
if (account1.category !== account2.category) {
|
||||||
const account1Category = AccountCategory.valueOf(account1.category);
|
const account1CategoryDisplayOrder = accountCategoryDisplayOrders[account1.category];
|
||||||
const account2Category = AccountCategory.valueOf(account2.category);
|
const account2CategoryDisplayOrder = accountCategoryDisplayOrders[account2.category];
|
||||||
|
|
||||||
if (!account1Category) {
|
if (!account1CategoryDisplayOrder) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!account2Category) {
|
if (!account2CategoryDisplayOrder) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return account1Category.displayOrder - account2Category.displayOrder;
|
return account1CategoryDisplayOrder - account2CategoryDisplayOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (account1.parentId === account2.parentId) {
|
if (account1.parentId === account2.parentId) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import StatisticsSettingsPage from '@/views/mobile/statistics/SettingsPage.vue';
|
|||||||
|
|
||||||
import TextSizeSettingsPage from '@/views/mobile/settings/TextSizeSettingsPage.vue';
|
import TextSizeSettingsPage from '@/views/mobile/settings/TextSizeSettingsPage.vue';
|
||||||
import PageSettingsPage from '@/views/mobile/settings/PageSettingsPage.vue';
|
import PageSettingsPage from '@/views/mobile/settings/PageSettingsPage.vue';
|
||||||
|
import AccountCategoryDisplayOrderSettingsPage from '@/views/mobile/settings/AccountCategoryDisplayOrderSettingsPage.vue';
|
||||||
import ApplicationCloudSyncSettingsPage from '@/views/mobile/settings/ApplicationCloudSyncSettingsPage.vue';
|
import ApplicationCloudSyncSettingsPage from '@/views/mobile/settings/ApplicationCloudSyncSettingsPage.vue';
|
||||||
import AccountFilterSettingsPage from '@/views/mobile/settings/AccountFilterSettingsPage.vue';
|
import AccountFilterSettingsPage from '@/views/mobile/settings/AccountFilterSettingsPage.vue';
|
||||||
import CategoryFilterSettingsPage from '@/views/mobile/settings/CategoryFilterSettingsPage.vue';
|
import CategoryFilterSettingsPage from '@/views/mobile/settings/CategoryFilterSettingsPage.vue';
|
||||||
@@ -238,6 +239,11 @@ const routes: Router.RouteParameters[] = [
|
|||||||
async: asyncResolve(PageSettingsPage),
|
async: asyncResolve(PageSettingsPage),
|
||||||
beforeEnter: [checkLogin]
|
beforeEnter: [checkLogin]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/settings/account_category_display_order',
|
||||||
|
async: asyncResolve(AccountCategoryDisplayOrderSettingsPage),
|
||||||
|
beforeEnter: [checkLogin]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/settings/sync',
|
path: '/settings/sync',
|
||||||
async: asyncResolve(ApplicationCloudSyncSettingsPage),
|
async: asyncResolve(ApplicationCloudSyncSettingsPage),
|
||||||
|
|||||||
+15
-12
@@ -48,7 +48,7 @@ export const useAccountsStore = defineStore('accounts', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Account.sortAccounts(allAccountsList, allAccountsMap.value);
|
return Account.sortAccounts(allAccountsList, settingsStore.accountCategoryDisplayOrders, allAccountsMap.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
const allMixedPlainAccounts = computed<Account[]>(() => {
|
const allMixedPlainAccounts = computed<Account[]>(() => {
|
||||||
@@ -68,7 +68,7 @@ export const useAccountsStore = defineStore('accounts', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Account.sortAccounts(allAccountsList, allAccountsMap.value);
|
return Account.sortAccounts(allAccountsList, settingsStore.accountCategoryDisplayOrders, allAccountsMap.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
const allVisiblePlainAccounts = computed<Account[]>(() => {
|
const allVisiblePlainAccounts = computed<Account[]>(() => {
|
||||||
@@ -95,7 +95,7 @@ export const useAccountsStore = defineStore('accounts', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Account.sortAccounts(allVisibleAccounts, allAccountsMap.value);
|
return Account.sortAccounts(allVisibleAccounts, settingsStore.accountCategoryDisplayOrders, allAccountsMap.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
const allAvailableAccountsCount = computed<number>(() => {
|
const allAvailableAccountsCount = computed<number>(() => {
|
||||||
@@ -148,8 +148,10 @@ export const useAccountsStore = defineStore('accounts', () => {
|
|||||||
if (newAccountCategory) {
|
if (newAccountCategory) {
|
||||||
for (const [account, index] of itemAndIndex(allAccounts.value)) {
|
for (const [account, index] of itemAndIndex(allAccounts.value)) {
|
||||||
const accountCategory = AccountCategory.valueOf(account.category);
|
const accountCategory = AccountCategory.valueOf(account.category);
|
||||||
|
const accountCategoryDisplayOrder = settingsStore.accountCategoryDisplayOrders[accountCategory?.type ?? 0] || Number.MAX_SAFE_INTEGER;
|
||||||
|
const newAccountCategoryDisplayOrder = settingsStore.accountCategoryDisplayOrders[newAccountCategory.type] || Number.MAX_SAFE_INTEGER;
|
||||||
|
|
||||||
if (accountCategory && accountCategory.displayOrder > newAccountCategory.displayOrder) {
|
if (accountCategory && accountCategoryDisplayOrder > newAccountCategoryDisplayOrder) {
|
||||||
insertIndexToAllList = index;
|
insertIndexToAllList = index;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -457,8 +459,8 @@ export const useAccountsStore = defineStore('accounts', () => {
|
|||||||
return DISPLAY_HIDDEN_AMOUNT;
|
return DISPLAY_HIDDEN_AMOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account =>
|
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, settingsStore.appSettings.accountCategoryOrders,
|
||||||
!(account.type === AccountType.SingleAccount.type && settingsStore.appSettings.totalAmountExcludeAccountIds[account.id])
|
account => !(account.type === AccountType.SingleAccount.type && settingsStore.appSettings.totalAmountExcludeAccountIds[account.id])
|
||||||
);
|
);
|
||||||
let netAssets = 0;
|
let netAssets = 0;
|
||||||
let hasUnCalculatedAmount = false;
|
let hasUnCalculatedAmount = false;
|
||||||
@@ -493,8 +495,8 @@ export const useAccountsStore = defineStore('accounts', () => {
|
|||||||
return DISPLAY_HIDDEN_AMOUNT;
|
return DISPLAY_HIDDEN_AMOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account =>
|
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, settingsStore.appSettings.accountCategoryOrders,
|
||||||
(account.isAsset || false) && !(account.type === AccountType.SingleAccount.type && settingsStore.appSettings.totalAmountExcludeAccountIds[account.id])
|
account => (account.isAsset || false) && !(account.type === AccountType.SingleAccount.type && settingsStore.appSettings.totalAmountExcludeAccountIds[account.id])
|
||||||
);
|
);
|
||||||
let totalAssets = 0;
|
let totalAssets = 0;
|
||||||
let hasUnCalculatedAmount = false;
|
let hasUnCalculatedAmount = false;
|
||||||
@@ -529,8 +531,8 @@ export const useAccountsStore = defineStore('accounts', () => {
|
|||||||
return DISPLAY_HIDDEN_AMOUNT;
|
return DISPLAY_HIDDEN_AMOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account =>
|
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, settingsStore.appSettings.accountCategoryOrders,
|
||||||
(account.isLiability || false) && !(account.type === AccountType.SingleAccount.type && settingsStore.appSettings.totalAmountExcludeAccountIds[account.id])
|
account => (account.isLiability || false) && !(account.type === AccountType.SingleAccount.type && settingsStore.appSettings.totalAmountExcludeAccountIds[account.id])
|
||||||
);
|
);
|
||||||
let totalLiabilities = 0;
|
let totalLiabilities = 0;
|
||||||
let hasUnCalculatedAmount = false;
|
let hasUnCalculatedAmount = false;
|
||||||
@@ -565,7 +567,8 @@ export const useAccountsStore = defineStore('accounts', () => {
|
|||||||
return DISPLAY_HIDDEN_AMOUNT;
|
return DISPLAY_HIDDEN_AMOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account => account.category === accountCategory.type);
|
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, settingsStore.appSettings.accountCategoryOrders,
|
||||||
|
account => account.category === accountCategory.type);
|
||||||
let totalBalance = 0;
|
let totalBalance = 0;
|
||||||
let hasUnCalculatedAmount = false;
|
let hasUnCalculatedAmount = false;
|
||||||
|
|
||||||
@@ -775,7 +778,7 @@ export const useAccountsStore = defineStore('accounts', () => {
|
|||||||
updateAccountListInvalidState(false);
|
updateAccountListInvalidState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const accounts = Account.sortAccounts(Account.ofMulti(data.result));
|
const accounts = Account.sortAccounts(Account.ofMulti(data.result), settingsStore.accountCategoryDisplayOrders);
|
||||||
|
|
||||||
if (force && data.result && isEquals(allAccounts.value, accounts)) {
|
if (force && data.result && isEquals(allAccounts.value, accounts)) {
|
||||||
reject({ message: 'Account list is up to date', isUpToDate: true });
|
reject({ message: 'Account list is up to date', isUpToDate: true });
|
||||||
|
|||||||
@@ -296,23 +296,25 @@ export const useExplorersStore = defineStore('explorers', () => {
|
|||||||
};
|
};
|
||||||
} else if (dimension === TransactionExplorerDataDimension.SourceAccount) {
|
} else if (dimension === TransactionExplorerDataDimension.SourceAccount) {
|
||||||
const primaryAccount = accountsStore.allAccountsMap[transaction.sourceAccount.parentId] ?? transaction.sourceAccount;
|
const primaryAccount = accountsStore.allAccountsMap[transaction.sourceAccount.parentId] ?? transaction.sourceAccount;
|
||||||
|
const primaryAccountCategoryDisplayOrder: number = settingsStore.accountCategoryDisplayOrders[primaryAccount.category] || Number.MAX_SAFE_INTEGER;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
categoryName: transaction.sourceAccountName || 'Unknown',
|
categoryName: transaction.sourceAccountName || 'Unknown',
|
||||||
categoryNameNeedI18n: !transaction.sourceAccountName,
|
categoryNameNeedI18n: !transaction.sourceAccountName,
|
||||||
categoryId: transaction.sourceAccountId || 'unknown',
|
categoryId: transaction.sourceAccountId || 'unknown',
|
||||||
categoryIdType: TransactionExplorerDimensionType.Account,
|
categoryIdType: TransactionExplorerDimensionType.Account,
|
||||||
categoryDisplayOrders: [primaryAccount.category, primaryAccount.displayOrder, transaction.sourceAccount.displayOrder]
|
categoryDisplayOrders: [primaryAccountCategoryDisplayOrder, primaryAccount.displayOrder, transaction.sourceAccount.displayOrder]
|
||||||
};
|
};
|
||||||
} else if (dimension === TransactionExplorerDataDimension.SourceAccountCategory) {
|
} else if (dimension === TransactionExplorerDataDimension.SourceAccountCategory) {
|
||||||
const accountCategory = AccountCategory.valueOf(transaction.sourceAccount.category);
|
const accountCategory = AccountCategory.valueOf(transaction.sourceAccount.category);
|
||||||
|
const accountCategoryDisplayOrder: number = settingsStore.accountCategoryDisplayOrders[accountCategory?.type ?? 0] || Number.MAX_SAFE_INTEGER;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
categoryName: accountCategory?.name || 'Unknown',
|
categoryName: accountCategory?.name || 'Unknown',
|
||||||
categoryNameNeedI18n: true,
|
categoryNameNeedI18n: true,
|
||||||
categoryId: accountCategory?.type.toString(10) || 'unknown',
|
categoryId: accountCategory?.type.toString(10) || 'unknown',
|
||||||
categoryIdType: TransactionExplorerDimensionType.Other,
|
categoryIdType: TransactionExplorerDimensionType.Other,
|
||||||
categoryDisplayOrders: [accountCategory ? accountCategory.type : 0]
|
categoryDisplayOrders: [accountCategoryDisplayOrder]
|
||||||
};
|
};
|
||||||
} else if (dimension === TransactionExplorerDataDimension.SourceAccountCurrency) {
|
} else if (dimension === TransactionExplorerDataDimension.SourceAccountCurrency) {
|
||||||
return {
|
return {
|
||||||
@@ -324,23 +326,25 @@ export const useExplorersStore = defineStore('explorers', () => {
|
|||||||
};
|
};
|
||||||
} else if (dimension === TransactionExplorerDataDimension.DestinationAccount) {
|
} else if (dimension === TransactionExplorerDataDimension.DestinationAccount) {
|
||||||
const primaryAccount = accountsStore.allAccountsMap[transaction.destinationAccount?.parentId ?? ''] ?? transaction.destinationAccount;
|
const primaryAccount = accountsStore.allAccountsMap[transaction.destinationAccount?.parentId ?? ''] ?? transaction.destinationAccount;
|
||||||
|
const primaryAccountCategoryDisplayOrder: number = settingsStore.accountCategoryDisplayOrders[primaryAccount?.category || 0] || Number.MAX_SAFE_INTEGER;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
categoryName: transaction.type === TransactionType.Transfer ? (transaction.destinationAccountName || 'Unknown') : 'None',
|
categoryName: transaction.type === TransactionType.Transfer ? (transaction.destinationAccountName || 'Unknown') : 'None',
|
||||||
categoryNameNeedI18n: transaction.type !== TransactionType.Transfer || !transaction.destinationAccountName,
|
categoryNameNeedI18n: transaction.type !== TransactionType.Transfer || !transaction.destinationAccountName,
|
||||||
categoryId: transaction.type === TransactionType.Transfer ? (transaction.destinationAccountId || 'unknown') : 'none',
|
categoryId: transaction.type === TransactionType.Transfer ? (transaction.destinationAccountId || 'unknown') : 'none',
|
||||||
categoryIdType: TransactionExplorerDimensionType.Account,
|
categoryIdType: TransactionExplorerDimensionType.Account,
|
||||||
categoryDisplayOrders: transaction.type === TransactionType.Transfer && primaryAccount && transaction.destinationAccount ? [primaryAccount.category, primaryAccount.displayOrder, transaction.destinationAccount.displayOrder] : [0]
|
categoryDisplayOrders: transaction.type === TransactionType.Transfer && primaryAccount && transaction.destinationAccount ? [primaryAccountCategoryDisplayOrder, primaryAccount.displayOrder, transaction.destinationAccount.displayOrder] : [0]
|
||||||
};
|
};
|
||||||
} else if (dimension === TransactionExplorerDataDimension.DestinationAccountCategory) {
|
} else if (dimension === TransactionExplorerDataDimension.DestinationAccountCategory) {
|
||||||
const accountCategory = transaction.type === TransactionType.Transfer && transaction.destinationAccount ? AccountCategory.valueOf(transaction.destinationAccount.category) : undefined;
|
const accountCategory = transaction.type === TransactionType.Transfer && transaction.destinationAccount ? AccountCategory.valueOf(transaction.destinationAccount.category) : undefined;
|
||||||
|
const accountCategoryDisplayOrder: number = settingsStore.accountCategoryDisplayOrders[accountCategory?.type ?? 0] || Number.MAX_SAFE_INTEGER;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
categoryName: transaction.type === TransactionType.Transfer ? (accountCategory?.name || 'Unknown') : 'None',
|
categoryName: transaction.type === TransactionType.Transfer ? (accountCategory?.name || 'Unknown') : 'None',
|
||||||
categoryNameNeedI18n: true,
|
categoryNameNeedI18n: true,
|
||||||
categoryId: transaction.type === TransactionType.Transfer ? (accountCategory?.name || 'unknown') : 'none',
|
categoryId: transaction.type === TransactionType.Transfer ? (accountCategory?.name || 'unknown') : 'none',
|
||||||
categoryIdType: TransactionExplorerDimensionType.Other,
|
categoryIdType: TransactionExplorerDimensionType.Other,
|
||||||
categoryDisplayOrders: transaction.type === TransactionType.Transfer ? [accountCategory?.type || 0] : [0]
|
categoryDisplayOrders: transaction.type === TransactionType.Transfer ? [accountCategoryDisplayOrder] : [0]
|
||||||
};
|
};
|
||||||
} else if (dimension === TransactionExplorerDataDimension.DestinationAccountCurrency) {
|
} else if (dimension === TransactionExplorerDataDimension.DestinationAccountCurrency) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ import {
|
|||||||
ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES
|
ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES
|
||||||
} from '@/core/setting.ts';
|
} from '@/core/setting.ts';
|
||||||
|
|
||||||
|
|
||||||
|
import { AccountCategory } from '@/core/account.ts';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
isObject,
|
isObject,
|
||||||
isString,
|
isString,
|
||||||
@@ -41,6 +44,8 @@ export const useSettingsStore = defineStore('settings', () => {
|
|||||||
|
|
||||||
const enableApplicationCloudSync = computed<boolean>(() => getObjectOwnFieldCount(syncedAppSettings.value) > 0);
|
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 {
|
function updateApplicationSettingsValueAndAppSettingsFromCloudSetting(key: string, value: string | number | boolean | Record<string, boolean>): void {
|
||||||
const keyItems = key.split('.');
|
const keyItems = key.split('.');
|
||||||
const keyFirstPart = keyItems[0] as string;
|
const keyFirstPart = keyItems[0] as string;
|
||||||
@@ -265,6 +270,12 @@ export const useSettingsStore = defineStore('settings', () => {
|
|||||||
updateUserApplicationCloudSettingValue('totalAmountExcludeAccountIds', value);
|
updateUserApplicationCloudSettingValue('totalAmountExcludeAccountIds', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setAccountCategoryOrders(value: string): void {
|
||||||
|
updateApplicationSettingsValue('accountCategoryOrders', value);
|
||||||
|
appSettings.value.accountCategoryOrders = value;
|
||||||
|
updateUserApplicationCloudSettingValue('accountCategoryOrders', value);
|
||||||
|
}
|
||||||
|
|
||||||
function setHideCategoriesWithoutAccounts(value: boolean): void {
|
function setHideCategoriesWithoutAccounts(value: boolean): void {
|
||||||
updateApplicationSettingsValue('hideCategoriesWithoutAccounts', value);
|
updateApplicationSettingsValue('hideCategoriesWithoutAccounts', value);
|
||||||
appSettings.value.hideCategoriesWithoutAccounts = value;
|
appSettings.value.hideCategoriesWithoutAccounts = value;
|
||||||
@@ -459,6 +470,7 @@ export const useSettingsStore = defineStore('settings', () => {
|
|||||||
localeDefaultSettings,
|
localeDefaultSettings,
|
||||||
// computed states
|
// computed states
|
||||||
enableApplicationCloudSync,
|
enableApplicationCloudSync,
|
||||||
|
accountCategoryDisplayOrders,
|
||||||
// functions
|
// functions
|
||||||
// -- Basic Settings
|
// -- Basic Settings
|
||||||
setTheme,
|
setTheme,
|
||||||
@@ -491,6 +503,7 @@ export const useSettingsStore = defineStore('settings', () => {
|
|||||||
setShowTagInInsightsExplorerPage,
|
setShowTagInInsightsExplorerPage,
|
||||||
// -- Account List Page
|
// -- Account List Page
|
||||||
setTotalAmountExcludeAccountIds,
|
setTotalAmountExcludeAccountIds,
|
||||||
|
setAccountCategoryOrders,
|
||||||
setHideCategoriesWithoutAccounts,
|
setHideCategoriesWithoutAccounts,
|
||||||
// -- Exchange Rates Data Page
|
// -- Exchange Rates Data Page
|
||||||
setCurrencySortByInExchangeRatesPage,
|
setCurrencySortByInExchangeRatesPage,
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
totalExpense += item.amountInDefaultCurrency;
|
totalExpense += item.amountInDefaultCurrency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const primaryAccountCategoryDisplayOrder = settingsStore.accountCategoryDisplayOrders[item.primaryAccount.category] || Number.MAX_SAFE_INTEGER;
|
||||||
const incomeByAccountKey = `${TransactionCategoricalOverviewAnalysisDataItemType.IncomeByAccount}:${item.account.id}`;
|
const incomeByAccountKey = `${TransactionCategoricalOverviewAnalysisDataItemType.IncomeByAccount}:${item.account.id}`;
|
||||||
const expenseByAccountKey = `${TransactionCategoricalOverviewAnalysisDataItemType.ExpenseByAccount}:${item.account.id}`;
|
const expenseByAccountKey = `${TransactionCategoricalOverviewAnalysisDataItemType.ExpenseByAccount}:${item.account.id}`;
|
||||||
let incomeByAccountItem: TransactionCategoricalOverviewAnalysisDataItem | undefined = allDataItemsMap[incomeByAccountKey];
|
let incomeByAccountItem: TransactionCategoricalOverviewAnalysisDataItem | undefined = allDataItemsMap[incomeByAccountKey];
|
||||||
@@ -294,7 +295,7 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
item.account.id,
|
item.account.id,
|
||||||
item.account.name,
|
item.account.name,
|
||||||
TransactionCategoricalOverviewAnalysisDataItemType.IncomeByAccount,
|
TransactionCategoricalOverviewAnalysisDataItemType.IncomeByAccount,
|
||||||
[item.primaryAccount.category, item.primaryAccount.displayOrder, item.account.displayOrder],
|
[primaryAccountCategoryDisplayOrder, item.primaryAccount.displayOrder, item.account.displayOrder],
|
||||||
item.primaryAccount.hidden || item.account.hidden);
|
item.primaryAccount.hidden || item.account.hidden);
|
||||||
allDataItemsMap[incomeByAccountKey] = incomeByAccountItem;
|
allDataItemsMap[incomeByAccountKey] = incomeByAccountItem;
|
||||||
allIncomeByAccountDataItems.push(incomeByAccountItem);
|
allIncomeByAccountDataItems.push(incomeByAccountItem);
|
||||||
@@ -305,7 +306,7 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
item.account.id,
|
item.account.id,
|
||||||
item.account.name,
|
item.account.name,
|
||||||
TransactionCategoricalOverviewAnalysisDataItemType.ExpenseByAccount,
|
TransactionCategoricalOverviewAnalysisDataItemType.ExpenseByAccount,
|
||||||
[item.primaryAccount.category, item.primaryAccount.displayOrder, item.account.displayOrder],
|
[primaryAccountCategoryDisplayOrder, item.primaryAccount.displayOrder, item.account.displayOrder],
|
||||||
item.primaryAccount.hidden || item.account.hidden);
|
item.primaryAccount.hidden || item.account.hidden);
|
||||||
allDataItemsMap[expenseByAccountKey] = expenseByAccountItem;
|
allDataItemsMap[expenseByAccountKey] = expenseByAccountItem;
|
||||||
allExpenseByAccountDataItems.push(expenseByAccountItem);
|
allExpenseByAccountDataItems.push(expenseByAccountItem);
|
||||||
@@ -404,11 +405,12 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
let transferToAccountItem: TransactionCategoricalOverviewAnalysisDataItem | undefined = allDataItemsMap[transferToAccountKey];
|
let transferToAccountItem: TransactionCategoricalOverviewAnalysisDataItem | undefined = allDataItemsMap[transferToAccountKey];
|
||||||
|
|
||||||
if (!transferToAccountItem) {
|
if (!transferToAccountItem) {
|
||||||
|
const relatedPrimaryAccountCategoryDisplayOrder = settingsStore.accountCategoryDisplayOrders[item.relatedPrimaryAccount.category] || Number.MAX_SAFE_INTEGER;
|
||||||
transferToAccountItem = createNewTransactionCategoricalOverviewAnalysisDataItem(
|
transferToAccountItem = createNewTransactionCategoricalOverviewAnalysisDataItem(
|
||||||
item.relatedAccount.id,
|
item.relatedAccount.id,
|
||||||
item.relatedAccount.name,
|
item.relatedAccount.name,
|
||||||
TransactionCategoricalOverviewAnalysisDataItemType.ExpenseByAccount,
|
TransactionCategoricalOverviewAnalysisDataItemType.ExpenseByAccount,
|
||||||
[item.relatedPrimaryAccount.category, item.relatedPrimaryAccount.displayOrder, item.relatedAccount.displayOrder],
|
[relatedPrimaryAccountCategoryDisplayOrder, item.relatedPrimaryAccount.displayOrder, item.relatedAccount.displayOrder],
|
||||||
item.relatedPrimaryAccount.hidden || item.relatedAccount.hidden);
|
item.relatedPrimaryAccount.hidden || item.relatedAccount.hidden);
|
||||||
allDataItemsMap[transferToAccountKey] = transferToAccountItem;
|
allDataItemsMap[transferToAccountKey] = transferToAccountItem;
|
||||||
allExpenseByAccountDataItems.push(transferToAccountItem);
|
allExpenseByAccountDataItems.push(transferToAccountItem);
|
||||||
@@ -543,6 +545,8 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
primaryAccount = account;
|
primaryAccount = account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const primaryAccountCategoryDisplayOrder = settingsStore.accountCategoryDisplayOrders[primaryAccount.category] || Number.MAX_SAFE_INTEGER;
|
||||||
|
|
||||||
let amount = account.balance;
|
let amount = account.balance;
|
||||||
|
|
||||||
if (account.currency !== userStore.currentUserDefaultCurrency) {
|
if (account.currency !== userStore.currentUserDefaultCurrency) {
|
||||||
@@ -566,7 +570,7 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
icon: account.icon || DEFAULT_ACCOUNT_ICON.icon,
|
icon: account.icon || DEFAULT_ACCOUNT_ICON.icon,
|
||||||
color: account.color || DEFAULT_ACCOUNT_COLOR,
|
color: account.color || DEFAULT_ACCOUNT_COLOR,
|
||||||
hidden: primaryAccount.hidden || account.hidden,
|
hidden: primaryAccount.hidden || account.hidden,
|
||||||
displayOrders: [primaryAccount.category, primaryAccount.displayOrder, account.displayOrder],
|
displayOrders: [primaryAccountCategoryDisplayOrder, primaryAccount.displayOrder, account.displayOrder],
|
||||||
totalAmount: amount
|
totalAmount: amount
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -888,6 +892,8 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
if (data) {
|
if (data) {
|
||||||
data.totalAmount += amount;
|
data.totalAmount += amount;
|
||||||
} else {
|
} else {
|
||||||
|
const primaryAccountCategoryDisplayOrder = settingsStore.accountCategoryDisplayOrders[item.primaryAccount.category] || Number.MAX_SAFE_INTEGER;
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
name: item.account.name,
|
name: item.account.name,
|
||||||
type: 'account',
|
type: 'account',
|
||||||
@@ -895,7 +901,7 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
icon: item.account.icon || DEFAULT_ACCOUNT_ICON.icon,
|
icon: item.account.icon || DEFAULT_ACCOUNT_ICON.icon,
|
||||||
color: item.account.color || DEFAULT_ACCOUNT_COLOR,
|
color: item.account.color || DEFAULT_ACCOUNT_COLOR,
|
||||||
hidden: item.primaryAccount.hidden || item.account.hidden,
|
hidden: item.primaryAccount.hidden || item.account.hidden,
|
||||||
displayOrders: [item.primaryAccount.category, item.primaryAccount.displayOrder, item.account.displayOrder],
|
displayOrders: [primaryAccountCategoryDisplayOrder, item.primaryAccount.displayOrder, item.account.displayOrder],
|
||||||
totalAmount: amount,
|
totalAmount: amount,
|
||||||
items: []
|
items: []
|
||||||
};
|
};
|
||||||
@@ -1131,6 +1137,8 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
if (data) {
|
if (data) {
|
||||||
data.totalAmount += item.amountInDefaultCurrency;
|
data.totalAmount += item.amountInDefaultCurrency;
|
||||||
} else {
|
} else {
|
||||||
|
const primaryAccountCategoryDisplayOrder = settingsStore.accountCategoryDisplayOrders[item.primaryAccount.category] || Number.MAX_SAFE_INTEGER;
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
name: item.account.name,
|
name: item.account.name,
|
||||||
type: 'account',
|
type: 'account',
|
||||||
@@ -1138,7 +1146,7 @@ export const useStatisticsStore = defineStore('statistics', () => {
|
|||||||
icon: item.account.icon || DEFAULT_ACCOUNT_ICON.icon,
|
icon: item.account.icon || DEFAULT_ACCOUNT_ICON.icon,
|
||||||
color: item.account.color || DEFAULT_ACCOUNT_COLOR,
|
color: item.account.color || DEFAULT_ACCOUNT_COLOR,
|
||||||
hidden: item.primaryAccount.hidden || item.account.hidden,
|
hidden: item.primaryAccount.hidden || item.account.hidden,
|
||||||
displayOrders: [item.primaryAccount.category, item.primaryAccount.displayOrder, item.account.displayOrder],
|
displayOrders: [primaryAccountCategoryDisplayOrder, item.primaryAccount.displayOrder, item.account.displayOrder],
|
||||||
totalAmount: item.amountInDefaultCurrency
|
totalAmount: item.amountInDefaultCurrency
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { ref, computed, watch } from 'vue';
|
|||||||
|
|
||||||
import { useI18n } from '@/locales/helpers.ts';
|
import { useI18n } from '@/locales/helpers.ts';
|
||||||
|
|
||||||
|
import { useSettingsStore } from '@/stores/setting.ts';
|
||||||
import { useUserStore } from '@/stores/user.ts';
|
import { useUserStore } from '@/stores/user.ts';
|
||||||
|
|
||||||
import type { TypeAndDisplayName } from '@/core/base.ts';
|
import type { TypeAndDisplayName } from '@/core/base.ts';
|
||||||
@@ -25,13 +26,16 @@ export interface DayAndDisplayName {
|
|||||||
export function useAccountEditPageBase() {
|
export function useAccountEditPageBase() {
|
||||||
const { tt, getAllAccountCategories, getAllAccountTypes, getMonthdayShortName } = useI18n();
|
const { tt, getAllAccountCategories, getAllAccountTypes, getMonthdayShortName } = useI18n();
|
||||||
|
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
|
const defaultAccountCategory = AccountCategory.values(settingsStore.appSettings.accountCategoryOrders)[0] ?? AccountCategory.Default;
|
||||||
|
|
||||||
const editAccountId = ref<string | null>(null);
|
const editAccountId = ref<string | null>(null);
|
||||||
const clientSessionId = ref<string>('');
|
const clientSessionId = ref<string>('');
|
||||||
const loading = ref<boolean>(false);
|
const loading = ref<boolean>(false);
|
||||||
const submitting = ref<boolean>(false);
|
const submitting = ref<boolean>(false);
|
||||||
const account = ref<Account>(Account.createNewAccount(userStore.currentUserDefaultCurrency, getCurrentUnixTimeForNewAccount()));
|
const account = ref<Account>(Account.createNewAccount(defaultAccountCategory, userStore.currentUserDefaultCurrency, getCurrentUnixTimeForNewAccount()));
|
||||||
const subAccounts = ref<Account[]>([]);
|
const subAccounts = ref<Account[]>([]);
|
||||||
|
|
||||||
const title = computed<string>(() => {
|
const title = computed<string>(() => {
|
||||||
@@ -72,7 +76,8 @@ export function useAccountEditPageBase() {
|
|||||||
|
|
||||||
const inputIsEmpty = computed<boolean>(() => !!inputEmptyProblemMessage.value);
|
const inputIsEmpty = computed<boolean>(() => !!inputEmptyProblemMessage.value);
|
||||||
|
|
||||||
const allAccountCategories = computed<LocalizedAccountCategory[]>(() => getAllAccountCategories());
|
const customAccountCategoryOrder = computed<string>(() => settingsStore.appSettings.accountCategoryOrders);
|
||||||
|
const allAccountCategories = computed<LocalizedAccountCategory[]>(() => getAllAccountCategories(customAccountCategoryOrder.value));
|
||||||
const allAccountTypes = computed<TypeAndDisplayName[]>(() => getAllAccountTypes());
|
const allAccountTypes = computed<TypeAndDisplayName[]>(() => getAllAccountTypes());
|
||||||
|
|
||||||
const allAvailableMonthDays = computed<DayAndDisplayName[]>(() => {
|
const allAvailableMonthDays = computed<DayAndDisplayName[]>(() => {
|
||||||
@@ -181,6 +186,8 @@ export function useAccountEditPageBase() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
// constants
|
||||||
|
defaultAccountCategory,
|
||||||
// states
|
// states
|
||||||
editAccountId,
|
editAccountId,
|
||||||
clientSessionId,
|
clientSessionId,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { useAccountsStore } from '@/stores/account.ts';
|
|||||||
|
|
||||||
import type { HiddenAmount, NumberWithSuffix } from '@/core/numeral.ts';
|
import type { HiddenAmount, NumberWithSuffix } from '@/core/numeral.ts';
|
||||||
import type { WeekDayValue } from '@/core/datetime.ts';
|
import type { WeekDayValue } from '@/core/datetime.ts';
|
||||||
import { type AccountCategory, AccountType } from '@/core/account.ts';
|
import { AccountCategory, AccountType } from '@/core/account.ts';
|
||||||
import type { Account, CategorizedAccount } from '@/models/account.ts';
|
import type { Account, CategorizedAccount } from '@/models/account.ts';
|
||||||
|
|
||||||
import { isObject, isNumber, isString } from '@/lib/common.ts';
|
import { isObject, isNumber, isString } from '@/lib/common.ts';
|
||||||
@@ -29,6 +29,9 @@ export function useAccountListPageBase() {
|
|||||||
set: (value) => settingsStore.setShowAccountBalance(value)
|
set: (value) => settingsStore.setShowAccountBalance(value)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const customAccountCategoryOrder = computed<string>(() => settingsStore.appSettings.accountCategoryOrders);
|
||||||
|
const defaultAccountCategory = computed<AccountCategory>(() => AccountCategory.values(customAccountCategoryOrder.value)[0] ?? AccountCategory.Default);
|
||||||
|
|
||||||
const firstDayOfWeek = computed<WeekDayValue>(() => userStore.currentUserFirstDayOfWeek);
|
const firstDayOfWeek = computed<WeekDayValue>(() => userStore.currentUserFirstDayOfWeek);
|
||||||
const fiscalYearStart = computed<number>(() => userStore.currentUserFiscalYearStart);
|
const fiscalYearStart = computed<number>(() => userStore.currentUserFiscalYearStart);
|
||||||
const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurrency);
|
const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurrency);
|
||||||
@@ -90,6 +93,8 @@ export function useAccountListPageBase() {
|
|||||||
displayOrderModified,
|
displayOrderModified,
|
||||||
// computed states
|
// computed states
|
||||||
showAccountBalance,
|
showAccountBalance,
|
||||||
|
customAccountCategoryOrder,
|
||||||
|
defaultAccountCategory,
|
||||||
firstDayOfWeek,
|
firstDayOfWeek,
|
||||||
fiscalYearStart,
|
fiscalYearStart,
|
||||||
defaultCurrency,
|
defaultCurrency,
|
||||||
|
|||||||
@@ -19,9 +19,10 @@ export function useMoveAllTransactionsPageBase() {
|
|||||||
const toAccountName = ref<string>('');
|
const toAccountName = ref<string>('');
|
||||||
|
|
||||||
const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.showAccountBalance);
|
const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.showAccountBalance);
|
||||||
|
const customAccountCategoryOrder = computed<string>(() => settingsStore.appSettings.accountCategoryOrders);
|
||||||
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
||||||
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
||||||
const allVisibleCategorizedAccounts = computed<CategorizedAccountWithDisplayBalance[]>(() => getCategorizedAccountsWithDisplayBalance(allVisibleAccounts.value, showAccountBalance.value));
|
const allVisibleCategorizedAccounts = computed<CategorizedAccountWithDisplayBalance[]>(() => getCategorizedAccountsWithDisplayBalance(allVisibleAccounts.value, showAccountBalance.value, customAccountCategoryOrder.value));
|
||||||
|
|
||||||
const displayToAccountName = computed<string>(() => {
|
const displayToAccountName = computed<string>(() => {
|
||||||
if (!toAccountId.value) {
|
if (!toAccountId.value) {
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { AccountCategory } from '@/core/account.ts';
|
||||||
|
|
||||||
|
import { useSettingsStore } from '@/stores/setting.ts';
|
||||||
|
|
||||||
|
export function useAccountCategoryDisplayOrderSettingsPageBase() {
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
|
const accountCategories = ref<AccountCategory[]>(AccountCategory.values(settingsStore.appSettings.accountCategoryOrders));
|
||||||
|
|
||||||
|
function isDisplayOrderModified(): boolean {
|
||||||
|
const currentOrders = AccountCategory.values(settingsStore.appSettings.accountCategoryOrders);
|
||||||
|
|
||||||
|
if (currentOrders.length !== accountCategories.value.length) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < currentOrders.length; i++) {
|
||||||
|
const accountCategory = accountCategories.value[i];
|
||||||
|
const currentCategory = currentOrders[i];
|
||||||
|
|
||||||
|
if (!accountCategory || !currentCategory) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountCategory.type !== currentCategory.type) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadDisplayOrderFromSettings(): void {
|
||||||
|
accountCategories.value = AccountCategory.values(settingsStore.appSettings.accountCategoryOrders);
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveDisplayOrderToSettings(): void {
|
||||||
|
const displayOrders = accountCategories.value.map(category => category.type).join(',');
|
||||||
|
const defaultOrders = AccountCategory.values('').map(category => category.type).join(',');
|
||||||
|
|
||||||
|
if (displayOrders === defaultOrders) {
|
||||||
|
settingsStore.setAccountCategoryOrders('');
|
||||||
|
} else {
|
||||||
|
settingsStore.setAccountCategoryOrders(displayOrders);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetDisplayOrderToDefault(): void {
|
||||||
|
accountCategories.value = AccountCategory.values('');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
// states
|
||||||
|
accountCategories,
|
||||||
|
// functions
|
||||||
|
isDisplayOrderModified,
|
||||||
|
loadDisplayOrderFromSettings,
|
||||||
|
saveDisplayOrderToSettings,
|
||||||
|
resetDisplayOrderToDefault
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ import { useStatisticsStore } from '@/stores/statistics.ts';
|
|||||||
import { useOverviewStore } from '@/stores/overview.ts';
|
import { useOverviewStore } from '@/stores/overview.ts';
|
||||||
|
|
||||||
import { keys, keysIfValueEquals, values } from '@/core/base.ts';
|
import { keys, keysIfValueEquals, values } from '@/core/base.ts';
|
||||||
import type {Account, CategorizedAccount} from '@/models/account.ts';
|
import type { Account, CategorizedAccount } from '@/models/account.ts';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
filterCategorizedAccounts,
|
filterCategorizedAccounts,
|
||||||
@@ -49,11 +49,12 @@ export function useAccountFilterSettingPageBase(type?: AccountFilterType, select
|
|||||||
return type === 'statisticsDefault' || type === 'statisticsCurrent' || type === 'homePageOverview' || type === 'transactionListCurrent' || type === 'custom';
|
return type === 'statisticsDefault' || type === 'statisticsCurrent' || type === 'homePageOverview' || type === 'transactionListCurrent' || type === 'custom';
|
||||||
});
|
});
|
||||||
|
|
||||||
const allCategorizedAccounts = computed<Record<number, CategorizedAccount>>(() => filterCategorizedAccounts(accountsStore.allCategorizedAccountsMap, filterContent.value, showHidden.value));
|
const customAccountCategoryOrder = computed<string>(() => settingsStore.appSettings.accountCategoryOrders);
|
||||||
|
const allCategorizedAccounts = computed<CategorizedAccount[]>(() => filterCategorizedAccounts(accountsStore.allCategorizedAccountsMap, customAccountCategoryOrder.value, filterContent.value, showHidden.value));
|
||||||
const allVisibleAccountMap = computed<Record<string, Account>>(() => {
|
const allVisibleAccountMap = computed<Record<string, Account>>(() => {
|
||||||
const accountMap: Record<string, Account> = {};
|
const accountMap: Record<string, Account> = {};
|
||||||
|
|
||||||
for (const accountCategory of values(allCategorizedAccounts.value)) {
|
for (const accountCategory of allCategorizedAccounts.value) {
|
||||||
for (const account of accountCategory.accounts) {
|
for (const account of accountCategory.accounts) {
|
||||||
accountMap[account.id] = account;
|
accountMap[account.id] = account;
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ export function useAccountFilterSettingPageBase(type?: AccountFilterType, select
|
|||||||
});
|
});
|
||||||
const hasAnyAvailableAccount = computed<boolean>(() => accountsStore.allAvailableAccountsCount > 0);
|
const hasAnyAvailableAccount = computed<boolean>(() => accountsStore.allAvailableAccountsCount > 0);
|
||||||
const hasAnyVisibleAccount = computed<boolean>(() => {
|
const hasAnyVisibleAccount = computed<boolean>(() => {
|
||||||
for (const accountCategory of values(allCategorizedAccounts.value)) {
|
for (const accountCategory of allCategorizedAccounts.value) {
|
||||||
if (accountCategory.accounts.length > 0) {
|
if (accountCategory.accounts.length > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -204,6 +205,7 @@ export function useAccountFilterSettingPageBase(type?: AccountFilterType, select
|
|||||||
title,
|
title,
|
||||||
applyText,
|
applyText,
|
||||||
allowHiddenAccount,
|
allowHiddenAccount,
|
||||||
|
customAccountCategoryOrder,
|
||||||
allCategorizedAccounts,
|
allCategorizedAccounts,
|
||||||
allVisibleAccountMap,
|
allVisibleAccountMap,
|
||||||
hasAnyAvailableAccount,
|
hasAnyAvailableAccount,
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ export const ALL_APPLICATION_CLOUD_SETTINGS: CategorizedApplicationCloudSettingI
|
|||||||
categoryName: 'Account List Page',
|
categoryName: 'Account List Page',
|
||||||
items: [
|
items: [
|
||||||
{ settingKey: 'totalAmountExcludeAccountIds', settingName: 'Accounts Included in Total', mobile: true, desktop: true },
|
{ settingKey: 'totalAmountExcludeAccountIds', settingName: 'Accounts Included in Total', mobile: true, desktop: true },
|
||||||
|
{ settingKey: 'accountCategoryOrders', settingName: 'Account Category Order', mobile: true, desktop: true },
|
||||||
{ settingKey: 'hideCategoriesWithoutAccounts', settingName: 'Hide Categories Without Accounts', mobile: false, desktop: true }
|
{ settingKey: 'hideCategoriesWithoutAccounts', settingName: 'Hide Categories Without Accounts', mobile: false, desktop: true }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -134,6 +134,14 @@ export function useAppSettingPageBase() {
|
|||||||
return getIncludedAccountsDisplayContent(excludeAccountIds, accountsStore.allVisiblePlainAccounts);
|
return getIncludedAccountsDisplayContent(excludeAccountIds, accountsStore.allVisiblePlainAccounts);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const accountCategorysDisplayOrderContent = computed<string>(() => {
|
||||||
|
if (!settingsStore.appSettings.accountCategoryOrders) {
|
||||||
|
return tt('Default');
|
||||||
|
}
|
||||||
|
|
||||||
|
return tt('Custom');
|
||||||
|
});
|
||||||
|
|
||||||
const transactionCategoriesIncludedInHomePageOverviewDisplayContent = computed<string>(() => {
|
const transactionCategoriesIncludedInHomePageOverviewDisplayContent = computed<string>(() => {
|
||||||
const excludeAccountIds = settingsStore.appSettings.overviewTransactionCategoryFilterInHomePage;
|
const excludeAccountIds = settingsStore.appSettings.overviewTransactionCategoryFilterInHomePage;
|
||||||
return getIncludedTransactionCategoriesDisplayContent(excludeAccountIds);
|
return getIncludedTransactionCategoriesDisplayContent(excludeAccountIds);
|
||||||
@@ -237,6 +245,7 @@ export function useAppSettingPageBase() {
|
|||||||
currencySortByInExchangeRatesPage,
|
currencySortByInExchangeRatesPage,
|
||||||
accountsIncludedInHomePageOverviewDisplayContent,
|
accountsIncludedInHomePageOverviewDisplayContent,
|
||||||
accountsIncludedInTotalDisplayContent,
|
accountsIncludedInTotalDisplayContent,
|
||||||
|
accountCategorysDisplayOrderContent,
|
||||||
transactionCategoriesIncludedInHomePageOverviewDisplayContent
|
transactionCategoriesIncludedInHomePageOverviewDisplayContent
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo
|
|||||||
const numeralSystem = computed<NumeralSystem>(() => getCurrentNumeralSystemType());
|
const numeralSystem = computed<NumeralSystem>(() => getCurrentNumeralSystemType());
|
||||||
const currentTimezoneOffsetMinutes = computed<number>(() => getTimezoneOffsetMinutes(transaction.value.time));
|
const currentTimezoneOffsetMinutes = computed<number>(() => getTimezoneOffsetMinutes(transaction.value.time));
|
||||||
const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.showAccountBalance);
|
const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.showAccountBalance);
|
||||||
|
const customAccountCategoryOrder = computed<string>(() => settingsStore.appSettings.accountCategoryOrders);
|
||||||
const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurrency);
|
const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurrency);
|
||||||
const defaultAccountId = computed<string>(() => userStore.currentUserDefaultAccountId);
|
const defaultAccountId = computed<string>(() => userStore.currentUserDefaultAccountId);
|
||||||
const firstDayOfWeek = computed<WeekDayValue>(() => userStore.currentUserFirstDayOfWeek);
|
const firstDayOfWeek = computed<WeekDayValue>(() => userStore.currentUserFirstDayOfWeek);
|
||||||
@@ -105,7 +106,7 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo
|
|||||||
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
||||||
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
||||||
const allAccountsMap = computed<Record<string, Account>>(() => accountsStore.allAccountsMap);
|
const allAccountsMap = computed<Record<string, Account>>(() => accountsStore.allAccountsMap);
|
||||||
const allVisibleCategorizedAccounts = computed<CategorizedAccountWithDisplayBalance[]>(() => getCategorizedAccountsWithDisplayBalance(allVisibleAccounts.value, showAccountBalance.value));
|
const allVisibleCategorizedAccounts = computed<CategorizedAccountWithDisplayBalance[]>(() => getCategorizedAccountsWithDisplayBalance(allVisibleAccounts.value, showAccountBalance.value, customAccountCategoryOrder.value));
|
||||||
const allCategories = computed<Record<number, TransactionCategory[]>>(() => transactionCategoriesStore.allTransactionCategories);
|
const allCategories = computed<Record<number, TransactionCategory[]>>(() => transactionCategoriesStore.allTransactionCategories);
|
||||||
const allCategoriesMap = computed<Record<string, TransactionCategory>>(() => transactionCategoriesStore.allTransactionCategoriesMap);
|
const allCategoriesMap = computed<Record<string, TransactionCategory>>(() => transactionCategoriesStore.allTransactionCategoriesMap);
|
||||||
const allTags = computed<TransactionTag[]>(() => transactionTagsStore.allTransactionTags);
|
const allTags = computed<TransactionTag[]>(() => transactionTagsStore.allTransactionTags);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export function useUserProfilePageBase() {
|
|||||||
|
|
||||||
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
||||||
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
||||||
const allVisibleCategorizedAccounts = computed<CategorizedAccount[]>(() => getCategorizedAccounts(allVisibleAccounts.value));
|
const allVisibleCategorizedAccounts = computed<CategorizedAccount[]>(() => getCategorizedAccounts(allVisibleAccounts.value, settingsStore.appSettings.accountCategoryOrders));
|
||||||
const allWeekDays = computed<TypeAndDisplayName[]>(() => getAllWeekDays());
|
const allWeekDays = computed<TypeAndDisplayName[]>(() => getAllWeekDays());
|
||||||
const allCalendarDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllCalendarDisplayTypes());
|
const allCalendarDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllCalendarDisplayTypes());
|
||||||
const allDateDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllDateDisplayTypes());
|
const allDateDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllDateDisplayTypes());
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<v-tabs show-arrows class="account-category-tabs my-4" direction="vertical"
|
<v-tabs show-arrows class="account-category-tabs my-4" direction="vertical"
|
||||||
:disabled="loading" v-model="activeAccountCategoryType">
|
:disabled="loading" v-model="activeAccountCategoryType">
|
||||||
<v-tab class="tab-text-truncate" :key="accountCategory.type" :value="accountCategory.type"
|
<v-tab class="tab-text-truncate" :key="accountCategory.type" :value="accountCategory.type"
|
||||||
v-for="accountCategory in AccountCategory.values()"
|
v-for="accountCategory in AccountCategory.values(customAccountCategoryOrder)"
|
||||||
v-show="!hideAccountCategoriesWithoutAccounts || (allCategorizedAccountsMap[accountCategory.type] && allCategorizedAccountsMap[accountCategory.type]!.accounts.length > 0)">
|
v-show="!hideAccountCategoriesWithoutAccounts || (allCategorizedAccountsMap[accountCategory.type] && allCategorizedAccountsMap[accountCategory.type]!.accounts.length > 0)">
|
||||||
<ItemIcon icon-type="account" :icon-id="accountCategory.defaultAccountIconId" />
|
<ItemIcon icon-type="account" :icon-id="accountCategory.defaultAccountIconId" />
|
||||||
<div class="d-flex flex-column text-truncate ms-2">
|
<div class="d-flex flex-column text-truncate ms-2">
|
||||||
@@ -372,6 +372,8 @@ const {
|
|||||||
showHidden,
|
showHidden,
|
||||||
displayOrderModified,
|
displayOrderModified,
|
||||||
showAccountBalance,
|
showAccountBalance,
|
||||||
|
customAccountCategoryOrder,
|
||||||
|
defaultAccountCategory,
|
||||||
firstDayOfWeek,
|
firstDayOfWeek,
|
||||||
fiscalYearStart,
|
fiscalYearStart,
|
||||||
allAccounts,
|
allAccounts,
|
||||||
@@ -394,7 +396,7 @@ const reconciliationStatementDialog = useTemplateRef<ReconciliationStatementDial
|
|||||||
const moveAllTransactionsDialog = useTemplateRef<MoveAllTransactionsDialogType>('moveAllTransactionsDialog');
|
const moveAllTransactionsDialog = useTemplateRef<MoveAllTransactionsDialogType>('moveAllTransactionsDialog');
|
||||||
const clearAllTransactionsDialog = useTemplateRef<ClearAllTransactionsDialogType>('clearAllTransactionsDialog');
|
const clearAllTransactionsDialog = useTemplateRef<ClearAllTransactionsDialogType>('clearAllTransactionsDialog');
|
||||||
|
|
||||||
const activeAccountCategoryType = ref<number>(AccountCategory.Default.type);
|
const activeAccountCategoryType = ref<number>(defaultAccountCategory.value.type);
|
||||||
const activeTab = ref<string>('accountPage');
|
const activeTab = ref<string>('accountPage');
|
||||||
const activeSubAccount = ref<Record<string, string>>({});
|
const activeSubAccount = ref<Record<string, string>>({});
|
||||||
const accountToShowReconciliationStatement = ref<Account | null>(null);
|
const accountToShowReconciliationStatement = ref<Account | null>(null);
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ type SnackBarType = InstanceType<typeof SnackBar>;
|
|||||||
|
|
||||||
const { tt } = useI18n();
|
const { tt } = useI18n();
|
||||||
const {
|
const {
|
||||||
|
defaultAccountCategory,
|
||||||
editAccountId,
|
editAccountId,
|
||||||
clientSessionId,
|
clientSessionId,
|
||||||
loading,
|
loading,
|
||||||
@@ -279,7 +280,7 @@ const accountAmountTitle = computed<string>(() => {
|
|||||||
|
|
||||||
const isAccountModified = computed<boolean>(() => {
|
const isAccountModified = computed<boolean>(() => {
|
||||||
if (!editAccountId.value) {
|
if (!editAccountId.value) {
|
||||||
return !account.value.equals(Account.createNewAccount(userStore.currentUserDefaultCurrency, account.value.balanceTime ?? getCurrentUnixTimeForNewAccount()));
|
return !account.value.equals(Account.createNewAccount(defaultAccountCategory, userStore.currentUserDefaultCurrency, account.value.balanceTime ?? getCurrentUnixTimeForNewAccount()));
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -293,7 +294,7 @@ function open(options?: { id?: string, currentAccount?: Account, category?: numb
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
submitting.value = false;
|
submitting.value = false;
|
||||||
|
|
||||||
const newAccount = Account.createNewAccount(userStore.currentUserDefaultCurrency, getCurrentUnixTimeForNewAccount());
|
const newAccount = Account.createNewAccount(defaultAccountCategory, userStore.currentUserDefaultCurrency, getCurrentUnixTimeForNewAccount());
|
||||||
account.value.fillFrom(newAccount);
|
account.value.fillFrom(newAccount);
|
||||||
subAccounts.value = [];
|
subAccounts.value = [];
|
||||||
currentAccountIndex.value = -1;
|
currentAccountIndex.value = -1;
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
<template>
|
||||||
|
<v-dialog width="600" :persistent="isDisplayOrderModified()" v-model="showState">
|
||||||
|
<v-card class="pa-sm-1 pa-md-2">
|
||||||
|
<template #title>
|
||||||
|
<div class="d-flex align-center justify-center">
|
||||||
|
<div class="d-flex align-center">
|
||||||
|
<h4 class="text-h4">{{ tt('Account Category Order') }}</h4>
|
||||||
|
</div>
|
||||||
|
<v-spacer/>
|
||||||
|
<v-btn density="comfortable" color="default" variant="text" class="ms-2" :icon="true">
|
||||||
|
<v-icon :icon="mdiDotsVertical" />
|
||||||
|
<v-menu activator="parent">
|
||||||
|
<v-list>
|
||||||
|
<v-list-item :prepend-icon="mdiRestore"
|
||||||
|
:title="tt('Reset to Default')"
|
||||||
|
@click="resetDisplayOrderToDefault"></v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-menu>
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<v-card-text class="d-flex flex-column flex-md-row flex-grow-1 overflow-y-auto">
|
||||||
|
<v-table hover density="comfortable" class="w-100 table-striped">
|
||||||
|
<draggable-list tag="tbody"
|
||||||
|
item-key="id"
|
||||||
|
handle=".drag-handle"
|
||||||
|
ghost-class="dragging-item"
|
||||||
|
v-model="accountCategories">
|
||||||
|
<template #item="{ element }">
|
||||||
|
<tr class="text-sm">
|
||||||
|
<td>
|
||||||
|
<div class="d-flex align-center">
|
||||||
|
<div class="d-flex align-center">
|
||||||
|
<span>{{ tt(element.name) }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<v-spacer/>
|
||||||
|
|
||||||
|
<span class="ms-2">
|
||||||
|
<v-icon class="drag-handle" :icon="mdiDrag"/>
|
||||||
|
<v-tooltip activator="parent">{{ tt('Drag to Reorder') }}</v-tooltip>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</template>
|
||||||
|
</draggable-list>
|
||||||
|
</v-table>
|
||||||
|
</v-card-text>
|
||||||
|
|
||||||
|
<v-card-text class="overflow-y-visible">
|
||||||
|
<div class="w-100 d-flex justify-center flex-wrap mt-sm-1 mt-md-2 gap-4">
|
||||||
|
<v-btn :disabled="!isDisplayOrderModified()" @click="saveDisplayOrder">{{ tt('Save') }}</v-btn>
|
||||||
|
<v-btn color="secondary" variant="tonal" @click="cancel">{{ tt('Cancel') }}</v-btn>
|
||||||
|
</div>
|
||||||
|
</v-card-text>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { useI18n } from '@/locales/helpers.ts';
|
||||||
|
import { useAccountCategoryDisplayOrderSettingsPageBase } from '@/views/base/settings/AccountCategoryDisplayOrderSettingsPageBase.ts';
|
||||||
|
|
||||||
|
import {
|
||||||
|
mdiDotsVertical,
|
||||||
|
mdiRestore,
|
||||||
|
mdiDrag
|
||||||
|
} from '@mdi/js';
|
||||||
|
|
||||||
|
const { tt } = useI18n();
|
||||||
|
|
||||||
|
const {
|
||||||
|
accountCategories,
|
||||||
|
isDisplayOrderModified,
|
||||||
|
loadDisplayOrderFromSettings,
|
||||||
|
saveDisplayOrderToSettings,
|
||||||
|
resetDisplayOrderToDefault
|
||||||
|
} = useAccountCategoryDisplayOrderSettingsPageBase();
|
||||||
|
|
||||||
|
let resolveFunc: (() => void) | null = null;
|
||||||
|
let rejectFunc: (() => void) | null = null;
|
||||||
|
|
||||||
|
const showState = ref<boolean>(false);
|
||||||
|
|
||||||
|
function open(): Promise<void> {
|
||||||
|
loadDisplayOrderFromSettings();
|
||||||
|
showState.value = true;
|
||||||
|
|
||||||
|
return new Promise<void>((resolve, reject) => {
|
||||||
|
resolveFunc = resolve;
|
||||||
|
rejectFunc = reject;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveDisplayOrder(): void {
|
||||||
|
saveDisplayOrderToSettings();
|
||||||
|
resolveFunc?.();
|
||||||
|
showState.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancel(): void {
|
||||||
|
rejectFunc?.();
|
||||||
|
showState.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -277,6 +277,19 @@
|
|||||||
@click="showAccountsIncludedInTotalDialog = true"
|
@click="showAccountsIncludedInTotalDialog = true"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
<v-col cols="12" md="6">
|
||||||
|
<v-text-field
|
||||||
|
class="always-cursor-pointer"
|
||||||
|
item-title="displayName"
|
||||||
|
item-value="type"
|
||||||
|
persistent-placeholder
|
||||||
|
:readonly="true"
|
||||||
|
:label="tt('Account Category Order')"
|
||||||
|
:placeholder="tt('Account Category Order')"
|
||||||
|
:model-value="accountCategorysDisplayOrderContent"
|
||||||
|
@click="accountCategorysDisplayOrderDialog?.open()"
|
||||||
|
/>
|
||||||
|
</v-col>
|
||||||
<v-col cols="12" md="6">
|
<v-col cols="12" md="6">
|
||||||
<v-select
|
<v-select
|
||||||
item-title="displayName"
|
item-title="displayName"
|
||||||
@@ -332,6 +345,8 @@
|
|||||||
@settings:change="showAccountsIncludedInTotalDialog = false" />
|
@settings:change="showAccountsIncludedInTotalDialog = false" />
|
||||||
</v-dialog>
|
</v-dialog>
|
||||||
|
|
||||||
|
<account-category-display-order-dialog ref="accountCategorysDisplayOrderDialog" />
|
||||||
|
|
||||||
<snack-bar ref="snackbar" />
|
<snack-bar ref="snackbar" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -339,6 +354,7 @@
|
|||||||
import SnackBar from '@/components/desktop/SnackBar.vue';
|
import SnackBar from '@/components/desktop/SnackBar.vue';
|
||||||
import AccountFilterSettingsCard from '@/views/desktop/common/cards/AccountFilterSettingsCard.vue';
|
import AccountFilterSettingsCard from '@/views/desktop/common/cards/AccountFilterSettingsCard.vue';
|
||||||
import CategoryFilterSettingsCard from '@/views/desktop/common/cards/CategoryFilterSettingsCard.vue';
|
import CategoryFilterSettingsCard from '@/views/desktop/common/cards/CategoryFilterSettingsCard.vue';
|
||||||
|
import AccountCategoryDisplayOrderDialog from '@/views/desktop/app/settings/dialogs/AccountCategoryDisplayOrderDialog.vue';
|
||||||
|
|
||||||
import { ref, computed, useTemplateRef } from 'vue';
|
import { ref, computed, useTemplateRef } from 'vue';
|
||||||
import { useTheme } from 'vuetify';
|
import { useTheme } from 'vuetify';
|
||||||
@@ -358,6 +374,7 @@ import { CategoryType } from '@/core/category.ts';
|
|||||||
import { getSystemTheme } from '@/lib/ui/common.ts';
|
import { getSystemTheme } from '@/lib/ui/common.ts';
|
||||||
|
|
||||||
type SnackBarType = InstanceType<typeof SnackBar>;
|
type SnackBarType = InstanceType<typeof SnackBar>;
|
||||||
|
type AccountCategoryDisplayOrderDialogType = InstanceType<typeof AccountCategoryDisplayOrderDialog>;
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
@@ -386,6 +403,7 @@ const {
|
|||||||
currencySortByInExchangeRatesPage,
|
currencySortByInExchangeRatesPage,
|
||||||
accountsIncludedInHomePageOverviewDisplayContent,
|
accountsIncludedInHomePageOverviewDisplayContent,
|
||||||
accountsIncludedInTotalDisplayContent,
|
accountsIncludedInTotalDisplayContent,
|
||||||
|
accountCategorysDisplayOrderContent,
|
||||||
transactionCategoriesIncludedInHomePageOverviewDisplayContent
|
transactionCategoriesIncludedInHomePageOverviewDisplayContent
|
||||||
} = useAppSettingPageBase();
|
} = useAppSettingPageBase();
|
||||||
|
|
||||||
@@ -394,6 +412,7 @@ const accountsStore = useAccountsStore();
|
|||||||
const transactionCategoriesStore = useTransactionCategoriesStore();
|
const transactionCategoriesStore = useTransactionCategoriesStore();
|
||||||
|
|
||||||
const snackbar = useTemplateRef<SnackBarType>('snackbar');
|
const snackbar = useTemplateRef<SnackBarType>('snackbar');
|
||||||
|
const accountCategorysDisplayOrderDialog = useTemplateRef<AccountCategoryDisplayOrderDialogType>('accountCategorysDisplayOrderDialog');
|
||||||
|
|
||||||
const showAccountsIncludedInHomePageOverviewDialog = ref<boolean>(false);
|
const showAccountsIncludedInHomePageOverviewDialog = ref<boolean>(false);
|
||||||
const showTransactionCategoriesIncludedInHomePageOverviewDialog = ref<boolean>(false);
|
const showTransactionCategoriesIncludedInHomePageOverviewDialog = ref<boolean>(false);
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ const {
|
|||||||
title,
|
title,
|
||||||
applyText,
|
applyText,
|
||||||
allowHiddenAccount,
|
allowHiddenAccount,
|
||||||
|
customAccountCategoryOrder,
|
||||||
allCategorizedAccounts,
|
allCategorizedAccounts,
|
||||||
allVisibleAccountMap,
|
allVisibleAccountMap,
|
||||||
hasAnyAvailableAccount,
|
hasAnyAvailableAccount,
|
||||||
@@ -194,7 +195,7 @@ const accountsStore = useAccountsStore();
|
|||||||
|
|
||||||
const snackbar = useTemplateRef<SnackBarType>('snackbar');
|
const snackbar = useTemplateRef<SnackBarType>('snackbar');
|
||||||
|
|
||||||
const expandAccountCategories = ref<number[]>(AccountCategory.values().map(category => category.type));
|
const expandAccountCategories = ref<number[]>(AccountCategory.values(customAccountCategoryOrder.value).map(category => category.type));
|
||||||
|
|
||||||
function init(): void {
|
function init(): void {
|
||||||
accountsStore.loadAllAccounts({
|
accountsStore.loadAllAccounts({
|
||||||
|
|||||||
@@ -279,9 +279,10 @@ let resolveFunc: ((response: BatchReplaceAllTypesDialogResponse) => void) | null
|
|||||||
let rejectFunc: ((reason?: unknown) => void) | null = null;
|
let rejectFunc: ((reason?: unknown) => void) | null = null;
|
||||||
|
|
||||||
const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.showAccountBalance);
|
const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.showAccountBalance);
|
||||||
|
const customAccountCategoryOrder = computed<string>(() => settingsStore.appSettings.accountCategoryOrders);
|
||||||
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
||||||
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
||||||
const allVisibleCategorizedAccounts = computed<CategorizedAccountWithDisplayBalance[]>(() => getCategorizedAccountsWithDisplayBalance(allVisibleAccounts.value, showAccountBalance.value));
|
const allVisibleCategorizedAccounts = computed<CategorizedAccountWithDisplayBalance[]>(() => getCategorizedAccountsWithDisplayBalance(allVisibleAccounts.value, showAccountBalance.value, customAccountCategoryOrder.value));
|
||||||
const allCategories = computed<Record<number, TransactionCategory[]>>(() => transactionCategoriesStore.allTransactionCategories);
|
const allCategories = computed<Record<number, TransactionCategory[]>>(() => transactionCategoriesStore.allTransactionCategories);
|
||||||
const allTags = computed<TransactionTag[]>(() => transactionTagsStore.allTransactionTags);
|
const allTags = computed<TransactionTag[]>(() => transactionTagsStore.allTransactionTags);
|
||||||
|
|
||||||
|
|||||||
@@ -269,9 +269,10 @@ let resolveFunc: ((response: BatchReplaceDialogResponse) => void) | null = null;
|
|||||||
let rejectFunc: ((reason?: unknown) => void) | null = null;
|
let rejectFunc: ((reason?: unknown) => void) | null = null;
|
||||||
|
|
||||||
const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.showAccountBalance);
|
const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.showAccountBalance);
|
||||||
|
const customAccountCategoryOrder = computed<string>(() => settingsStore.appSettings.accountCategoryOrders);
|
||||||
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
||||||
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
||||||
const allVisibleCategorizedAccounts = computed<CategorizedAccountWithDisplayBalance[]>(() => getCategorizedAccountsWithDisplayBalance(allVisibleAccounts.value, showAccountBalance.value));
|
const allVisibleCategorizedAccounts = computed<CategorizedAccountWithDisplayBalance[]>(() => getCategorizedAccountsWithDisplayBalance(allVisibleAccounts.value, showAccountBalance.value, customAccountCategoryOrder.value));
|
||||||
const allCategories = computed<Record<number, TransactionCategory[]>>(() => transactionCategoriesStore.allTransactionCategories);
|
const allCategories = computed<Record<number, TransactionCategory[]>>(() => transactionCategoriesStore.allTransactionCategories);
|
||||||
const allTags = computed<TransactionTag[]>(() => transactionTagsStore.allTransactionTags);
|
const allTags = computed<TransactionTag[]>(() => transactionTagsStore.allTransactionTags);
|
||||||
|
|
||||||
|
|||||||
@@ -539,13 +539,14 @@ const currentDescriptionFilterValue = ref<string | null>(null);
|
|||||||
|
|
||||||
const numeralSystem = computed<NumeralSystem>(() => getCurrentNumeralSystemType());
|
const numeralSystem = computed<NumeralSystem>(() => getCurrentNumeralSystemType());
|
||||||
const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.showAccountBalance);
|
const showAccountBalance = computed<boolean>(() => settingsStore.appSettings.showAccountBalance);
|
||||||
|
const customAccountCategoryOrder = computed<string>(() => settingsStore.appSettings.accountCategoryOrders);
|
||||||
|
|
||||||
const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurrency);
|
const defaultCurrency = computed<string>(() => userStore.currentUserDefaultCurrency);
|
||||||
const coordinateDisplayType = computed<number>(() => userStore.currentUserCoordinateDisplayType);
|
const coordinateDisplayType = computed<number>(() => userStore.currentUserCoordinateDisplayType);
|
||||||
|
|
||||||
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
||||||
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
||||||
const allVisibleCategorizedAccounts = computed<CategorizedAccountWithDisplayBalance[]>(() => getCategorizedAccountsWithDisplayBalance(allVisibleAccounts.value, showAccountBalance.value));
|
const allVisibleCategorizedAccounts = computed<CategorizedAccountWithDisplayBalance[]>(() => getCategorizedAccountsWithDisplayBalance(allVisibleAccounts.value, showAccountBalance.value, customAccountCategoryOrder.value));
|
||||||
const allAccountsMap = computed<Record<string, Account>>(() => accountsStore.allAccountsMap);
|
const allAccountsMap = computed<Record<string, Account>>(() => accountsStore.allAccountsMap);
|
||||||
const allAccountsMapByName = computed<Record<string, Account>>(() => getAccountMapByName(accountsStore.allAccounts));
|
const allAccountsMapByName = computed<Record<string, Account>>(() => getAccountMapByName(accountsStore.allAccounts));
|
||||||
const allCategories = computed<Record<number, TransactionCategory[]>>(() => transactionCategoriesStore.allTransactionCategories);
|
const allCategories = computed<Record<number, TransactionCategory[]>>(() => transactionCategoriesStore.allTransactionCategories);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
</f7-list>
|
</f7-list>
|
||||||
|
|
||||||
<div :key="accountCategory.type"
|
<div :key="accountCategory.type"
|
||||||
v-for="accountCategory in AccountCategory.values()"
|
v-for="accountCategory in AccountCategory.values(customAccountCategoryOrder)"
|
||||||
v-show="!loading && ((showHidden && hasAccount(accountCategory, false)) || hasAccount(accountCategory, true))">
|
v-show="!loading && ((showHidden && hasAccount(accountCategory, false)) || hasAccount(accountCategory, true))">
|
||||||
<f7-list strong inset dividers sortable class="list-has-group-title account-list margin-vertical"
|
<f7-list strong inset dividers sortable class="list-has-group-title account-list margin-vertical"
|
||||||
:sortable-enabled="sortable"
|
:sortable-enabled="sortable"
|
||||||
@@ -246,6 +246,7 @@ const {
|
|||||||
showHidden,
|
showHidden,
|
||||||
displayOrderModified,
|
displayOrderModified,
|
||||||
showAccountBalance,
|
showAccountBalance,
|
||||||
|
customAccountCategoryOrder,
|
||||||
allCategorizedAccountsMap,
|
allCategorizedAccountsMap,
|
||||||
allAccountCount,
|
allAccountCount,
|
||||||
netAssets,
|
netAssets,
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
<template>
|
||||||
|
<f7-page>
|
||||||
|
<f7-navbar>
|
||||||
|
<f7-nav-left :back-link="tt('Back')"></f7-nav-left>
|
||||||
|
<f7-nav-title :title="tt('Account Category Order')"></f7-nav-title>
|
||||||
|
<f7-nav-right class="navbar-compact-icons">
|
||||||
|
<f7-link icon-f7="ellipsis" @click="showMoreActionSheet = true"></f7-link>
|
||||||
|
<f7-link icon-f7="checkmark_alt" :class="{ 'disabled': !isDisplayOrderModified() }" @click="saveDisplayOrder"></f7-link>
|
||||||
|
</f7-nav-right>
|
||||||
|
</f7-navbar>
|
||||||
|
|
||||||
|
<f7-list strong inset dividers sortable sortable-enabled class="margin-top"
|
||||||
|
@sortable:sort="onSort">
|
||||||
|
<f7-list-item :id="getAccountCategoryDomId(accountCategory)"
|
||||||
|
:key="accountCategory.type"
|
||||||
|
:title="tt(accountCategory.name)"
|
||||||
|
v-for="accountCategory in accountCategories">
|
||||||
|
</f7-list-item>
|
||||||
|
</f7-list>
|
||||||
|
|
||||||
|
<f7-actions close-by-outside-click close-on-escape :opened="showMoreActionSheet" @actions:closed="showMoreActionSheet = false">
|
||||||
|
<f7-actions-group>
|
||||||
|
<f7-actions-button @click="resetToDefault()">{{ tt('Reset to Default') }}</f7-actions-button>
|
||||||
|
</f7-actions-group>
|
||||||
|
<f7-actions-group>
|
||||||
|
<f7-actions-button bold close>{{ tt('Cancel') }}</f7-actions-button>
|
||||||
|
</f7-actions-group>
|
||||||
|
</f7-actions>
|
||||||
|
</f7-page>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
|
import type { Router } from 'framework7/types';
|
||||||
|
|
||||||
|
import { useI18n } from '@/locales/helpers.ts';
|
||||||
|
import { useI18nUIComponents } from '@/lib/ui/mobile.ts';
|
||||||
|
import { useAccountCategoryDisplayOrderSettingsPageBase } from '@/views/base/settings/AccountCategoryDisplayOrderSettingsPageBase.ts';
|
||||||
|
|
||||||
|
import { AccountCategory } from '@/core/account.ts';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
f7router: Router.Router;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const { tt } = useI18n();
|
||||||
|
const { showToast } = useI18nUIComponents();
|
||||||
|
|
||||||
|
const {
|
||||||
|
accountCategories,
|
||||||
|
isDisplayOrderModified,
|
||||||
|
loadDisplayOrderFromSettings,
|
||||||
|
saveDisplayOrderToSettings,
|
||||||
|
resetDisplayOrderToDefault
|
||||||
|
} = useAccountCategoryDisplayOrderSettingsPageBase();
|
||||||
|
|
||||||
|
const showMoreActionSheet = ref<boolean>(false);
|
||||||
|
|
||||||
|
function getAccountCategoryDomId(accountCategory: AccountCategory): string {
|
||||||
|
return 'account_category_' + accountCategory.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseAccountCategoryTypeFromDomId(domId: string): string | null {
|
||||||
|
if (!domId || domId.indexOf('account_category_') !== 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return domId.substring(17); // account_category_
|
||||||
|
}
|
||||||
|
|
||||||
|
function init(): void {
|
||||||
|
loadDisplayOrderFromSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveDisplayOrder(): void {
|
||||||
|
saveDisplayOrderToSettings();
|
||||||
|
showToast('Account category order saved');
|
||||||
|
props.f7router.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetToDefault() {
|
||||||
|
resetDisplayOrderToDefault();
|
||||||
|
showMoreActionSheet.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSort(event: { el: { id: string }, from: number, to: number }): void {
|
||||||
|
if (!event || !event.el || !event.el.id) {
|
||||||
|
showToast('Unable to move account category');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const type = parseAccountCategoryTypeFromDomId(event.el.id);
|
||||||
|
|
||||||
|
if (!type) {
|
||||||
|
showToast('Unable to move account category');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentAccountCategory: AccountCategory | null = null;
|
||||||
|
|
||||||
|
for (const accountCategory of accountCategories.value) {
|
||||||
|
if (accountCategory.type.toString() === type) {
|
||||||
|
currentAccountCategory = accountCategory;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!currentAccountCategory || !accountCategories.value[event.to]) {
|
||||||
|
showToast('Unable to move account category');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
accountCategories.value.splice(event.to, 0, accountCategories.value.splice(event.from, 1)[0] as AccountCategory);
|
||||||
|
}
|
||||||
|
|
||||||
|
init();
|
||||||
|
</script>
|
||||||
@@ -178,6 +178,7 @@ const {
|
|||||||
filterAccountIds,
|
filterAccountIds,
|
||||||
title,
|
title,
|
||||||
allowHiddenAccount,
|
allowHiddenAccount,
|
||||||
|
customAccountCategoryOrder,
|
||||||
allCategorizedAccounts,
|
allCategorizedAccounts,
|
||||||
allVisibleAccountMap,
|
allVisibleAccountMap,
|
||||||
hasAnyAvailableAccount,
|
hasAnyAvailableAccount,
|
||||||
@@ -195,7 +196,7 @@ const showMoreActionSheet = ref<boolean>(false);
|
|||||||
|
|
||||||
function getCollapseStates(): Record<number, CollapseState> {
|
function getCollapseStates(): Record<number, CollapseState> {
|
||||||
const collapseStates: Record<number, CollapseState> = {};
|
const collapseStates: Record<number, CollapseState> = {};
|
||||||
const allCategories = AccountCategory.values();
|
const allCategories = AccountCategory.values(customAccountCategoryOrder.value);
|
||||||
|
|
||||||
for (const accountCategory of allCategories) {
|
for (const accountCategory of allCategories) {
|
||||||
collapseStates[accountCategory.type] = {
|
collapseStates[accountCategory.type] = {
|
||||||
|
|||||||
@@ -153,6 +153,18 @@
|
|||||||
<div v-else-if="!loadingAccounts">{{ accountsIncludedInTotalDisplayContent }}</div>
|
<div v-else-if="!loadingAccounts">{{ accountsIncludedInTotalDisplayContent }}</div>
|
||||||
</template>
|
</template>
|
||||||
</f7-list-item>
|
</f7-list-item>
|
||||||
|
<f7-list-item
|
||||||
|
class="item-truncate-after-text"
|
||||||
|
link="/settings/account_category_display_order">
|
||||||
|
<template #after-title>
|
||||||
|
<div class="item-actual-title">
|
||||||
|
<span>{{ tt('Account Category Order') }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template #after>
|
||||||
|
<div>{{ accountCategorysDisplayOrderContent }}</div>
|
||||||
|
</template>
|
||||||
|
</f7-list-item>
|
||||||
</f7-list>
|
</f7-list>
|
||||||
|
|
||||||
<f7-block-title>{{ tt('Exchange Rates Data Page') }}</f7-block-title>
|
<f7-block-title>{{ tt('Exchange Rates Data Page') }}</f7-block-title>
|
||||||
@@ -221,6 +233,7 @@ const {
|
|||||||
currencySortByInExchangeRatesPage,
|
currencySortByInExchangeRatesPage,
|
||||||
accountsIncludedInHomePageOverviewDisplayContent,
|
accountsIncludedInHomePageOverviewDisplayContent,
|
||||||
accountsIncludedInTotalDisplayContent,
|
accountsIncludedInTotalDisplayContent,
|
||||||
|
accountCategorysDisplayOrderContent,
|
||||||
transactionCategoriesIncludedInHomePageOverviewDisplayContent
|
transactionCategoriesIncludedInHomePageOverviewDisplayContent
|
||||||
} = useAppSettingPageBase();
|
} = useAppSettingPageBase();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user