@zeniai/client-epic-state 5.1.72-betaRD1 → 5.1.73
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/jeSchedulesPayload.d.ts +0 -2
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +0 -4
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +1 -11
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +0 -2
- 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 -5
- package/lib/epic.js +1 -5
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +0 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +1 -11
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/esm/epic.js +1 -5
- package/lib/esm/index.js +4 -10
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -23
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +8 -133
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +15 -110
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -3
- package/lib/index.d.ts +7 -11
- package/lib/index.js +48 -70
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +1 -21
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -7
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +9 -40
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +8 -134
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -31
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +1 -4
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +14 -112
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +6 -53
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -5
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -21
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -73
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
- 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 -70
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -77
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
- 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 -25
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -10
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -75
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { toAmount } from '../../../commonStateTypes/amount';
|
|
2
|
-
import { DEFAULT_DATE_FORMAT } from '../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
|
|
3
|
-
import { MONTH_YEAR_FORMAT } from '../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
|
|
4
|
-
import { LAST_SCHEDULE_DAY_OF_MONTH } from '../../../commonStateTypes/timePeriod';
|
|
5
|
-
import { getPostingDateAndStatusForIndex } from '../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper';
|
|
6
|
-
import { mapScheduleTransactionToBaseScheduleTransactionPayload, } from '../../scheduleView/scheduleDetailView/scheduleDetailPayload';
|
|
7
|
-
const getNewScheduleMemo = (vendorName, schedulePostingDate, currentPeriod, totalPeriod, assetId) => {
|
|
8
|
-
const addAsset = assetId != null && assetId !== '' ? ` - ${assetId}` : '';
|
|
9
|
-
return `${vendorName} - ${schedulePostingDate.format(MONTH_YEAR_FORMAT)} (${currentPeriod} of ${totalPeriod})${addAsset}`;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Computes the month-by-month JE schedule breakdown for a brand-new schedule
|
|
13
|
-
* (no linked transaction yet) — replicates createNewSchedulesHelper's math
|
|
14
|
-
* (scheduleDetailLocalDataHelper.ts) exactly: lump-sum total split evenly
|
|
15
|
-
* across months with the rounding remainder absorbed by the last month, and a
|
|
16
|
-
* running balance that decrements each month and is forced to exactly 0 on
|
|
17
|
-
* the last row.
|
|
18
|
-
*/
|
|
19
|
-
export const computeNewScheduleJeDetails = (localData, totalAmount, vendorName) => {
|
|
20
|
-
const period = localData.selectedMonths;
|
|
21
|
-
const startingMonth = localData.selectedDate;
|
|
22
|
-
if (startingMonth == null || period == null) {
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
const assetId = 'assetId' in localData ? localData.assetId : undefined;
|
|
26
|
-
const averageAmount = Math.abs(Math.round((totalAmount.amount / period) * 100) / 100);
|
|
27
|
-
const lastMonthAmount = Math.abs(Math.round((Math.abs(totalAmount.amount) - averageAmount * (period - 1)) * 100) / 100);
|
|
28
|
-
let runningBalance = Math.abs(totalAmount.amount);
|
|
29
|
-
const negativeNumbers = totalAmount.amount < 0 || runningBalance < 0;
|
|
30
|
-
const newJeDetails = [];
|
|
31
|
-
for (let index = 0; index < period; index++) {
|
|
32
|
-
if (runningBalance > averageAmount) {
|
|
33
|
-
runningBalance = Math.round((runningBalance - averageAmount) * 100) / 100;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
runningBalance = 0;
|
|
37
|
-
}
|
|
38
|
-
const amount = index === period - 1 ? lastMonthAmount : averageAmount;
|
|
39
|
-
runningBalance = index === period - 1 ? 0 : runningBalance;
|
|
40
|
-
const schedulePostingDate = startingMonth.add(index, 'month');
|
|
41
|
-
const { postingDate, postingStatus } = getPostingDateAndStatusForIndex(schedulePostingDate.month(), schedulePostingDate.year(), localData.lastDayOfMonth === true
|
|
42
|
-
? undefined
|
|
43
|
-
: localData.selectedDayOfMonth);
|
|
44
|
-
newJeDetails.push({
|
|
45
|
-
postingDate,
|
|
46
|
-
amount: toAmount(negativeNumbers ? -amount : amount, totalAmount.currencyCode, totalAmount.currencySymbol),
|
|
47
|
-
runningBalance: toAmount(negativeNumbers ? -runningBalance : runningBalance, totalAmount.currencyCode, totalAmount.currencySymbol),
|
|
48
|
-
postingStatus,
|
|
49
|
-
memo: getNewScheduleMemo(vendorName, schedulePostingDate, index + 1, period, assetId),
|
|
50
|
-
jeLink: { type: 'unknown' },
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return newJeDetails;
|
|
54
|
-
};
|
|
55
|
-
const mapNewJeDetailsToScheduledJournalEntryPayload = (jeScheduleDetails) => jeScheduleDetails.map((journalEntry) => ({
|
|
56
|
-
status: {
|
|
57
|
-
code: journalEntry.postingStatus,
|
|
58
|
-
label: journalEntry.postingStatus,
|
|
59
|
-
},
|
|
60
|
-
transaction_memo: journalEntry.memo,
|
|
61
|
-
third_party_id: journalEntry.jeLink.thirdPartyTransactionId ?? null,
|
|
62
|
-
expected_post_date: journalEntry.postingDate.format(DEFAULT_DATE_FORMAT),
|
|
63
|
-
amount: journalEntry.amount.amount,
|
|
64
|
-
balance: journalEntry.runningBalance.amount,
|
|
65
|
-
// Brand-new schedule — there is no prior scheduled-journal-entry history
|
|
66
|
-
// to cross-reference (unlike the legacy edit flow's equivalent mapper).
|
|
67
|
-
scheduled_journal_entry_id: null,
|
|
68
|
-
actual_post_date: null,
|
|
69
|
-
is_platform_generated: null,
|
|
70
|
-
je_schedule_id: null,
|
|
71
|
-
update_time: null,
|
|
72
|
-
create_time: null,
|
|
73
|
-
}));
|
|
74
|
-
/**
|
|
75
|
-
* Builds a savable schedule payload directly from a Base Transaction search
|
|
76
|
-
* result and the New Schedule form's local data — bypassing the legacy
|
|
77
|
-
* getJEScheduledTransactionByJEScheduleTransactionKey selector entirely,
|
|
78
|
-
* since that selector throws unless the entity has already round-tripped
|
|
79
|
-
* through a real GET /1.0/schedules/:id. A brand-new schedule has no such
|
|
80
|
-
* history, so this reads only from data already in hand (the selected
|
|
81
|
-
* transaction/line plus what the user filled into the form).
|
|
82
|
-
*/
|
|
83
|
-
export const prepareNewSchedulePayload = (transaction, localData, scheduleType) => {
|
|
84
|
-
if (transaction.thirdPartyTransactionId == null ||
|
|
85
|
-
transaction.thirdPartyTransactionId === '') {
|
|
86
|
-
return { ok: false, reason: 'missing_third_party_id' };
|
|
87
|
-
}
|
|
88
|
-
const scheduleTransaction = transaction;
|
|
89
|
-
const vendorId = localData.selectedVendor?.id ?? transaction.vendorId ?? '';
|
|
90
|
-
const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
|
|
91
|
-
if (vendorId === '' || vendorName === '') {
|
|
92
|
-
return { ok: false, reason: 'missing_vendor' };
|
|
93
|
-
}
|
|
94
|
-
const vendor = {
|
|
95
|
-
vendor_id: vendorId,
|
|
96
|
-
vendor_name: vendorName,
|
|
97
|
-
};
|
|
98
|
-
const jeScheduleDetails = computeNewScheduleJeDetails(localData, scheduleTransaction.amount, vendorName);
|
|
99
|
-
const postingDate = localData.selectedDayOfMonth ??
|
|
100
|
-
(localData.lastDayOfMonth === true ? LAST_SCHEDULE_DAY_OF_MONTH : null);
|
|
101
|
-
const firstJEScheduleDate = jeScheduleDetails.length > 0
|
|
102
|
-
? jeScheduleDetails[0].postingDate.format(DEFAULT_DATE_FORMAT)
|
|
103
|
-
: null;
|
|
104
|
-
const lastJEScheduleDate = jeScheduleDetails.length > 0
|
|
105
|
-
? jeScheduleDetails[jeScheduleDetails.length - 1].postingDate.format(DEFAULT_DATE_FORMAT)
|
|
106
|
-
: null;
|
|
107
|
-
const isFixedAssets = scheduleType === 'fixed_assets';
|
|
108
|
-
const assetId = 'assetId' in localData ? localData.assetId : undefined;
|
|
109
|
-
const selectedAccumulatedDepreciationCategory = 'selectedAccumulatedDepreciationCategory' in localData
|
|
110
|
-
? localData.selectedAccumulatedDepreciationCategory
|
|
111
|
-
: undefined;
|
|
112
|
-
const status = { code: 'new', label: 'New' };
|
|
113
|
-
const jeSchedulePayload = {
|
|
114
|
-
status,
|
|
115
|
-
vendor,
|
|
116
|
-
currency_code: scheduleTransaction.currency.currencyCode,
|
|
117
|
-
currency_symbol: scheduleTransaction.currency.currencySymbol,
|
|
118
|
-
period: localData.selectedMonths ?? null,
|
|
119
|
-
je_schedule_type: scheduleType,
|
|
120
|
-
posting_date: postingDate,
|
|
121
|
-
balance: scheduleTransaction.amount.amount,
|
|
122
|
-
start_date: firstJEScheduleDate,
|
|
123
|
-
end_date: lastJEScheduleDate,
|
|
124
|
-
je_credit_accounting_class_id: scheduleTransaction.classBase?.classId ?? null,
|
|
125
|
-
je_credit_account_id: isFixedAssets
|
|
126
|
-
? (selectedAccumulatedDepreciationCategory ?? null)
|
|
127
|
-
: scheduleTransaction.account.accountId,
|
|
128
|
-
je_debit_account_id: localData.selectedAccount ?? null,
|
|
129
|
-
je_debit_accounting_class_id: localData.selectedClass ?? null,
|
|
130
|
-
other_attributes: assetId != null ? { asset_id: assetId } : {},
|
|
131
|
-
base_transaction: mapScheduleTransactionToBaseScheduleTransactionPayload(scheduleTransaction),
|
|
132
|
-
};
|
|
133
|
-
return {
|
|
134
|
-
ok: true,
|
|
135
|
-
payload: {
|
|
136
|
-
je_schedules: [jeSchedulePayload],
|
|
137
|
-
scheduled_journal_entries: mapNewJeDetailsToScheduledJournalEntryPayload(jeScheduleDetails),
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { getAccountIdsForTypes } from '../../../entity/account/accountSelector';
|
|
2
|
-
import { getScheduleTransactionById } from '../../../entity/transaction/transactionSelector';
|
|
3
|
-
import { getAccountIdsForLabel, getAccountList, getNestedAccountListHierarchy, } from '../../accountList/accountListSelector';
|
|
4
|
-
import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
|
|
5
|
-
import { getAccountsTypesForScheduleDetails } from '../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper';
|
|
6
|
-
import { filterNestedAccountHierarchyById } from '../../scheduleView/scheduleDetailView/scheduleDetailSelector';
|
|
7
|
-
import { getAccountLabelForScheduleType, getAccountsTypesForScheduleEpics, } from '../../scheduleView/scheduleListView/scheduleListHelper';
|
|
8
|
-
/**
|
|
9
|
-
* The Base Transaction search is shared across schedule types (one search
|
|
10
|
-
* box, not one per prepaid_expenses/fixed_assets) — split out from
|
|
11
|
-
* getNewScheduleView so a consumer can read it without supplying an
|
|
12
|
-
* otherwise-irrelevant scheduleType.
|
|
13
|
-
*/
|
|
14
|
-
export const getNewScheduleSearchTransactionsView = (state) => {
|
|
15
|
-
const { searchTransactions } = state.expenseAutomationJESchedulesViewState.newSchedule;
|
|
16
|
-
const searchTransactionsResults = searchTransactions.searchResults
|
|
17
|
-
.map((key) => getScheduleTransactionById(state.transactionState, key))
|
|
18
|
-
.filter((transaction) => transaction != null);
|
|
19
|
-
return {
|
|
20
|
-
searchTransactionsResults,
|
|
21
|
-
searchTransactionsFetchState: {
|
|
22
|
-
fetchState: searchTransactions.fetchState,
|
|
23
|
-
error: searchTransactions.error,
|
|
24
|
-
},
|
|
25
|
-
searchTransactionsString: searchTransactions.searchString,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export const getNewScheduleView = (state, scheduleType) => {
|
|
29
|
-
const { accountState, accountListState, classState, classListState } = state;
|
|
30
|
-
const { newSchedule } = state.expenseAutomationJESchedulesViewState;
|
|
31
|
-
const searchTransactionsView = getNewScheduleSearchTransactionsView(state);
|
|
32
|
-
const accountType = getAccountsTypesForScheduleEpics();
|
|
33
|
-
const newScheduleAccountTypes = getAccountsTypesForScheduleDetails(scheduleType);
|
|
34
|
-
const newScheduleAccountIds = getAccountIdsForTypes(accountState, newScheduleAccountTypes);
|
|
35
|
-
const allAccountList = getAccountList(accountState, accountListState, accountType.accountListKey);
|
|
36
|
-
const filteredAccounts = allAccountList.accounts.filter((account) => newScheduleAccountIds.includes(account.accountId));
|
|
37
|
-
const accountListNestedAccountHierarchy = filterNestedAccountHierarchyById(getNestedAccountListHierarchy(accountListState, accountType.accountListKey), filteredAccounts.map((account) => account.accountId));
|
|
38
|
-
const allClassList = getClassList(classState, classListState);
|
|
39
|
-
const classListNestedAccountHierarchy = getNestedClassListHierarchy(classListState);
|
|
40
|
-
let allDepreciationAccountList;
|
|
41
|
-
let allDepreciationAccountListNestedAccountHierarchy;
|
|
42
|
-
if (scheduleType === 'fixed_assets') {
|
|
43
|
-
const depreciationCategoryIds = getAccountIdsForTypes(accountState, [
|
|
44
|
-
'fixed_assets',
|
|
45
|
-
'other_assets',
|
|
46
|
-
]);
|
|
47
|
-
const accountLabel = getAccountLabelForScheduleType('fixed_assets');
|
|
48
|
-
const fixedAssetLabelAccountIds = accountLabel != null
|
|
49
|
-
? getAccountIdsForLabel(accountListState, accountType.accountListKey, accountLabel)
|
|
50
|
-
: [];
|
|
51
|
-
allDepreciationAccountList = allAccountList.accounts.filter((account) => depreciationCategoryIds.includes(account.accountId) &&
|
|
52
|
-
!fixedAssetLabelAccountIds.includes(account.accountId));
|
|
53
|
-
allDepreciationAccountListNestedAccountHierarchy =
|
|
54
|
-
filterNestedAccountHierarchyById(getNestedAccountListHierarchy(accountListState, accountType.accountListKey), allDepreciationAccountList.map((account) => account.accountId));
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
scheduleType,
|
|
58
|
-
accountListNestedAccountHierarchy,
|
|
59
|
-
allAccountList: filteredAccounts,
|
|
60
|
-
allClassList: allClassList.classes,
|
|
61
|
-
allDepreciationAccountList,
|
|
62
|
-
allDepreciationAccountListNestedAccountHierarchy,
|
|
63
|
-
classListNestedAccountHierarchy,
|
|
64
|
-
newScheduleLocalData: newSchedule.newScheduleState[scheduleType],
|
|
65
|
-
saveStatus: newSchedule.saveStatus,
|
|
66
|
-
...searchTransactionsView,
|
|
67
|
-
fetchState: newSchedule.fetchState,
|
|
68
|
-
error: newSchedule.error,
|
|
69
|
-
};
|
|
70
|
-
};
|
package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../../reducer';
|
|
4
|
-
import { fetchAccountList } from '../../../../accountList/accountListReducer';
|
|
5
|
-
import { fetchClassList } from '../../../../classList/classListReducer';
|
|
6
|
-
import { clearSearchTransactionsForNewSchedule, initializeNewSchedule, resetNewScheduleLocalData } from '../../../reducers/jeSchedulesViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof clearSearchTransactionsForNewSchedule> | ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchClassList> | ReturnType<typeof initializeNewSchedule> | ReturnType<typeof resetNewScheduleLocalData>;
|
|
8
|
-
export declare const initializeNewScheduleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initializeNewScheduleEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const accountListReducer_1 = require("../../../../accountList/accountListReducer");
|
|
7
|
-
const classListReducer_1 = require("../../../../classList/classListReducer");
|
|
8
|
-
const scheduleListHelper_1 = require("../../../../scheduleView/scheduleListView/scheduleListHelper");
|
|
9
|
-
const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
|
|
10
|
-
const initializeNewScheduleEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.initializeNewSchedule.match), (0, operators_1.mergeMap)((action) => {
|
|
11
|
-
const newScheduleActions = [];
|
|
12
|
-
const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
|
|
13
|
-
const { accountListState, classListState } = state$.value;
|
|
14
|
-
if (accountListState.byReportId[accountType.accountListKey]?.fetchState ===
|
|
15
|
-
'Not-Started') {
|
|
16
|
-
newScheduleActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
|
|
17
|
-
}
|
|
18
|
-
if (classListState.fetchState === 'Not-Started') {
|
|
19
|
-
newScheduleActions.push((0, classListReducer_1.fetchClassList)());
|
|
20
|
-
}
|
|
21
|
-
newScheduleActions.push((0, jeSchedulesViewReducer_1.resetNewScheduleLocalData)({ scheduleType: action.payload.scheduleType }));
|
|
22
|
-
newScheduleActions.push((0, jeSchedulesViewReducer_1.clearSearchTransactionsForNewSchedule)());
|
|
23
|
-
return (0, rxjs_1.from)(newScheduleActions);
|
|
24
|
-
}));
|
|
25
|
-
exports.initializeNewScheduleEpic = initializeNewScheduleEpic;
|
package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { updateJESchedules, updateJESchedulesDetails } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
3
|
-
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { RootState } from '../../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
6
|
-
import { resetNewScheduleLocalData, saveNewSchedule, saveNewScheduleFailure, saveNewScheduleSuccess } from '../../../reducers/jeSchedulesViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof saveNewSchedule> | ReturnType<typeof saveNewScheduleSuccess> | ReturnType<typeof saveNewScheduleFailure> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateJESchedulesDetails> | ReturnType<typeof resetNewScheduleLocalData> | ReturnType<typeof openSnackbar>;
|
|
8
|
-
export declare const saveNewScheduleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
9
|
-
payload: {
|
|
10
|
-
messageSection: import("../../../../..").SnackbarMessageSections;
|
|
11
|
-
messageText: import("../../../../..").SnackbarMessageSectionTexts;
|
|
12
|
-
type: import("../../../../..").SnackbarMessageType;
|
|
13
|
-
showStatusIcon?: boolean;
|
|
14
|
-
variables?: {
|
|
15
|
-
variableName: string;
|
|
16
|
-
variableValue: string;
|
|
17
|
-
}[];
|
|
18
|
-
};
|
|
19
|
-
type: "snackbar/openSnackbar";
|
|
20
|
-
} | {
|
|
21
|
-
payload: {
|
|
22
|
-
jeSchedulesTransactionsPayload: import("../../../../../entity/jeSchedules/jeSchedulesPayload").JEScheduledTransactionPayload[];
|
|
23
|
-
};
|
|
24
|
-
type: "jeSchedules/updateJESchedules";
|
|
25
|
-
} | {
|
|
26
|
-
payload: {
|
|
27
|
-
jeSchedulesPayload: import("../../../../../entity/jeSchedules/jeSchedulesPayload").JEScheduledTransactionPayload[];
|
|
28
|
-
scheduledJEntriesPayload: import("../../../../../entity/jeSchedules/jeSchedulesPayload").ScheduledJournalEntryPayload[] | undefined;
|
|
29
|
-
updateType: import("../../../../..").UpdateType;
|
|
30
|
-
};
|
|
31
|
-
type: "jeSchedules/updateJESchedulesDetails";
|
|
32
|
-
} | {
|
|
33
|
-
payload: {
|
|
34
|
-
scheduleType: "prepaid_expenses" | "fixed_assets";
|
|
35
|
-
};
|
|
36
|
-
type: "expenseAutomationJESchedulesView/resetNewScheduleLocalData";
|
|
37
|
-
} | {
|
|
38
|
-
payload: undefined;
|
|
39
|
-
type: "expenseAutomationJESchedulesView/saveNewScheduleSuccess";
|
|
40
|
-
} | {
|
|
41
|
-
payload: {
|
|
42
|
-
status: import("../../../../../responsePayload").ZeniAPIStatus;
|
|
43
|
-
};
|
|
44
|
-
type: "expenseAutomationJESchedulesView/saveNewScheduleFailure";
|
|
45
|
-
}>;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.saveNewScheduleEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const jeSchedulesReducer_1 = require("../../../../../entity/jeSchedules/jeSchedulesReducer");
|
|
7
|
-
const jeSchedulesTypes_1 = require("../../../../../entity/jeSchedules/jeSchedulesTypes");
|
|
8
|
-
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
9
|
-
const transactionSelector_1 = require("../../../../../entity/transaction/transactionSelector");
|
|
10
|
-
const responsePayload_1 = require("../../../../../responsePayload");
|
|
11
|
-
const newScheduleLocalDataHelper_1 = require("../../../helpers/newScheduleLocalDataHelper");
|
|
12
|
-
const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
|
|
13
|
-
const FAILURE_REASON_MESSAGES = {
|
|
14
|
-
missing_third_party_id: 'This transaction is missing a QuickBooks reference and cannot be scheduled.',
|
|
15
|
-
missing_vendor: 'Select a vendor before saving this schedule.',
|
|
16
|
-
};
|
|
17
|
-
const saveNewScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.saveNewSchedule.match), (0, operators_1.mergeMap)((action) => {
|
|
18
|
-
const { scheduleType } = action.payload;
|
|
19
|
-
const state = state$.value;
|
|
20
|
-
const localData = state.expenseAutomationJESchedulesViewState.newSchedule
|
|
21
|
-
.newScheduleState[scheduleType];
|
|
22
|
-
const { selectedBaseTransactionId } = localData;
|
|
23
|
-
const transaction = selectedBaseTransactionId != null
|
|
24
|
-
? (0, transactionSelector_1.getScheduleTransactionById)(state.transactionState, (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)(selectedBaseTransactionId))
|
|
25
|
-
: undefined;
|
|
26
|
-
if (transaction == null) {
|
|
27
|
-
return (0, rxjs_1.from)([
|
|
28
|
-
(0, jeSchedulesViewReducer_1.saveNewScheduleFailure)({
|
|
29
|
-
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'No base transaction selected for this schedule.'),
|
|
30
|
-
}),
|
|
31
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
32
|
-
messageSection: 'create_schedule',
|
|
33
|
-
messageText: 'failed',
|
|
34
|
-
type: 'error',
|
|
35
|
-
variables: [
|
|
36
|
-
{
|
|
37
|
-
variableName: '_api-error_',
|
|
38
|
-
variableValue: 'No base transaction selected.',
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
}),
|
|
42
|
-
]);
|
|
43
|
-
}
|
|
44
|
-
const result = (0, newScheduleLocalDataHelper_1.prepareNewSchedulePayload)(transaction, localData, scheduleType);
|
|
45
|
-
if (!result.ok) {
|
|
46
|
-
const message = FAILURE_REASON_MESSAGES[result.reason];
|
|
47
|
-
return (0, rxjs_1.from)([
|
|
48
|
-
(0, jeSchedulesViewReducer_1.saveNewScheduleFailure)({
|
|
49
|
-
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', message),
|
|
50
|
-
}),
|
|
51
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
52
|
-
messageSection: 'create_schedule',
|
|
53
|
-
messageText: 'failed',
|
|
54
|
-
type: 'error',
|
|
55
|
-
variables: [{ variableName: '_api-error_', variableValue: message }],
|
|
56
|
-
}),
|
|
57
|
-
]);
|
|
58
|
-
}
|
|
59
|
-
const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
|
|
60
|
-
const queryParam = {
|
|
61
|
-
je_schedule_type: scheduleType,
|
|
62
|
-
};
|
|
63
|
-
const payload = { ...result.payload };
|
|
64
|
-
return zeniAPI
|
|
65
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`, payload)
|
|
66
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
67
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
68
|
-
return (0, rxjs_1.from)([
|
|
69
|
-
(0, jeSchedulesReducer_1.updateJESchedules)(response.data.je_schedules),
|
|
70
|
-
(0, jeSchedulesReducer_1.updateJESchedulesDetails)(response.data.je_schedules, response.data.scheduled_journal_entries),
|
|
71
|
-
(0, jeSchedulesViewReducer_1.resetNewScheduleLocalData)({ scheduleType }),
|
|
72
|
-
(0, jeSchedulesViewReducer_1.saveNewScheduleSuccess)(),
|
|
73
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
74
|
-
messageSection: 'create_schedule',
|
|
75
|
-
messageText: 'success',
|
|
76
|
-
type: 'success',
|
|
77
|
-
variables: [
|
|
78
|
-
{ variableName: '_vendor_name_', variableValue: vendorName },
|
|
79
|
-
],
|
|
80
|
-
}),
|
|
81
|
-
]);
|
|
82
|
-
}
|
|
83
|
-
return (0, rxjs_1.from)([
|
|
84
|
-
(0, jeSchedulesViewReducer_1.saveNewScheduleFailure)({ status: response.status }),
|
|
85
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
86
|
-
messageSection: 'create_schedule',
|
|
87
|
-
messageText: 'failed',
|
|
88
|
-
type: 'error',
|
|
89
|
-
variables: [
|
|
90
|
-
{
|
|
91
|
-
variableName: '_api-error_',
|
|
92
|
-
variableValue: response.status.message,
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
}),
|
|
96
|
-
]);
|
|
97
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
98
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
99
|
-
messageSection: 'create_schedule',
|
|
100
|
-
messageText: 'failed',
|
|
101
|
-
type: 'error',
|
|
102
|
-
variables: [
|
|
103
|
-
{
|
|
104
|
-
variableName: '_api-error_',
|
|
105
|
-
variableValue: JSON.stringify(error),
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
}),
|
|
109
|
-
(0, jeSchedulesViewReducer_1.saveNewScheduleFailure)({
|
|
110
|
-
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Save New Schedule REST API call errored out ${JSON.stringify(error)}`),
|
|
111
|
-
}),
|
|
112
|
-
])));
|
|
113
|
-
}));
|
|
114
|
-
exports.saveNewScheduleEpic = saveNewScheduleEpic;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { updateScheduleTransactions } from '../../../../../entity/transaction/transactionReducer';
|
|
4
|
-
import { RootState } from '../../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
6
|
-
import { searchTransactionsForNewSchedule, searchTransactionsForNewScheduleFailure, searchTransactionsForNewScheduleSuccess } from '../../../reducers/jeSchedulesViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof searchTransactionsForNewSchedule> | ReturnType<typeof searchTransactionsForNewScheduleSuccess> | ReturnType<typeof searchTransactionsForNewScheduleFailure> | ReturnType<typeof updateScheduleTransactions>;
|
|
8
|
-
export declare const searchTransactionsForNewScheduleEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.searchTransactionsForNewScheduleEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const jeSchedulesTypes_1 = require("../../../../../entity/jeSchedules/jeSchedulesTypes");
|
|
7
|
-
const transactionType_1 = require("../../../../../entity/transaction/stateTypes/transactionType");
|
|
8
|
-
const transactionReducer_1 = require("../../../../../entity/transaction/transactionReducer");
|
|
9
|
-
const responsePayload_1 = require("../../../../../responsePayload");
|
|
10
|
-
const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
|
|
11
|
-
const jeSchedulesViewState_1 = require("../../../types/jeSchedulesViewState");
|
|
12
|
-
/** Dropdown-sized result set — no pagination for Base Transaction search. */
|
|
13
|
-
const NEW_SCHEDULE_SEARCH_PAGE_SIZE = 10;
|
|
14
|
-
/** Fallback when the backend sends a null currency for a search result. */
|
|
15
|
-
const DEFAULT_CURRENCY_CODE = 'USD';
|
|
16
|
-
const DEFAULT_CURRENCY_SYMBOL = '$';
|
|
17
|
-
const searchTransactionsForNewScheduleEpic = (actions$, _state$, zeniAPI) => {
|
|
18
|
-
const searchActions$ = actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.searchTransactionsForNewSchedule.match));
|
|
19
|
-
/** No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP. */
|
|
20
|
-
const newSearchTooShortOrClear$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.query.trim().length < jeSchedulesViewState_1.MIN_NEW_SCHEDULE_SEARCH_LENGTH));
|
|
21
|
-
const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.query.trim().length >= jeSchedulesViewState_1.MIN_NEW_SCHEDULE_SEARCH_LENGTH), (0, operators_1.debounceTime)(300));
|
|
22
|
-
return (0, rxjs_1.merge)(newSearchTooShortOrClear$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
|
|
23
|
-
const query = action.payload.query.trim();
|
|
24
|
-
if (query.length < jeSchedulesViewState_1.MIN_NEW_SCHEDULE_SEARCH_LENGTH) {
|
|
25
|
-
return rxjs_1.EMPTY;
|
|
26
|
-
}
|
|
27
|
-
const queryParam = {
|
|
28
|
-
page_size: NEW_SCHEDULE_SEARCH_PAGE_SIZE,
|
|
29
|
-
search_text: query,
|
|
30
|
-
je_schedule_type: action.payload.scheduleType,
|
|
31
|
-
};
|
|
32
|
-
return zeniAPI
|
|
33
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/base_transaction_search?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
34
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
35
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
36
|
-
const { transactions } = response.data;
|
|
37
|
-
const transactionsPerCurrency = {};
|
|
38
|
-
transactions.forEach((transaction) => {
|
|
39
|
-
const { currency_code, currency_symbol } = transaction;
|
|
40
|
-
const currencyCode = currency_code ?? DEFAULT_CURRENCY_CODE;
|
|
41
|
-
const existing = transactionsPerCurrency[currencyCode];
|
|
42
|
-
transactionsPerCurrency[currencyCode] =
|
|
43
|
-
existing != null
|
|
44
|
-
? {
|
|
45
|
-
currencySymbol: existing.currencySymbol,
|
|
46
|
-
transactions: [...existing.transactions, transaction],
|
|
47
|
-
}
|
|
48
|
-
: {
|
|
49
|
-
currencySymbol: currency_code == null
|
|
50
|
-
? DEFAULT_CURRENCY_SYMBOL
|
|
51
|
-
: currency_symbol,
|
|
52
|
-
transactions: [transaction],
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
const actionsOut = Object.keys(transactionsPerCurrency).map((currencyCode) => {
|
|
56
|
-
const perCurrency = transactionsPerCurrency[currencyCode];
|
|
57
|
-
return (0, transactionReducer_1.updateScheduleTransactions)(perCurrency.transactions, currencyCode, perCurrency.currencySymbol, 'merge');
|
|
58
|
-
});
|
|
59
|
-
actionsOut.push((0, jeSchedulesViewReducer_1.searchTransactionsForNewScheduleSuccess)({
|
|
60
|
-
searchResults: transactions.map((transaction) => (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)({
|
|
61
|
-
id: transaction.transaction_id,
|
|
62
|
-
type: (0, transactionType_1.toTransactionType)(transaction.transaction_type),
|
|
63
|
-
lineId: transaction.line_id,
|
|
64
|
-
})),
|
|
65
|
-
}));
|
|
66
|
-
return (0, rxjs_1.from)(actionsOut);
|
|
67
|
-
}
|
|
68
|
-
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.searchTransactionsForNewScheduleFailure)({
|
|
69
|
-
status: response.status,
|
|
70
|
-
}));
|
|
71
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.searchTransactionsForNewScheduleFailure)({
|
|
72
|
-
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search transactions for new schedule errored: ' +
|
|
73
|
-
JSON.stringify(error)),
|
|
74
|
-
}))));
|
|
75
|
-
}));
|
|
76
|
-
};
|
|
77
|
-
exports.searchTransactionsForNewScheduleEpic = searchTransactionsForNewScheduleEpic;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../reducer';
|
|
4
|
-
import { fetchJeSchedulesPage, updateJESchedulesUIState } from '../../reducers/jeSchedulesViewReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof updateJESchedulesUIState>;
|
|
6
|
-
export declare const switchJESchedulesTabEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.switchJESchedulesTabEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
-
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
|
-
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
9
|
-
const switchJESchedulesTabEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.updateJESchedulesUIState.match), (0, operators_1.filter)((action) => action.payload.selectedPageTab != null), (0, operators_1.mergeMap)(() => {
|
|
10
|
-
const state = state$.value;
|
|
11
|
-
const { fetchState, refreshStatus } = state.expenseAutomationJESchedulesViewState;
|
|
12
|
-
if (fetchState === 'In-Progress' ||
|
|
13
|
-
refreshStatus.fetchState === 'In-Progress') {
|
|
14
|
-
return rxjs_1.EMPTY;
|
|
15
|
-
}
|
|
16
|
-
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
17
|
-
const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
|
|
18
|
-
const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
|
|
19
|
-
const timePeriodStart = (0, timePeriod_1.toAbsoluteDay)(period.start);
|
|
20
|
-
const timePeriodEnd = (0, timePeriod_1.toAbsoluteDay)(period.end);
|
|
21
|
-
if (timePeriodStart == null || timePeriodEnd == null) {
|
|
22
|
-
return rxjs_1.EMPTY;
|
|
23
|
-
}
|
|
24
|
-
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, true));
|
|
25
|
-
}));
|
|
26
|
-
exports.switchJESchedulesTabEpic = switchJESchedulesTabEpic;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
|
-
import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
3
|
-
import { ScheduleTransaction } from '../../../entity/transaction/stateTypes/scheduleTransaction';
|
|
4
|
-
import { JESchedulePayload, SaveJESchedulePayload } from '../../scheduleView/scheduleDetailView/scheduleDetailPayload';
|
|
5
|
-
import { NewJeDetailLocalData, NewScheduleLocalData, NewScheduleLocalDataFixedAssets } from '../types/jeSchedulesViewState';
|
|
6
|
-
/**
|
|
7
|
-
* Computes the month-by-month JE schedule breakdown for a brand-new schedule
|
|
8
|
-
* (no linked transaction yet) — replicates createNewSchedulesHelper's math
|
|
9
|
-
* (scheduleDetailLocalDataHelper.ts) exactly: lump-sum total split evenly
|
|
10
|
-
* across months with the rounding remainder absorbed by the last month, and a
|
|
11
|
-
* running balance that decrements each month and is forced to exactly 0 on
|
|
12
|
-
* the last row.
|
|
13
|
-
*/
|
|
14
|
-
export declare const computeNewScheduleJeDetails: (localData: NewScheduleLocalData | NewScheduleLocalDataFixedAssets, totalAmount: Amount, vendorName: string) => NewJeDetailLocalData[];
|
|
15
|
-
export interface NewSchedulePayload {
|
|
16
|
-
je_schedules: JESchedulePayload[];
|
|
17
|
-
scheduled_journal_entries: SaveJESchedulePayload[];
|
|
18
|
-
}
|
|
19
|
-
export type PrepareNewSchedulePayloadFailureReason = 'missing_third_party_id' | 'missing_vendor';
|
|
20
|
-
export type PrepareNewSchedulePayloadResult = {
|
|
21
|
-
ok: true;
|
|
22
|
-
payload: NewSchedulePayload;
|
|
23
|
-
} | {
|
|
24
|
-
ok: false;
|
|
25
|
-
reason: PrepareNewSchedulePayloadFailureReason;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Builds a savable schedule payload directly from a Base Transaction search
|
|
29
|
-
* result and the New Schedule form's local data — bypassing the legacy
|
|
30
|
-
* getJEScheduledTransactionByJEScheduleTransactionKey selector entirely,
|
|
31
|
-
* since that selector throws unless the entity has already round-tripped
|
|
32
|
-
* through a real GET /1.0/schedules/:id. A brand-new schedule has no such
|
|
33
|
-
* history, so this reads only from data already in hand (the selected
|
|
34
|
-
* transaction/line plus what the user filled into the form).
|
|
35
|
-
*/
|
|
36
|
-
export declare const prepareNewSchedulePayload: (transaction: ScheduleTransaction, localData: NewScheduleLocalData | NewScheduleLocalDataFixedAssets, scheduleType: ScheduleTypes) => PrepareNewSchedulePayloadResult;
|