@zeniai/client-epic-state 5.2.14-betaRD0 → 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/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/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/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/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,37 +1,3 @@
|
|
|
1
|
-
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
|
-
import { JEAccruedSchedule, JEOneTimeAccrual, JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
3
|
-
import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
4
1
|
import { RootState } from '../../../rootStateTypes';
|
|
5
2
|
import { ExpenseAutomationJESchedulesViewSelector } from '../selectorTypes/jeSchedulesSelectorTypes';
|
|
6
|
-
import { JEScheduledTransactionWithFailedEntries } from './jeScheduledTransactionWithFailedEntries';
|
|
7
|
-
/**
|
|
8
|
-
* `posting_blocked` is written by the posting Cron when a JE fails to post. It is an internal
|
|
9
|
-
* failure state with no human action attached, so it is dropped here rather than hidden at render
|
|
10
|
-
* time — filtering in the view would leave the group counts and KPI totals counting rows nobody
|
|
11
|
-
* can see. The expense-automation endpoint applies no status filter on the close-period path, so
|
|
12
|
-
* these rows do arrive.
|
|
13
|
-
*/
|
|
14
|
-
export declare function isRenderableOneTimeAccrual(accrual: JEOneTimeAccrual): boolean;
|
|
15
|
-
export declare function getJEScheduleRowType(schedule: JEScheduleRow): ScheduleTypes | undefined;
|
|
16
|
-
export declare function isPendingReviewRow(schedule: JEScheduleRow): boolean;
|
|
17
|
-
export declare function isExistingTabRow(schedule: JEScheduleRow): boolean;
|
|
18
|
-
export declare const isAiAccountantSchedule: (schedule: JEScheduleRow) => boolean;
|
|
19
|
-
export declare function isAccruedScheduleRow(schedule: JEScheduleRow): schedule is JEAccruedSchedule;
|
|
20
|
-
export declare function isOneTimeAccrualRow(schedule: JEScheduleRow): schedule is JEOneTimeAccrual;
|
|
21
3
|
export declare function getExpenseAutomationJESchedulesView(state: RootState): ExpenseAutomationJESchedulesViewSelector;
|
|
22
|
-
export type JEScheduleRow = JEAccruedSchedule | JEOneTimeAccrual | JEScheduledTransaction | JEScheduledTransactionWithFailedEntries;
|
|
23
|
-
export type JEScheduleRowWithoutOneTimeAccrual = Exclude<JEScheduleRow, JEOneTimeAccrual>;
|
|
24
|
-
export interface ExpenseAutomationJEOneTimeAccrualDetailView {
|
|
25
|
-
actionFetchState: FetchStateAndError;
|
|
26
|
-
detailFetchState: FetchStateAndError;
|
|
27
|
-
accrual?: JEOneTimeAccrual;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* One accrual plus the status of its promote / ignore request, for the detail screen.
|
|
31
|
-
*
|
|
32
|
-
* `accrual` is undefined on a cold load — a refresh or a shared link, where the list has never run
|
|
33
|
-
* — so the screen dispatches `fetchOneTimeAccrual` and waits on `detailFetchState`. The two states
|
|
34
|
-
* are separate on purpose: `actionFetchState` drives the row spinner and the post-revert navigation,
|
|
35
|
-
* and a page load must not look like an action that just finished.
|
|
36
|
-
*/
|
|
37
|
-
export declare function getExpenseAutomationJEOneTimeAccrualDetailView(state: RootState, accrualId: ID): ExpenseAutomationJEOneTimeAccrualDetailView;
|
|
@@ -3,23 +3,13 @@ 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;
|
|
13
6
|
exports.getExpenseAutomationJESchedulesView = getExpenseAutomationJESchedulesView;
|
|
14
|
-
exports.getExpenseAutomationJEOneTimeAccrualDetailView = getExpenseAutomationJEOneTimeAccrualDetailView;
|
|
15
7
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
16
8
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
17
9
|
const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
|
|
18
10
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
19
11
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
20
|
-
const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper");
|
|
21
12
|
const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
|
|
22
|
-
const jeSchedulesTypes_1 = require("../../../entity/jeSchedules/jeSchedulesTypes");
|
|
23
13
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
24
14
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
25
15
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
@@ -27,144 +17,8 @@ const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDeta
|
|
|
27
17
|
const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailSelector");
|
|
28
18
|
const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
|
|
29
19
|
const getAllStepsHelper_1 = require("./getAllStepsHelper");
|
|
30
|
-
const jeSchedulesViewState_1 = require("../types/jeSchedulesViewState");
|
|
31
20
|
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
|
-
}
|
|
161
21
|
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) {
|
|
168
22
|
switch (sortKey) {
|
|
169
23
|
case 'vendor':
|
|
170
24
|
return (s) => s.vendor.name?.toLowerCase();
|
|
@@ -175,9 +29,7 @@ function getScheduleRowSortAccessor(sortKey) {
|
|
|
175
29
|
case 'depCategory':
|
|
176
30
|
return (s) => s.jeCredit.account?.accountName?.toLowerCase();
|
|
177
31
|
case 'scheduleCategory':
|
|
178
|
-
return (s) =>
|
|
179
|
-
? undefined
|
|
180
|
-
: s.baseTransaction.account?.accountName?.toLowerCase();
|
|
32
|
+
return (s) => s.baseTransaction.account?.accountName?.toLowerCase();
|
|
181
33
|
case 'startMonth':
|
|
182
34
|
return (s) => s.startDate?.valueOf();
|
|
183
35
|
case 'type':
|
|
@@ -205,13 +57,11 @@ function getScheduleRowSortAccessor(sortKey) {
|
|
|
205
57
|
return s.balanceAsOfToday?.amount ?? null;
|
|
206
58
|
};
|
|
207
59
|
case 'totalAmount':
|
|
208
|
-
return (s) =>
|
|
60
|
+
return (s) => s.baseTransaction.amount.amount;
|
|
209
61
|
case 'transactionDate':
|
|
210
|
-
return (s) => s.
|
|
62
|
+
return (s) => s.baseTransaction.date.valueOf();
|
|
211
63
|
case 'memo':
|
|
212
|
-
return (s) =>
|
|
213
|
-
? s.memo.toLowerCase()
|
|
214
|
-
: s.baseTransaction.memo?.toLowerCase();
|
|
64
|
+
return (s) => s.baseTransaction.memo?.toLowerCase();
|
|
215
65
|
default:
|
|
216
66
|
return (s) => s.startDate?.valueOf();
|
|
217
67
|
}
|
|
@@ -223,15 +73,9 @@ function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
|
|
|
223
73
|
function getExpenseAutomationJESchedulesView(state) {
|
|
224
74
|
const jeScheduledTransaction = [];
|
|
225
75
|
const failedJeScheduledTransaction = [];
|
|
226
|
-
const accruedSchedules = [];
|
|
227
|
-
const oneTimeAccruals = [];
|
|
228
76
|
const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
229
|
-
const {
|
|
77
|
+
const { jeScheduleTransactionKeysByPeriod, failedJeScheduleTransactionKeysByPeriod, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, } = expenseAutomationJESchedulesViewState;
|
|
230
78
|
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;
|
|
235
79
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
236
80
|
const { selectedPeriodByTenantId } = expenseAutomationViewState;
|
|
237
81
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
@@ -259,48 +103,27 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
259
103
|
const filteredDepAccountListNestedAccountHierarchy = (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)(depAccountListNestedAccountHierarchy, filteredDepAccounts.map((account) => account.accountId));
|
|
260
104
|
const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
|
|
261
105
|
const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : null;
|
|
262
|
-
const
|
|
263
|
-
?
|
|
106
|
+
const jeScheduleTransactionKeysForSelectedPeriod = monthYearPeriodId != null
|
|
107
|
+
? jeScheduleTransactionKeysByPeriod[monthYearPeriodId]
|
|
264
108
|
: null;
|
|
265
|
-
const
|
|
266
|
-
?
|
|
267
|
-
:
|
|
268
|
-
const
|
|
269
|
-
|
|
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
|
-
});
|
|
109
|
+
const failedJeScheduleTransactionKeysForSelectedPeriod = monthYearPeriodId != null
|
|
110
|
+
? failedJeScheduleTransactionKeysByPeriod[monthYearPeriodId]
|
|
111
|
+
: null;
|
|
112
|
+
const jeScheduleTransactionKeys = jeScheduleTransactionKeysForSelectedPeriod ?? [];
|
|
113
|
+
const failedJeScheduleTransactionKeys = failedJeScheduleTransactionKeysForSelectedPeriod ?? [];
|
|
289
114
|
jeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
290
115
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
291
116
|
jeScheduledTransaction.push(jeScheduleDetails);
|
|
292
117
|
});
|
|
293
|
-
jeScheduleAccruedKeys.forEach((jeAccruedScheduleKey) => {
|
|
294
|
-
const accruedScheduleDetails = (0, jeSchedulesSelector_1.getJEAccruedScheduleByJEScheduleKey)(jeAccruedScheduleKey, state);
|
|
295
|
-
if (accruedScheduleDetails != null) {
|
|
296
|
-
accruedSchedules.push(accruedScheduleDetails);
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
118
|
failedJeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
300
119
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
301
120
|
failedJeScheduledTransaction.push(jeScheduleDetails);
|
|
302
121
|
});
|
|
303
|
-
const { sortKey, sortOrder
|
|
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);
|
|
304
127
|
const unsortedResolveSchedules = [];
|
|
305
128
|
failedJeScheduledTransaction.forEach((schedule) => {
|
|
306
129
|
schedule.scheduledJournalEntry.forEach((journalEntry) => {
|
|
@@ -312,103 +135,10 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
312
135
|
});
|
|
313
136
|
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
|
|
314
137
|
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
|
-
];
|
|
332
138
|
const pendingReviewSchedules = sortJEScheduledTransactions([
|
|
333
|
-
...
|
|
139
|
+
...jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'),
|
|
334
140
|
...validResolveForPending,
|
|
335
141
|
], 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
|
-
});
|
|
412
142
|
const allSteps = monthYearPeriodId != null
|
|
413
143
|
? (0, getAllStepsHelper_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
|
|
414
144
|
: [];
|
|
@@ -421,20 +151,6 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
421
151
|
{ fetchState, error },
|
|
422
152
|
monthEndFetchState,
|
|
423
153
|
]);
|
|
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
|
-
};
|
|
438
154
|
return {
|
|
439
155
|
uncategorizedAccounts,
|
|
440
156
|
allDepreciationAccountList: filteredDepAccounts,
|
|
@@ -443,21 +159,14 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
443
159
|
allAccountList: filteredAccounts,
|
|
444
160
|
accountListNestedAccountHierarchy,
|
|
445
161
|
allClassList: allClasses,
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
jeScheduleTypeCounts,
|
|
450
|
-
scheduleCountsByTab,
|
|
451
|
-
kpiSummary,
|
|
162
|
+
completedSchedules,
|
|
163
|
+
draftSchedules,
|
|
164
|
+
ongoingSchedules,
|
|
452
165
|
pendingReviewSchedules,
|
|
453
|
-
pendingReviewTotal,
|
|
454
166
|
resolveSchedules: resolveSchedules,
|
|
455
167
|
accountSettingsView,
|
|
456
|
-
newScheduleView,
|
|
457
168
|
postStatusById: postStatusById,
|
|
458
169
|
ignoreStatusById: ignoreStatusById,
|
|
459
|
-
revertStatusById: revertStatusById,
|
|
460
|
-
oneTimeAccrualActionStatusById: oneTimeAccrualActionStatusById,
|
|
461
170
|
fetchState: reducedFetchStatus.fetchState,
|
|
462
171
|
jeScheduleLocalDataById: jeScheduleLocalDataById,
|
|
463
172
|
uiState: uiState,
|
|
@@ -466,26 +175,3 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
466
175
|
completionStatus,
|
|
467
176
|
};
|
|
468
177
|
}
|
|
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) => "all" | "ai_accountant" | "manual";
|
|
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,31 +1,22 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
|
-
import { Amount } from '../../../commonStateTypes/amount';
|
|
3
2
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
4
3
|
import { Recommendation } from '../../../commonStateTypes/recommendationBase';
|
|
5
4
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
6
|
-
import { MonthYearPeriodId
|
|
5
|
+
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
7
6
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
8
|
-
import {
|
|
7
|
+
import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
9
8
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
10
|
-
|
|
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";
|
|
9
|
+
export declare const toJEScheduleSortKey: (v: string) => "type" | "vendor" | "category" | "class" | "memo" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "jePostingDate" | "remainingMonths" | "runningBalance" | "totalAmount" | "transactionDate";
|
|
13
10
|
export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
|
|
14
|
-
export declare const
|
|
15
|
-
export type
|
|
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;
|
|
11
|
+
export declare const toJEScheduleMainTab: (v: string) => "pending_review" | "completed" | "ongoing";
|
|
12
|
+
export type JEScheduleMainTab = ReturnType<typeof toJEScheduleMainTab>;
|
|
19
13
|
export interface JESchedulesViewUIState {
|
|
20
|
-
createdGroupCollapsed: boolean;
|
|
21
|
-
pendingGroupCollapsed: boolean;
|
|
22
14
|
scrollPosition: {
|
|
23
15
|
scrollTop: number;
|
|
24
16
|
scrollLeft?: number;
|
|
25
17
|
} | undefined;
|
|
26
18
|
searchString: string;
|
|
27
|
-
|
|
28
|
-
selectedPageTab: JEPageTab;
|
|
19
|
+
selectedMainTab: JEScheduleMainTab;
|
|
29
20
|
sortKey: JEScheduleSortKey;
|
|
30
21
|
sortOrder: SortOrder;
|
|
31
22
|
totalCount: number;
|
|
@@ -42,79 +33,14 @@ export interface JEScheduleLocalData {
|
|
|
42
33
|
}
|
|
43
34
|
export interface JESchedulesViewState extends FetchedState {
|
|
44
35
|
accountSettings: AccountSettingsState;
|
|
45
|
-
|
|
36
|
+
failedJeScheduleTransactionKeysByPeriod: Record<MonthYearPeriodId, JEScheduleTransactionKey[]>;
|
|
46
37
|
ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
|
|
47
|
-
jeScheduleAccruedKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleKey[]>;
|
|
48
38
|
jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
|
|
49
|
-
|
|
50
|
-
jeScheduleTransactionKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleTransactionKey[]>;
|
|
51
|
-
newSchedule: NewJeScheduleState;
|
|
52
|
-
oneTimeAccrualActionStatusById: Record<ID, FetchStateAndError>;
|
|
53
|
-
oneTimeAccrualFetchStatusById: Record<ID, FetchStateAndError>;
|
|
39
|
+
jeScheduleTransactionKeysByPeriod: Record<MonthYearPeriodId, JEScheduleTransactionKey[]>;
|
|
54
40
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
55
41
|
refreshStatus: FetchStateAndError;
|
|
56
|
-
revertStatusById: Record<JEScheduleKey | JEScheduleTransactionKey, FetchStateAndError>;
|
|
57
42
|
uiState: JESchedulesViewUIState;
|
|
58
43
|
}
|
|
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
|
-
}
|
|
118
44
|
export interface AccountSettingsLocalData {
|
|
119
45
|
previousAccruedExpensesAccount: AccountBase[];
|
|
120
46
|
previousFixedAssetsAccount: AccountBase[];
|
|
@@ -131,7 +57,6 @@ export interface AccountSettingsState {
|
|
|
131
57
|
fixedAssetsAccountIdList: ID[];
|
|
132
58
|
fixedAssetsNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
|
|
133
59
|
fixedAssetsRecommendations: Recommendation[];
|
|
134
|
-
hasLoadedAccountSettings: boolean;
|
|
135
60
|
localData: AccountSettingsLocalData;
|
|
136
61
|
prepaidExpensesAccountIdList: ID[];
|
|
137
62
|
prepaidExpensesNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.toJEScheduleMainTab = 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_SCHEDULE_MAIN_TABS = [
|
|
24
|
+
'pending_review',
|
|
25
|
+
'ongoing',
|
|
26
|
+
'completed',
|
|
27
|
+
];
|
|
28
|
+
const toJEScheduleMainTab = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_MAIN_TABS);
|
|
29
|
+
exports.toJEScheduleMainTab = toJEScheduleMainTab;
|