mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 07:27:33 +08:00
use the account / transaction category filter of the statistics page when navigating from the statistics page to the transaction list page
This commit is contained in:
@@ -228,6 +228,35 @@ export function getAllFilteredAccountsBalance(categorizedAccounts, accountFilter
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
export function getFinalAccountIdsByFilteredAccountIds(allAccountsMap, filteredAccountIds) {
|
||||
let finalAccountIds = '';
|
||||
|
||||
if (!allAccountsMap) {
|
||||
return finalAccountIds;
|
||||
}
|
||||
|
||||
for (let accountId in allAccountsMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(allAccountsMap, accountId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const account = allAccountsMap[accountId];
|
||||
|
||||
if (filteredAccountIds && !isAccountOrSubAccountsAllChecked(account, filteredAccountIds)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (finalAccountIds.length > 0) {
|
||||
finalAccountIds += ',';
|
||||
}
|
||||
|
||||
finalAccountIds += account.id;
|
||||
}
|
||||
|
||||
return finalAccountIds;
|
||||
}
|
||||
|
||||
export function getUnifiedSelectedAccountsCurrencyOrDefaultCurrency(allAccounts, selectedAccountIds, defaultCurrency) {
|
||||
if (!selectedAccountIds) {
|
||||
return defaultCurrency;
|
||||
|
||||
@@ -138,6 +138,34 @@ export function allVisiblePrimaryTransactionCategoriesByType(allTransactionCateg
|
||||
return allVisibleCategories[type.toString()].visibleCategories;
|
||||
}
|
||||
|
||||
export function getFinalCategoryIdsByFilteredCategoryIds(allTransactionCategoriesMap, filteredCategoryIds) {
|
||||
let finalCategoryIds = '';
|
||||
|
||||
if (!allTransactionCategoriesMap) {
|
||||
return finalCategoryIds;
|
||||
}
|
||||
|
||||
for (let categoryId in allTransactionCategoriesMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(allTransactionCategoriesMap, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const category = allTransactionCategoriesMap[categoryId];
|
||||
|
||||
if (filteredCategoryIds && !isCategoryOrSubCategoriesAllChecked(category, filteredCategoryIds)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (finalCategoryIds.length > 0) {
|
||||
finalCategoryIds += ',';
|
||||
}
|
||||
|
||||
finalCategoryIds += category.id;
|
||||
}
|
||||
|
||||
return finalCategoryIds;
|
||||
}
|
||||
|
||||
export function isSubCategoryIdAvailable(categories, categoryId) {
|
||||
if (!categories || !categories.length) {
|
||||
return false;
|
||||
|
||||
@@ -91,6 +91,22 @@ export function isEquals(obj1, obj2) {
|
||||
}
|
||||
}
|
||||
|
||||
export function isObjectEmpty(obj) {
|
||||
if (!obj) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (let field in obj) {
|
||||
if (!Object.prototype.hasOwnProperty.call(obj, field)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function getObjectOwnFieldCount(object) {
|
||||
let count = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user