remove compatibility code for migration

This commit is contained in:
MaysWind
2025-02-09 16:51:21 +08:00
parent f2c043a299
commit 0e4cd10376
20 changed files with 171 additions and 214 deletions
+18 -18
View File
@@ -78,12 +78,12 @@ export function getCategorizedAccountsWithVisibleCount(categorizedAccountsMap: R
} }
} }
if (account.type === AccountType.MultiSubAccounts.type && account.childrenAccounts) { if (account.type === AccountType.MultiSubAccounts.type && account.subAccounts) {
let visibleSubAccountCount = 0; let visibleSubAccountCount = 0;
let firstVisibleSubAccountIndex = -1; let firstVisibleSubAccountIndex = -1;
for (let k = 0; k < account.childrenAccounts.length; k++) { for (let k = 0; k < account.subAccounts.length; k++) {
const subAccount = account.childrenAccounts[k]; const subAccount = account.subAccounts[k];
if (!subAccount.hidden) { if (!subAccount.hidden) {
visibleSubAccountCount++; visibleSubAccountCount++;
@@ -94,8 +94,8 @@ export function getCategorizedAccountsWithVisibleCount(categorizedAccountsMap: R
} }
} }
if (account.childrenAccounts.length > 0) { if (account.subAccounts.length > 0) {
allSubAccounts[account.id] = account.childrenAccounts; allSubAccounts[account.id] = account.subAccounts;
allVisibleSubAccountCounts[account.id] = visibleSubAccountCount; allVisibleSubAccountCounts[account.id] = visibleSubAccountCount;
allFirstVisibleSubAccountIndexes[account.id] = firstVisibleSubAccountIndex; allFirstVisibleSubAccountIndexes[account.id] = firstVisibleSubAccountIndex;
} }
@@ -145,9 +145,9 @@ export function getAllFilteredAccountsBalance(categorizedAccounts: Record<number
isLiability: !!account.isLiability, isLiability: !!account.isLiability,
currency: account.currency currency: account.currency
}); });
} else if (account.type === AccountType.MultiSubAccounts.type && account.childrenAccounts) { } else if (account.type === AccountType.MultiSubAccounts.type && account.subAccounts) {
for (let subAccountIdx = 0; subAccountIdx < account.childrenAccounts.length; subAccountIdx++) { for (let subAccountIdx = 0; subAccountIdx < account.subAccounts.length; subAccountIdx++) {
const subAccount = account.childrenAccounts[subAccountIdx]; const subAccount = account.subAccounts[subAccountIdx];
if (subAccount.hidden || !accountFilter(subAccount)) { if (subAccount.hidden || !accountFilter(subAccount)) {
continue; continue;
@@ -231,12 +231,12 @@ export function selectAccountOrSubAccounts(filterAccountIds: Record<string, bool
if (account.type === AccountType.SingleAccount.type) { if (account.type === AccountType.SingleAccount.type) {
filterAccountIds[account.id] = value; filterAccountIds[account.id] = value;
} else if (account.type === AccountType.MultiSubAccounts.type) { } else if (account.type === AccountType.MultiSubAccounts.type) {
if (!account.childrenAccounts || !account.childrenAccounts.length) { if (!account.subAccounts || !account.subAccounts.length) {
return; return;
} }
for (let i = 0; i < account.childrenAccounts.length; i++) { for (let i = 0; i < account.subAccounts.length; i++) {
const subAccount = account.childrenAccounts[i]; const subAccount = account.subAccounts[i];
filterAccountIds[subAccount.id] = value; filterAccountIds[subAccount.id] = value;
} }
} }
@@ -285,12 +285,12 @@ export function selectInvert(filterAccountIds: Record<string, boolean>, allAccou
} }
export function isAccountOrSubAccountsAllChecked(account: Account, filterAccountIds: Record<string, boolean>): boolean { export function isAccountOrSubAccountsAllChecked(account: Account, filterAccountIds: Record<string, boolean>): boolean {
if (!account.childrenAccounts) { if (!account.subAccounts) {
return !filterAccountIds[account.id]; return !filterAccountIds[account.id];
} }
for (let i = 0; i < account.childrenAccounts.length; i++) { for (let i = 0; i < account.subAccounts.length; i++) {
const subAccount = account.childrenAccounts[i]; const subAccount = account.subAccounts[i];
if (filterAccountIds[subAccount.id]) { if (filterAccountIds[subAccount.id]) {
return false; return false;
} }
@@ -300,20 +300,20 @@ export function isAccountOrSubAccountsAllChecked(account: Account, filterAccount
} }
export function isAccountOrSubAccountsHasButNotAllChecked(account: Account, filterAccountIds: Record<string, boolean>): boolean { export function isAccountOrSubAccountsHasButNotAllChecked(account: Account, filterAccountIds: Record<string, boolean>): boolean {
if (!account.childrenAccounts) { if (!account.subAccounts) {
return false; return false;
} }
let checkedCount = 0; let checkedCount = 0;
for (let i = 0; i < account.childrenAccounts.length; i++) { for (let i = 0; i < account.subAccounts.length; i++) {
const subAccount = account.childrenAccounts[i]; const subAccount = account.subAccounts[i];
if (!filterAccountIds[subAccount.id]) { if (!filterAccountIds[subAccount.id]) {
checkedCount++; checkedCount++;
} }
} }
return checkedCount > 0 && checkedCount < account.childrenAccounts.length; return checkedCount > 0 && checkedCount < account.subAccounts.length;
} }
export function setAccountSuitableIcon(account: Account, oldCategory: number, newCategory: number): void { export function setAccountSuitableIcon(account: Account, oldCategory: number, newCategory: number): void {
+23 -23
View File
@@ -32,7 +32,7 @@ export function getTransactionPrimaryCategoryName(categoryId: string | null | un
} }
for (let i = 0; i < allCategories.length; i++) { for (let i = 0; i < allCategories.length; i++) {
const subCategoryList = allCategories[i].secondaryCategories; const subCategoryList = allCategories[i].subCategories;
if (!subCategoryList) { if (!subCategoryList) {
continue; continue;
@@ -55,7 +55,7 @@ export function getTransactionSecondaryCategoryName(categoryId: string | null |
} }
for (let i = 0; i < allCategories.length; i++) { for (let i = 0; i < allCategories.length; i++) {
const subCategoryList = allCategories[i].secondaryCategories; const subCategoryList = allCategories[i].subCategories;
if (!subCategoryList) { if (!subCategoryList) {
continue; continue;
@@ -110,12 +110,12 @@ export function allTransactionCategoriesWithVisibleCount(allTransactionCategorie
} }
} }
if (category.secondaryCategories) { if (category.subCategories) {
let visibleSubCategoryCount = 0; let visibleSubCategoryCount = 0;
let firstVisibleSubCategoryIndex = -1; let firstVisibleSubCategoryIndex = -1;
for (let k = 0; k < category.secondaryCategories.length; k++) { for (let k = 0; k < category.subCategories.length; k++) {
const subCategory = category.secondaryCategories[k]; const subCategory = category.subCategories[k];
if (!subCategory.hidden) { if (!subCategory.hidden) {
visibleSubCategoryCount++; visibleSubCategoryCount++;
@@ -126,8 +126,8 @@ export function allTransactionCategoriesWithVisibleCount(allTransactionCategorie
} }
} }
if (category.secondaryCategories.length > 0) { if (category.subCategories.length > 0) {
allSubCategories[category.id] = category.secondaryCategories; allSubCategories[category.id] = category.subCategories;
allVisibleSubCategoryCounts[category.id] = visibleSubCategoryCount; allVisibleSubCategoryCounts[category.id] = visibleSubCategoryCount;
allFirstVisibleSubCategoryIndexes[category.id] = firstVisibleSubCategoryIndex; allFirstVisibleSubCategoryIndexes[category.id] = firstVisibleSubCategoryIndex;
} }
@@ -209,7 +209,7 @@ export function isSubCategoryIdAvailable(categories: TransactionCategory[], cate
continue; continue;
} }
const subCategoryList = primaryCategory.secondaryCategories; const subCategoryList = primaryCategory.subCategories;
if (!subCategoryList) { if (!subCategoryList) {
continue; continue;
@@ -243,7 +243,7 @@ export function getFirstAvailableCategoryId(categories: TransactionCategory[]):
continue; continue;
} }
const subCategoryList = primaryCategory.secondaryCategories; const subCategoryList = primaryCategory.subCategories;
if (!subCategoryList) { if (!subCategoryList) {
continue; continue;
@@ -275,7 +275,7 @@ export function getFirstAvailableSubCategoryId(categories: TransactionCategory[]
continue; continue;
} }
const subCategoryList = primaryCategory.secondaryCategories; const subCategoryList = primaryCategory.subCategories;
if (!subCategoryList) { if (!subCategoryList) {
return ''; return '';
@@ -382,12 +382,12 @@ export function containsAvailableCategory(allTransactionCategories: Record<numbe
} }
export function selectAllSubCategories(filterCategoryIds: Record<string, boolean>, category: TransactionCategory, value: boolean): void { export function selectAllSubCategories(filterCategoryIds: Record<string, boolean>, category: TransactionCategory, value: boolean): void {
if (!category || !category.secondaryCategories || !category.secondaryCategories.length) { if (!category || !category.subCategories || !category.subCategories.length) {
return; return;
} }
for (let i = 0; i < category.secondaryCategories.length; i++) { for (let i = 0; i < category.subCategories.length; i++) {
const subCategory = category.secondaryCategories[i]; const subCategory = category.subCategories[i];
filterCategoryIds[subCategory.id] = value; filterCategoryIds[subCategory.id] = value;
} }
} }
@@ -435,12 +435,12 @@ export function selectInvert(filterCategoryIds: Record<string, boolean>, allTran
} }
export function isCategoryOrSubCategoriesAllChecked(category: TransactionCategory, filterCategoryIds: Record<string, boolean>): boolean { export function isCategoryOrSubCategoriesAllChecked(category: TransactionCategory, filterCategoryIds: Record<string, boolean>): boolean {
if (!category.secondaryCategories || category.secondaryCategories.length < 1) { if (!category.subCategories || category.subCategories.length < 1) {
return !filterCategoryIds[category.id]; return !filterCategoryIds[category.id];
} }
for (let i = 0; i < category.secondaryCategories.length; i++) { for (let i = 0; i < category.subCategories.length; i++) {
const subCategory = category.secondaryCategories[i]; const subCategory = category.subCategories[i];
if (filterCategoryIds[subCategory.id]) { if (filterCategoryIds[subCategory.id]) {
return false; return false;
} }
@@ -450,12 +450,12 @@ export function isCategoryOrSubCategoriesAllChecked(category: TransactionCategor
} }
export function isSubCategoriesAllChecked(category: TransactionCategory, filterCategoryIds: Record<string, boolean>): boolean { export function isSubCategoriesAllChecked(category: TransactionCategory, filterCategoryIds: Record<string, boolean>): boolean {
if (!category.secondaryCategories || category.secondaryCategories.length < 1) { if (!category.subCategories || category.subCategories.length < 1) {
return false; return false;
} }
for (let i = 0; i < category.secondaryCategories.length; i++) { for (let i = 0; i < category.subCategories.length; i++) {
const subCategory = category.secondaryCategories[i]; const subCategory = category.subCategories[i];
if (filterCategoryIds[subCategory.id]) { if (filterCategoryIds[subCategory.id]) {
return false; return false;
} }
@@ -467,16 +467,16 @@ export function isSubCategoriesAllChecked(category: TransactionCategory, filterC
export function isSubCategoriesHasButNotAllChecked(category: TransactionCategory, filterCategoryIds: Record<string, boolean>): boolean { export function isSubCategoriesHasButNotAllChecked(category: TransactionCategory, filterCategoryIds: Record<string, boolean>): boolean {
let checkedCount = 0; let checkedCount = 0;
if (!category.secondaryCategories || category.secondaryCategories.length < 1) { if (!category.subCategories || category.subCategories.length < 1) {
return false; return false;
} }
for (let i = 0; i < category.secondaryCategories.length; i++) { for (let i = 0; i < category.subCategories.length; i++) {
const subCategory = category.secondaryCategories[i]; const subCategory = category.subCategories[i];
if (!filterCategoryIds[subCategory.id]) { if (!filterCategoryIds[subCategory.id]) {
checkedCount++; checkedCount++;
} }
} }
return checkedCount > 0 && checkedCount < category.secondaryCategories.length; return checkedCount > 0 && checkedCount < category.subCategories.length;
} }
+33 -49
View File
@@ -21,9 +21,9 @@ export class Account implements AccountInfoResponse {
public isAsset?: boolean; public isAsset?: boolean;
public isLiability?: boolean; public isLiability?: boolean;
public visible: boolean; public visible: boolean;
public childrenAccounts?: Account[]; public subAccounts?: Account[];
protected constructor(id: string, name: string, parentId: string, category: number, type: number, icon: string, color: string, currency: string, balance: number, comment: string, displayOrder: number, visible: boolean, balanceTime?: number, creditCardStatementDate?: number, isAsset?: boolean, isLiability?: boolean, childrenAccounts?: Account[]) { protected constructor(id: string, name: string, parentId: string, category: number, type: number, icon: string, color: string, currency: string, balance: number, comment: string, displayOrder: number, visible: boolean, balanceTime?: number, creditCardStatementDate?: number, isAsset?: boolean, isLiability?: boolean, subAccounts?: Account[]) {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.parentId = parentId; this.parentId = parentId;
@@ -41,10 +41,10 @@ export class Account implements AccountInfoResponse {
this.isAsset = isAsset; this.isAsset = isAsset;
this.isLiability = isLiability; this.isLiability = isLiability;
if (typeof(childrenAccounts) !== 'undefined') { if (typeof(subAccounts) !== 'undefined') {
this.childrenAccounts = childrenAccounts; this.subAccounts = subAccounts;
} else { } else {
this.childrenAccounts = undefined; this.subAccounts = undefined;
} }
} }
@@ -52,22 +52,6 @@ export class Account implements AccountInfoResponse {
return !this.visible; return !this.visible;
} }
public get subAccounts(): AccountInfoResponse[] | undefined {
if (typeof(this.childrenAccounts) === 'undefined') {
return undefined;
}
const ret: AccountInfoResponse[] = [];
if (this.childrenAccounts) {
for (const subCategory of this.childrenAccounts) {
ret.push(subCategory);
}
}
return ret;
}
public from(other: Account): void { public from(other: Account): void {
this.id = other.id; this.id = other.id;
this.category = other.category; this.category = other.category;
@@ -83,19 +67,19 @@ export class Account implements AccountInfoResponse {
this.visible = other.visible; this.visible = other.visible;
} }
public toCreateRequest(clientSessionId: string, childrenAccounts?: Account[], parentAccount?: Account): AccountCreateRequest { public toCreateRequest(clientSessionId: string, subAccounts?: Account[], parentAccount?: Account): AccountCreateRequest {
let subAccounts: AccountCreateRequest[] | undefined = undefined; let subAccountCreateRequests: AccountCreateRequest[] | undefined = undefined;
if (this.type === AccountType.MultiSubAccounts.type) { if (this.type === AccountType.MultiSubAccounts.type) {
subAccounts = []; subAccountCreateRequests = [];
if (!childrenAccounts) { if (!subAccounts) {
childrenAccounts = this.childrenAccounts; subAccounts = this.subAccounts;
} }
if (childrenAccounts) { if (subAccounts) {
for (const subAccount of childrenAccounts) { for (const subAccount of subAccounts) {
subAccounts.push(subAccount.toCreateRequest(clientSessionId, undefined, this)); subAccountCreateRequests.push(subAccount.toCreateRequest(clientSessionId, undefined, this));
} }
} }
} }
@@ -111,24 +95,24 @@ export class Account implements AccountInfoResponse {
balanceTime: (parentAccount || this.type === AccountType.SingleAccount.type) && this.balanceTime ? this.balanceTime : 0, balanceTime: (parentAccount || this.type === AccountType.SingleAccount.type) && this.balanceTime ? this.balanceTime : 0,
comment: this.comment, comment: this.comment,
creditCardStatementDate: !parentAccount && this.category === AccountCategory.CreditCard.type ? this.creditCardStatementDate : undefined, creditCardStatementDate: !parentAccount && this.category === AccountCategory.CreditCard.type ? this.creditCardStatementDate : undefined,
subAccounts: !parentAccount ? subAccounts : undefined, subAccounts: !parentAccount ? subAccountCreateRequests : undefined,
clientSessionId: !parentAccount ? clientSessionId : undefined clientSessionId: !parentAccount ? clientSessionId : undefined
}; };
} }
public toModifyRequest(childrenAccounts?: Account[], parentAccount?: Account): AccountModifyRequest { public toModifyRequest(subAccounts?: Account[], parentAccount?: Account): AccountModifyRequest {
let subAccounts: AccountModifyRequest[] | undefined = undefined; let subAccountModifyRequests: AccountModifyRequest[] | undefined = undefined;
if (this.type === AccountType.MultiSubAccounts.type) { if (this.type === AccountType.MultiSubAccounts.type) {
subAccounts = []; subAccountModifyRequests = [];
if (!childrenAccounts) { if (!subAccounts) {
childrenAccounts = this.childrenAccounts; subAccounts = this.subAccounts;
} }
if (childrenAccounts) { if (subAccounts) {
for (const subAccount of childrenAccounts) { for (const subAccount of subAccounts) {
subAccounts.push(subAccount.toModifyRequest(undefined, this)); subAccountModifyRequests.push(subAccount.toModifyRequest(undefined, this));
} }
} }
} }
@@ -142,7 +126,7 @@ export class Account implements AccountInfoResponse {
comment: this.comment, comment: this.comment,
creditCardStatementDate: !parentAccount && this.category === AccountCategory.CreditCard.type ? this.creditCardStatementDate : undefined, creditCardStatementDate: !parentAccount && this.category === AccountCategory.CreditCard.type ? this.creditCardStatementDate : undefined,
hidden: !this.visible, hidden: !this.visible,
subAccounts: !parentAccount ? subAccounts : undefined, subAccounts: !parentAccount ? subAccountModifyRequests : undefined,
}; };
} }
@@ -152,12 +136,12 @@ export class Account implements AccountInfoResponse {
} else if (this.type === AccountType.MultiSubAccounts.type && !subAccountId) { } else if (this.type === AccountType.MultiSubAccounts.type && !subAccountId) {
return this.id; return this.id;
} else if (this.type === AccountType.MultiSubAccounts.type && subAccountId) { } else if (this.type === AccountType.MultiSubAccounts.type && subAccountId) {
if (!this.childrenAccounts || !this.childrenAccounts.length) { if (!this.subAccounts || !this.subAccounts.length) {
return null; return null;
} }
for (let i = 0; i < this.childrenAccounts.length; i++) { for (let i = 0; i < this.subAccounts.length; i++) {
const subAccount = this.childrenAccounts[i]; const subAccount = this.subAccounts[i];
if (subAccountId && subAccountId === subAccount.id) { if (subAccountId && subAccountId === subAccount.id) {
return subAccount.id; return subAccount.id;
@@ -176,12 +160,12 @@ export class Account implements AccountInfoResponse {
} else if (this.type === AccountType.MultiSubAccounts.type && !subAccountId) { } else if (this.type === AccountType.MultiSubAccounts.type && !subAccountId) {
return this.comment; return this.comment;
} else if (this.type === AccountType.MultiSubAccounts.type && subAccountId) { } else if (this.type === AccountType.MultiSubAccounts.type && subAccountId) {
if (!this.childrenAccounts || !this.childrenAccounts.length) { if (!this.subAccounts || !this.subAccounts.length) {
return null; return null;
} }
for (let i = 0; i < this.childrenAccounts.length; i++) { for (let i = 0; i < this.subAccounts.length; i++) {
const subAccount = this.childrenAccounts[i]; const subAccount = this.subAccounts[i];
if (subAccountId && subAccountId === subAccount.id) { if (subAccountId && subAccountId === subAccount.id) {
return subAccount.comment; return subAccount.comment;
@@ -195,15 +179,15 @@ export class Account implements AccountInfoResponse {
} }
public getSubAccountCurrencies(showHidden: boolean, subAccountId: string): string[] { public getSubAccountCurrencies(showHidden: boolean, subAccountId: string): string[] {
if (!this.childrenAccounts || !this.childrenAccounts.length) { if (!this.subAccounts || !this.subAccounts.length) {
return []; return [];
} }
const subAccountCurrenciesMap: Record<string, boolean> = {}; const subAccountCurrenciesMap: Record<string, boolean> = {};
const subAccountCurrencies: string[] = []; const subAccountCurrencies: string[] = [];
for (let i = 0; i < this.childrenAccounts.length; i++) { for (let i = 0; i < this.subAccounts.length; i++) {
const subAccount = this.childrenAccounts[i]; const subAccount = this.subAccounts[i];
if (!showHidden && subAccount.hidden) { if (!showHidden && subAccount.hidden) {
continue; continue;
@@ -324,7 +308,7 @@ export class AccountWithDisplayBalance extends Account {
Account.creditCardStatementDate, Account.creditCardStatementDate,
Account.isAsset, Account.isAsset,
Account.isLiability, Account.isLiability,
Account.childrenAccounts Account.subAccounts
); );
this.displayBalance = displayBalance; this.displayBalance = displayBalance;
-20
View File
@@ -675,32 +675,12 @@ export interface TransactionStatisticResponseItem {
readonly amount: number; readonly amount: number;
} }
export interface TransactionStatisticResponseWithInfo {
readonly startTime: number;
readonly endTime: number;
readonly items: TransactionStatisticResponseItemWithInfo[];
}
export interface TransactionStatisticResponseItemWithInfo extends TransactionStatisticResponseItem {
readonly account?: AccountInfoResponse;
readonly primaryAccount?: AccountInfoResponse;
readonly category?: TransactionCategoryInfoResponse;
readonly primaryCategory?: TransactionCategoryInfoResponse;
readonly amountInDefaultCurrency: number | null;
}
export interface TransactionStatisticTrendsResponseItem { export interface TransactionStatisticTrendsResponseItem {
readonly year: number; readonly year: number;
readonly month: number; readonly month: number;
readonly items: TransactionStatisticResponseItem[]; readonly items: TransactionStatisticResponseItem[];
} }
export interface TransactionStatisticTrendsResponseItemWithInfo {
readonly year: number;
readonly month: number;
readonly items: TransactionStatisticResponseItemWithInfo[];
}
export interface YearMonthDataItem extends YearMonth, Record<string, unknown> {} export interface YearMonthDataItem extends YearMonth, Record<string, unknown> {}
export interface YearMonthItems<T extends YearMonth> extends Record<string, unknown> { export interface YearMonthItems<T extends YearMonth> extends Record<string, unknown> {
+6 -22
View File
@@ -13,9 +13,9 @@ export class TransactionCategory implements TransactionCategoryInfoResponse {
public comment: string; public comment: string;
public displayOrder: number; public displayOrder: number;
public visible: boolean; public visible: boolean;
public secondaryCategories?: TransactionCategory[]; public subCategories?: TransactionCategory[];
private constructor(id: string, name: string, parentId: string, type: CategoryType, icon: string, color: ColorValue, comment: string, displayOrder: number, visible: boolean, secondaryCategories?: TransactionCategory[]) { private constructor(id: string, name: string, parentId: string, type: CategoryType, icon: string, color: ColorValue, comment: string, displayOrder: number, visible: boolean, subCategories?: TransactionCategory[]) {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.parentId = parentId; this.parentId = parentId;
@@ -26,10 +26,10 @@ export class TransactionCategory implements TransactionCategoryInfoResponse {
this.displayOrder = displayOrder; this.displayOrder = displayOrder;
this.visible = visible; this.visible = visible;
if (secondaryCategories) { if (subCategories) {
this.secondaryCategories = secondaryCategories; this.subCategories = subCategories;
} else if (!secondaryCategories && (!parentId || parentId === '0')) { } else if (!subCategories && (!parentId || parentId === '0')) {
this.secondaryCategories = []; this.subCategories = [];
} }
} }
@@ -37,22 +37,6 @@ export class TransactionCategory implements TransactionCategoryInfoResponse {
return !this.visible; return !this.visible;
} }
public get subCategories(): TransactionCategoryInfoResponse[] | undefined {
if (typeof(this.secondaryCategories) === 'undefined') {
return undefined;
}
const ret: TransactionCategoryInfoResponse[] = [];
if (this.secondaryCategories) {
for (const subCategory of this.secondaryCategories) {
ret.push(subCategory);
}
}
return ret;
}
public from(other: TransactionCategory): void { public from(other: TransactionCategory): void {
this.id = other.id; this.id = other.id;
this.name = other.name; this.name = other.name;
+31 -31
View File
@@ -38,9 +38,9 @@ export const useAccountsStore = defineStore('accounts', () => {
if (account.type === AccountType.SingleAccount.type) { if (account.type === AccountType.SingleAccount.type) {
allAccountsList.push(account); allAccountsList.push(account);
} else if (account.type === AccountType.MultiSubAccounts.type) { } else if (account.type === AccountType.MultiSubAccounts.type) {
if (account.childrenAccounts) { if (account.subAccounts) {
for (let j = 0; j < account.childrenAccounts.length; j++) { for (let j = 0; j < account.subAccounts.length; j++) {
const subAccount = account.childrenAccounts[j]; const subAccount = account.subAccounts[j];
allAccountsList.push(subAccount); allAccountsList.push(subAccount);
} }
} }
@@ -63,9 +63,9 @@ export const useAccountsStore = defineStore('accounts', () => {
if (account.type === AccountType.SingleAccount.type) { if (account.type === AccountType.SingleAccount.type) {
allVisibleAccounts.push(account); allVisibleAccounts.push(account);
} else if (account.type === AccountType.MultiSubAccounts.type) { } else if (account.type === AccountType.MultiSubAccounts.type) {
if (account.childrenAccounts) { if (account.subAccounts) {
for (let j = 0; j < account.childrenAccounts.length; j++) { for (let j = 0; j < account.subAccounts.length; j++) {
const subAccount = account.childrenAccounts[j]; const subAccount = account.subAccounts[j];
allVisibleAccounts.push(subAccount); allVisibleAccounts.push(subAccount);
} }
} }
@@ -117,9 +117,9 @@ export const useAccountsStore = defineStore('accounts', () => {
const account = accounts[i]; const account = accounts[i];
allAccountsMap.value[account.id] = account; allAccountsMap.value[account.id] = account;
if (account.childrenAccounts) { if (account.subAccounts) {
for (let j = 0; j < account.childrenAccounts.length; j++) { for (let j = 0; j < account.subAccounts.length; j++) {
const subAccount = account.childrenAccounts[j]; const subAccount = account.subAccounts[j];
allAccountsMap.value[subAccount.id] = subAccount; allAccountsMap.value[subAccount.id] = subAccount;
} }
} }
@@ -142,9 +142,9 @@ export const useAccountsStore = defineStore('accounts', () => {
allAccountsMap.value[account.id] = account; allAccountsMap.value[account.id] = account;
if (account.childrenAccounts) { if (account.subAccounts) {
for (let i = 0; i < account.childrenAccounts.length; i++) { for (let i = 0; i < account.subAccounts.length; i++) {
const subAccount = account.childrenAccounts[i]; const subAccount = account.subAccounts[i];
allAccountsMap.value[subAccount.id] = subAccount; allAccountsMap.value[subAccount.id] = subAccount;
} }
} }
@@ -167,9 +167,9 @@ export const useAccountsStore = defineStore('accounts', () => {
allAccountsMap.value[account.id] = account; allAccountsMap.value[account.id] = account;
if (account.childrenAccounts) { if (account.subAccounts) {
for (let i = 0; i < account.childrenAccounts.length; i++) { for (let i = 0; i < account.subAccounts.length; i++) {
const subAccount = account.childrenAccounts[i]; const subAccount = account.subAccounts[i];
allAccountsMap.value[subAccount.id] = subAccount; allAccountsMap.value[subAccount.id] = subAccount;
} }
} }
@@ -240,8 +240,8 @@ export const useAccountsStore = defineStore('accounts', () => {
} }
} }
if (allAccountsMap.value[account.id] && allAccountsMap.value[account.id].childrenAccounts) { if (allAccountsMap.value[account.id] && allAccountsMap.value[account.id].subAccounts) {
const subAccounts = allAccountsMap.value[account.id].childrenAccounts as Account[]; const subAccounts = allAccountsMap.value[account.id].subAccounts as Account[];
for (let i = 0; i < subAccounts.length; i++) { for (let i = 0; i < subAccounts.length; i++) {
const subAccount = subAccounts[i]; const subAccount = subAccounts[i];
@@ -298,9 +298,9 @@ export const useAccountsStore = defineStore('accounts', () => {
for (let i = 0; i < accounts.length; i++) { for (let i = 0; i < accounts.length; i++) {
const account = accounts[i]; const account = accounts[i];
if (account.type === AccountType.MultiSubAccounts.type && account.childrenAccounts) { if (account.type === AccountType.MultiSubAccounts.type && account.subAccounts) {
for (let j = 0; j < account.childrenAccounts.length; j++) { for (let j = 0; j < account.subAccounts.length; j++) {
const subAccount = account.childrenAccounts[j]; const subAccount = account.subAccounts[j];
if (showHidden || !subAccount.hidden) { if (showHidden || !subAccount.hidden) {
ret.subAccounts[account.id] = subAccount.id; ret.subAccounts[account.id] = subAccount.id;
@@ -339,9 +339,9 @@ export const useAccountsStore = defineStore('accounts', () => {
for (let i = accounts.length - 1; i >= 0; i--) { for (let i = accounts.length - 1; i >= 0; i--) {
const account = accounts[i]; const account = accounts[i];
if (account.type === AccountType.MultiSubAccounts.type && account.childrenAccounts) { if (account.type === AccountType.MultiSubAccounts.type && account.subAccounts) {
for (let j = account.childrenAccounts.length - 1; j >= 0; j--) { for (let j = account.subAccounts.length - 1; j >= 0; j--) {
const subAccount = account.childrenAccounts[j]; const subAccount = account.subAccounts[j];
if (showHidden || !subAccount.hidden) { if (showHidden || !subAccount.hidden) {
ret.subAccounts[account.id] = subAccount.id; ret.subAccounts[account.id] = subAccount.id;
@@ -563,7 +563,7 @@ export const useAccountsStore = defineStore('accounts', () => {
let resultCurrency = userStore.currentUserDefaultCurrency; let resultCurrency = userStore.currentUserDefaultCurrency;
if (!account.childrenAccounts || !account.childrenAccounts.length) { if (!account.subAccounts || !account.subAccounts.length) {
return { return {
balance: showAccountBalance ? '0' : '***', balance: showAccountBalance ? '0' : '***',
currency: resultCurrency currency: resultCurrency
@@ -574,8 +574,8 @@ export const useAccountsStore = defineStore('accounts', () => {
const allSubAccountCurrencies: string[] = []; const allSubAccountCurrencies: string[] = [];
let totalBalance = 0; let totalBalance = 0;
for (let i = 0; i < account.childrenAccounts.length; i++) { for (let i = 0; i < account.subAccounts.length; i++) {
const subAccount = account.childrenAccounts[i]; const subAccount = account.subAccounts[i];
if (!showHidden && subAccount.hidden) { if (!showHidden && subAccount.hidden) {
continue; continue;
@@ -600,8 +600,8 @@ export const useAccountsStore = defineStore('accounts', () => {
let hasUnCalculatedAmount = false; let hasUnCalculatedAmount = false;
for (let i = 0; i < account.childrenAccounts.length; i++) { for (let i = 0; i < account.subAccounts.length; i++) {
const subAccount = account.childrenAccounts[i]; const subAccount = account.subAccounts[i];
if (!showHidden && subAccount.hidden) { if (!showHidden && subAccount.hidden) {
continue; continue;
@@ -679,12 +679,12 @@ export const useAccountsStore = defineStore('accounts', () => {
} }
function hasVisibleSubAccount(showHidden: boolean, account: Account): boolean { function hasVisibleSubAccount(showHidden: boolean, account: Account): boolean {
if (!account || account.type !== AccountType.MultiSubAccounts.type || !account.childrenAccounts) { if (!account || account.type !== AccountType.MultiSubAccounts.type || !account.subAccounts) {
return false; return false;
} }
for (let i = 0; i < account.childrenAccounts.length; i++) { for (let i = 0; i < account.subAccounts.length; i++) {
if (showHidden || !account.childrenAccounts[i].hidden) { if (showHidden || !account.subAccounts[i].hidden) {
return true; return true;
} }
} }
+20 -11
View File
@@ -24,15 +24,12 @@ import {
import { DEFAULT_ACCOUNT_ICON, DEFAULT_CATEGORY_ICON } from '@/consts/icon.ts'; import { DEFAULT_ACCOUNT_ICON, DEFAULT_CATEGORY_ICON } from '@/consts/icon.ts';
import { DEFAULT_ACCOUNT_COLOR, DEFAULT_CATEGORY_COLOR } from '@/consts/color.ts'; import { DEFAULT_ACCOUNT_COLOR, DEFAULT_CATEGORY_COLOR } from '@/consts/color.ts';
import type { AccountInfoResponse } from '@/models/account.ts'; import type { Account } from '@/models/account.ts';
import type { TransactionCategoryInfoResponse } from '@/models/transaction_category.ts'; import type { TransactionCategory } from '@/models/transaction_category.ts';
import type { import type {
TransactionStatisticResponse, TransactionStatisticResponse,
TransactionStatisticResponseItem, TransactionStatisticResponseItem,
TransactionStatisticResponseWithInfo,
TransactionStatisticResponseItemWithInfo,
TransactionStatisticTrendsResponseItem, TransactionStatisticTrendsResponseItem,
TransactionStatisticTrendsResponseItemWithInfo,
TransactionStatisticDataItemType, TransactionStatisticDataItemType,
TransactionStatisticDataItemBase, TransactionStatisticDataItemBase,
TransactionCategoricalAnalysisData, TransactionCategoricalAnalysisData,
@@ -60,17 +57,29 @@ import { sortStatisticsItems } from '@/lib/statistics.ts';
import logger from '@/lib/logger.ts'; import logger from '@/lib/logger.ts';
import services from '@/lib/services.ts'; import services from '@/lib/services.ts';
interface WritableTransactionStatisticResponseItemWithInfo extends TransactionStatisticResponseItemWithInfo { interface TransactionStatisticResponseItemWithInfo extends TransactionStatisticResponseItem {
categoryId: string; categoryId: string;
accountId: string; accountId: string;
amount: number; amount: number;
account?: AccountInfoResponse; account?: Account;
primaryAccount?: AccountInfoResponse; primaryAccount?: Account;
category?: TransactionCategoryInfoResponse; category?: TransactionCategory;
primaryCategory?: TransactionCategoryInfoResponse; primaryCategory?: TransactionCategory;
amountInDefaultCurrency: number | null; amountInDefaultCurrency: number | null;
} }
interface TransactionStatisticResponseWithInfo {
readonly startTime: number;
readonly endTime: number;
readonly items: TransactionStatisticResponseItemWithInfo[];
}
interface TransactionStatisticTrendsResponseItemWithInfo {
readonly year: number;
readonly month: number;
readonly items: TransactionStatisticResponseItemWithInfo[];
}
interface WritableTransactionCategoricalAnalysisData { interface WritableTransactionCategoricalAnalysisData {
totalAmount: number; totalAmount: number;
totalNonNegativeAmount: number; totalNonNegativeAmount: number;
@@ -438,7 +447,7 @@ export const useStatisticsStore = defineStore('statistics', () => {
for (let i = 0; i < items.length; i++) { for (let i = 0; i < items.length; i++) {
const dataItem = items[i]; const dataItem = items[i];
const item: WritableTransactionStatisticResponseItemWithInfo = { const item: TransactionStatisticResponseItemWithInfo = {
categoryId: dataItem.categoryId, categoryId: dataItem.categoryId,
accountId: dataItem.accountId, accountId: dataItem.accountId,
amount: dataItem.amount, amount: dataItem.amount,
+12 -12
View File
@@ -64,12 +64,12 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories'
const category = categories[i]; const category = categories[i];
allTransactionCategoriesMap.value[category.id] = category; allTransactionCategoriesMap.value[category.id] = category;
if (!category.secondaryCategories) { if (!category.subCategories) {
continue; continue;
} }
for (let j = 0; j < category.secondaryCategories.length; j++) { for (let j = 0; j < category.subCategories.length; j++) {
const subCategory = category.secondaryCategories[j]; const subCategory = category.subCategories[j];
allTransactionCategoriesMap.value[subCategory.id] = subCategory; allTransactionCategoriesMap.value[subCategory.id] = subCategory;
} }
} }
@@ -82,7 +82,7 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories'
if (!category.parentId || category.parentId === '0') { if (!category.parentId || category.parentId === '0') {
categoryList = allTransactionCategories.value[category.type]; categoryList = allTransactionCategories.value[category.type];
} else if (allTransactionCategoriesMap.value[category.parentId]) { } else if (allTransactionCategoriesMap.value[category.parentId]) {
categoryList = allTransactionCategoriesMap.value[category.parentId].secondaryCategories; categoryList = allTransactionCategoriesMap.value[category.parentId].subCategories;
} }
if (categoryList) { if (categoryList) {
@@ -102,14 +102,14 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories'
if (!category.parentId || category.parentId === '0') { if (!category.parentId || category.parentId === '0') {
categoryList = allTransactionCategories.value[category.type]; categoryList = allTransactionCategories.value[category.type];
} else if (allTransactionCategoriesMap.value[category.parentId]) { } else if (allTransactionCategoriesMap.value[category.parentId]) {
categoryList = allTransactionCategoriesMap.value[category.parentId].secondaryCategories; categoryList = allTransactionCategoriesMap.value[category.parentId].subCategories;
} }
if (categoryList) { if (categoryList) {
for (let i = 0; i < categoryList.length; i++) { for (let i = 0; i < categoryList.length; i++) {
if (categoryList[i].id === category.id) { if (categoryList[i].id === category.id) {
if (!category.parentId || category.parentId === '0') { if (!category.parentId || category.parentId === '0') {
category.secondaryCategories = categoryList[i].secondaryCategories; category.subCategories = categoryList[i].subCategories;
} }
categoryList.splice(i, 1, category); categoryList.splice(i, 1, category);
@@ -128,7 +128,7 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories'
if (!category.parentId || category.parentId === '0') { if (!category.parentId || category.parentId === '0') {
categoryList = allTransactionCategories.value[category.type]; categoryList = allTransactionCategories.value[category.type];
} else if (allTransactionCategoriesMap.value[category.parentId]) { } else if (allTransactionCategoriesMap.value[category.parentId]) {
categoryList = allTransactionCategoriesMap.value[category.parentId].secondaryCategories; categoryList = allTransactionCategoriesMap.value[category.parentId].subCategories;
} }
if (categoryList) { if (categoryList) {
@@ -148,7 +148,7 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories'
if (!category.parentId || category.parentId === '0') { if (!category.parentId || category.parentId === '0') {
categoryList = allTransactionCategories.value[category.type]; categoryList = allTransactionCategories.value[category.type];
} else if (allTransactionCategoriesMap.value[category.parentId]) { } else if (allTransactionCategoriesMap.value[category.parentId]) {
categoryList = allTransactionCategoriesMap.value[category.parentId].secondaryCategories; categoryList = allTransactionCategoriesMap.value[category.parentId].subCategories;
} }
if (categoryList) { if (categoryList) {
@@ -160,8 +160,8 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories'
} }
} }
if (allTransactionCategoriesMap.value[category.id] && allTransactionCategoriesMap.value[category.id].secondaryCategories) { if (allTransactionCategoriesMap.value[category.id] && allTransactionCategoriesMap.value[category.id].subCategories) {
const subCategoryList = allTransactionCategoriesMap.value[category.id].secondaryCategories; const subCategoryList = allTransactionCategoriesMap.value[category.id].subCategories;
if (subCategoryList) { if (subCategoryList) {
for (let i = 0; i < subCategoryList.length; i++) { for (let i = 0; i < subCategoryList.length; i++) {
@@ -377,7 +377,7 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories'
return; return;
} }
} else { } else {
const subCategoryList = allTransactionCategoriesMap.value[category.parentId].secondaryCategories; const subCategoryList = allTransactionCategoriesMap.value[category.parentId].subCategories;
if (!subCategoryList || !subCategoryList[to]) { if (!subCategoryList || !subCategoryList[to]) {
reject({ message: 'Unable to move category' }); reject({ message: 'Unable to move category' });
@@ -403,7 +403,7 @@ export const useTransactionCategoriesStore = defineStore('transactionCategories'
if (!parentId || parentId === '0') { if (!parentId || parentId === '0') {
categoryList = allTransactionCategories.value[type]; categoryList = allTransactionCategories.value[type];
} else if (allTransactionCategoriesMap.value[parentId]) { } else if (allTransactionCategoriesMap.value[parentId]) {
categoryList = allTransactionCategoriesMap.value[parentId].secondaryCategories; categoryList = allTransactionCategoriesMap.value[parentId].subCategories;
} }
if (categoryList) { if (categoryList) {
@@ -144,10 +144,10 @@ export function useAccountEditPageBaseBase() {
account.value.from(newAccount); account.value.from(newAccount);
subAccounts.value = []; subAccounts.value = [];
if (newAccount.childrenAccounts && newAccount.childrenAccounts.length > 0) { if (newAccount.subAccounts && newAccount.subAccounts.length > 0) {
for (let i = 0; i < newAccount.childrenAccounts.length; i++) { for (let i = 0; i < newAccount.subAccounts.length; i++) {
const subAccount = account.value.createNewSubAccount(userStore.currentUserDefaultCurrency, getCurrentUnixTime()); const subAccount = account.value.createNewSubAccount(userStore.currentUserDefaultCurrency, getCurrentUnixTime());
subAccount.from(newAccount.childrenAccounts[i]); subAccount.from(newAccount.subAccounts[i]);
subAccounts.value.push(subAccount); subAccounts.value.push(subAccount);
} }
@@ -109,7 +109,7 @@ export function useCategoryFilterSettingPageBase(type?: string, allowCategoryTyp
const category = transactionCategoriesStore.allTransactionCategoriesMap[categoryId]; const category = transactionCategoriesStore.allTransactionCategoriesMap[categoryId];
if (category && (!category.secondaryCategories || !category.secondaryCategories.length)) { if (category && (!category.subCategories || !category.subCategories.length)) {
allCategoryIds[category.id] = false; allCategoryIds[category.id] = false;
} else if (category) { } else if (category) {
selectAllSubCategories(allCategoryIds, category, false); selectAllSubCategories(allCategoryIds, category, false);
+1 -1
View File
@@ -184,7 +184,7 @@
<span>{{ tt('All') }}</span> <span>{{ tt('All') }}</span>
</v-btn> </v-btn>
<v-btn :key="subAccount.id" :value="subAccount.id" <v-btn :key="subAccount.id" :value="subAccount.id"
v-for="subAccount in element.childrenAccounts" v-for="subAccount in element.subAccounts"
v-show="showHidden || !subAccount.hidden"> v-show="showHidden || !subAccount.hidden">
<ItemIcon size="1.5rem" icon-type="account" :icon-id="subAccount.icon" <ItemIcon size="1.5rem" icon-type="account" :icon-id="subAccount.icon"
:color="subAccount.color" :hidden-status="subAccount.hidden" /> :color="subAccount.color" :hidden-status="subAccount.hidden" />
+1 -1
View File
@@ -267,7 +267,7 @@ const secondaryCategories = computed<TransactionCategory[]>(() => {
return []; return [];
} }
return transactionCategoriesStore.allTransactionCategoriesMap[primaryCategoryId.value].secondaryCategories || []; return transactionCategoriesStore.allTransactionCategoriesMap[primaryCategoryId.value].subCategories || [];
}); });
const hasSubCategories = computed<boolean>(() => { const hasSubCategories = computed<boolean>(() => {
+4 -4
View File
@@ -234,7 +234,7 @@
</v-list-item> </v-list-item>
<template :key="subCategory.id" <template :key="subCategory.id"
v-for="subCategory in category.secondaryCategories"> v-for="subCategory in category.subCategories">
<v-divider v-if="!subCategory.hidden || query.categoryIds === subCategory.id" /> <v-divider v-if="!subCategory.hidden || query.categoryIds === subCategory.id" />
<v-list-item class="text-sm" density="compact" <v-list-item class="text-sm" density="compact"
:value="subCategory.id" :value="subCategory.id"
@@ -978,9 +978,9 @@ function getCategoryListItemCheckedClass(category: TransactionCategory, queryCat
}; };
} }
if (category.secondaryCategories) { if (category.subCategories) {
for (let i = 0; i < category.secondaryCategories.length; i++) { for (let i = 0; i < category.subCategories.length; i++) {
if (queryCategoryIds && queryCategoryIds[category.secondaryCategories[i].id]) { if (queryCategoryIds && queryCategoryIds[category.subCategories[i].id]) {
return { return {
'list-item-selected': true, 'list-item-selected': true,
'has-children-item-selected': true 'has-children-item-selected': true
@@ -32,7 +32,7 @@
<v-col cols="12"> <v-col cols="12">
<two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name" <two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
@@ -49,7 +49,7 @@
</two-column-select> </two-column-select>
<two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name" <two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
@@ -66,7 +66,7 @@
</two-column-select> </two-column-select>
<two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name" <two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
@@ -108,7 +108,7 @@
<v-col cols="12" md="12" v-if="transaction.type === TransactionType.Expense"> <v-col cols="12" md="12" v-if="transaction.type === TransactionType.Expense">
<two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name" <two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
@@ -126,7 +126,7 @@
<v-col cols="12" md="12" v-if="transaction.type === TransactionType.Income"> <v-col cols="12" md="12" v-if="transaction.type === TransactionType.Income">
<two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name" <two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
@@ -144,7 +144,7 @@
<v-col cols="12" md="12" v-if="transaction.type === TransactionType.Transfer"> <v-col cols="12" md="12" v-if="transaction.type === TransactionType.Transfer">
<two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name" <two-column-select primary-key-field="id" primary-value-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
@@ -312,7 +312,7 @@
<two-column-select density="compact" variant="plain" <two-column-select density="compact" variant="plain"
primary-key-field="id" primary-value-field="id" primary-title-field="name" primary-key-field="id" primary-value-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
@@ -330,7 +330,7 @@
<two-column-select density="compact" variant="plain" <two-column-select density="compact" variant="plain"
primary-key-field="id" primary-value-field="id" primary-title-field="name" primary-key-field="id" primary-value-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
@@ -348,7 +348,7 @@
<two-column-select density="compact" variant="plain" <two-column-select density="compact" variant="plain"
primary-key-field="id" primary-value-field="id" primary-title-field="name" primary-key-field="id" primary-value-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
+1 -1
View File
@@ -120,7 +120,7 @@
:title="subAccount.name" :footer="subAccount.comment" :after="accountBalance(subAccount)" :title="subAccount.name" :footer="subAccount.comment" :after="accountBalance(subAccount)"
:link="!sortable ? '/transaction/list?accountIds=' + subAccount.id : null" :link="!sortable ? '/transaction/list?accountIds=' + subAccount.id : null"
:key="subAccount.id" :key="subAccount.id"
v-for="subAccount in account.childrenAccounts" v-for="subAccount in account.subAccounts"
v-show="showHidden || !subAccount.hidden" v-show="showHidden || !subAccount.hidden"
> >
<template #media> <template #media>
+1 -1
View File
@@ -139,7 +139,7 @@ const categories = computed<TransactionCategory[]>(() => {
return []; return [];
} }
return transactionCategoriesStore.allTransactionCategoriesMap[primaryCategoryId.value].secondaryCategories || []; return transactionCategoriesStore.allTransactionCategoriesMap[primaryCategoryId.value].subCategories || [];
} else { } else {
return []; return [];
} }
+3 -3
View File
@@ -114,7 +114,7 @@
</template> </template>
<tree-view-selection-sheet primary-key-field="id" primary-title-field="name" <tree-view-selection-sheet primary-key-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
@@ -146,7 +146,7 @@
</template> </template>
<tree-view-selection-sheet primary-key-field="id" primary-title-field="name" <tree-view-selection-sheet primary-key-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
@@ -178,7 +178,7 @@
</template> </template>
<tree-view-selection-sheet primary-key-field="id" primary-title-field="name" <tree-view-selection-sheet primary-key-field="id" primary-title-field="name"
primary-icon-field="icon" primary-icon-type="category" primary-color-field="color" primary-icon-field="icon" primary-icon-type="category" primary-color-field="color"
primary-hidden-field="hidden" primary-sub-items-field="secondaryCategories" primary-hidden-field="hidden" primary-sub-items-field="subCategories"
secondary-key-field="id" secondary-value-field="id" secondary-title-field="name" secondary-key-field="id" secondary-value-field="id" secondary-title-field="name"
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
secondary-hidden-field="hidden" secondary-hidden-field="hidden"
+4 -4
View File
@@ -344,7 +344,7 @@
<f7-list-item :title="subCategory.name" <f7-list-item :title="subCategory.name"
:class="{ 'list-item-selected': query.categoryIds === subCategory.id, 'item-in-multiple-selection': queryAllFilterCategoryIdsCount > 1 && queryAllFilterCategoryIds[subCategory.id] }" :class="{ 'list-item-selected': query.categoryIds === subCategory.id, 'item-in-multiple-selection': queryAllFilterCategoryIdsCount > 1 && queryAllFilterCategoryIds[subCategory.id] }"
:key="subCategory.id" :key="subCategory.id"
v-for="subCategory in category.secondaryCategories" v-for="subCategory in category.subCategories"
v-show="!subCategory.hidden || query.categoryIds === subCategory.id" v-show="!subCategory.hidden || query.categoryIds === subCategory.id"
@click="changeCategoryFilter(subCategory.id)" @click="changeCategoryFilter(subCategory.id)"
> >
@@ -661,9 +661,9 @@ function getCategoryListItemCheckedClass(category: TransactionCategory, queryCat
}; };
} }
if (category.secondaryCategories) { if (category.subCategories) {
for (let i = 0; i < category.secondaryCategories.length; i++) { for (let i = 0; i < category.subCategories.length; i++) {
if (queryCategoryIds && queryCategoryIds[category.secondaryCategories[i].id]) { if (queryCategoryIds && queryCategoryIds[category.subCategories[i].id]) {
return { return {
'list-item-checked': true 'list-item-checked': true
}; };