@zeniai/client-epic-state 4.11.51 → 4.11.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -57,9 +57,8 @@ const getScheduleDetailsView = (state, scheduleType) => {
|
|
|
57
57
|
});
|
|
58
58
|
const accountListNestedAccountHierarchy = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountTypes.accountListKey).filter((account) => account.accountId[0] != null &&
|
|
59
59
|
scheduleDetailAccountIds.includes(account.accountId[0]));
|
|
60
|
-
const depAccountListNestedAccountHierarchy = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountTypes.accountListKey)
|
|
61
|
-
|
|
62
|
-
!fixedAssetLabelAccountIds.includes(account.accountId[0]));
|
|
60
|
+
const depAccountListNestedAccountHierarchy = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountTypes.accountListKey);
|
|
61
|
+
const filteredDepAccountListNestedAccountHierarchy = filterNestedAccountHierarchyById(depAccountListNestedAccountHierarchy, filteredDepAccounts.map((account) => account.accountId));
|
|
63
62
|
const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
|
|
64
63
|
const selectedJeScheduleDetailId = jeScheduleTransactionState.jeScheduleId;
|
|
65
64
|
const scheduleDetailsLocalData = Object.assign({}, scheduleDetailReducer_1.initialScheduleDetailsLocalData);
|
|
@@ -85,7 +84,7 @@ const getScheduleDetailsView = (state, scheduleType) => {
|
|
|
85
84
|
allAccountList: filteredAccounts,
|
|
86
85
|
allClassList: allClasses,
|
|
87
86
|
allDepreciationAccountList: filteredDepAccounts,
|
|
88
|
-
allDepreciationAccountListNestedAccountHierarchy:
|
|
87
|
+
allDepreciationAccountListNestedAccountHierarchy: filteredDepAccountListNestedAccountHierarchy,
|
|
89
88
|
uncategorizedAccounts,
|
|
90
89
|
accountListNestedAccountHierarchy,
|
|
91
90
|
classListNestedAccountHierarchy,
|
|
@@ -99,3 +98,23 @@ const getScheduleDetailsView = (state, scheduleType) => {
|
|
|
99
98
|
};
|
|
100
99
|
};
|
|
101
100
|
exports.getScheduleDetailsView = getScheduleDetailsView;
|
|
101
|
+
// TODO: Optimize this function as the accountlist is very huge
|
|
102
|
+
const filterNestedAccountHierarchyById = (accountList, targetIds) => {
|
|
103
|
+
const result = [];
|
|
104
|
+
for (const account of accountList) {
|
|
105
|
+
const presentInTargetIds = targetIds.includes(account.accountId[0]);
|
|
106
|
+
// Recursively filter the children
|
|
107
|
+
const filteredChildren = filterNestedAccountHierarchyById(account.children, targetIds);
|
|
108
|
+
// Include the current account if:
|
|
109
|
+
// - It matches the targetIds, OR
|
|
110
|
+
// - It has children that match targetIds
|
|
111
|
+
if (presentInTargetIds) {
|
|
112
|
+
result.push(Object.assign(Object.assign({}, account), { children: filteredChildren }));
|
|
113
|
+
}
|
|
114
|
+
else if (filteredChildren.length > 0) {
|
|
115
|
+
// If the current account does not match but has matching children, include the children only
|
|
116
|
+
result.push(...filteredChildren);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return result;
|
|
120
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.52",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|