@zeniai/client-epic-state 4.12.8 → 4.12.10
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.
|
@@ -77,7 +77,10 @@ exports.initialState = {
|
|
|
77
77
|
totalOpexByVendor: {
|
|
78
78
|
totals: {},
|
|
79
79
|
},
|
|
80
|
-
dataAvailable:
|
|
80
|
+
dataAvailable: {
|
|
81
|
+
month: undefined,
|
|
82
|
+
quarter: undefined,
|
|
83
|
+
},
|
|
81
84
|
firstMonthOfFY: 1,
|
|
82
85
|
reportId: 'operating_expenses_by_vendor',
|
|
83
86
|
reportTitle: 'OpEx By Vendor',
|
|
@@ -249,7 +252,7 @@ const doUpdateOpexByVendorReport = (draft, timeframe, reportPayload, queryProps)
|
|
|
249
252
|
var _a, _b, _c;
|
|
250
253
|
if (reportPayload.status.is_report_generated == null) {
|
|
251
254
|
const report = (0, viewAndReportPayload_1.mapReportPayloadToReport)(reportPayload);
|
|
252
|
-
draft.dataAvailable = report.dataAvailable;
|
|
255
|
+
draft.dataAvailable[timeframe] = report.dataAvailable;
|
|
253
256
|
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
254
257
|
draft.bookCloseDate = report.bookCloseDate;
|
|
255
258
|
const currencyPayload = reportPayload.currency;
|
|
@@ -16,6 +16,15 @@ function getOpexVendorTimeframeKey(timeframeTick) {
|
|
|
16
16
|
return `${timeframeTick.startDate.toString()}-${timeframeTick.endDate.toString()}`;
|
|
17
17
|
}
|
|
18
18
|
exports.getOpexVendorTimeframeKey = getOpexVendorTimeframeKey;
|
|
19
|
+
const getDateRange = (timeframe, firstMonthOfFY, dataAvailable) => {
|
|
20
|
+
if (dataAvailable != null) {
|
|
21
|
+
if (timeframe === 'month') {
|
|
22
|
+
return dataAvailable;
|
|
23
|
+
}
|
|
24
|
+
return getDataAvailableForQuarter(dataAvailable, firstMonthOfFY);
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
};
|
|
19
28
|
exports.getOpExByVendorReport = (0, toolkit_1.createSelector)((state) => state.opExByVendorState, (state) => state.vendorState, (state) => state.accountState, (state) => state.classState, (opExByVendorState, vendorState, accountState, classState) => {
|
|
20
29
|
const fetchState = (0, reduceFetchState_1.reduceFetchState)([
|
|
21
30
|
opExByVendorState.reportFetchState.month,
|
|
@@ -31,13 +40,12 @@ exports.getOpExByVendorReport = (0, toolkit_1.createSelector)((state) => state.o
|
|
|
31
40
|
let opexBalances = [];
|
|
32
41
|
const summaryBalances = [];
|
|
33
42
|
let totalBalances = undefined;
|
|
34
|
-
|
|
43
|
+
const dateRange = getDateRange(timeframe, firstMonthOfFY, dataAvailable[timeframe]);
|
|
44
|
+
if (dateRange != null &&
|
|
35
45
|
(fetchState.fetchState === 'Completed' ||
|
|
36
46
|
opExByVendorState.uiState.sortOrSearchInProgress === true ||
|
|
37
47
|
opExByVendorState.uiState.pageFetchInProgress === true)) {
|
|
38
|
-
filter = (0, coaBalancesFilter_1.newBalancesFilterForDateRange)(firstMonthOfFY,
|
|
39
|
-
? dataAvailable
|
|
40
|
-
: getDataAvailableForQuarter(dataAvailable, firstMonthOfFY), 'ascending_date', opExByVendorState.uiState.selectedAdditionalBalances);
|
|
48
|
+
filter = (0, coaBalancesFilter_1.newBalancesFilterForDateRange)(firstMonthOfFY, timeframe, dateRange, 'ascending_date', opExByVendorState.uiState.selectedAdditionalBalances);
|
|
41
49
|
const opexByVendorBalances = (0, coaBalance_1.getCOABalancesWithTotals)(opExByVendorState.totalOpexByVendor, filter);
|
|
42
50
|
const opexKeys = opExByVendorState.uiState.searchString[timeframe].length > 0
|
|
43
51
|
? opExByVendorState.opExByVendorKeysForSearchByTimeframe[timeframe]
|
|
@@ -64,7 +72,7 @@ exports.getOpExByVendorReport = (0, toolkit_1.createSelector)((state) => state.o
|
|
|
64
72
|
summaryBalances,
|
|
65
73
|
allTimeframeTicks,
|
|
66
74
|
totalBalances,
|
|
67
|
-
dataAvailable: opExByVendorState.dataAvailable,
|
|
75
|
+
dataAvailable: opExByVendorState.dataAvailable[timeframe],
|
|
68
76
|
bookCloseDate: opExByVendorState.bookCloseDate,
|
|
69
77
|
reportId: opExByVendorState.reportId,
|
|
70
78
|
reportTitle: opExByVendorState.reportTitle,
|
|
@@ -4,6 +4,7 @@ import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
|
4
4
|
import { ReportUIState } from '../../commonStateTypes/viewAndReport/reportUIState';
|
|
5
5
|
import { PageToken, Report } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
6
6
|
import { ZeniDate } from '../../zeniDayJS';
|
|
7
|
+
import { DataAvailable } from '../../commonStateTypes/dataAvailable';
|
|
7
8
|
export interface OpExByVendorQuery {
|
|
8
9
|
sortKey: OpexByVendorSortKey;
|
|
9
10
|
sortOrder: SortOrder;
|
|
@@ -49,7 +50,7 @@ export interface OpexByVendorUIState extends ReportUIState {
|
|
|
49
50
|
scrollTop: number;
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
|
-
export interface OpExByVendorState extends Report {
|
|
53
|
+
export interface OpExByVendorState extends Omit<Report, 'dataAvailable'> {
|
|
53
54
|
opExByVendorReportGenerated: boolean;
|
|
54
55
|
opExByVendorKeysByTimeframe: {
|
|
55
56
|
month: OpexVendorKey[];
|
|
@@ -69,4 +70,8 @@ export interface OpExByVendorState extends Report {
|
|
|
69
70
|
};
|
|
70
71
|
summaryFetchState: FetchStateAndError;
|
|
71
72
|
lastRefreshSuccessTime?: ZeniDate;
|
|
73
|
+
dataAvailable: {
|
|
74
|
+
month?: DataAvailable;
|
|
75
|
+
quarter?: DataAvailable;
|
|
76
|
+
};
|
|
72
77
|
}
|
|
@@ -18,11 +18,14 @@ const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
18
18
|
? zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}`, payload)
|
|
19
19
|
: zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload);
|
|
20
20
|
return saveTaskApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
21
|
+
var _a;
|
|
21
22
|
if ((0, responsePayload_1.isSuccessResponse)(response) &&
|
|
22
23
|
response.data != null &&
|
|
23
|
-
response.data.tasks.length > 0
|
|
24
|
-
taskGroupId != null) {
|
|
24
|
+
response.data.tasks.length > 0) {
|
|
25
25
|
const newTaskId = response.data.tasks[0].task_id;
|
|
26
|
+
const newTaskGroupId = taskGroupId != null
|
|
27
|
+
? taskGroupId
|
|
28
|
+
: (_a = response.data.tasks[0].task_group_ids) === null || _a === void 0 ? void 0 : _a[0];
|
|
26
29
|
const fetchActions = [
|
|
27
30
|
(0, taskReducer_1.updateTasks)(response.data.tasks),
|
|
28
31
|
(0, taskDetailReducer_1.saveTaskSuccessOrFailure)({
|
|
@@ -30,11 +33,13 @@ const saveTaskDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
30
33
|
newTaskId,
|
|
31
34
|
taskId,
|
|
32
35
|
}),
|
|
33
|
-
(0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
|
|
34
|
-
taskGroupId,
|
|
35
|
-
task: response.data.tasks[0],
|
|
36
|
-
}),
|
|
37
36
|
];
|
|
37
|
+
if (newTaskGroupId != null) {
|
|
38
|
+
fetchActions.push((0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
|
|
39
|
+
taskGroupId: newTaskGroupId,
|
|
40
|
+
task: response.data.tasks[0],
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
38
43
|
return (0, rxjs_1.from)(fetchActions);
|
|
39
44
|
}
|
|
40
45
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.10",
|
|
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",
|