@zeniai/client-epic-state 5.2.11-beta0ND → 5.2.11-betaAM2
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/invoicing/invoicingCommonPayload.d.ts +29 -27
- package/lib/entity/invoicing/invoicingCommonPayload.js +75 -37
- package/lib/entity/invoicing/product/productPayload.d.ts +0 -10
- package/lib/entity/invoicing/product/productPayload.js +2 -14
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +1 -0
- package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +97 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +209 -0
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +140 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +88 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
- package/lib/epic.d.ts +15 -3
- package/lib/epic.js +31 -12
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +73 -33
- package/lib/esm/entity/invoicing/product/productPayload.js +2 -14
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +209 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +78 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/esm/epic.js +27 -8
- package/lib/esm/index.js +23 -14
- package/lib/esm/reducer.js +3 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +46 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +7 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +50 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
- package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +104 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +136 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +180 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +111 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +33 -0
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
- package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +35 -0
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +260 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +319 -29
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +162 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +297 -22
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +22 -0
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +9 -25
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +1 -6
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +0 -40
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +92 -0
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -25
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +0 -41
- package/lib/esm/view/recommendation/recommendationReducer.js +1 -16
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
- package/lib/index.d.ts +29 -22
- package/lib/index.js +116 -56
- package/lib/reducer.d.ts +1 -0
- package/lib/reducer.js +3 -0
- package/lib/rootStateTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +50 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +11 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +54 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +48 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +48 -0
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +21 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +108 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +140 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +13 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +187 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +65 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +115 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +37 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +66 -0
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +40 -0
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +86 -3
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +53 -0
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +264 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +93 -12
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +321 -29
- 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/actualMatchingViewSelectorTypes.d.ts +58 -0
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +36 -7
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +9 -0
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +172 -0
- package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +305 -21
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +76 -0
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +27 -0
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +11 -7
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +1 -12
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +9 -25
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +1 -6
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +1 -10
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +1 -43
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +12 -0
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +99 -0
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +1 -4
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +2 -26
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +0 -35
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +1 -43
- package/lib/view/invoicing/settingsView/settingsViewState.d.ts +0 -8
- package/lib/view/recommendation/recommendationPayload.d.ts +0 -34
- package/lib/view/recommendation/recommendationReducer.d.ts +1 -2
- package/lib/view/recommendation/recommendationReducer.js +2 -17
- package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
- package/package.json +1 -1
- package/lib/esm/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +0 -27
- package/lib/esm/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +0 -19
- package/lib/esm/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +0 -19
- package/lib/esm/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +0 -39
- package/lib/esm/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +0 -25
- package/lib/esm/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +0 -48
- package/lib/esm/view/recommendation/submitRecommendationFeedbackEpic.js +0 -52
- package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.d.ts +0 -6
- package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +0 -31
- package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.d.ts +0 -6
- package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +0 -23
- package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.d.ts +0 -6
- package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +0 -23
- package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.d.ts +0 -6
- package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +0 -43
- package/lib/view/invoicing/settingsView/epics/settingsViewActionType.d.ts +0 -5
- package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.d.ts +0 -11
- package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +0 -29
- package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.d.ts +0 -34
- package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +0 -53
- package/lib/view/recommendation/submitRecommendationFeedbackEpic.d.ts +0 -7
- package/lib/view/recommendation/submitRecommendationFeedbackEpic.js +0 -56
- /package/lib/esm/view/{invoicing/settingsView/epics/settingsViewActionType.js → expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js} +0 -0
- /package/lib/view/{invoicing/settingsView/epics/settingsViewActionType.js → expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js} +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { toAmount } from '../../../commonStateTypes/amount';
|
|
2
|
+
import { DEFAULT_DATE_FORMAT } from '../../../commonStateTypes/timePeriod';
|
|
3
|
+
import { MONTH_YEAR_FORMAT } from '../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
|
|
4
|
+
import { LAST_SCHEDULE_DAY_OF_MONTH } from '../../../commonStateTypes/timePeriod';
|
|
5
|
+
import { getPostingDateAndStatusForIndex } from '../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper';
|
|
6
|
+
import { mapScheduleTransactionToBaseScheduleTransactionPayload, } from '../../scheduleView/scheduleDetailView/scheduleDetailPayload';
|
|
7
|
+
const getNewScheduleMemo = (vendorName, schedulePostingDate, currentPeriod, totalPeriod, assetId) => {
|
|
8
|
+
const addAsset = assetId != null && assetId !== '' ? ` - ${assetId}` : '';
|
|
9
|
+
return `${vendorName} - ${schedulePostingDate.format(MONTH_YEAR_FORMAT)} (${currentPeriod} of ${totalPeriod})${addAsset}`;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Computes the month-by-month JE schedule breakdown for a brand-new schedule
|
|
13
|
+
* (no linked transaction yet) — replicates createNewSchedulesHelper's math
|
|
14
|
+
* (scheduleDetailLocalDataHelper.ts) exactly: lump-sum total split evenly
|
|
15
|
+
* across months with the rounding remainder absorbed by the last month, and a
|
|
16
|
+
* running balance that decrements each month and is forced to exactly 0 on
|
|
17
|
+
* the last row.
|
|
18
|
+
*/
|
|
19
|
+
export const computeNewScheduleJeDetails = (localData, totalAmount, vendorName) => {
|
|
20
|
+
const period = localData.selectedMonths;
|
|
21
|
+
const startingMonth = localData.selectedDate;
|
|
22
|
+
if (startingMonth == null || period == null) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
const assetId = 'assetId' in localData ? localData.assetId : undefined;
|
|
26
|
+
const averageAmount = Math.abs(Math.round((totalAmount.amount / period) * 100) / 100);
|
|
27
|
+
const lastMonthAmount = Math.abs(Math.round((Math.abs(totalAmount.amount) - averageAmount * (period - 1)) * 100) / 100);
|
|
28
|
+
let runningBalance = Math.abs(totalAmount.amount);
|
|
29
|
+
const negativeNumbers = totalAmount.amount < 0 || runningBalance < 0;
|
|
30
|
+
const newJeDetails = [];
|
|
31
|
+
for (let index = 0; index < period; index++) {
|
|
32
|
+
if (runningBalance > averageAmount) {
|
|
33
|
+
runningBalance = Math.round((runningBalance - averageAmount) * 100) / 100;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
runningBalance = 0;
|
|
37
|
+
}
|
|
38
|
+
const amount = index === period - 1 ? lastMonthAmount : averageAmount;
|
|
39
|
+
runningBalance = index === period - 1 ? 0 : runningBalance;
|
|
40
|
+
const schedulePostingDate = startingMonth.add(index, 'month');
|
|
41
|
+
const { postingDate, postingStatus } = getPostingDateAndStatusForIndex(schedulePostingDate.month(), schedulePostingDate.year(), localData.lastDayOfMonth === true
|
|
42
|
+
? undefined
|
|
43
|
+
: localData.selectedDayOfMonth);
|
|
44
|
+
newJeDetails.push({
|
|
45
|
+
postingDate,
|
|
46
|
+
amount: toAmount(negativeNumbers ? -amount : amount, totalAmount.currencyCode, totalAmount.currencySymbol),
|
|
47
|
+
runningBalance: toAmount(negativeNumbers ? -runningBalance : runningBalance, totalAmount.currencyCode, totalAmount.currencySymbol),
|
|
48
|
+
postingStatus,
|
|
49
|
+
memo: getNewScheduleMemo(vendorName, schedulePostingDate, index + 1, period, assetId),
|
|
50
|
+
jeLink: { type: 'unknown' },
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return newJeDetails;
|
|
54
|
+
};
|
|
55
|
+
const mapNewJeDetailsToScheduledJournalEntryPayload = (jeScheduleDetails) => jeScheduleDetails.map((journalEntry) => ({
|
|
56
|
+
status: {
|
|
57
|
+
code: journalEntry.postingStatus,
|
|
58
|
+
label: journalEntry.postingStatus,
|
|
59
|
+
},
|
|
60
|
+
transaction_memo: journalEntry.memo,
|
|
61
|
+
third_party_id: journalEntry.jeLink.thirdPartyTransactionId ?? null,
|
|
62
|
+
expected_post_date: journalEntry.postingDate.format(DEFAULT_DATE_FORMAT),
|
|
63
|
+
amount: journalEntry.amount.amount,
|
|
64
|
+
balance: journalEntry.runningBalance.amount,
|
|
65
|
+
// Brand-new schedule — there is no prior scheduled-journal-entry history
|
|
66
|
+
// to cross-reference (unlike the legacy edit flow's equivalent mapper).
|
|
67
|
+
scheduled_journal_entry_id: null,
|
|
68
|
+
actual_post_date: null,
|
|
69
|
+
is_platform_generated: null,
|
|
70
|
+
je_schedule_id: null,
|
|
71
|
+
update_time: null,
|
|
72
|
+
create_time: null,
|
|
73
|
+
}));
|
|
74
|
+
/**
|
|
75
|
+
* Builds a savable schedule payload directly from a Base Transaction search
|
|
76
|
+
* result and the New Schedule form's local data — bypassing the legacy
|
|
77
|
+
* getJEScheduledTransactionByJEScheduleTransactionKey selector entirely,
|
|
78
|
+
* since that selector throws unless the entity has already round-tripped
|
|
79
|
+
* through a real GET /1.0/schedules/:id. A brand-new schedule has no such
|
|
80
|
+
* history, so this reads only from data already in hand (the selected
|
|
81
|
+
* transaction/line plus what the user filled into the form).
|
|
82
|
+
*/
|
|
83
|
+
export const prepareNewSchedulePayload = (transaction, localData, scheduleType) => {
|
|
84
|
+
if (transaction.thirdPartyTransactionId == null ||
|
|
85
|
+
transaction.thirdPartyTransactionId === '') {
|
|
86
|
+
return { ok: false, reason: 'missing_third_party_id' };
|
|
87
|
+
}
|
|
88
|
+
const scheduleTransaction = transaction;
|
|
89
|
+
const vendorId = localData.selectedVendor?.id ?? transaction.vendorId ?? '';
|
|
90
|
+
const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
|
|
91
|
+
if (vendorId === '' || vendorName === '') {
|
|
92
|
+
return { ok: false, reason: 'missing_vendor' };
|
|
93
|
+
}
|
|
94
|
+
const vendor = {
|
|
95
|
+
vendor_id: vendorId,
|
|
96
|
+
vendor_name: vendorName,
|
|
97
|
+
};
|
|
98
|
+
const jeScheduleDetails = computeNewScheduleJeDetails(localData, scheduleTransaction.amount, vendorName);
|
|
99
|
+
const postingDate = localData.selectedDayOfMonth ??
|
|
100
|
+
(localData.lastDayOfMonth === true ? LAST_SCHEDULE_DAY_OF_MONTH : null);
|
|
101
|
+
const firstJEScheduleDate = jeScheduleDetails.length > 0
|
|
102
|
+
? jeScheduleDetails[0].postingDate.format(DEFAULT_DATE_FORMAT)
|
|
103
|
+
: null;
|
|
104
|
+
const lastJEScheduleDate = jeScheduleDetails.length > 0
|
|
105
|
+
? jeScheduleDetails[jeScheduleDetails.length - 1].postingDate.format(DEFAULT_DATE_FORMAT)
|
|
106
|
+
: null;
|
|
107
|
+
const isFixedAssets = scheduleType === 'fixed_assets';
|
|
108
|
+
const assetId = 'assetId' in localData ? localData.assetId : undefined;
|
|
109
|
+
const selectedAccumulatedDepreciationCategory = 'selectedAccumulatedDepreciationCategory' in localData
|
|
110
|
+
? localData.selectedAccumulatedDepreciationCategory
|
|
111
|
+
: undefined;
|
|
112
|
+
const status = { code: 'new', label: 'New' };
|
|
113
|
+
const jeSchedulePayload = {
|
|
114
|
+
status,
|
|
115
|
+
vendor,
|
|
116
|
+
currency_code: scheduleTransaction.currency.currencyCode,
|
|
117
|
+
currency_symbol: scheduleTransaction.currency.currencySymbol,
|
|
118
|
+
period: localData.selectedMonths ?? null,
|
|
119
|
+
je_schedule_type: scheduleType,
|
|
120
|
+
posting_date: postingDate,
|
|
121
|
+
balance: scheduleTransaction.amount.amount,
|
|
122
|
+
start_date: firstJEScheduleDate,
|
|
123
|
+
end_date: lastJEScheduleDate,
|
|
124
|
+
je_credit_accounting_class_id: scheduleTransaction.classBase?.classId ?? null,
|
|
125
|
+
je_credit_account_id: isFixedAssets
|
|
126
|
+
? (selectedAccumulatedDepreciationCategory ?? null)
|
|
127
|
+
: scheduleTransaction.account.accountId,
|
|
128
|
+
je_debit_account_id: localData.selectedAccount ?? null,
|
|
129
|
+
je_debit_accounting_class_id: localData.selectedClass ?? null,
|
|
130
|
+
other_attributes: assetId != null ? { asset_id: assetId } : {},
|
|
131
|
+
base_transaction: mapScheduleTransactionToBaseScheduleTransactionPayload(scheduleTransaction),
|
|
132
|
+
};
|
|
133
|
+
return {
|
|
134
|
+
ok: true,
|
|
135
|
+
payload: {
|
|
136
|
+
je_schedules: [jeSchedulePayload],
|
|
137
|
+
scheduled_journal_entries: mapNewJeDetailsToScheduledJournalEntryPayload(jeScheduleDetails),
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { toString } from '../../../commonStateTypes/timePeriod';
|
|
2
|
+
import { toMatchAndReverseResultStatus, } from '../types/actualMatchingViewState';
|
|
3
|
+
export function toServiceMonthFromPeriod(period) {
|
|
4
|
+
return toString(period.start).slice(0, 7);
|
|
5
|
+
}
|
|
6
|
+
const DEFAULT_CURRENCY_CODE = 'USD';
|
|
7
|
+
const DEFAULT_CURRENCY_SYMBOL = '$';
|
|
8
|
+
export function toActualMatchingTransactionSearchResult(payload) {
|
|
9
|
+
const currencyCode = payload.currency_code ?? DEFAULT_CURRENCY_CODE;
|
|
10
|
+
return {
|
|
11
|
+
transactionId: payload.transaction_id,
|
|
12
|
+
transactionIntegrationId: payload.transaction_integration_id,
|
|
13
|
+
transactionType: payload.transaction_type,
|
|
14
|
+
lineId: payload.line_id,
|
|
15
|
+
vendorId: payload.vendor_id ?? undefined,
|
|
16
|
+
vendorName: payload.vendor_name ?? '',
|
|
17
|
+
amount: payload.total_amount,
|
|
18
|
+
transactionDate: payload.transaction_date,
|
|
19
|
+
accountId: payload.account_id ?? undefined,
|
|
20
|
+
accountName: payload.account_name ?? undefined,
|
|
21
|
+
currencyCode,
|
|
22
|
+
currencySymbol: payload.currency_symbol ??
|
|
23
|
+
(currencyCode === DEFAULT_CURRENCY_CODE
|
|
24
|
+
? DEFAULT_CURRENCY_SYMBOL
|
|
25
|
+
: currencyCode),
|
|
26
|
+
transactionMemo: payload.transaction_memo ?? undefined,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function toMatchAndReverseResult(payload) {
|
|
30
|
+
return {
|
|
31
|
+
accrualId: payload.accrual_id,
|
|
32
|
+
status: toMatchAndReverseResultStatus(payload.status),
|
|
33
|
+
reason: payload.reason ?? undefined,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
import { DEFAULT_DATE_FORMAT } from '../../../commonStateTypes/timePeriod';
|
|
2
|
+
import { getClassList } from '../../classList/classListSelector';
|
|
2
3
|
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');
|
|
3
58
|
export const prepareIgnoreSchedulePayload = (scheduleType, jeScheduleTransaction, state) => {
|
|
4
59
|
const { vendorState } = state;
|
|
5
60
|
const { vendor, currencyCode, currencySymbol, baseTransaction, status, balanceAsOfToday, period, startDate, endDate, jeCredit, jeDebit, } = jeScheduleTransaction;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import { toMonthYearPeriodId, } from '../../../commonStateTypes/timePeriod';
|
|
3
|
+
import { generateJEOneTimeAccrualKey } from '../../../entity/jeSchedules/jeScheduleHelper';
|
|
4
|
+
import { clearAll } from '../../../rootActions';
|
|
5
|
+
export const initialTransactionSearchState = {
|
|
6
|
+
query: '',
|
|
7
|
+
results: [],
|
|
8
|
+
fetchState: 'Not-Started',
|
|
9
|
+
error: undefined,
|
|
10
|
+
nextPageToken: null,
|
|
11
|
+
isLoadingMore: false,
|
|
12
|
+
};
|
|
13
|
+
export const initialAccrualSearchState = {
|
|
14
|
+
query: '',
|
|
15
|
+
results: [],
|
|
16
|
+
fetchState: 'Not-Started',
|
|
17
|
+
error: undefined,
|
|
18
|
+
nextPageToken: null,
|
|
19
|
+
isLoadingMore: false,
|
|
20
|
+
};
|
|
21
|
+
export const initialMatchModalState = {
|
|
22
|
+
isOpen: false,
|
|
23
|
+
transactionSearch: initialTransactionSearchState,
|
|
24
|
+
accrualSearch: initialAccrualSearchState,
|
|
25
|
+
confirmStatus: { fetchState: 'Not-Started', error: undefined },
|
|
26
|
+
};
|
|
27
|
+
export const initialState = {
|
|
28
|
+
accrualKeysByPeriod: {},
|
|
29
|
+
fetchState: 'Not-Started',
|
|
30
|
+
error: undefined,
|
|
31
|
+
refreshStatus: {
|
|
32
|
+
fetchState: 'Not-Started',
|
|
33
|
+
error: undefined,
|
|
34
|
+
},
|
|
35
|
+
uiState: {
|
|
36
|
+
sortKey: 'date',
|
|
37
|
+
sortOrder: 'descending',
|
|
38
|
+
searchString: '',
|
|
39
|
+
scrollPosition: { scrollTop: 0, scrollLeft: undefined },
|
|
40
|
+
},
|
|
41
|
+
matchModal: initialMatchModalState,
|
|
42
|
+
hasValidState() {
|
|
43
|
+
return this.fetchState == 'Completed';
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
function resetMatchModalSearches(draft) {
|
|
47
|
+
draft.matchModal.transactionSearch = initialTransactionSearchState;
|
|
48
|
+
draft.matchModal.accrualSearch = initialAccrualSearchState;
|
|
49
|
+
draft.matchModal.confirmStatus = {
|
|
50
|
+
fetchState: 'Not-Started',
|
|
51
|
+
error: undefined,
|
|
52
|
+
};
|
|
53
|
+
draft.matchModal.lastBatchResults = undefined;
|
|
54
|
+
}
|
|
55
|
+
const expenseAutomationActualMatchingView = createSlice({
|
|
56
|
+
name: 'expenseAutomationActualMatchingView',
|
|
57
|
+
initialState,
|
|
58
|
+
reducers: {
|
|
59
|
+
fetchActualMatchingPage: {
|
|
60
|
+
prepare(period, refreshViewInBackground = false) {
|
|
61
|
+
return {
|
|
62
|
+
payload: {
|
|
63
|
+
period,
|
|
64
|
+
refreshViewInBackground,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
reducer() {
|
|
69
|
+
// Epic-only fan-out.
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
fetchActualMatching: {
|
|
73
|
+
reducer(draft, action) {
|
|
74
|
+
const { refreshViewInBackground } = action.payload;
|
|
75
|
+
if (refreshViewInBackground) {
|
|
76
|
+
draft.refreshStatus = { fetchState: 'In-Progress', error: undefined };
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
draft.fetchState = 'In-Progress';
|
|
80
|
+
draft.error = undefined;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
prepare(period, refreshViewInBackground = false) {
|
|
84
|
+
return {
|
|
85
|
+
payload: {
|
|
86
|
+
period,
|
|
87
|
+
refreshViewInBackground,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
fetchActualMatchingSuccess(draft, action) {
|
|
93
|
+
const { accruals, selectedPeriod, refreshViewInBackground } = action.payload;
|
|
94
|
+
const periodId = toMonthYearPeriodId(selectedPeriod);
|
|
95
|
+
draft.accrualKeysByPeriod[periodId] = accruals.map((accrual) => generateJEOneTimeAccrualKey(accrual._id));
|
|
96
|
+
if (refreshViewInBackground) {
|
|
97
|
+
draft.refreshStatus = { fetchState: 'Completed', error: undefined };
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
draft.fetchState = 'Completed';
|
|
101
|
+
draft.error = undefined;
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
fetchActualMatchingFailure(draft, action) {
|
|
105
|
+
const { status, refreshViewInBackground } = action.payload;
|
|
106
|
+
if (refreshViewInBackground) {
|
|
107
|
+
draft.refreshStatus = { fetchState: 'Error', error: status };
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
draft.fetchState = 'Error';
|
|
111
|
+
draft.error = status;
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
updateActualMatchingUIState(draft, action) {
|
|
115
|
+
if (action.payload.sortKey != null) {
|
|
116
|
+
draft.uiState.sortKey = action.payload.sortKey;
|
|
117
|
+
}
|
|
118
|
+
if (action.payload.sortOrder != null) {
|
|
119
|
+
draft.uiState.sortOrder = action.payload.sortOrder;
|
|
120
|
+
}
|
|
121
|
+
if (action.payload.searchString != null) {
|
|
122
|
+
draft.uiState.searchString = action.payload.searchString;
|
|
123
|
+
}
|
|
124
|
+
if (action.payload.scrollPosition != null) {
|
|
125
|
+
draft.uiState.scrollPosition = action.payload.scrollPosition;
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
openMatchNewModal(draft) {
|
|
129
|
+
draft.matchModal.isOpen = true;
|
|
130
|
+
},
|
|
131
|
+
closeMatchNewModal(draft) {
|
|
132
|
+
draft.matchModal.isOpen = false;
|
|
133
|
+
resetMatchModalSearches(draft);
|
|
134
|
+
},
|
|
135
|
+
clearMatchNewModal(draft) {
|
|
136
|
+
draft.matchModal.isOpen = false;
|
|
137
|
+
resetMatchModalSearches(draft);
|
|
138
|
+
},
|
|
139
|
+
searchMatchTransactions: {
|
|
140
|
+
reducer(draft, action) {
|
|
141
|
+
const { query, pageToken } = action.payload;
|
|
142
|
+
const isLoadMore = pageToken != null;
|
|
143
|
+
draft.matchModal.transactionSearch.query = query;
|
|
144
|
+
if (isLoadMore) {
|
|
145
|
+
draft.matchModal.transactionSearch.isLoadingMore = true;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
draft.matchModal.transactionSearch.isLoadingMore = false;
|
|
149
|
+
draft.matchModal.transactionSearch.results = [];
|
|
150
|
+
draft.matchModal.transactionSearch.nextPageToken = null;
|
|
151
|
+
draft.matchModal.transactionSearch.fetchState = 'In-Progress';
|
|
152
|
+
draft.matchModal.transactionSearch.error = undefined;
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
prepare({ query, pageToken }) {
|
|
156
|
+
return { payload: { query, pageToken: pageToken ?? undefined } };
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
searchMatchTransactionsSuccess(draft, action) {
|
|
160
|
+
const { append, nextPageToken, results } = action.payload;
|
|
161
|
+
if (append) {
|
|
162
|
+
const merged = [
|
|
163
|
+
...draft.matchModal.transactionSearch.results,
|
|
164
|
+
...results,
|
|
165
|
+
];
|
|
166
|
+
const byKey = new Map(merged.map((result) => [
|
|
167
|
+
`${result.transactionId}:${result.lineId}`,
|
|
168
|
+
result,
|
|
169
|
+
]));
|
|
170
|
+
draft.matchModal.transactionSearch.results = Array.from(byKey.values());
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
draft.matchModal.transactionSearch.results = results;
|
|
174
|
+
}
|
|
175
|
+
draft.matchModal.transactionSearch.nextPageToken = nextPageToken;
|
|
176
|
+
draft.matchModal.transactionSearch.isLoadingMore = false;
|
|
177
|
+
draft.matchModal.transactionSearch.fetchState = 'Completed';
|
|
178
|
+
draft.matchModal.transactionSearch.error = undefined;
|
|
179
|
+
},
|
|
180
|
+
searchMatchTransactionsFailure(draft, action) {
|
|
181
|
+
draft.matchModal.transactionSearch.isLoadingMore = false;
|
|
182
|
+
draft.matchModal.transactionSearch.fetchState = 'Error';
|
|
183
|
+
draft.matchModal.transactionSearch.error = action.payload.error;
|
|
184
|
+
},
|
|
185
|
+
searchMatchAccruals: {
|
|
186
|
+
reducer(draft, action) {
|
|
187
|
+
const { query, pageToken } = action.payload;
|
|
188
|
+
const isLoadMore = pageToken != null;
|
|
189
|
+
draft.matchModal.accrualSearch.query = query;
|
|
190
|
+
if (isLoadMore) {
|
|
191
|
+
draft.matchModal.accrualSearch.isLoadingMore = true;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
draft.matchModal.accrualSearch.isLoadingMore = false;
|
|
195
|
+
draft.matchModal.accrualSearch.results = [];
|
|
196
|
+
draft.matchModal.accrualSearch.nextPageToken = null;
|
|
197
|
+
draft.matchModal.accrualSearch.fetchState = 'In-Progress';
|
|
198
|
+
draft.matchModal.accrualSearch.error = undefined;
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
prepare({ query, pageToken }) {
|
|
202
|
+
return { payload: { query, pageToken: pageToken ?? undefined } };
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
searchMatchAccrualsSuccess(draft, action) {
|
|
206
|
+
const { append, nextPageToken, results } = action.payload;
|
|
207
|
+
const keys = results.map((accrual) => generateJEOneTimeAccrualKey(accrual._id));
|
|
208
|
+
if (append) {
|
|
209
|
+
const merged = [...draft.matchModal.accrualSearch.results, ...keys];
|
|
210
|
+
draft.matchModal.accrualSearch.results = Array.from(new Set(merged));
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
draft.matchModal.accrualSearch.results = keys;
|
|
214
|
+
}
|
|
215
|
+
draft.matchModal.accrualSearch.nextPageToken = nextPageToken;
|
|
216
|
+
draft.matchModal.accrualSearch.isLoadingMore = false;
|
|
217
|
+
draft.matchModal.accrualSearch.fetchState = 'Completed';
|
|
218
|
+
draft.matchModal.accrualSearch.error = undefined;
|
|
219
|
+
},
|
|
220
|
+
searchMatchAccrualsFailure(draft, action) {
|
|
221
|
+
draft.matchModal.accrualSearch.isLoadingMore = false;
|
|
222
|
+
draft.matchModal.accrualSearch.fetchState = 'Error';
|
|
223
|
+
draft.matchModal.accrualSearch.error = action.payload.error;
|
|
224
|
+
},
|
|
225
|
+
matchAndReverseAccruals: {
|
|
226
|
+
reducer(draft) {
|
|
227
|
+
draft.matchModal.confirmStatus = {
|
|
228
|
+
fetchState: 'In-Progress',
|
|
229
|
+
error: undefined,
|
|
230
|
+
};
|
|
231
|
+
},
|
|
232
|
+
prepare(params) {
|
|
233
|
+
return { payload: params };
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
matchAndReverseAccrualsSuccess(draft, action) {
|
|
237
|
+
draft.matchModal.confirmStatus = {
|
|
238
|
+
fetchState: 'Completed',
|
|
239
|
+
error: undefined,
|
|
240
|
+
};
|
|
241
|
+
draft.matchModal.lastBatchResults = action.payload.results;
|
|
242
|
+
},
|
|
243
|
+
matchAndReverseAccrualsFailure(draft, action) {
|
|
244
|
+
draft.matchModal.confirmStatus = {
|
|
245
|
+
fetchState: 'Error',
|
|
246
|
+
error: action.payload.status,
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
clearActualMatchingView(draft) {
|
|
250
|
+
Object.assign(draft, initialState);
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
extraReducers: (builder) => {
|
|
254
|
+
builder.addCase(clearAll, (draft) => {
|
|
255
|
+
Object.assign(draft, initialState);
|
|
256
|
+
});
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
export const { clearActualMatchingView, clearMatchNewModal, closeMatchNewModal, fetchActualMatching, fetchActualMatchingFailure, fetchActualMatchingPage, fetchActualMatchingSuccess, matchAndReverseAccruals, matchAndReverseAccrualsFailure, matchAndReverseAccrualsSuccess, openMatchNewModal, searchMatchAccruals, searchMatchAccrualsFailure, searchMatchAccrualsSuccess, searchMatchTransactions, searchMatchTransactionsFailure, searchMatchTransactionsSuccess, updateActualMatchingUIState, } = expenseAutomationActualMatchingView.actions;
|
|
260
|
+
export default expenseAutomationActualMatchingView.reducer;
|