@zeniai/client-epic-state 5.1.43-betaRD5 → 5.1.43-betaRD6
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/switchJESchedulesTabEpic.js +4 -2
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +1 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +18 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +4 -2
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +1 -1
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +5 -1
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +18 -0
- package/package.json +1 -1
|
@@ -5,7 +5,9 @@ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
|
5
5
|
import { fetchJeSchedulesPage, updateJESchedulesUIState, } from '../../reducers/jeSchedulesViewReducer';
|
|
6
6
|
export const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe(filter(updateJESchedulesUIState.match), filter((action) => action.payload.selectedPageTab != null), mergeMap(() => {
|
|
7
7
|
const state = state$.value;
|
|
8
|
-
|
|
8
|
+
const { fetchState, refreshStatus } = state.expenseAutomationJESchedulesViewState;
|
|
9
|
+
if (fetchState === 'In-Progress' ||
|
|
10
|
+
refreshStatus.fetchState === 'In-Progress') {
|
|
9
11
|
return EMPTY;
|
|
10
12
|
}
|
|
11
13
|
const currentTenant = getCurrentTenant(state);
|
|
@@ -16,5 +18,5 @@ export const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe(filt
|
|
|
16
18
|
if (timePeriodStart == null || timePeriodEnd == null) {
|
|
17
19
|
return EMPTY;
|
|
18
20
|
}
|
|
19
|
-
return of(fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }));
|
|
21
|
+
return of(fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, true));
|
|
20
22
|
}));
|
|
@@ -124,8 +124,8 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
124
124
|
else {
|
|
125
125
|
draft.fetchState = 'Error';
|
|
126
126
|
draft.error = status;
|
|
127
|
+
draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = [];
|
|
127
128
|
}
|
|
128
|
-
draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = [];
|
|
129
129
|
},
|
|
130
130
|
retryJeSchedule(draft, action) {
|
|
131
131
|
const { scheduledJournalEntryID } = action.payload;
|
|
@@ -4,6 +4,7 @@ import { reduceAnyFetchState } from '../../../commonStateTypes/reduceFetchState'
|
|
|
4
4
|
import { LAST_SCHEDULE_DAY_OF_MONTH, toMonthYearPeriodId, } from '../../../commonStateTypes/timePeriod';
|
|
5
5
|
import { getAccountIdsForTypes } from '../../../entity/account/accountSelector';
|
|
6
6
|
import { getJEScheduledTransactionByJEScheduleTransactionKey, } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
7
|
+
import { ALL_SCHEDULES_TYPES, } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
7
8
|
import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
|
|
8
9
|
import { getAccountIdsForLabel, getAccountList, getNestedAccountListHierarchy, getUncategorizedAccounts, } from '../../accountList/accountListSelector';
|
|
9
10
|
import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
|
|
@@ -172,6 +173,22 @@ export function getExpenseAutomationJESchedulesView(state) {
|
|
|
172
173
|
{ fetchState, error },
|
|
173
174
|
monthEndFetchState,
|
|
174
175
|
]);
|
|
176
|
+
const countByType = (schedules) => {
|
|
177
|
+
const counts = ALL_SCHEDULES_TYPES.reduce((acc, type) => ({ ...acc, [type]: 0 }), {});
|
|
178
|
+
schedules.forEach((schedule) => {
|
|
179
|
+
if (schedule.jeScheduleType != null) {
|
|
180
|
+
counts[schedule.jeScheduleType] += 1;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return counts;
|
|
184
|
+
};
|
|
185
|
+
const jeScheduleTypeCounts = {
|
|
186
|
+
active: countByType(allSchedules.filter((schedule) => schedule.status.code === 'draft' ||
|
|
187
|
+
schedule.status.code === 'ongoing' ||
|
|
188
|
+
schedule.status.code === 'completed' ||
|
|
189
|
+
schedule.status.code === 'marked_as_completed')),
|
|
190
|
+
ongoing: countByType(allSchedules.filter((schedule) => schedule.status.code === 'ongoing')),
|
|
191
|
+
};
|
|
175
192
|
return {
|
|
176
193
|
uncategorizedAccounts,
|
|
177
194
|
allDepreciationAccountList: filteredDepAccounts,
|
|
@@ -181,6 +198,7 @@ export function getExpenseAutomationJESchedulesView(state) {
|
|
|
181
198
|
accountListNestedAccountHierarchy,
|
|
182
199
|
allClassList: allClasses,
|
|
183
200
|
createdSchedules,
|
|
201
|
+
jeScheduleTypeCounts,
|
|
184
202
|
kpiSummary,
|
|
185
203
|
pendingReviewSchedules,
|
|
186
204
|
resolveSchedules: resolveSchedules,
|
|
@@ -8,7 +8,9 @@ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
|
8
8
|
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
9
9
|
const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.updateJESchedulesUIState.match), (0, operators_1.filter)((action) => action.payload.selectedPageTab != null), (0, operators_1.mergeMap)(() => {
|
|
10
10
|
const state = state$.value;
|
|
11
|
-
|
|
11
|
+
const { fetchState, refreshStatus } = state.expenseAutomationJESchedulesViewState;
|
|
12
|
+
if (fetchState === 'In-Progress' ||
|
|
13
|
+
refreshStatus.fetchState === 'In-Progress') {
|
|
12
14
|
return rxjs_1.EMPTY;
|
|
13
15
|
}
|
|
14
16
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
@@ -19,6 +21,6 @@ const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe((0, operato
|
|
|
19
21
|
if (timePeriodStart == null || timePeriodEnd == null) {
|
|
20
22
|
return rxjs_1.EMPTY;
|
|
21
23
|
}
|
|
22
|
-
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }));
|
|
24
|
+
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, true));
|
|
23
25
|
}));
|
|
24
26
|
exports.switchJESchedulesTabEpic = switchJESchedulesTabEpic;
|
|
@@ -128,8 +128,8 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
|
|
|
128
128
|
else {
|
|
129
129
|
draft.fetchState = 'Error';
|
|
130
130
|
draft.error = status;
|
|
131
|
+
draft.jeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = [];
|
|
131
132
|
}
|
|
132
|
-
draft.jeScheduleTransactionKeysByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = [];
|
|
133
133
|
},
|
|
134
134
|
retryJeSchedule(draft, action) {
|
|
135
135
|
const { scheduledJournalEntryID } = action.payload;
|
|
@@ -5,7 +5,7 @@ import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndRep
|
|
|
5
5
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
6
|
import { ClassBase } from '../../../entity/class/classState';
|
|
7
7
|
import { JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
8
|
-
import { JEScheduleTransactionKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
8
|
+
import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
9
9
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
10
10
|
import { JEAccountSettingsView } from '../selectorTypes/jeAccountSettingsViewSelectorTypes';
|
|
11
11
|
import { JEScheduledTransactionWithFailedEntries } from '../selectors/jeSchedulesViewSelector';
|
|
@@ -40,6 +40,10 @@ export interface ExpenseAutomationJESchedulesViewSelector extends SelectorView {
|
|
|
40
40
|
createdSchedules: JEScheduledTransaction[];
|
|
41
41
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
42
42
|
jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
|
|
43
|
+
jeScheduleTypeCounts: {
|
|
44
|
+
active: Record<ScheduleTypes, number>;
|
|
45
|
+
ongoing: Record<ScheduleTypes, number>;
|
|
46
|
+
};
|
|
43
47
|
kpiSummary: JEKpiSummary;
|
|
44
48
|
pendingReviewSchedules: (JEScheduledTransaction | JEScheduledTransactionWithFailedEntries)[];
|
|
45
49
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
@@ -10,6 +10,7 @@ const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState")
|
|
|
10
10
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
11
11
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
12
12
|
const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
|
|
13
|
+
const jeSchedulesTypes_1 = require("../../../entity/jeSchedules/jeSchedulesTypes");
|
|
13
14
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
14
15
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
15
16
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
@@ -178,6 +179,22 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
178
179
|
{ fetchState, error },
|
|
179
180
|
monthEndFetchState,
|
|
180
181
|
]);
|
|
182
|
+
const countByType = (schedules) => {
|
|
183
|
+
const counts = jeSchedulesTypes_1.ALL_SCHEDULES_TYPES.reduce((acc, type) => ({ ...acc, [type]: 0 }), {});
|
|
184
|
+
schedules.forEach((schedule) => {
|
|
185
|
+
if (schedule.jeScheduleType != null) {
|
|
186
|
+
counts[schedule.jeScheduleType] += 1;
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
return counts;
|
|
190
|
+
};
|
|
191
|
+
const jeScheduleTypeCounts = {
|
|
192
|
+
active: countByType(allSchedules.filter((schedule) => schedule.status.code === 'draft' ||
|
|
193
|
+
schedule.status.code === 'ongoing' ||
|
|
194
|
+
schedule.status.code === 'completed' ||
|
|
195
|
+
schedule.status.code === 'marked_as_completed')),
|
|
196
|
+
ongoing: countByType(allSchedules.filter((schedule) => schedule.status.code === 'ongoing')),
|
|
197
|
+
};
|
|
181
198
|
return {
|
|
182
199
|
uncategorizedAccounts,
|
|
183
200
|
allDepreciationAccountList: filteredDepAccounts,
|
|
@@ -187,6 +204,7 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
187
204
|
accountListNestedAccountHierarchy,
|
|
188
205
|
allClassList: allClasses,
|
|
189
206
|
createdSchedules,
|
|
207
|
+
jeScheduleTypeCounts,
|
|
190
208
|
kpiSummary,
|
|
191
209
|
pendingReviewSchedules,
|
|
192
210
|
resolveSchedules: resolveSchedules,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.43-
|
|
3
|
+
"version": "5.1.43-betaRD6",
|
|
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
|
"module": "lib/esm/index.js",
|