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