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:
MaysWind
2024-07-07 14:22:03 +08:00
parent dad3f1041e
commit d0e8419b2e
4 changed files with 91 additions and 1 deletions
+28
View File
@@ -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;