@zeniai/client-epic-state 5.2.14-betaRD1 → 5.2.14
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/entity/approvalRule/approvalRuleConflict.d.ts +0 -13
- package/lib/entity/approvalRule/approvalRuleConflict.js +1 -16
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
- package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -78
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +4 -183
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -123
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -96
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
- package/lib/epic.d.ts +1 -9
- package/lib/epic.js +0 -16
- package/lib/esm/entity/approvalRule/approvalRuleConflict.js +1 -16
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +5 -183
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -86
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/esm/epic.js +0 -16
- package/lib/esm/index.js +8 -14
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +1 -9
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -319
- package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +0 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -327
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +1 -20
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +1 -20
- package/lib/index.d.ts +12 -17
- package/lib/index.js +47 -91
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +1 -9
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -86
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -93
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -321
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +0 -1
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -41
- package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +0 -1
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -335
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -83
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +1 -20
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelectorTypes.d.ts +0 -3
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +1 -20
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelectorTypes.d.ts +0 -3
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -104
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -138
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -180
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -111
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -28
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -21
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -9
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -108
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -9
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -142
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -13
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -187
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -65
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -115
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -32
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
|
@@ -1,60 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_DATE_FORMAT } from '../../../commonStateTypes/timePeriod';
|
|
2
|
-
import { getClassList } from '../../classList/classListSelector';
|
|
3
2
|
import { mapScheduleTransactionToBaseScheduleTransactionPayload, mapVendorToVendorPayload, } from '../../scheduleView/scheduleDetailView/scheduleDetailPayload';
|
|
4
|
-
const BALANCE_SHEET_CLASS_LABEL = 'balance_sheet';
|
|
5
|
-
const SERVICE_MONTH_FORMAT = 'YYYY-MM';
|
|
6
|
-
/**
|
|
7
|
-
* The credit line is the accrued liability, which always sits on the balance sheet — the
|
|
8
|
-
* recurring accrued path resolves the same class the same way (see
|
|
9
|
-
* prepareNewScheduleAccruedDetailPayload). Omitted rather than sent empty when the tenant has
|
|
10
|
-
* no balance_sheet class, since the API treats the field as optional.
|
|
11
|
-
*/
|
|
12
|
-
export const prepareCreateOneTimeAccrualPayload = (state, localData) => {
|
|
13
|
-
const { classListState, classState } = state;
|
|
14
|
-
const balanceSheetClass = getClassList(classState, classListState).classes.find((accountingClass) => accountingClass.labels?.includes(BALANCE_SHEET_CLASS_LABEL) === true);
|
|
15
|
-
// reverse_next_month alone decides reversal_policy server-side, so reversal_policy is
|
|
16
|
-
// deliberately not sent — the API documents it only as an alternate way to say on_bill_match,
|
|
17
|
-
// and sending both would be two sources of truth for one toggle.
|
|
18
|
-
const reversalFields = localData.reverseNextMonth
|
|
19
|
-
? {
|
|
20
|
-
reverse_next_month: true,
|
|
21
|
-
expected_reversal_date: getExpectedReversalDate(localData.serviceMonth).format(DEFAULT_DATE_FORMAT),
|
|
22
|
-
}
|
|
23
|
-
: { reverse_next_month: false };
|
|
24
|
-
return {
|
|
25
|
-
vendor_id: localData.vendorId,
|
|
26
|
-
vendor_name: localData.vendorName,
|
|
27
|
-
service_month: localData.serviceMonth.format(SERVICE_MONTH_FORMAT),
|
|
28
|
-
amount: localData.amount,
|
|
29
|
-
memo: localData.memo,
|
|
30
|
-
je_debit_account_id: localData.debitAccountId,
|
|
31
|
-
je_credit_account_id: localData.creditAccountId,
|
|
32
|
-
...(localData.debitAccountName != null
|
|
33
|
-
? { je_debit_account_name: localData.debitAccountName }
|
|
34
|
-
: {}),
|
|
35
|
-
...(localData.creditAccountName != null
|
|
36
|
-
? { je_credit_account_name: localData.creditAccountName }
|
|
37
|
-
: {}),
|
|
38
|
-
...(localData.debitClassId != null
|
|
39
|
-
? { je_debit_accounting_class_id: localData.debitClassId }
|
|
40
|
-
: {}),
|
|
41
|
-
...(localData.debitClassName != null
|
|
42
|
-
? { je_debit_accounting_class_name: localData.debitClassName }
|
|
43
|
-
: {}),
|
|
44
|
-
...(balanceSheetClass != null
|
|
45
|
-
? {
|
|
46
|
-
je_credit_accounting_class_id: balanceSheetClass.classId,
|
|
47
|
-
je_credit_accounting_class_name: balanceSheetClass.className,
|
|
48
|
-
}
|
|
49
|
-
: {}),
|
|
50
|
-
...reversalFields,
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* The API defaults this to the 1st of the month after service_month. We send it explicitly so the
|
|
55
|
-
* date the form promised the user is the date that gets stored.
|
|
56
|
-
*/
|
|
57
|
-
export const getExpectedReversalDate = (serviceMonth) => serviceMonth.add(1, 'month').startOf('month');
|
|
58
3
|
export const prepareIgnoreSchedulePayload = (scheduleType, jeScheduleTransaction, state) => {
|
|
59
4
|
const { vendorState } = state;
|
|
60
5
|
const { vendor, currencyCode, currencySymbol, baseTransaction, status, balanceAsOfToday, period, startDate, endDate, jeCredit, jeDebit, } = jeScheduleTransaction;
|
|
@@ -2,16 +2,9 @@ import { createSlice } from '@reduxjs/toolkit';
|
|
|
2
2
|
import { geNestedAccountIDHierarchyForReport } from '../../../commonStateTypes/accountView/getNestedAccountIDHierarchyForReport';
|
|
3
3
|
import { toMonthYearPeriodId, } from '../../../commonStateTypes/timePeriod';
|
|
4
4
|
import { mapAccountBasePayloadToAccountBase, mapAccountMetadataPayloadToAccountMetadata, } from '../../../entity/account/accountPayload';
|
|
5
|
-
import {
|
|
6
|
-
import { getJEScheduleKey, getJEScheduleTransactionDetailKeyPayload, } from '../../../entity/jeSchedules/jeSchedulesPayload';
|
|
5
|
+
import { getJEScheduleTransactionDetailKeyPayload, } from '../../../entity/jeSchedules/jeSchedulesPayload';
|
|
7
6
|
import { clearAll } from '../../../rootActions';
|
|
8
7
|
import { mapAccountTypeRecommendationPayloadToAccountRecommendationByType, } from '../../accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload';
|
|
9
|
-
import { MIN_NEW_SCHEDULE_SEARCH_LENGTH, getJESchedulePeriodTabKey, } from '../types/jeSchedulesViewState';
|
|
10
|
-
function removeKeyFromEveryTabSlot(keysByPeriodAndTab, keyToRemove) {
|
|
11
|
-
for (const periodTabKey of Object.keys(keysByPeriodAndTab)) {
|
|
12
|
-
keysByPeriodAndTab[periodTabKey] = keysByPeriodAndTab[periodTabKey].filter((jeScheduleKey) => jeScheduleKey !== keyToRemove);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
8
|
export const accountSettingsInitialState = {
|
|
16
9
|
localData: {
|
|
17
10
|
selectedPrepaidExpensesAccountIds: [],
|
|
@@ -25,7 +18,6 @@ export const accountSettingsInitialState = {
|
|
|
25
18
|
error: undefined,
|
|
26
19
|
fetchState: 'Not-Started',
|
|
27
20
|
},
|
|
28
|
-
hasLoadedAccountSettings: false,
|
|
29
21
|
recommendationFetchState: {
|
|
30
22
|
error: undefined,
|
|
31
23
|
fetchState: 'Not-Started',
|
|
@@ -44,37 +36,16 @@ export const accountSettingsInitialState = {
|
|
|
44
36
|
accruedExpensesNestedAccountListHierarchy: [],
|
|
45
37
|
accruedExpensesRecommendations: [],
|
|
46
38
|
};
|
|
47
|
-
export const getBaseNewScheduleLocalData = (scheduleType) => ({
|
|
48
|
-
scheduleType,
|
|
49
|
-
jeScheduleDetails: [],
|
|
50
|
-
});
|
|
51
|
-
export const newScheduleInitialState = {
|
|
52
|
-
fixed_assets: getBaseNewScheduleLocalData('fixed_assets'),
|
|
53
|
-
prepaid_expenses: getBaseNewScheduleLocalData('prepaid_expenses'),
|
|
54
|
-
};
|
|
55
|
-
export const searchTransactionsInitialState = {
|
|
56
|
-
searchResults: [],
|
|
57
|
-
fetchState: 'Not-Started',
|
|
58
|
-
error: undefined,
|
|
59
|
-
};
|
|
60
39
|
export const initialState = {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
jeScheduleOneTimeAccrualKeysByPeriodAndTab: {},
|
|
64
|
-
failedJeScheduleTransactionKeysByPeriodAndTab: {},
|
|
40
|
+
jeScheduleTransactionKeysByPeriod: {},
|
|
41
|
+
failedJeScheduleTransactionKeysByPeriod: {},
|
|
65
42
|
postStatusById: {},
|
|
66
43
|
ignoreStatusById: {},
|
|
67
|
-
revertStatusById: {},
|
|
68
44
|
jeScheduleLocalDataById: {},
|
|
69
|
-
oneTimeAccrualActionStatusById: {},
|
|
70
|
-
oneTimeAccrualFetchStatusById: {},
|
|
71
45
|
uiState: {
|
|
72
|
-
createdGroupCollapsed: false,
|
|
73
|
-
pendingGroupCollapsed: false,
|
|
74
|
-
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
75
46
|
searchString: '',
|
|
76
|
-
|
|
77
|
-
|
|
47
|
+
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
48
|
+
selectedMainTab: 'pending_review',
|
|
78
49
|
sortKey: 'transactionDate',
|
|
79
50
|
sortOrder: 'descending',
|
|
80
51
|
totalCount: 0,
|
|
@@ -85,14 +56,6 @@ export const initialState = {
|
|
|
85
56
|
error: undefined,
|
|
86
57
|
},
|
|
87
58
|
accountSettings: accountSettingsInitialState,
|
|
88
|
-
newSchedule: {
|
|
89
|
-
createOneTimeAccrualStatus: { fetchState: 'Not-Started', error: undefined },
|
|
90
|
-
newScheduleState: newScheduleInitialState,
|
|
91
|
-
saveStatus: { fetchState: 'Not-Started', error: undefined },
|
|
92
|
-
searchTransactions: searchTransactionsInitialState,
|
|
93
|
-
fetchState: 'Not-Started',
|
|
94
|
-
error: undefined,
|
|
95
|
-
},
|
|
96
59
|
fetchState: 'Not-Started',
|
|
97
60
|
error: undefined,
|
|
98
61
|
hasValidState() {
|
|
@@ -137,12 +100,9 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
137
100
|
},
|
|
138
101
|
},
|
|
139
102
|
fetchJeSchedulesSuccess(draft, action) {
|
|
140
|
-
const { jeSchedules, selectedPeriod,
|
|
141
|
-
const periodTabKey = getJESchedulePeriodTabKey(selectedPageTab, toMonthYearPeriodId(selectedPeriod));
|
|
103
|
+
const { jeSchedules, selectedPeriod, failedJeSchedules, refreshViewInBackground, } = action.payload;
|
|
142
104
|
const jeScheduleTransactionKeys = jeSchedules.map((schedules) => getJEScheduleTransactionDetailKeyPayload(schedules.base_transaction));
|
|
143
105
|
const failedJeScheduleTransactionKeys = failedJeSchedules.map((schedules) => getJEScheduleTransactionDetailKeyPayload(schedules.base_transaction));
|
|
144
|
-
const jeScheduleAccruedKeys = accruedJeSchedules.map((schedule) => getJEScheduleKey(schedule));
|
|
145
|
-
const jeScheduleOneTimeAccrualKeys = oneTimeAccruals.map((accrual) => generateJEOneTimeAccrualKey(accrual._id));
|
|
146
106
|
if (refreshViewInBackground === true &&
|
|
147
107
|
draft.refreshStatus.fetchState === 'In-Progress') {
|
|
148
108
|
draft.refreshStatus = { fetchState: 'Completed', error: undefined };
|
|
@@ -151,31 +111,19 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
151
111
|
draft.fetchState = 'Completed';
|
|
152
112
|
draft.error = undefined;
|
|
153
113
|
}
|
|
154
|
-
draft.
|
|
155
|
-
|
|
156
|
-
draft.jeScheduleAccruedKeysByPeriodAndTab[periodTabKey] =
|
|
157
|
-
jeScheduleAccruedKeys;
|
|
158
|
-
draft.jeScheduleOneTimeAccrualKeysByPeriodAndTab[periodTabKey] =
|
|
159
|
-
jeScheduleOneTimeAccrualKeys;
|
|
160
|
-
draft.failedJeScheduleTransactionKeysByPeriodAndTab[periodTabKey] =
|
|
161
|
-
failedJeScheduleTransactionKeys;
|
|
114
|
+
draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = jeScheduleTransactionKeys;
|
|
115
|
+
draft.failedJeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = failedJeScheduleTransactionKeys;
|
|
162
116
|
},
|
|
163
117
|
fetchJeSchedulesFailure(draft, action) {
|
|
164
|
-
const { status, selectedPeriod
|
|
165
|
-
const periodTabKey = getJESchedulePeriodTabKey(selectedPageTab, toMonthYearPeriodId(selectedPeriod));
|
|
118
|
+
const { status, selectedPeriod } = action.payload;
|
|
166
119
|
if (draft.refreshStatus.fetchState === 'In-Progress') {
|
|
167
120
|
draft.refreshStatus = { fetchState: 'Error', error: status };
|
|
168
121
|
}
|
|
169
122
|
else {
|
|
170
123
|
draft.fetchState = 'Error';
|
|
171
124
|
draft.error = status;
|
|
172
|
-
draft.jeScheduleTransactionKeysByPeriodAndTab[periodTabKey] = [];
|
|
173
|
-
draft.jeScheduleAccruedKeysByPeriodAndTab[periodTabKey] = [];
|
|
174
|
-
draft.jeScheduleOneTimeAccrualKeysByPeriodAndTab[periodTabKey] = [];
|
|
175
|
-
// Cleared with the rest: leaving it behind kept the previous fetch's resolve rows on an
|
|
176
|
-
// otherwise empty errored tab, which reads as "these are all the schedules there are".
|
|
177
|
-
draft.failedJeScheduleTransactionKeysByPeriodAndTab[periodTabKey] = [];
|
|
178
125
|
}
|
|
126
|
+
draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = [];
|
|
179
127
|
},
|
|
180
128
|
retryJeSchedule(draft, action) {
|
|
181
129
|
const { scheduledJournalEntryID } = action.payload;
|
|
@@ -211,13 +159,11 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
211
159
|
};
|
|
212
160
|
},
|
|
213
161
|
ignoreRecommendedJeSchedule: {
|
|
214
|
-
prepare(jeScheduleTransactionKey, scheduleType
|
|
162
|
+
prepare(jeScheduleTransactionKey, scheduleType) {
|
|
215
163
|
return {
|
|
216
164
|
payload: {
|
|
217
165
|
jeScheduleTransactionKey,
|
|
218
166
|
scheduleType,
|
|
219
|
-
reason,
|
|
220
|
-
note,
|
|
221
167
|
},
|
|
222
168
|
};
|
|
223
169
|
},
|
|
@@ -233,41 +179,6 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
233
179
|
};
|
|
234
180
|
},
|
|
235
181
|
},
|
|
236
|
-
revertJeSchedule: {
|
|
237
|
-
// jeScheduleTransactionKey is a JEScheduleKey for an accrued schedule, which has no base
|
|
238
|
-
// transaction to derive a transaction key from. It is only ever used as an opaque row
|
|
239
|
-
// identifier here -- for the row's spinner and for dropping the row from the list -- so one
|
|
240
|
-
// action serves both shapes rather than two near-identical ones.
|
|
241
|
-
prepare(jeScheduleId, jeScheduleTransactionKey, scheduleType, reason, note) {
|
|
242
|
-
return {
|
|
243
|
-
payload: {
|
|
244
|
-
jeScheduleId,
|
|
245
|
-
jeScheduleTransactionKey,
|
|
246
|
-
scheduleType,
|
|
247
|
-
reason,
|
|
248
|
-
note,
|
|
249
|
-
},
|
|
250
|
-
};
|
|
251
|
-
},
|
|
252
|
-
reducer(draft, action) {
|
|
253
|
-
draft.revertStatusById[action.payload.jeScheduleTransactionKey] = {
|
|
254
|
-
fetchState: 'In-Progress',
|
|
255
|
-
error: undefined,
|
|
256
|
-
};
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
revertJeScheduleSuccess(draft, action) {
|
|
260
|
-
draft.revertStatusById[action.payload.jeScheduleTransactionKey] = {
|
|
261
|
-
fetchState: 'Completed',
|
|
262
|
-
error: undefined,
|
|
263
|
-
};
|
|
264
|
-
},
|
|
265
|
-
revertJeScheduleFailure(draft, action) {
|
|
266
|
-
draft.revertStatusById[action.payload.jeScheduleTransactionKey] = {
|
|
267
|
-
fetchState: 'Error',
|
|
268
|
-
error: action.payload.status,
|
|
269
|
-
};
|
|
270
|
-
},
|
|
271
182
|
ignoreRecommendedJeScheduleSuccess: {
|
|
272
183
|
reducer(draft, action) {
|
|
273
184
|
const { jeScheduleTransactionKey } = action.payload;
|
|
@@ -300,18 +211,17 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
300
211
|
};
|
|
301
212
|
},
|
|
302
213
|
updateJeScheduleTransactionKeys: {
|
|
303
|
-
prepare(jeScheduleKeys, selectedPeriod
|
|
214
|
+
prepare(jeScheduleKeys, selectedPeriod) {
|
|
304
215
|
return {
|
|
305
216
|
payload: {
|
|
306
217
|
jeScheduleKeys: jeScheduleKeys,
|
|
307
218
|
selectedPeriod: selectedPeriod,
|
|
308
|
-
selectedPageTab: selectedPageTab,
|
|
309
219
|
},
|
|
310
220
|
};
|
|
311
221
|
},
|
|
312
222
|
reducer(draft, action) {
|
|
313
|
-
const { selectedPeriod,
|
|
314
|
-
draft.
|
|
223
|
+
const { selectedPeriod, jeScheduleKeys } = action.payload;
|
|
224
|
+
draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = jeScheduleKeys;
|
|
315
225
|
},
|
|
316
226
|
},
|
|
317
227
|
removeJeScheduleTransactionKey: {
|
|
@@ -324,20 +234,12 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
324
234
|
};
|
|
325
235
|
},
|
|
326
236
|
reducer(draft, action) {
|
|
327
|
-
const { jeScheduleKey } = action.payload;
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
removeJeAccruedScheduleKey: {
|
|
334
|
-
prepare(jeAccruedScheduleKey) {
|
|
335
|
-
return { payload: { jeAccruedScheduleKey } };
|
|
336
|
-
},
|
|
337
|
-
reducer(draft, action) {
|
|
338
|
-
// Accrued keys live in their own per-tab map, so removeJeScheduleTransactionKey cannot drop
|
|
339
|
-
// them -- a reverted accrued schedule stayed on the list until the next fetch.
|
|
340
|
-
removeKeyFromEveryTabSlot(draft.jeScheduleAccruedKeysByPeriodAndTab, action.payload.jeAccruedScheduleKey);
|
|
237
|
+
const { selectedPeriod, jeScheduleKey } = action.payload;
|
|
238
|
+
const prevData = [
|
|
239
|
+
...(draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] ?? []),
|
|
240
|
+
];
|
|
241
|
+
const filteredKeys = prevData.filter((jeKey) => jeKey !== jeScheduleKey);
|
|
242
|
+
draft.jeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = filteredKeys;
|
|
341
243
|
},
|
|
342
244
|
},
|
|
343
245
|
removeFailedJeScheduleTransactionKey: {
|
|
@@ -350,8 +252,12 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
350
252
|
};
|
|
351
253
|
},
|
|
352
254
|
reducer(draft, action) {
|
|
353
|
-
const { failedJeScheduleKey } = action.payload;
|
|
354
|
-
|
|
255
|
+
const { selectedPeriod, failedJeScheduleKey } = action.payload;
|
|
256
|
+
const prevData = [
|
|
257
|
+
...(draft.failedJeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] ?? []),
|
|
258
|
+
];
|
|
259
|
+
const filteredKeys = prevData.filter((jeKey) => jeKey !== failedJeScheduleKey);
|
|
260
|
+
draft.failedJeScheduleTransactionKeysByPeriod[toMonthYearPeriodId(selectedPeriod)] = filteredKeys;
|
|
355
261
|
},
|
|
356
262
|
},
|
|
357
263
|
initializeJeScheduleLocalData: {
|
|
@@ -430,9 +336,6 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
430
336
|
error: status,
|
|
431
337
|
fetchState: 'Error',
|
|
432
338
|
};
|
|
433
|
-
// Set on failure too: a tenant whose account list errors must still reach the page rather
|
|
434
|
-
// than sit under a skeleton forever.
|
|
435
|
-
draft.accountSettings.hasLoadedAccountSettings = true;
|
|
436
339
|
},
|
|
437
340
|
updateAccountSettingsListForAccountTypes(draft, action) {
|
|
438
341
|
doUpdateAccountSettingsListForAccountTypes(draft.accountSettings, action.payload.accountPayload);
|
|
@@ -466,187 +369,6 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
466
369
|
clearJeAccountSettingsLocalData(draft) {
|
|
467
370
|
draft.accountSettings.localData = accountSettingsInitialState.localData;
|
|
468
371
|
},
|
|
469
|
-
initializeNewSchedule: {
|
|
470
|
-
prepare({ scheduleType, shouldResetEnteredData = true, }) {
|
|
471
|
-
return { payload: { scheduleType, shouldResetEnteredData } };
|
|
472
|
-
},
|
|
473
|
-
reducer() {
|
|
474
|
-
// Purely an epic-trigger action — the epic fans out the account/class
|
|
475
|
-
// list fetches, and clears entered data only when asked to.
|
|
476
|
-
},
|
|
477
|
-
},
|
|
478
|
-
resetNewScheduleLocalData: {
|
|
479
|
-
prepare({ scheduleType, }) {
|
|
480
|
-
return { payload: { scheduleType } };
|
|
481
|
-
},
|
|
482
|
-
reducer(draft, action) {
|
|
483
|
-
const { scheduleType } = action.payload;
|
|
484
|
-
draft.newSchedule.newScheduleState[scheduleType] =
|
|
485
|
-
getBaseNewScheduleLocalData(scheduleType);
|
|
486
|
-
},
|
|
487
|
-
},
|
|
488
|
-
updateNewScheduleLocalData(draft, action) {
|
|
489
|
-
const { scheduleType, localData } = action.payload;
|
|
490
|
-
draft.newSchedule.newScheduleState[scheduleType] = {
|
|
491
|
-
...draft.newSchedule.newScheduleState[scheduleType],
|
|
492
|
-
...localData,
|
|
493
|
-
};
|
|
494
|
-
},
|
|
495
|
-
searchTransactionsForNewSchedule: {
|
|
496
|
-
prepare({ query, scheduleType, }) {
|
|
497
|
-
return { payload: { query, scheduleType } };
|
|
498
|
-
},
|
|
499
|
-
reducer(draft, action) {
|
|
500
|
-
const trimmed = action.payload.query.trim();
|
|
501
|
-
// Cleared or too-short query: no API (see epic) — reset immediately.
|
|
502
|
-
if (trimmed.length < MIN_NEW_SCHEDULE_SEARCH_LENGTH) {
|
|
503
|
-
draft.newSchedule.searchTransactions = searchTransactionsInitialState;
|
|
504
|
-
return;
|
|
505
|
-
}
|
|
506
|
-
draft.newSchedule.searchTransactions = {
|
|
507
|
-
...draft.newSchedule.searchTransactions,
|
|
508
|
-
searchString: action.payload.query,
|
|
509
|
-
fetchState: 'In-Progress',
|
|
510
|
-
};
|
|
511
|
-
},
|
|
512
|
-
},
|
|
513
|
-
searchTransactionsForNewScheduleSuccess(draft, action) {
|
|
514
|
-
draft.newSchedule.searchTransactions = {
|
|
515
|
-
...draft.newSchedule.searchTransactions,
|
|
516
|
-
searchResults: action.payload.searchResults,
|
|
517
|
-
fetchState: 'Completed',
|
|
518
|
-
error: undefined,
|
|
519
|
-
};
|
|
520
|
-
},
|
|
521
|
-
searchTransactionsForNewScheduleFailure(draft, action) {
|
|
522
|
-
draft.newSchedule.searchTransactions = {
|
|
523
|
-
...draft.newSchedule.searchTransactions,
|
|
524
|
-
fetchState: 'Error',
|
|
525
|
-
error: action.payload.status,
|
|
526
|
-
};
|
|
527
|
-
},
|
|
528
|
-
clearSearchTransactionsForNewSchedule(draft) {
|
|
529
|
-
draft.newSchedule.searchTransactions = searchTransactionsInitialState;
|
|
530
|
-
},
|
|
531
|
-
saveNewSchedule: {
|
|
532
|
-
prepare({ scheduleType, }) {
|
|
533
|
-
return { payload: { scheduleType } };
|
|
534
|
-
},
|
|
535
|
-
reducer(draft) {
|
|
536
|
-
draft.newSchedule.saveStatus = {
|
|
537
|
-
fetchState: 'In-Progress',
|
|
538
|
-
error: undefined,
|
|
539
|
-
};
|
|
540
|
-
},
|
|
541
|
-
},
|
|
542
|
-
saveNewScheduleSuccess(draft) {
|
|
543
|
-
draft.newSchedule.saveStatus = {
|
|
544
|
-
fetchState: 'Completed',
|
|
545
|
-
error: undefined,
|
|
546
|
-
};
|
|
547
|
-
},
|
|
548
|
-
saveNewScheduleFailure(draft, action) {
|
|
549
|
-
draft.newSchedule.saveStatus = {
|
|
550
|
-
fetchState: 'Error',
|
|
551
|
-
error: action.payload.status,
|
|
552
|
-
};
|
|
553
|
-
},
|
|
554
|
-
createOneTimeAccrual: {
|
|
555
|
-
prepare(localData) {
|
|
556
|
-
return { payload: { localData } };
|
|
557
|
-
},
|
|
558
|
-
reducer(draft) {
|
|
559
|
-
draft.newSchedule.createOneTimeAccrualStatus = {
|
|
560
|
-
fetchState: 'In-Progress',
|
|
561
|
-
error: undefined,
|
|
562
|
-
};
|
|
563
|
-
},
|
|
564
|
-
},
|
|
565
|
-
createOneTimeAccrualSuccess(draft) {
|
|
566
|
-
draft.newSchedule.createOneTimeAccrualStatus = {
|
|
567
|
-
fetchState: 'Completed',
|
|
568
|
-
error: undefined,
|
|
569
|
-
};
|
|
570
|
-
},
|
|
571
|
-
createOneTimeAccrualFailure(draft, action) {
|
|
572
|
-
draft.newSchedule.createOneTimeAccrualStatus = {
|
|
573
|
-
fetchState: 'Error',
|
|
574
|
-
error: action.payload.status,
|
|
575
|
-
};
|
|
576
|
-
},
|
|
577
|
-
/**
|
|
578
|
-
* Promote applies the body and posts in one step, so it carries whatever the user edited on the
|
|
579
|
-
* detail page. `edits` is absent when nothing was changed -- the epic then falls back to the
|
|
580
|
-
* stored accrual, which is what the list's inline Post does.
|
|
581
|
-
*/
|
|
582
|
-
promoteOneTimeAccrual: {
|
|
583
|
-
prepare(accrualId, amount, edits) {
|
|
584
|
-
return { payload: { accrualId, amount, edits } };
|
|
585
|
-
},
|
|
586
|
-
reducer(draft, action) {
|
|
587
|
-
draft.oneTimeAccrualActionStatusById[action.payload.accrualId] = {
|
|
588
|
-
fetchState: 'In-Progress',
|
|
589
|
-
error: undefined,
|
|
590
|
-
};
|
|
591
|
-
},
|
|
592
|
-
},
|
|
593
|
-
revertOneTimeAccrual: {
|
|
594
|
-
prepare(accrualId, reason, note) {
|
|
595
|
-
return { payload: { accrualId, reason, note } };
|
|
596
|
-
},
|
|
597
|
-
reducer(draft, action) {
|
|
598
|
-
draft.oneTimeAccrualActionStatusById[action.payload.accrualId] = {
|
|
599
|
-
fetchState: 'In-Progress',
|
|
600
|
-
error: undefined,
|
|
601
|
-
};
|
|
602
|
-
},
|
|
603
|
-
},
|
|
604
|
-
ignoreOneTimeAccrual: {
|
|
605
|
-
prepare(accrualId, reason, note) {
|
|
606
|
-
return { payload: { accrualId, reason, note } };
|
|
607
|
-
},
|
|
608
|
-
reducer(draft, action) {
|
|
609
|
-
draft.oneTimeAccrualActionStatusById[action.payload.accrualId] = {
|
|
610
|
-
fetchState: 'In-Progress',
|
|
611
|
-
error: undefined,
|
|
612
|
-
};
|
|
613
|
-
},
|
|
614
|
-
},
|
|
615
|
-
fetchOneTimeAccrual: {
|
|
616
|
-
prepare(accrualId) {
|
|
617
|
-
return { payload: { accrualId } };
|
|
618
|
-
},
|
|
619
|
-
reducer(draft, action) {
|
|
620
|
-
draft.oneTimeAccrualFetchStatusById[action.payload.accrualId] = {
|
|
621
|
-
fetchState: 'In-Progress',
|
|
622
|
-
error: undefined,
|
|
623
|
-
};
|
|
624
|
-
},
|
|
625
|
-
},
|
|
626
|
-
fetchOneTimeAccrualSuccess(draft, action) {
|
|
627
|
-
draft.oneTimeAccrualFetchStatusById[action.payload.accrualId] = {
|
|
628
|
-
fetchState: 'Completed',
|
|
629
|
-
error: undefined,
|
|
630
|
-
};
|
|
631
|
-
},
|
|
632
|
-
fetchOneTimeAccrualFailure(draft, action) {
|
|
633
|
-
draft.oneTimeAccrualFetchStatusById[action.payload.accrualId] = {
|
|
634
|
-
fetchState: 'Error',
|
|
635
|
-
error: action.payload.status,
|
|
636
|
-
};
|
|
637
|
-
},
|
|
638
|
-
oneTimeAccrualActionSuccess(draft, action) {
|
|
639
|
-
draft.oneTimeAccrualActionStatusById[action.payload.accrualId] = {
|
|
640
|
-
fetchState: 'Completed',
|
|
641
|
-
error: undefined,
|
|
642
|
-
};
|
|
643
|
-
},
|
|
644
|
-
oneTimeAccrualActionFailure(draft, action) {
|
|
645
|
-
draft.oneTimeAccrualActionStatusById[action.payload.accrualId] = {
|
|
646
|
-
fetchState: 'Error',
|
|
647
|
-
error: action.payload.status,
|
|
648
|
-
};
|
|
649
|
-
},
|
|
650
372
|
updateJESchedulesUIState(draft, action) {
|
|
651
373
|
if (action.payload.sortKey != null) {
|
|
652
374
|
draft.uiState.sortKey = action.payload.sortKey;
|
|
@@ -660,21 +382,10 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
660
382
|
if (action.payload.scrollPosition != null) {
|
|
661
383
|
draft.uiState.scrollPosition = action.payload.scrollPosition;
|
|
662
384
|
}
|
|
663
|
-
if (action.payload.
|
|
664
|
-
draft.uiState.
|
|
385
|
+
if (action.payload.selectedMainTab != null) {
|
|
386
|
+
draft.uiState.selectedMainTab = action.payload.selectedMainTab;
|
|
665
387
|
}
|
|
666
388
|
},
|
|
667
|
-
updateJEScheduleTypeFilter(draft, action) {
|
|
668
|
-
draft.uiState.selectedJETypeFilter = action.payload;
|
|
669
|
-
},
|
|
670
|
-
toggleJEPendingGroupCollapsed(draft) {
|
|
671
|
-
draft.uiState.pendingGroupCollapsed =
|
|
672
|
-
!draft.uiState.pendingGroupCollapsed;
|
|
673
|
-
},
|
|
674
|
-
toggleJECreatedGroupCollapsed(draft) {
|
|
675
|
-
draft.uiState.createdGroupCollapsed =
|
|
676
|
-
!draft.uiState.createdGroupCollapsed;
|
|
677
|
-
},
|
|
678
389
|
clearExpenseAutomationJESchedulesView(draft) {
|
|
679
390
|
Object.assign(draft, initialState);
|
|
680
391
|
},
|
|
@@ -685,7 +396,7 @@ const expenseAutomationJESchedulesView = createSlice({
|
|
|
685
396
|
});
|
|
686
397
|
},
|
|
687
398
|
});
|
|
688
|
-
export const { clearExpenseAutomationJESchedulesView, clearJeAccountSettingsLocalData, clearJeScheduleLocalData,
|
|
399
|
+
export const { clearExpenseAutomationJESchedulesView, clearJeAccountSettingsLocalData, clearJeScheduleLocalData, fetchAccountSettingsListForAccountTypes, fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesPage, fetchJeSchedulesSuccess, fetchRecommendationForAccountSettings, ignoreRecommendedJeSchedule, ignoreRecommendedJeScheduleFailure, ignoreRecommendedJeScheduleSuccess, initializeAccountSettingsView, initializeJeScheduleLocalData, removeFailedJeScheduleTransactionKey, removeJeScheduleLocalDataById, removeJeScheduleTransactionKey, retryJeSchedule, retryJeScheduleFailure, retryJeScheduleSuccess, saveAccountSettings, saveAccountSettingsFailure, saveAccountSettingsLocalData, saveAccountSettingsSuccess, updateAccountSettingsListForAccountTypes, updateAccountSettingsListForAccountTypesFailure, updateJESchedulesUIState, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, updateRecommendationForAccountSettings, updateRecommendationForAccountSettingsFailure, } = expenseAutomationJESchedulesView.actions;
|
|
689
400
|
export default expenseAutomationJESchedulesView.reducer;
|
|
690
401
|
const doUpdateRecommendationForAccountSettings = (draft, payload) => {
|
|
691
402
|
const { prepaidExpensesRecommendations, fixedAssetsRecommendations, accruedExpensesRecommendations, } = mapAccountTypeRecommendationPayloadToAccountRecommendationByType(payload);
|
|
@@ -753,5 +464,4 @@ const doUpdateAccountSettingsListForAccountTypes = (draft, accountPayloadList) =
|
|
|
753
464
|
error: undefined,
|
|
754
465
|
fetchState: 'Completed',
|
|
755
466
|
};
|
|
756
|
-
draft.hasLoadedAccountSettings = true;
|
|
757
467
|
};
|
|
@@ -22,7 +22,6 @@ export const getJEAccountSettingsView = createSelector((state) => state.expenseA
|
|
|
22
22
|
fixedAssetsAccountHierarchy: jeAccountMappingState.fixedAssetsNestedAccountListHierarchy,
|
|
23
23
|
accruedExpensesAccountHierarchy: jeAccountMappingState.accruedExpensesNestedAccountListHierarchy,
|
|
24
24
|
fetchState: fetchState.fetchState,
|
|
25
|
-
hasLoaded: jeAccountMappingState.hasLoadedAccountSettings,
|
|
26
25
|
saveState,
|
|
27
26
|
};
|
|
28
27
|
});
|