mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-16 16:07:33 +08:00
support filter multiple accounts and categories in transaction list page
This commit is contained in:
@@ -262,6 +262,21 @@ export function selectInvert(filterCategoryIds, allTransactionCategoriesMap) {
|
||||
}
|
||||
}
|
||||
|
||||
export function isCategoryOrSubCategoriesAllChecked(category, filterCategoryIds) {
|
||||
if (!category.subCategories) {
|
||||
return !filterCategoryIds[category.id];
|
||||
}
|
||||
|
||||
for (let i = 0; i < category.subCategories.length; i++) {
|
||||
const subCategory = category.subCategories[i];
|
||||
if (filterCategoryIds[subCategory.id]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
export function isSubCategoriesAllChecked(category, filterCategoryIds) {
|
||||
for (let i = 0; i < category.subCategories.length; i++) {
|
||||
const subCategory = category.subCategories[i];
|
||||
|
||||
@@ -359,6 +359,20 @@ export function arrayContainsFieldValue(array, fieldName, value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function objectToArray(object) {
|
||||
const ret = [];
|
||||
|
||||
for (let field in object) {
|
||||
if (!Object.prototype.hasOwnProperty.call(object, field)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ret.push(field);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
export function categorizedArrayToPlainArray(object) {
|
||||
const ret = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user