@zeniai/client-epic-state 5.2.14 → 5.2.15
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/accountRecon/accountReconReducer.d.ts +2 -1
- package/lib/entity/accountRecon/accountReconReducer.js +22 -10
- package/lib/entity/accountRecon/accountReconSelector.d.ts +1 -0
- package/lib/entity/accountRecon/accountReconSelector.js +1 -0
- package/lib/entity/approvalRule/approvalRuleConflict.d.ts +13 -0
- package/lib/entity/approvalRule/approvalRuleConflict.js +16 -1
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +1 -0
- package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +78 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +183 -4
- 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 +123 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +96 -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 +10 -1
- package/lib/epic.js +18 -0
- package/lib/esm/entity/accountRecon/accountReconReducer.js +22 -10
- package/lib/esm/entity/accountRecon/accountReconSelector.js +1 -0
- package/lib/esm/entity/approvalRule/approvalRuleConflict.js +16 -1
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +183 -5
- 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 +86 -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 +18 -0
- package/lib/esm/index.js +16 -10
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.js +54 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +3 -6
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
- 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 +138 -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 +28 -0
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
- package/lib/esm/view/expenseAutomationView/helpers/reconciliationHelpers.js +12 -0
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +319 -29
- package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +20 -2
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -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 +327 -22
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
- 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/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +20 -1
- package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +20 -1
- package/lib/index.d.ts +18 -13
- package/lib/index.js +92 -47
- package/lib/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.d.ts +10 -2
- package/lib/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/deleteCombinedStatementEpic.js +58 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +3 -6
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
- 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 +142 -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 +6 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +32 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
- package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +6 -0
- package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +13 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +86 -3
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +4 -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/reconciliationViewReducer.d.ts +6 -1
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +22 -4
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
- 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 +41 -7
- 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 +335 -21
- 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 +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 +7 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +20 -1
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelectorTypes.d.ts +3 -0
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelector.js +20 -1
- package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewSelectorTypes.d.ts +3 -0
- package/package.json +1 -1
|
@@ -3,13 +3,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isAiAccountantSchedule = void 0;
|
|
7
|
+
exports.isRenderableOneTimeAccrual = isRenderableOneTimeAccrual;
|
|
8
|
+
exports.getJEScheduleRowType = getJEScheduleRowType;
|
|
9
|
+
exports.isPendingReviewRow = isPendingReviewRow;
|
|
10
|
+
exports.isExistingTabRow = isExistingTabRow;
|
|
11
|
+
exports.isAccruedScheduleRow = isAccruedScheduleRow;
|
|
12
|
+
exports.isOneTimeAccrualRow = isOneTimeAccrualRow;
|
|
6
13
|
exports.getExpenseAutomationJESchedulesView = getExpenseAutomationJESchedulesView;
|
|
14
|
+
exports.getExpenseAutomationJEOneTimeAccrualDetailView = getExpenseAutomationJEOneTimeAccrualDetailView;
|
|
7
15
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
8
16
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
9
17
|
const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
|
|
10
18
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
11
19
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
20
|
+
const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper");
|
|
12
21
|
const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
|
|
22
|
+
const jeSchedulesTypes_1 = require("../../../entity/jeSchedules/jeSchedulesTypes");
|
|
13
23
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
14
24
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
15
25
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
@@ -17,8 +27,144 @@ const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDeta
|
|
|
17
27
|
const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailSelector");
|
|
18
28
|
const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
|
|
19
29
|
const getAllStepsHelper_1 = require("./getAllStepsHelper");
|
|
30
|
+
const jeSchedulesViewState_1 = require("../types/jeSchedulesViewState");
|
|
20
31
|
const jeAccountSettingsViewSelector_1 = require("./jeAccountSettingsViewSelector");
|
|
32
|
+
const jeNewScheduleViewSelector_1 = require("./jeNewScheduleViewSelector");
|
|
33
|
+
// Matches the AI-automation user addresses webc's schedule list row already
|
|
34
|
+
// checks (JEScheduleReadOnlyListRow/JEScheduleDraftListRow "Method" column,
|
|
35
|
+
// strings.ts aiBotEmail/botEmail) to determine whether a schedule was
|
|
36
|
+
// created by the AI accountant vs. a human.
|
|
37
|
+
const AI_BOT_EMAIL = 'ai@zeni.ai';
|
|
38
|
+
const BOT_EMAIL = 'bot@zeni.ai';
|
|
39
|
+
// A one-time accrual has no jeScheduleType of its own — it is not a JE schedule. It is still an
|
|
40
|
+
// accrued expense, so it counts and filters under that type on the page's type tabs.
|
|
41
|
+
const ONE_TIME_ACCRUAL_SCHEDULE_TYPE = 'accrued_expenses';
|
|
42
|
+
// Which of the two list buckets an accrual belongs in. `draft` still needs a human to post it;
|
|
43
|
+
// everything else is already on the books or in a transient claim.
|
|
44
|
+
const ONE_TIME_ACCRUAL_REVIEW_STATUSES = [
|
|
45
|
+
'draft',
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* `posting_blocked` is written by the posting Cron when a JE fails to post. It is an internal
|
|
49
|
+
* failure state with no human action attached, so it is dropped here rather than hidden at render
|
|
50
|
+
* time — filtering in the view would leave the group counts and KPI totals counting rows nobody
|
|
51
|
+
* can see. The expense-automation endpoint applies no status filter on the close-period path, so
|
|
52
|
+
* these rows do arrive.
|
|
53
|
+
*/
|
|
54
|
+
function isRenderableOneTimeAccrual(accrual) {
|
|
55
|
+
return (accrual.accrualStatus !== 'posting_blocked' &&
|
|
56
|
+
// Terminal states the user has already decided. The GET list excludes both server-side, so
|
|
57
|
+
// these only appear in the window between an ignore/revert response being written back and the
|
|
58
|
+
// background refresh landing -- during which an ignored row would otherwise sit in Pending
|
|
59
|
+
// Review offering a Post button. Dropped here rather than at render time so group counts and
|
|
60
|
+
// KPI totals do not count rows nobody can see.
|
|
61
|
+
accrual.accrualStatus !== 'reverted' &&
|
|
62
|
+
!accrual.isIgnored);
|
|
63
|
+
}
|
|
64
|
+
function getJEScheduleRowType(schedule) {
|
|
65
|
+
return isOneTimeAccrualRow(schedule)
|
|
66
|
+
? ONE_TIME_ACCRUAL_SCHEDULE_TYPE
|
|
67
|
+
: schedule.jeScheduleType;
|
|
68
|
+
}
|
|
69
|
+
function isPendingReviewRow(schedule) {
|
|
70
|
+
return isOneTimeAccrualRow(schedule)
|
|
71
|
+
? ONE_TIME_ACCRUAL_REVIEW_STATUSES.includes(schedule.accrualStatus)
|
|
72
|
+
: schedule.status.code === 'draft';
|
|
73
|
+
}
|
|
74
|
+
// Belongs on the Existing Schedules tab. For an accrual the endpoint has already filtered to
|
|
75
|
+
// posted, so this only has to agree with that rather than re-derive it.
|
|
76
|
+
function isExistingTabRow(schedule) {
|
|
77
|
+
return isOneTimeAccrualRow(schedule)
|
|
78
|
+
? schedule.accrualStatus === 'posted'
|
|
79
|
+
: schedule.status.code === 'ongoing';
|
|
80
|
+
}
|
|
81
|
+
// Exported (rather than kept as a closure inside the selector) so it can be
|
|
82
|
+
// unit-tested directly — confidenceScore is a separate, more narrowly
|
|
83
|
+
// populated field that can be null on a schedule the bot user created,
|
|
84
|
+
// which previously caused these schedules to display as "AI Accountant" in
|
|
85
|
+
// the list but count under "Manual" in the KPI summary.
|
|
86
|
+
const isAiAccountantSchedule = (schedule) => {
|
|
87
|
+
// A one-time accrual records who made it as `origin`, which is authoritative — no email
|
|
88
|
+
// sniffing needed, and the JE bot is often absent from the user entity entirely.
|
|
89
|
+
if (isOneTimeAccrualRow(schedule)) {
|
|
90
|
+
return schedule.origin === 'agent';
|
|
91
|
+
}
|
|
92
|
+
return (schedule.createdByUser?.email === AI_BOT_EMAIL ||
|
|
93
|
+
schedule.createdByUser?.email === BOT_EMAIL);
|
|
94
|
+
};
|
|
95
|
+
exports.isAiAccountantSchedule = isAiAccountantSchedule;
|
|
96
|
+
// Accrued schedules are structurally distinct — no baseTransaction, carrying recurringAmount and
|
|
97
|
+
// memo in its place — so anything reading baseTransaction has to branch on this first.
|
|
98
|
+
//
|
|
99
|
+
// Discriminates on jeAccruedScheduleKey, which only JEAccruedSchedule carries. jeScheduleType
|
|
100
|
+
// cannot be used: it is a data field present on BOTH row shapes, so an accrued-typed row that
|
|
101
|
+
// arrived through the prepaid/fixed DTO (failed_je_postings, legacy fetches) would be
|
|
102
|
+
// misclassified and then crash on recurringAmount / jeAccruedScheduleKey.
|
|
103
|
+
function isAccruedScheduleRow(schedule) {
|
|
104
|
+
return 'jeAccruedScheduleKey' in schedule;
|
|
105
|
+
}
|
|
106
|
+
// Same structural approach as isAccruedScheduleRow, and for the same reason: jeOneTimeAccrualKey
|
|
107
|
+
// exists only on this shape. Note the two guards are NOT interchangeable — a one-time accrual is
|
|
108
|
+
// not an accrued *schedule*, and routing it into the accrued branch would read recurringAmount,
|
|
109
|
+
// render postedCount/lifecycleTotal as a lifecycle and startDate–endDate as a period, none of
|
|
110
|
+
// which it has.
|
|
111
|
+
function isOneTimeAccrualRow(schedule) {
|
|
112
|
+
return 'jeOneTimeAccrualKey' in schedule;
|
|
113
|
+
}
|
|
114
|
+
/** The row's own Amount, so callers can read its currency and not just its value. */
|
|
115
|
+
function getScheduleAmountObject(schedule) {
|
|
116
|
+
if (isOneTimeAccrualRow(schedule)) {
|
|
117
|
+
return schedule.estimatedAmount;
|
|
118
|
+
}
|
|
119
|
+
if (isAccruedScheduleRow(schedule)) {
|
|
120
|
+
return schedule.recurringAmount;
|
|
121
|
+
}
|
|
122
|
+
return schedule.baseTransaction.amount;
|
|
123
|
+
}
|
|
124
|
+
function getScheduleAmount(schedule) {
|
|
125
|
+
if (isOneTimeAccrualRow(schedule)) {
|
|
126
|
+
return schedule.estimatedAmount.amount;
|
|
127
|
+
}
|
|
128
|
+
if (isAccruedScheduleRow(schedule)) {
|
|
129
|
+
return schedule.recurringAmount.amount;
|
|
130
|
+
}
|
|
131
|
+
return schedule.baseTransaction.amount.amount;
|
|
132
|
+
}
|
|
133
|
+
// A one-time accrual shares almost no sortable field with a schedule, so it gets its own accessor
|
|
134
|
+
// rather than a guard on each of the dozen cases below. Keys with no meaning for a single-month
|
|
135
|
+
// accrual -- amortizationPeriod, remainingMonths, runningBalance, jePostingDate, scheduleCategory --
|
|
136
|
+
// deliberately fall through to undefined, which sorts them together at one end.
|
|
137
|
+
function getOneTimeAccrualSortValue(accrual, sortKey) {
|
|
138
|
+
switch (sortKey) {
|
|
139
|
+
case 'vendor':
|
|
140
|
+
return accrual.vendorName.toLowerCase();
|
|
141
|
+
case 'category':
|
|
142
|
+
return accrual.jeDebitAccountName?.toLowerCase();
|
|
143
|
+
case 'class':
|
|
144
|
+
return accrual.jeDebitAccountingClassName?.toLowerCase();
|
|
145
|
+
case 'depCategory':
|
|
146
|
+
return accrual.jeCreditAccountName?.toLowerCase();
|
|
147
|
+
case 'type':
|
|
148
|
+
return ONE_TIME_ACCRUAL_SCHEDULE_TYPE;
|
|
149
|
+
case 'totalAmount':
|
|
150
|
+
return accrual.estimatedAmount.amount;
|
|
151
|
+
case 'transactionDate':
|
|
152
|
+
return accrual.postingDate?.valueOf();
|
|
153
|
+
case 'memo':
|
|
154
|
+
return accrual.memo.toLowerCase();
|
|
155
|
+
case 'startMonth':
|
|
156
|
+
return accrual.serviceMonth;
|
|
157
|
+
default:
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
21
161
|
function getJEScheduleSortAccessor(sortKey) {
|
|
162
|
+
const scheduleAccessor = getScheduleRowSortAccessor(sortKey);
|
|
163
|
+
return (schedule) => isOneTimeAccrualRow(schedule)
|
|
164
|
+
? getOneTimeAccrualSortValue(schedule, sortKey)
|
|
165
|
+
: scheduleAccessor(schedule);
|
|
166
|
+
}
|
|
167
|
+
function getScheduleRowSortAccessor(sortKey) {
|
|
22
168
|
switch (sortKey) {
|
|
23
169
|
case 'vendor':
|
|
24
170
|
return (s) => s.vendor.name?.toLowerCase();
|
|
@@ -29,7 +175,9 @@ function getJEScheduleSortAccessor(sortKey) {
|
|
|
29
175
|
case 'depCategory':
|
|
30
176
|
return (s) => s.jeCredit.account?.accountName?.toLowerCase();
|
|
31
177
|
case 'scheduleCategory':
|
|
32
|
-
return (s) => s
|
|
178
|
+
return (s) => isAccruedScheduleRow(s)
|
|
179
|
+
? undefined
|
|
180
|
+
: s.baseTransaction.account?.accountName?.toLowerCase();
|
|
33
181
|
case 'startMonth':
|
|
34
182
|
return (s) => s.startDate?.valueOf();
|
|
35
183
|
case 'type':
|
|
@@ -57,11 +205,13 @@ function getJEScheduleSortAccessor(sortKey) {
|
|
|
57
205
|
return s.balanceAsOfToday?.amount ?? null;
|
|
58
206
|
};
|
|
59
207
|
case 'totalAmount':
|
|
60
|
-
return (s) => s
|
|
208
|
+
return (s) => getScheduleAmount(s);
|
|
61
209
|
case 'transactionDate':
|
|
62
|
-
return (s) => s.
|
|
210
|
+
return (s) => s.createTime?.valueOf();
|
|
63
211
|
case 'memo':
|
|
64
|
-
return (s) => s
|
|
212
|
+
return (s) => isAccruedScheduleRow(s)
|
|
213
|
+
? s.memo.toLowerCase()
|
|
214
|
+
: s.baseTransaction.memo?.toLowerCase();
|
|
65
215
|
default:
|
|
66
216
|
return (s) => s.startDate?.valueOf();
|
|
67
217
|
}
|
|
@@ -73,9 +223,15 @@ function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
|
|
|
73
223
|
function getExpenseAutomationJESchedulesView(state) {
|
|
74
224
|
const jeScheduledTransaction = [];
|
|
75
225
|
const failedJeScheduledTransaction = [];
|
|
226
|
+
const accruedSchedules = [];
|
|
227
|
+
const oneTimeAccruals = [];
|
|
76
228
|
const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
77
|
-
const {
|
|
229
|
+
const { jeScheduleTransactionKeysByPeriodAndTab, jeScheduleAccruedKeysByPeriodAndTab, jeScheduleOneTimeAccrualKeysByPeriodAndTab, failedJeScheduleTransactionKeysByPeriodAndTab, jeScheduleLocalDataById, postStatusById, ignoreStatusById, revertStatusById, oneTimeAccrualActionStatusById, uiState, error, fetchState, refreshStatus, newSchedule, } = expenseAutomationJESchedulesViewState;
|
|
78
230
|
const accountSettingsView = (0, jeAccountSettingsViewSelector_1.getJEAccountSettingsView)(state);
|
|
231
|
+
const newScheduleView = newSchedule.selectedDetailScheduleType === 'fixed_assets' ||
|
|
232
|
+
newSchedule.selectedDetailScheduleType === 'prepaid_expenses'
|
|
233
|
+
? (0, jeNewScheduleViewSelector_1.getNewScheduleView)(state, newSchedule.selectedDetailScheduleType)
|
|
234
|
+
: undefined;
|
|
79
235
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
80
236
|
const { selectedPeriodByTenantId } = expenseAutomationViewState;
|
|
81
237
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
@@ -103,27 +259,48 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
103
259
|
const filteredDepAccountListNestedAccountHierarchy = (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)(depAccountListNestedAccountHierarchy, filteredDepAccounts.map((account) => account.accountId));
|
|
104
260
|
const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
|
|
105
261
|
const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : null;
|
|
106
|
-
const
|
|
107
|
-
?
|
|
108
|
-
: null;
|
|
109
|
-
const failedJeScheduleTransactionKeysForSelectedPeriod = monthYearPeriodId != null
|
|
110
|
-
? failedJeScheduleTransactionKeysByPeriod[monthYearPeriodId]
|
|
262
|
+
const selectedPeriodTabKey = monthYearPeriodId != null
|
|
263
|
+
? (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(uiState.selectedPageTab, monthYearPeriodId)
|
|
111
264
|
: null;
|
|
112
|
-
const
|
|
113
|
-
|
|
265
|
+
const jeScheduleTransactionKeysForSelectedTab = selectedPeriodTabKey != null
|
|
266
|
+
? jeScheduleTransactionKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
267
|
+
: undefined;
|
|
268
|
+
const failedJeScheduleTransactionKeysForSelectedTab = selectedPeriodTabKey != null
|
|
269
|
+
? failedJeScheduleTransactionKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
270
|
+
: undefined;
|
|
271
|
+
// Distinguishes "this tab has never been fetched for this period" from "fetched and genuinely
|
|
272
|
+
// empty". Without it the page cannot tell a first visit from a real empty state, and renders an
|
|
273
|
+
// empty table where it should render a skeleton.
|
|
274
|
+
const hasLoadedForSelectedTab = jeScheduleTransactionKeysForSelectedTab != null;
|
|
275
|
+
const jeScheduleTransactionKeys = jeScheduleTransactionKeysForSelectedTab ?? [];
|
|
276
|
+
const failedJeScheduleTransactionKeys = failedJeScheduleTransactionKeysForSelectedTab ?? [];
|
|
277
|
+
const jeScheduleAccruedKeys = (selectedPeriodTabKey != null
|
|
278
|
+
? jeScheduleAccruedKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
279
|
+
: undefined) ?? [];
|
|
280
|
+
const jeScheduleOneTimeAccrualKeys = (selectedPeriodTabKey != null
|
|
281
|
+
? jeScheduleOneTimeAccrualKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
282
|
+
: undefined) ?? [];
|
|
283
|
+
jeScheduleOneTimeAccrualKeys.forEach((jeOneTimeAccrualKey) => {
|
|
284
|
+
const accrual = (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(jeOneTimeAccrualKey, state.jeSchedulesState);
|
|
285
|
+
if (accrual != null && isRenderableOneTimeAccrual(accrual)) {
|
|
286
|
+
oneTimeAccruals.push(accrual);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
114
289
|
jeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
115
290
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
116
291
|
jeScheduledTransaction.push(jeScheduleDetails);
|
|
117
292
|
});
|
|
293
|
+
jeScheduleAccruedKeys.forEach((jeAccruedScheduleKey) => {
|
|
294
|
+
const accruedScheduleDetails = (0, jeSchedulesSelector_1.getJEAccruedScheduleByJEScheduleKey)(jeAccruedScheduleKey, state);
|
|
295
|
+
if (accruedScheduleDetails != null) {
|
|
296
|
+
accruedSchedules.push(accruedScheduleDetails);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
118
299
|
failedJeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
119
300
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
120
301
|
failedJeScheduledTransaction.push(jeScheduleDetails);
|
|
121
302
|
});
|
|
122
|
-
const { sortKey, sortOrder } = uiState;
|
|
123
|
-
const draftSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'), sortKey, sortOrder);
|
|
124
|
-
const ongoingSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'ongoing'), sortKey, sortOrder);
|
|
125
|
-
const completedSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'completed' ||
|
|
126
|
-
schedule.status.code === 'marked_as_completed'), sortKey, sortOrder);
|
|
303
|
+
const { sortKey, sortOrder, selectedJETypeFilter } = uiState;
|
|
127
304
|
const unsortedResolveSchedules = [];
|
|
128
305
|
failedJeScheduledTransaction.forEach((schedule) => {
|
|
129
306
|
schedule.scheduledJournalEntry.forEach((journalEntry) => {
|
|
@@ -135,10 +312,103 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
135
312
|
});
|
|
136
313
|
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
|
|
137
314
|
const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
|
|
315
|
+
const matchesTypeFilter = (schedule) => selectedJETypeFilter == null ||
|
|
316
|
+
getJEScheduleRowType(schedule) === selectedJETypeFilter;
|
|
317
|
+
const isCreatedStatus = (schedule) => {
|
|
318
|
+
// An accrual is "created" once it is not review work: posted, reversing, reversed, or in a
|
|
319
|
+
// transient posting claim.
|
|
320
|
+
if (isOneTimeAccrualRow(schedule)) {
|
|
321
|
+
return !isPendingReviewRow(schedule);
|
|
322
|
+
}
|
|
323
|
+
return (schedule.status.code === 'ongoing' ||
|
|
324
|
+
schedule.status.code === 'completed' ||
|
|
325
|
+
schedule.status.code === 'marked_as_completed');
|
|
326
|
+
};
|
|
327
|
+
const allScheduleRows = [
|
|
328
|
+
...jeScheduledTransaction,
|
|
329
|
+
...accruedSchedules,
|
|
330
|
+
...oneTimeAccruals,
|
|
331
|
+
];
|
|
138
332
|
const pendingReviewSchedules = sortJEScheduledTransactions([
|
|
139
|
-
...
|
|
333
|
+
...allScheduleRows.filter((schedule) => isPendingReviewRow(schedule) && matchesTypeFilter(schedule)),
|
|
140
334
|
...validResolveForPending,
|
|
141
335
|
], sortKey, sortOrder);
|
|
336
|
+
const createdSchedules = sortJEScheduledTransactions(allScheduleRows.filter((schedule) => isCreatedStatus(schedule) && matchesTypeFilter(schedule)), sortKey, sortOrder);
|
|
337
|
+
// KPI summary — derived from unfiltered schedules so counts are always accurate
|
|
338
|
+
const allSchedules = allScheduleRows;
|
|
339
|
+
const sumAmount = (schedules) => schedules.reduce((total, schedule) => total + (getScheduleAmount(schedule) ?? 0), 0);
|
|
340
|
+
const pendingReviewTotal = sumAmount(pendingReviewSchedules);
|
|
341
|
+
const createdTotal = sumAmount(createdSchedules);
|
|
342
|
+
/**
|
|
343
|
+
* The currency the tiles render in. Taken from the schedules themselves rather than assumed:
|
|
344
|
+
* every row on a tab shares a tenant currency, so the first one that states it is the answer.
|
|
345
|
+
*/
|
|
346
|
+
const sumToAmount = (schedules) => {
|
|
347
|
+
const first = schedules[0];
|
|
348
|
+
const currency = first != null ? getScheduleAmountObject(first) : allScheduleAmountFallback;
|
|
349
|
+
return {
|
|
350
|
+
...currency,
|
|
351
|
+
amount: sumAmount(schedules),
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
// An empty bucket still has to render a currency; borrow it from any row on the page.
|
|
355
|
+
const allScheduleAmountFallback = allScheduleRows.length > 0
|
|
356
|
+
? getScheduleAmountObject(allScheduleRows[0])
|
|
357
|
+
: { amount: 0, currencyCode: '', currencySymbol: '' };
|
|
358
|
+
const aiAccountantSchedules = allSchedules.filter(exports.isAiAccountantSchedule);
|
|
359
|
+
const manualSchedules = allSchedules.filter((schedule) => !(0, exports.isAiAccountantSchedule)(schedule));
|
|
360
|
+
const pendingUnfiltered = allSchedules.filter((schedule) => isPendingReviewRow(schedule));
|
|
361
|
+
const kpiSummary = {
|
|
362
|
+
aiAccountant: {
|
|
363
|
+
count: aiAccountantSchedules.length,
|
|
364
|
+
amount: sumToAmount(aiAccountantSchedules),
|
|
365
|
+
},
|
|
366
|
+
manual: {
|
|
367
|
+
count: manualSchedules.length,
|
|
368
|
+
amount: sumToAmount(manualSchedules),
|
|
369
|
+
},
|
|
370
|
+
needsReview: {
|
|
371
|
+
count: pendingUnfiltered.length,
|
|
372
|
+
amount: sumToAmount(pendingUnfiltered),
|
|
373
|
+
},
|
|
374
|
+
total: {
|
|
375
|
+
count: allSchedules.length,
|
|
376
|
+
amount: sumToAmount(allSchedules),
|
|
377
|
+
},
|
|
378
|
+
};
|
|
379
|
+
// Each tab's badge counts from that tab's own bucket. A tab that has not been fetched yet
|
|
380
|
+
// reports undefined rather than 0, so the UI can hide the badge instead of asserting "none".
|
|
381
|
+
const scheduleCountsByTab = {};
|
|
382
|
+
jeSchedulesViewState_1.ALL_JE_PAGE_TABS.forEach((pageTab) => {
|
|
383
|
+
const periodTabKey = monthYearPeriodId != null
|
|
384
|
+
? (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(pageTab, monthYearPeriodId)
|
|
385
|
+
: null;
|
|
386
|
+
const transactionKeys = periodTabKey != null
|
|
387
|
+
? jeScheduleTransactionKeysByPeriodAndTab[periodTabKey]
|
|
388
|
+
: undefined;
|
|
389
|
+
if (transactionKeys == null) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const accruedKeys = (periodTabKey != null
|
|
393
|
+
? jeScheduleAccruedKeysByPeriodAndTab[periodTabKey]
|
|
394
|
+
: undefined) ?? [];
|
|
395
|
+
const oneTimeAccrualKeys = (periodTabKey != null
|
|
396
|
+
? jeScheduleOneTimeAccrualKeysByPeriodAndTab[periodTabKey]
|
|
397
|
+
: undefined) ?? [];
|
|
398
|
+
const rowsForTab = [
|
|
399
|
+
...transactionKeys.map((transactionKey) => (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(transactionKey, state)),
|
|
400
|
+
...accruedKeys
|
|
401
|
+
.map((accruedKey) => (0, jeSchedulesSelector_1.getJEAccruedScheduleByJEScheduleKey)(accruedKey, state))
|
|
402
|
+
.filter((accruedRow) => accruedRow != null),
|
|
403
|
+
...oneTimeAccrualKeys
|
|
404
|
+
.map((accrualKey) => (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(accrualKey, state.jeSchedulesState))
|
|
405
|
+
.filter((accrualRow) => accrualRow != null && isRenderableOneTimeAccrual(accrualRow)),
|
|
406
|
+
];
|
|
407
|
+
scheduleCountsByTab[pageTab] =
|
|
408
|
+
pageTab === 'existing_schedules'
|
|
409
|
+
? rowsForTab.filter((row) => isExistingTabRow(row)).length
|
|
410
|
+
: rowsForTab.filter((row) => isPendingReviewRow(row) || isCreatedStatus(row)).length;
|
|
411
|
+
});
|
|
142
412
|
const allSteps = monthYearPeriodId != null
|
|
143
413
|
? (0, getAllStepsHelper_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
|
|
144
414
|
: [];
|
|
@@ -151,6 +421,20 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
151
421
|
{ fetchState, error },
|
|
152
422
|
monthEndFetchState,
|
|
153
423
|
]);
|
|
424
|
+
const countByType = (schedules) => {
|
|
425
|
+
const counts = jeSchedulesTypes_1.ALL_SCHEDULES_TYPES.reduce((acc, type) => ({ ...acc, [type]: 0 }), {});
|
|
426
|
+
schedules.forEach((schedule) => {
|
|
427
|
+
const scheduleType = getJEScheduleRowType(schedule);
|
|
428
|
+
if (scheduleType != null) {
|
|
429
|
+
counts[scheduleType] += 1;
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
return counts;
|
|
433
|
+
};
|
|
434
|
+
const jeScheduleTypeCounts = {
|
|
435
|
+
active: countByType(allSchedules.filter((schedule) => isPendingReviewRow(schedule) || isCreatedStatus(schedule))),
|
|
436
|
+
ongoing: countByType(allSchedules.filter((schedule) => isExistingTabRow(schedule))),
|
|
437
|
+
};
|
|
154
438
|
return {
|
|
155
439
|
uncategorizedAccounts,
|
|
156
440
|
allDepreciationAccountList: filteredDepAccounts,
|
|
@@ -159,14 +443,21 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
159
443
|
allAccountList: filteredAccounts,
|
|
160
444
|
accountListNestedAccountHierarchy,
|
|
161
445
|
allClassList: allClasses,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
446
|
+
createdSchedules,
|
|
447
|
+
createdTotal,
|
|
448
|
+
hasLoadedForSelectedTab,
|
|
449
|
+
jeScheduleTypeCounts,
|
|
450
|
+
scheduleCountsByTab,
|
|
451
|
+
kpiSummary,
|
|
165
452
|
pendingReviewSchedules,
|
|
453
|
+
pendingReviewTotal,
|
|
166
454
|
resolveSchedules: resolveSchedules,
|
|
167
455
|
accountSettingsView,
|
|
456
|
+
newScheduleView,
|
|
168
457
|
postStatusById: postStatusById,
|
|
169
458
|
ignoreStatusById: ignoreStatusById,
|
|
459
|
+
revertStatusById: revertStatusById,
|
|
460
|
+
oneTimeAccrualActionStatusById: oneTimeAccrualActionStatusById,
|
|
170
461
|
fetchState: reducedFetchStatus.fetchState,
|
|
171
462
|
jeScheduleLocalDataById: jeScheduleLocalDataById,
|
|
172
463
|
uiState: uiState,
|
|
@@ -175,3 +466,26 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
175
466
|
completionStatus,
|
|
176
467
|
};
|
|
177
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* One accrual plus the status of its promote / ignore request, for the detail screen.
|
|
471
|
+
*
|
|
472
|
+
* `accrual` is undefined on a cold load — a refresh or a shared link, where the list has never run
|
|
473
|
+
* — so the screen dispatches `fetchOneTimeAccrual` and waits on `detailFetchState`. The two states
|
|
474
|
+
* are separate on purpose: `actionFetchState` drives the row spinner and the post-revert navigation,
|
|
475
|
+
* and a page load must not look like an action that just finished.
|
|
476
|
+
*/
|
|
477
|
+
function getExpenseAutomationJEOneTimeAccrualDetailView(state, accrualId) {
|
|
478
|
+
return {
|
|
479
|
+
accrual: (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)((0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(accrualId), state.jeSchedulesState),
|
|
480
|
+
actionFetchState: state.expenseAutomationJESchedulesViewState
|
|
481
|
+
.oneTimeAccrualActionStatusById[accrualId] ?? {
|
|
482
|
+
fetchState: 'Not-Started',
|
|
483
|
+
error: undefined,
|
|
484
|
+
},
|
|
485
|
+
detailFetchState: state.expenseAutomationJESchedulesViewState
|
|
486
|
+
.oneTimeAccrualFetchStatusById[accrualId] ?? {
|
|
487
|
+
fetchState: 'Not-Started',
|
|
488
|
+
error: undefined,
|
|
489
|
+
},
|
|
490
|
+
};
|
|
491
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const toCompletedSubTab: (v: string) => "
|
|
1
|
+
export declare const toCompletedSubTab: (v: string) => "manual" | "all" | "ai_accountant";
|
|
2
2
|
export type CompletedSubTab = ReturnType<typeof toCompletedSubTab>;
|
|
3
3
|
/**
|
|
4
4
|
* "No sub-tab filter" sentinel — single source of truth for the default
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
|
+
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
3
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
3
4
|
import { Recommendation } from '../../../commonStateTypes/recommendationBase';
|
|
4
5
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
5
|
-
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
6
|
+
import { MonthYearPeriodId, ScheduleDaysOfMonth } from '../../../commonStateTypes/timePeriod';
|
|
6
7
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
7
|
-
import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
8
|
+
import { JEOneTimeAccrualKey, JEScheduleKey, JEScheduleTransactionKey, ScheduleJournalEntryStatusCodeType, ScheduleTransactionID, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
8
9
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
9
|
-
|
|
10
|
+
import { ZeniDate } from '../../../zeniDayJS';
|
|
11
|
+
import { JETransactionLink } from '../../scheduleView/scheduleDetailView/scheduleDetailState';
|
|
12
|
+
export declare const toJEScheduleSortKey: (v: string) => "type" | "vendor" | "category" | "class" | "memo" | "jePostingDate" | "runningBalance" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "remainingMonths" | "totalAmount" | "transactionDate";
|
|
10
13
|
export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
|
|
11
|
-
export declare const
|
|
12
|
-
export type
|
|
14
|
+
export declare const toJEPageTab: (v: string) => "schedules" | "existing_schedules";
|
|
15
|
+
export type JEPageTab = ReturnType<typeof toJEPageTab>;
|
|
16
|
+
export declare const ALL_JE_PAGE_TABS: readonly JEPageTab[];
|
|
17
|
+
export type JESchedulePeriodTabKey = `${JEPageTab}_${MonthYearPeriodId}`;
|
|
18
|
+
export declare const getJESchedulePeriodTabKey: (selectedPageTab: JEPageTab, monthYearPeriodId: MonthYearPeriodId) => JESchedulePeriodTabKey;
|
|
13
19
|
export interface JESchedulesViewUIState {
|
|
20
|
+
createdGroupCollapsed: boolean;
|
|
21
|
+
pendingGroupCollapsed: boolean;
|
|
14
22
|
scrollPosition: {
|
|
15
23
|
scrollTop: number;
|
|
16
24
|
scrollLeft?: number;
|
|
17
25
|
} | undefined;
|
|
18
26
|
searchString: string;
|
|
19
|
-
|
|
27
|
+
selectedJETypeFilter: ScheduleTypes | null;
|
|
28
|
+
selectedPageTab: JEPageTab;
|
|
20
29
|
sortKey: JEScheduleSortKey;
|
|
21
30
|
sortOrder: SortOrder;
|
|
22
31
|
totalCount: number;
|
|
@@ -33,14 +42,79 @@ export interface JEScheduleLocalData {
|
|
|
33
42
|
}
|
|
34
43
|
export interface JESchedulesViewState extends FetchedState {
|
|
35
44
|
accountSettings: AccountSettingsState;
|
|
36
|
-
|
|
45
|
+
failedJeScheduleTransactionKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleTransactionKey[]>;
|
|
37
46
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
47
|
+
jeScheduleAccruedKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleKey[]>;
|
|
38
48
|
jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
|
|
39
|
-
|
|
49
|
+
jeScheduleOneTimeAccrualKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEOneTimeAccrualKey[]>;
|
|
50
|
+
jeScheduleTransactionKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleTransactionKey[]>;
|
|
51
|
+
newSchedule: NewJeScheduleState;
|
|
52
|
+
oneTimeAccrualActionStatusById: Record<ID, FetchStateAndError>;
|
|
53
|
+
oneTimeAccrualFetchStatusById: Record<ID, FetchStateAndError>;
|
|
40
54
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
41
55
|
refreshStatus: FetchStateAndError;
|
|
56
|
+
revertStatusById: Record<JEScheduleKey | JEScheduleTransactionKey, FetchStateAndError>;
|
|
42
57
|
uiState: JESchedulesViewUIState;
|
|
43
58
|
}
|
|
59
|
+
export interface NewJeDetailLocalData {
|
|
60
|
+
amount: Amount;
|
|
61
|
+
jeLink: JETransactionLink;
|
|
62
|
+
memo: string;
|
|
63
|
+
postingDate: ZeniDate;
|
|
64
|
+
postingStatus: ScheduleJournalEntryStatusCodeType;
|
|
65
|
+
runningBalance: Amount;
|
|
66
|
+
}
|
|
67
|
+
export interface NewScheduleLocalData {
|
|
68
|
+
jeScheduleDetails: NewJeDetailLocalData[];
|
|
69
|
+
scheduleType: ScheduleTypes;
|
|
70
|
+
lastDayOfMonth?: boolean;
|
|
71
|
+
selectedAccount?: ID;
|
|
72
|
+
selectedBaseTransactionId?: ScheduleTransactionID;
|
|
73
|
+
selectedClass?: ID;
|
|
74
|
+
selectedDate?: ZeniDate;
|
|
75
|
+
selectedDayOfMonth?: ScheduleDaysOfMonth;
|
|
76
|
+
selectedJEScheduleKey?: JEScheduleTransactionKey;
|
|
77
|
+
selectedMonths?: number;
|
|
78
|
+
selectedVendor?: VendorBase;
|
|
79
|
+
}
|
|
80
|
+
export interface NewScheduleLocalDataFixedAssets extends NewScheduleLocalData {
|
|
81
|
+
assetId?: string;
|
|
82
|
+
selectedAccumulatedDepreciationCategory?: ID;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The form values for creating a one-time accrual. Not stored in the slice — a one-time accrual is
|
|
86
|
+
* created in a single POST with no draft/resume step, so this is passed straight through the action
|
|
87
|
+
* to the payload builder.
|
|
88
|
+
*/
|
|
89
|
+
export interface NewOneTimeAccrualLocalData {
|
|
90
|
+
amount: number;
|
|
91
|
+
creditAccountId: ID;
|
|
92
|
+
debitAccountId: ID;
|
|
93
|
+
memo: string;
|
|
94
|
+
reverseNextMonth: boolean;
|
|
95
|
+
serviceMonth: ZeniDate;
|
|
96
|
+
vendorId: ID;
|
|
97
|
+
vendorName: string;
|
|
98
|
+
creditAccountName?: string;
|
|
99
|
+
debitAccountName?: string;
|
|
100
|
+
debitClassId?: ID;
|
|
101
|
+
debitClassName?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface SearchTransactionsState extends FetchStateAndError {
|
|
104
|
+
searchResults: JEScheduleTransactionKey[];
|
|
105
|
+
searchString?: string;
|
|
106
|
+
}
|
|
107
|
+
export declare const MIN_NEW_SCHEDULE_SEARCH_LENGTH = 2;
|
|
108
|
+
export interface NewJeScheduleState extends FetchStateAndError {
|
|
109
|
+
createOneTimeAccrualStatus: FetchStateAndError;
|
|
110
|
+
newScheduleState: {
|
|
111
|
+
fixed_assets: NewScheduleLocalDataFixedAssets;
|
|
112
|
+
prepaid_expenses: NewScheduleLocalData;
|
|
113
|
+
};
|
|
114
|
+
saveStatus: FetchStateAndError;
|
|
115
|
+
searchTransactions: SearchTransactionsState;
|
|
116
|
+
selectedDetailScheduleType?: ScheduleTypes;
|
|
117
|
+
}
|
|
44
118
|
export interface AccountSettingsLocalData {
|
|
45
119
|
previousAccruedExpensesAccount: AccountBase[];
|
|
46
120
|
previousFixedAssetsAccount: AccountBase[];
|
|
@@ -57,6 +131,7 @@ export interface AccountSettingsState {
|
|
|
57
131
|
fixedAssetsAccountIdList: ID[];
|
|
58
132
|
fixedAssetsNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
|
|
59
133
|
fixedAssetsRecommendations: Recommendation[];
|
|
134
|
+
hasLoadedAccountSettings: boolean;
|
|
60
135
|
localData: AccountSettingsLocalData;
|
|
61
136
|
prepaidExpensesAccountIdList: ID[];
|
|
62
137
|
prepaidExpensesNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MIN_NEW_SCHEDULE_SEARCH_LENGTH = exports.getJESchedulePeriodTabKey = exports.ALL_JE_PAGE_TABS = exports.toJEPageTab = exports.toJEScheduleSortKey = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
5
|
const JE_SCHEDULE_SORT_KEYS = [
|
|
6
6
|
'vendor',
|
|
@@ -20,10 +20,10 @@ const JE_SCHEDULE_SORT_KEYS = [
|
|
|
20
20
|
];
|
|
21
21
|
const toJEScheduleSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_SORT_KEYS);
|
|
22
22
|
exports.toJEScheduleSortKey = toJEScheduleSortKey;
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
exports.
|
|
23
|
+
const JE_PAGE_TABS = ['schedules', 'existing_schedules'];
|
|
24
|
+
const toJEPageTab = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_PAGE_TABS);
|
|
25
|
+
exports.toJEPageTab = toJEPageTab;
|
|
26
|
+
exports.ALL_JE_PAGE_TABS = JE_PAGE_TABS;
|
|
27
|
+
const getJESchedulePeriodTabKey = (selectedPageTab, monthYearPeriodId) => `${selectedPageTab}_${monthYearPeriodId}`;
|
|
28
|
+
exports.getJESchedulePeriodTabKey = getJESchedulePeriodTabKey;
|
|
29
|
+
exports.MIN_NEW_SCHEDULE_SEARCH_LENGTH = 2;
|
|
@@ -200,7 +200,7 @@ export interface SaveReconciliationDetailFailurePayload {
|
|
|
200
200
|
}
|
|
201
201
|
export declare const toReconciliationTabsType: (v: string) => "review" | "reconcile";
|
|
202
202
|
export declare type ReconciliationViewTabType = ReturnType<typeof toReconciliationTabsType>;
|
|
203
|
-
declare const toReconReconcileSortKeysType: (v: string) => "type" | "date" | "amount" | "memo" | "account" | "
|
|
203
|
+
declare const toReconReconcileSortKeysType: (v: string) => "type" | "date" | "amount" | "memo" | "account" | "recommended" | "clearedDate" | "payee" | "transactionDirection";
|
|
204
204
|
export declare type ReconReconcileSortKey = ReturnType<typeof toReconReconcileSortKeysType>;
|
|
205
205
|
export interface ReconciliationReconcileTabLocalData {
|
|
206
206
|
selectedTransactionIds: ID[];
|
|
@@ -33,7 +33,7 @@ const fetchAccruedScheduleListEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
33
33
|
je_schedule_type: scheduleType,
|
|
34
34
|
sort_by: 'transaction_date',
|
|
35
35
|
sort_order: 'desc',
|
|
36
|
-
filter:
|
|
36
|
+
filter: action.payload.statusFilter,
|
|
37
37
|
};
|
|
38
38
|
return zeniAPI
|
|
39
39
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -10,9 +10,14 @@ const responsePayload_1 = require("../../../../responsePayload");
|
|
|
10
10
|
const scheduleListReducer_1 = require("../scheduleListReducer");
|
|
11
11
|
const scheduleListTypes_1 = require("../scheduleListTypes");
|
|
12
12
|
const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(scheduleListReducer_1.fetchDownloadSchedules.match), (0, operators_1.mergeMap)((action) => {
|
|
13
|
-
const { scheduleType, downloadCategories } = action.payload;
|
|
13
|
+
const { scheduleType, downloadCategories, statusFilter } = action.payload;
|
|
14
14
|
const scheduleListState = state$.value.scheduleListState;
|
|
15
15
|
// if parameters are provided, use those. else go to localdata
|
|
16
|
+
// Accrued is deliberately not served here. Its rows come back in a different shape, this
|
|
17
|
+
// epic writes them through updateJESchedules (the prepaid / fixed mapper), and
|
|
18
|
+
// doUpdateScheduleList never flips downloadState for accrued -- so a request would store the
|
|
19
|
+
// wrong data and then never report completion. Accrued downloads go through
|
|
20
|
+
// fetchAccruedScheduleList, which owns that shape end to end.
|
|
16
21
|
let scheduleState;
|
|
17
22
|
if (scheduleType !== 'accrued_expenses') {
|
|
18
23
|
scheduleState = (0, scheduleListReducer_1.getState)(scheduleListState, scheduleType);
|
|
@@ -37,7 +42,7 @@ const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
37
42
|
base_txn_account_ids: downloadCategories,
|
|
38
43
|
sort_by: 'transaction_date',
|
|
39
44
|
sort_order: 'desc',
|
|
40
|
-
filter:
|
|
45
|
+
filter: statusFilter,
|
|
41
46
|
};
|
|
42
47
|
return zeniAPI
|
|
43
48
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/download?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|