@zeniai/client-epic-state 4.19.99-betaSS4 → 4.19.99-betaVR3
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.
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +21 -21
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -1
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +21 -21
- package/package.json +1 -1
|
@@ -21,13 +21,13 @@ export const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
21
21
|
if (isSuccessResponse(response) && response.data != null) {
|
|
22
22
|
const updateActions = [];
|
|
23
23
|
updateActions.push(updateJESchedules([
|
|
24
|
-
...response.data.
|
|
24
|
+
...response.data.draft_je_schedules,
|
|
25
25
|
...response.data.failed_je_postings.je_schedules,
|
|
26
26
|
]), updateJESchedulesDetails([...response.data.failed_je_postings.je_schedules], response.data.failed_je_postings.scheduled_journal_entries), initializeJeScheduleLocalData([
|
|
27
27
|
...response.data.failed_je_postings.je_schedules,
|
|
28
28
|
]));
|
|
29
29
|
updateActions.push(fetchJeSchedulesSuccess({
|
|
30
|
-
jeSchedules: [...response.data.
|
|
30
|
+
jeSchedules: [...response.data.draft_je_schedules],
|
|
31
31
|
failedJeSchedules: [
|
|
32
32
|
...response.data.failed_je_postings.je_schedules,
|
|
33
33
|
],
|
|
@@ -39,17 +39,17 @@ function enrichHorizontalSection(report, section) {
|
|
|
39
39
|
};
|
|
40
40
|
const siblingsPerRow = buildSiblingIndicesPerRow(section.accounts, parentIndices);
|
|
41
41
|
const hasChildFlags = computeHorizontalHasChildFlags(parentIndices);
|
|
42
|
-
for (let
|
|
43
|
-
const row = section.accounts[
|
|
42
|
+
for (let i = 0; i < section.accounts.length; i++) {
|
|
43
|
+
const row = section.accounts[i];
|
|
44
44
|
// Same column order as `report.classColumns` (see `pivotSectionToHorizontal`).
|
|
45
|
-
const classRowAmounts = row.classBalances.map((
|
|
45
|
+
const classRowAmounts = row.classBalances.map((b) => b.balance.amount);
|
|
46
46
|
row.accountReportData = {
|
|
47
47
|
accountId: row.accountId,
|
|
48
48
|
accountName: row.accountName,
|
|
49
49
|
accountType: row.accountType,
|
|
50
50
|
depth: row.depth,
|
|
51
51
|
balancesInTimeframe: buildHorizontalClassColumnBalancesSlice(report, classRowAmounts, row.rowTotal.amount),
|
|
52
|
-
horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts,
|
|
52
|
+
horizontalTreeView: buildHorizontalTreeViewFromPrecomputed(section.accounts, i, parentIndices, siblingsPerRow, hasChildFlags),
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -81,9 +81,9 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
|
|
|
81
81
|
return emptySlice;
|
|
82
82
|
}
|
|
83
83
|
const { startDate, endDate } = report.selectedPeriod;
|
|
84
|
-
const balances = report.classColumns.map((col,
|
|
84
|
+
const balances = report.classColumns.map((col, i) => ({
|
|
85
85
|
balance: {
|
|
86
|
-
amount: classAmounts[
|
|
86
|
+
amount: classAmounts[i] ?? 0,
|
|
87
87
|
currencyCode,
|
|
88
88
|
currencySymbol,
|
|
89
89
|
},
|
|
@@ -134,23 +134,23 @@ function computeHorizontalAccountParentIndices(rows) {
|
|
|
134
134
|
if (accountRow == null) {
|
|
135
135
|
continue;
|
|
136
136
|
}
|
|
137
|
-
const
|
|
137
|
+
const d = accountRow.depth;
|
|
138
138
|
while (stack.length > 0) {
|
|
139
|
-
const
|
|
140
|
-
if (
|
|
139
|
+
const topIdx = stack[stack.length - 1];
|
|
140
|
+
if (topIdx == null) {
|
|
141
141
|
break;
|
|
142
142
|
}
|
|
143
|
-
const topRow = rows[
|
|
143
|
+
const topRow = rows[topIdx];
|
|
144
144
|
if (topRow == null) {
|
|
145
145
|
stack.pop();
|
|
146
146
|
continue;
|
|
147
147
|
}
|
|
148
|
-
if (topRow.depth <
|
|
148
|
+
if (topRow.depth < d) {
|
|
149
149
|
break;
|
|
150
150
|
}
|
|
151
151
|
stack.pop();
|
|
152
152
|
}
|
|
153
|
-
if (
|
|
153
|
+
if (d <= 2) {
|
|
154
154
|
parentIndex[rowIndex] = -1;
|
|
155
155
|
}
|
|
156
156
|
else if (stack.length === 0) {
|
|
@@ -164,7 +164,7 @@ function computeHorizontalAccountParentIndices(rows) {
|
|
|
164
164
|
else {
|
|
165
165
|
const parentRow = rows[peek];
|
|
166
166
|
parentIndex[rowIndex] =
|
|
167
|
-
parentRow != null && parentRow.depth ===
|
|
167
|
+
parentRow != null && parentRow.depth === d - 1 ? peek : -1;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
stack.push(rowIndex);
|
|
@@ -182,12 +182,12 @@ function buildSiblingIndicesPerRow(rows, parentIndices) {
|
|
|
182
182
|
continue;
|
|
183
183
|
}
|
|
184
184
|
const key = `${parentRowIndex}:${accountRow.depth}`;
|
|
185
|
-
let
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
keyToIndices.set(key,
|
|
185
|
+
let g = keyToIndices.get(key);
|
|
186
|
+
if (g == null) {
|
|
187
|
+
g = [];
|
|
188
|
+
keyToIndices.set(key, g);
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
g.push(rowIndex);
|
|
191
191
|
}
|
|
192
192
|
const siblingsPerRow = new Array(accountRowCount);
|
|
193
193
|
for (let rowIndex = 0; rowIndex < accountRowCount; rowIndex++) {
|
|
@@ -255,14 +255,14 @@ function buildHorizontalTreeViewFromPrecomputed(dfsOrderedAccountRows, currentRo
|
|
|
255
255
|
const hasChildrenFlag = hasChildFlags[currentRowIndex];
|
|
256
256
|
const treeDepth = accountRow != null ? Math.max(0, accountRow.depth - 2) : 0;
|
|
257
257
|
const hasChildren = hasChildrenFlag === true;
|
|
258
|
-
const
|
|
258
|
+
const sibs = siblingIndices ?? [currentRowIndex];
|
|
259
259
|
return {
|
|
260
260
|
subAccountAncestorMetadata: buildHorizontalSubAccountAncestorMetadataFromPrecomputed(dfsOrderedAccountRows, currentRowIndex, parentIndices, siblingsPerRow, hasChildFlags),
|
|
261
261
|
treeDepth,
|
|
262
262
|
hasChildren,
|
|
263
|
-
hasSiblings:
|
|
263
|
+
hasSiblings: sibs.length > 1,
|
|
264
264
|
isLeaf: !hasChildren,
|
|
265
|
-
isLastNode: currentRowIndex ===
|
|
265
|
+
isLastNode: currentRowIndex === sibs[sibs.length - 1],
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
268
|
function buildHorizontalAccountChildIndicesByParent(parentIndices) {
|