@zeniai/client-epic-state 5.1.82 → 5.1.83-betaRD1
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 +2 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +2 -0
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -0
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +13 -2
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +29 -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 +5 -1
- package/lib/epic.js +5 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +2 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +13 -2
- package/lib/esm/entity/snackbar/snackbarTypes.js +29 -0
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/esm/epic.js +5 -1
- package/lib/esm/index.js +11 -5
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +26 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +21 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +73 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +157 -28
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +70 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +159 -22
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +24 -4
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +24 -4
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
- package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +33 -9
- package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +35 -9
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +32 -5
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +23 -3
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +24 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +24 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +20 -3
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +60 -17
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
- package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +29 -10
- package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +28 -5
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +24 -4
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +22 -14
- package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +46 -7
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +26 -8
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +4 -1
- package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +41 -9
- package/lib/index.d.ts +15 -10
- package/lib/index.js +71 -50
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +24 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +77 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -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/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +7 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +44 -10
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +158 -28
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +25 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +34 -8
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +10 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +75 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +4 -1
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +161 -21
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +58 -8
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +23 -3
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +2 -1
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +23 -3
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +22 -8
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
- package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +2 -1
- package/lib/view/invoicing/discountAction/discountActionEpic.js +32 -8
- package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +2 -1
- package/lib/view/invoicing/dunningAction/dunningActionEpic.js +34 -8
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +31 -4
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +22 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +23 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +23 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +19 -2
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +2 -1
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +59 -16
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +13 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +11 -31
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +15 -0
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +2 -1
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +28 -9
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +27 -4
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +23 -3
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +24 -7
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +23 -16
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +2 -1
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +45 -6
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +2 -1
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +25 -7
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +10 -1
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +4 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +4 -1
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +2 -1
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +40 -8
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RootState } from '../../../reducer';
|
|
2
|
+
import { NewScheduleSearchTransactionsView, NewScheduleView } from '../selectorTypes/jeNewScheduleViewSelectorTypes';
|
|
3
|
+
/**
|
|
4
|
+
* The Base Transaction search is shared across schedule types (one search
|
|
5
|
+
* box, not one per prepaid_expenses/fixed_assets) — split out from
|
|
6
|
+
* getNewScheduleView so a consumer can read it without supplying an
|
|
7
|
+
* otherwise-irrelevant scheduleType.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getNewScheduleSearchTransactionsView: (state: RootState) => NewScheduleSearchTransactionsView;
|
|
10
|
+
export declare const getNewScheduleView: (state: RootState, scheduleType: "fixed_assets" | "prepaid_expenses") => NewScheduleView;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNewScheduleView = exports.getNewScheduleSearchTransactionsView = void 0;
|
|
4
|
+
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
5
|
+
const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
|
|
6
|
+
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
7
|
+
const classListSelector_1 = require("../../classList/classListSelector");
|
|
8
|
+
const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper");
|
|
9
|
+
const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailSelector");
|
|
10
|
+
const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
|
|
11
|
+
/**
|
|
12
|
+
* The Base Transaction search is shared across schedule types (one search
|
|
13
|
+
* box, not one per prepaid_expenses/fixed_assets) — split out from
|
|
14
|
+
* getNewScheduleView so a consumer can read it without supplying an
|
|
15
|
+
* otherwise-irrelevant scheduleType.
|
|
16
|
+
*/
|
|
17
|
+
const getNewScheduleSearchTransactionsView = (state) => {
|
|
18
|
+
const { searchTransactions } = state.expenseAutomationJESchedulesViewState.newSchedule;
|
|
19
|
+
const searchTransactionsResults = searchTransactions.searchResults
|
|
20
|
+
.map((key) => (0, transactionSelector_1.getScheduleTransactionById)(state.transactionState, key))
|
|
21
|
+
.filter((transaction) => transaction != null);
|
|
22
|
+
return {
|
|
23
|
+
searchTransactionsResults,
|
|
24
|
+
searchTransactionsFetchState: {
|
|
25
|
+
fetchState: searchTransactions.fetchState,
|
|
26
|
+
error: searchTransactions.error,
|
|
27
|
+
},
|
|
28
|
+
searchTransactionsString: searchTransactions.searchString,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports.getNewScheduleSearchTransactionsView = getNewScheduleSearchTransactionsView;
|
|
32
|
+
const getNewScheduleView = (state, scheduleType) => {
|
|
33
|
+
const { accountState, accountListState, classState, classListState } = state;
|
|
34
|
+
const { newSchedule } = state.expenseAutomationJESchedulesViewState;
|
|
35
|
+
const searchTransactionsView = (0, exports.getNewScheduleSearchTransactionsView)(state);
|
|
36
|
+
const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
|
|
37
|
+
const newScheduleAccountTypes = (0, scheduleDetailLocalDataHelper_1.getAccountsTypesForScheduleDetails)(scheduleType);
|
|
38
|
+
const newScheduleAccountIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, newScheduleAccountTypes);
|
|
39
|
+
const allAccountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, accountType.accountListKey);
|
|
40
|
+
const filteredAccounts = allAccountList.accounts.filter((account) => newScheduleAccountIds.includes(account.accountId));
|
|
41
|
+
const accountListNestedAccountHierarchy = (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)((0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountType.accountListKey), filteredAccounts.map((account) => account.accountId));
|
|
42
|
+
const allClassList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
43
|
+
const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
|
|
44
|
+
let allDepreciationAccountList;
|
|
45
|
+
let allDepreciationAccountListNestedAccountHierarchy;
|
|
46
|
+
if (scheduleType === 'fixed_assets') {
|
|
47
|
+
const depreciationCategoryIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, [
|
|
48
|
+
'fixed_assets',
|
|
49
|
+
'other_assets',
|
|
50
|
+
]);
|
|
51
|
+
const accountLabel = (0, scheduleListHelper_1.getAccountLabelForScheduleType)('fixed_assets');
|
|
52
|
+
const fixedAssetLabelAccountIds = accountLabel != null
|
|
53
|
+
? (0, accountListSelector_1.getAccountIdsForLabel)(accountListState, accountType.accountListKey, accountLabel)
|
|
54
|
+
: [];
|
|
55
|
+
allDepreciationAccountList = allAccountList.accounts.filter((account) => depreciationCategoryIds.includes(account.accountId) &&
|
|
56
|
+
!fixedAssetLabelAccountIds.includes(account.accountId));
|
|
57
|
+
allDepreciationAccountListNestedAccountHierarchy =
|
|
58
|
+
(0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)((0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, accountType.accountListKey), allDepreciationAccountList.map((account) => account.accountId));
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
scheduleType,
|
|
62
|
+
accountListNestedAccountHierarchy,
|
|
63
|
+
allAccountList: filteredAccounts,
|
|
64
|
+
allClassList: allClassList.classes,
|
|
65
|
+
allDepreciationAccountList,
|
|
66
|
+
allDepreciationAccountListNestedAccountHierarchy,
|
|
67
|
+
classListNestedAccountHierarchy,
|
|
68
|
+
newScheduleLocalData: newSchedule.newScheduleState[scheduleType],
|
|
69
|
+
saveStatus: newSchedule.saveStatus,
|
|
70
|
+
...searchTransactionsView,
|
|
71
|
+
fetchState: newSchedule.fetchState,
|
|
72
|
+
error: newSchedule.error,
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
exports.getNewScheduleView = getNewScheduleView;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { JEScheduledTransaction, ScheduledJournalEntry } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
1
|
+
import { JEAccruedSchedule, JEScheduledTransaction, ScheduledJournalEntry } from '../../../entity/jeSchedules/jeSchedulesSelector';
|
|
2
2
|
import { RootState } from '../../../reducer';
|
|
3
3
|
import { ExpenseAutomationJESchedulesViewSelector } from '../selectorTypes/jeSchedulesSelectorTypes';
|
|
4
|
+
export declare const isAiAccountantSchedule: (schedule: JEScheduleRow) => boolean;
|
|
5
|
+
export declare function isAccruedScheduleRow(schedule: JEScheduleRow): schedule is JEAccruedSchedule;
|
|
4
6
|
export declare function getExpenseAutomationJESchedulesView(state: RootState): ExpenseAutomationJESchedulesViewSelector;
|
|
5
7
|
export interface JEScheduledTransactionWithFailedEntries extends Omit<JEScheduledTransaction, 'scheduledJournalEntry'> {
|
|
6
8
|
scheduledJournalEntry: ScheduledJournalEntry;
|
|
7
9
|
}
|
|
10
|
+
export type JEScheduleRow = JEAccruedSchedule | JEScheduledTransaction | JEScheduledTransactionWithFailedEntries;
|
|
@@ -3,6 +3,8 @@ 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.isAccruedScheduleRow = isAccruedScheduleRow;
|
|
6
8
|
exports.getExpenseAutomationJESchedulesView = getExpenseAutomationJESchedulesView;
|
|
7
9
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
8
10
|
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
@@ -10,6 +12,7 @@ const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState")
|
|
|
10
12
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
11
13
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
12
14
|
const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
|
|
15
|
+
const jeSchedulesTypes_1 = require("../../../entity/jeSchedules/jeSchedulesTypes");
|
|
13
16
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
14
17
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
15
18
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
@@ -17,7 +20,39 @@ const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDeta
|
|
|
17
20
|
const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailSelector");
|
|
18
21
|
const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
|
|
19
22
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
23
|
+
const jeSchedulesViewState_1 = require("../types/jeSchedulesViewState");
|
|
20
24
|
const jeAccountSettingsViewSelector_1 = require("./jeAccountSettingsViewSelector");
|
|
25
|
+
const jeNewScheduleViewSelector_1 = require("./jeNewScheduleViewSelector");
|
|
26
|
+
// Matches the AI-automation user addresses webc's schedule list row already
|
|
27
|
+
// checks (JEScheduleReadOnlyListRow/JEScheduleDraftListRow "Method" column,
|
|
28
|
+
// strings.ts aiBotEmail/botEmail) to determine whether a schedule was
|
|
29
|
+
// created by the AI accountant vs. a human.
|
|
30
|
+
const AI_BOT_EMAIL = 'ai@zeni.ai';
|
|
31
|
+
const BOT_EMAIL = 'bot@zeni.ai';
|
|
32
|
+
// Exported (rather than kept as a closure inside the selector) so it can be
|
|
33
|
+
// unit-tested directly — confidenceScore is a separate, more narrowly
|
|
34
|
+
// populated field that can be null on a schedule the bot user created,
|
|
35
|
+
// which previously caused these schedules to display as "AI Accountant" in
|
|
36
|
+
// the list but count under "Manual" in the KPI summary.
|
|
37
|
+
const isAiAccountantSchedule = (schedule) => schedule.createdByUser?.email === AI_BOT_EMAIL ||
|
|
38
|
+
schedule.createdByUser?.email === BOT_EMAIL;
|
|
39
|
+
exports.isAiAccountantSchedule = isAiAccountantSchedule;
|
|
40
|
+
// Accrued schedules are structurally distinct — no baseTransaction, carrying recurringAmount and
|
|
41
|
+
// memo in its place — so anything reading baseTransaction has to branch on this first.
|
|
42
|
+
//
|
|
43
|
+
// Discriminates on jeAccruedScheduleKey, which only JEAccruedSchedule carries. jeScheduleType
|
|
44
|
+
// cannot be used: it is a data field present on BOTH row shapes, so an accrued-typed row that
|
|
45
|
+
// arrived through the prepaid/fixed DTO (failed_je_postings, legacy fetches) would be
|
|
46
|
+
// misclassified and then crash on recurringAmount / jeAccruedScheduleKey.
|
|
47
|
+
function isAccruedScheduleRow(schedule) {
|
|
48
|
+
return 'jeAccruedScheduleKey' in schedule;
|
|
49
|
+
}
|
|
50
|
+
function getScheduleAmount(schedule) {
|
|
51
|
+
if (isAccruedScheduleRow(schedule)) {
|
|
52
|
+
return schedule.recurringAmount.amount;
|
|
53
|
+
}
|
|
54
|
+
return schedule.baseTransaction.amount.amount;
|
|
55
|
+
}
|
|
21
56
|
function getJEScheduleSortAccessor(sortKey) {
|
|
22
57
|
switch (sortKey) {
|
|
23
58
|
case 'vendor':
|
|
@@ -29,7 +64,9 @@ function getJEScheduleSortAccessor(sortKey) {
|
|
|
29
64
|
case 'depCategory':
|
|
30
65
|
return (s) => s.jeCredit.account?.accountName?.toLowerCase();
|
|
31
66
|
case 'scheduleCategory':
|
|
32
|
-
return (s) => s
|
|
67
|
+
return (s) => isAccruedScheduleRow(s)
|
|
68
|
+
? undefined
|
|
69
|
+
: s.baseTransaction.account?.accountName?.toLowerCase();
|
|
33
70
|
case 'startMonth':
|
|
34
71
|
return (s) => s.startDate?.valueOf();
|
|
35
72
|
case 'type':
|
|
@@ -57,11 +94,13 @@ function getJEScheduleSortAccessor(sortKey) {
|
|
|
57
94
|
return s.balanceAsOfToday?.amount ?? null;
|
|
58
95
|
};
|
|
59
96
|
case 'totalAmount':
|
|
60
|
-
return (s) => s
|
|
97
|
+
return (s) => getScheduleAmount(s);
|
|
61
98
|
case 'transactionDate':
|
|
62
|
-
return (s) => s.
|
|
99
|
+
return (s) => s.createTime?.valueOf();
|
|
63
100
|
case 'memo':
|
|
64
|
-
return (s) => s
|
|
101
|
+
return (s) => isAccruedScheduleRow(s)
|
|
102
|
+
? s.memo.toLowerCase()
|
|
103
|
+
: s.baseTransaction.memo?.toLowerCase();
|
|
65
104
|
default:
|
|
66
105
|
return (s) => s.startDate?.valueOf();
|
|
67
106
|
}
|
|
@@ -73,9 +112,14 @@ function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
|
|
|
73
112
|
function getExpenseAutomationJESchedulesView(state) {
|
|
74
113
|
const jeScheduledTransaction = [];
|
|
75
114
|
const failedJeScheduledTransaction = [];
|
|
115
|
+
const accruedSchedules = [];
|
|
76
116
|
const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
77
|
-
const {
|
|
117
|
+
const { jeScheduleTransactionKeysByPeriodAndTab, jeScheduleAccruedKeysByPeriodAndTab, failedJeScheduleTransactionKeysByPeriodAndTab, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, newSchedule, } = expenseAutomationJESchedulesViewState;
|
|
78
118
|
const accountSettingsView = (0, jeAccountSettingsViewSelector_1.getJEAccountSettingsView)(state);
|
|
119
|
+
const newScheduleView = newSchedule.selectedDetailScheduleType === 'fixed_assets' ||
|
|
120
|
+
newSchedule.selectedDetailScheduleType === 'prepaid_expenses'
|
|
121
|
+
? (0, jeNewScheduleViewSelector_1.getNewScheduleView)(state, newSchedule.selectedDetailScheduleType)
|
|
122
|
+
: undefined;
|
|
79
123
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
80
124
|
const { selectedPeriodByTenantId } = expenseAutomationViewState;
|
|
81
125
|
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
@@ -103,27 +147,39 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
103
147
|
const filteredDepAccountListNestedAccountHierarchy = (0, scheduleDetailSelector_1.filterNestedAccountHierarchyById)(depAccountListNestedAccountHierarchy, filteredDepAccounts.map((account) => account.accountId));
|
|
104
148
|
const classListNestedAccountHierarchy = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
|
|
105
149
|
const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : null;
|
|
106
|
-
const
|
|
107
|
-
?
|
|
150
|
+
const selectedPeriodTabKey = monthYearPeriodId != null
|
|
151
|
+
? (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(uiState.selectedPageTab, monthYearPeriodId)
|
|
108
152
|
: null;
|
|
109
|
-
const
|
|
110
|
-
?
|
|
111
|
-
:
|
|
112
|
-
const
|
|
113
|
-
|
|
153
|
+
const jeScheduleTransactionKeysForSelectedTab = selectedPeriodTabKey != null
|
|
154
|
+
? jeScheduleTransactionKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
155
|
+
: undefined;
|
|
156
|
+
const failedJeScheduleTransactionKeysForSelectedTab = selectedPeriodTabKey != null
|
|
157
|
+
? failedJeScheduleTransactionKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
158
|
+
: undefined;
|
|
159
|
+
// Distinguishes "this tab has never been fetched for this period" from "fetched and genuinely
|
|
160
|
+
// empty". Without it the page cannot tell a first visit from a real empty state, and renders an
|
|
161
|
+
// empty table where it should render a skeleton.
|
|
162
|
+
const hasLoadedForSelectedTab = jeScheduleTransactionKeysForSelectedTab != null;
|
|
163
|
+
const jeScheduleTransactionKeys = jeScheduleTransactionKeysForSelectedTab ?? [];
|
|
164
|
+
const failedJeScheduleTransactionKeys = failedJeScheduleTransactionKeysForSelectedTab ?? [];
|
|
165
|
+
const jeScheduleAccruedKeys = (selectedPeriodTabKey != null
|
|
166
|
+
? jeScheduleAccruedKeysByPeriodAndTab[selectedPeriodTabKey]
|
|
167
|
+
: undefined) ?? [];
|
|
114
168
|
jeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
115
169
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
116
170
|
jeScheduledTransaction.push(jeScheduleDetails);
|
|
117
171
|
});
|
|
172
|
+
jeScheduleAccruedKeys.forEach((jeAccruedScheduleKey) => {
|
|
173
|
+
const accruedScheduleDetails = (0, jeSchedulesSelector_1.getJEAccruedScheduleByJEScheduleKey)(jeAccruedScheduleKey, state);
|
|
174
|
+
if (accruedScheduleDetails != null) {
|
|
175
|
+
accruedSchedules.push(accruedScheduleDetails);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
118
178
|
failedJeScheduleTransactionKeys.forEach((jeScheduleKey) => {
|
|
119
179
|
const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
|
|
120
180
|
failedJeScheduledTransaction.push(jeScheduleDetails);
|
|
121
181
|
});
|
|
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);
|
|
182
|
+
const { sortKey, sortOrder, selectedJETypeFilter } = uiState;
|
|
127
183
|
const unsortedResolveSchedules = [];
|
|
128
184
|
failedJeScheduledTransaction.forEach((schedule) => {
|
|
129
185
|
schedule.scheduledJournalEntry.forEach((journalEntry) => {
|
|
@@ -135,10 +191,73 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
135
191
|
});
|
|
136
192
|
const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
|
|
137
193
|
const validResolveForPending = unsortedResolveSchedules.filter((r) => jeScheduleLocalDataById[r.scheduledJournalEntry.scheduledJournalEntryID] != null);
|
|
194
|
+
const matchesTypeFilter = (schedule) => selectedJETypeFilter == null ||
|
|
195
|
+
schedule.jeScheduleType === selectedJETypeFilter;
|
|
196
|
+
const isCreatedStatus = (schedule) => schedule.status.code === 'ongoing' ||
|
|
197
|
+
schedule.status.code === 'completed' ||
|
|
198
|
+
schedule.status.code === 'marked_as_completed';
|
|
199
|
+
const allScheduleRows = [
|
|
200
|
+
...jeScheduledTransaction,
|
|
201
|
+
...accruedSchedules,
|
|
202
|
+
];
|
|
138
203
|
const pendingReviewSchedules = sortJEScheduledTransactions([
|
|
139
|
-
...
|
|
204
|
+
...allScheduleRows.filter((schedule) => schedule.status.code === 'draft' && matchesTypeFilter(schedule)),
|
|
140
205
|
...validResolveForPending,
|
|
141
206
|
], sortKey, sortOrder);
|
|
207
|
+
const createdSchedules = sortJEScheduledTransactions(allScheduleRows.filter((schedule) => isCreatedStatus(schedule) && matchesTypeFilter(schedule)), sortKey, sortOrder);
|
|
208
|
+
// KPI summary — derived from unfiltered schedules so counts are always accurate
|
|
209
|
+
const allSchedules = allScheduleRows;
|
|
210
|
+
const sumAmount = (schedules) => schedules.reduce((total, schedule) => total + (getScheduleAmount(schedule) ?? 0), 0);
|
|
211
|
+
const pendingReviewTotal = sumAmount(pendingReviewSchedules);
|
|
212
|
+
const createdTotal = sumAmount(createdSchedules);
|
|
213
|
+
const aiAccountantSchedules = allSchedules.filter(exports.isAiAccountantSchedule);
|
|
214
|
+
const manualSchedules = allSchedules.filter((schedule) => !(0, exports.isAiAccountantSchedule)(schedule));
|
|
215
|
+
const pendingUnfiltered = allSchedules.filter((schedule) => schedule.status.code === 'draft');
|
|
216
|
+
const kpiSummary = {
|
|
217
|
+
aiAccountant: {
|
|
218
|
+
count: aiAccountantSchedules.length,
|
|
219
|
+
amount: sumAmount(aiAccountantSchedules),
|
|
220
|
+
},
|
|
221
|
+
manual: {
|
|
222
|
+
count: manualSchedules.length,
|
|
223
|
+
amount: sumAmount(manualSchedules),
|
|
224
|
+
},
|
|
225
|
+
needsReview: {
|
|
226
|
+
count: pendingUnfiltered.length,
|
|
227
|
+
amount: sumAmount(pendingUnfiltered),
|
|
228
|
+
},
|
|
229
|
+
total: {
|
|
230
|
+
count: allSchedules.length,
|
|
231
|
+
amount: sumAmount(allSchedules),
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
// Each tab's badge counts from that tab's own bucket. A tab that has not been fetched yet
|
|
235
|
+
// reports undefined rather than 0, so the UI can hide the badge instead of asserting "none".
|
|
236
|
+
const scheduleCountsByTab = {};
|
|
237
|
+
jeSchedulesViewState_1.ALL_JE_PAGE_TABS.forEach((pageTab) => {
|
|
238
|
+
const periodTabKey = monthYearPeriodId != null
|
|
239
|
+
? (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(pageTab, monthYearPeriodId)
|
|
240
|
+
: null;
|
|
241
|
+
const transactionKeys = periodTabKey != null
|
|
242
|
+
? jeScheduleTransactionKeysByPeriodAndTab[periodTabKey]
|
|
243
|
+
: undefined;
|
|
244
|
+
if (transactionKeys == null) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const accruedKeys = (periodTabKey != null
|
|
248
|
+
? jeScheduleAccruedKeysByPeriodAndTab[periodTabKey]
|
|
249
|
+
: undefined) ?? [];
|
|
250
|
+
const rowsForTab = [
|
|
251
|
+
...transactionKeys.map((transactionKey) => (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(transactionKey, state)),
|
|
252
|
+
...accruedKeys
|
|
253
|
+
.map((accruedKey) => (0, jeSchedulesSelector_1.getJEAccruedScheduleByJEScheduleKey)(accruedKey, state))
|
|
254
|
+
.filter((accruedRow) => accruedRow != null),
|
|
255
|
+
];
|
|
256
|
+
scheduleCountsByTab[pageTab] =
|
|
257
|
+
pageTab === 'existing_schedules'
|
|
258
|
+
? rowsForTab.filter((row) => row.status.code === 'ongoing').length
|
|
259
|
+
: rowsForTab.filter((row) => row.status.code === 'draft' || isCreatedStatus(row)).length;
|
|
260
|
+
});
|
|
142
261
|
const allSteps = monthYearPeriodId != null
|
|
143
262
|
? (0, expenseAutomationViewSelectorTypes_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
|
|
144
263
|
: [];
|
|
@@ -151,6 +270,22 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
151
270
|
{ fetchState, error },
|
|
152
271
|
monthEndFetchState,
|
|
153
272
|
]);
|
|
273
|
+
const countByType = (schedules) => {
|
|
274
|
+
const counts = jeSchedulesTypes_1.ALL_SCHEDULES_TYPES.reduce((acc, type) => ({ ...acc, [type]: 0 }), {});
|
|
275
|
+
schedules.forEach((schedule) => {
|
|
276
|
+
if (schedule.jeScheduleType != null) {
|
|
277
|
+
counts[schedule.jeScheduleType] += 1;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
return counts;
|
|
281
|
+
};
|
|
282
|
+
const jeScheduleTypeCounts = {
|
|
283
|
+
active: countByType(allSchedules.filter((schedule) => schedule.status.code === 'draft' ||
|
|
284
|
+
schedule.status.code === 'ongoing' ||
|
|
285
|
+
schedule.status.code === 'completed' ||
|
|
286
|
+
schedule.status.code === 'marked_as_completed')),
|
|
287
|
+
ongoing: countByType(allSchedules.filter((schedule) => schedule.status.code === 'ongoing')),
|
|
288
|
+
};
|
|
154
289
|
return {
|
|
155
290
|
uncategorizedAccounts,
|
|
156
291
|
allDepreciationAccountList: filteredDepAccounts,
|
|
@@ -159,12 +294,17 @@ function getExpenseAutomationJESchedulesView(state) {
|
|
|
159
294
|
allAccountList: filteredAccounts,
|
|
160
295
|
accountListNestedAccountHierarchy,
|
|
161
296
|
allClassList: allClasses,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
297
|
+
createdSchedules,
|
|
298
|
+
createdTotal,
|
|
299
|
+
hasLoadedForSelectedTab,
|
|
300
|
+
jeScheduleTypeCounts,
|
|
301
|
+
scheduleCountsByTab,
|
|
302
|
+
kpiSummary,
|
|
165
303
|
pendingReviewSchedules,
|
|
304
|
+
pendingReviewTotal,
|
|
166
305
|
resolveSchedules: resolveSchedules,
|
|
167
306
|
accountSettingsView,
|
|
307
|
+
newScheduleView,
|
|
168
308
|
postStatusById: postStatusById,
|
|
169
309
|
ignoreStatusById: ignoreStatusById,
|
|
170
310
|
fetchState: reducedFetchStatus.fetchState,
|
|
@@ -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 { 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) => "vendor" | "type" | "category" | "class" | "memo" | "transactionDate" | "totalAmount" | "runningBalance" | "jePostingDate" | "depCategory" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "remainingMonths";
|
|
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,55 @@ 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
|
+
jeScheduleTransactionKeysByPeriodAndTab: Record<JESchedulePeriodTabKey, JEScheduleTransactionKey[]>;
|
|
50
|
+
newSchedule: NewJeScheduleState;
|
|
40
51
|
postStatusById: Record<ID, FetchStateAndError>;
|
|
41
52
|
refreshStatus: FetchStateAndError;
|
|
42
53
|
uiState: JESchedulesViewUIState;
|
|
43
54
|
}
|
|
55
|
+
export interface NewJeDetailLocalData {
|
|
56
|
+
amount: Amount;
|
|
57
|
+
jeLink: JETransactionLink;
|
|
58
|
+
memo: string;
|
|
59
|
+
postingDate: ZeniDate;
|
|
60
|
+
postingStatus: ScheduleJournalEntryStatusCodeType;
|
|
61
|
+
runningBalance: Amount;
|
|
62
|
+
}
|
|
63
|
+
export interface NewScheduleLocalData {
|
|
64
|
+
jeScheduleDetails: NewJeDetailLocalData[];
|
|
65
|
+
scheduleType: ScheduleTypes;
|
|
66
|
+
lastDayOfMonth?: boolean;
|
|
67
|
+
selectedAccount?: ID;
|
|
68
|
+
selectedBaseTransactionId?: ScheduleTransactionID;
|
|
69
|
+
selectedClass?: ID;
|
|
70
|
+
selectedDate?: ZeniDate;
|
|
71
|
+
selectedDayOfMonth?: ScheduleDaysOfMonth;
|
|
72
|
+
selectedJEScheduleKey?: JEScheduleTransactionKey;
|
|
73
|
+
selectedMonths?: number;
|
|
74
|
+
selectedVendor?: VendorBase;
|
|
75
|
+
}
|
|
76
|
+
export interface NewScheduleLocalDataFixedAssets extends NewScheduleLocalData {
|
|
77
|
+
assetId?: string;
|
|
78
|
+
selectedAccumulatedDepreciationCategory?: ID;
|
|
79
|
+
}
|
|
80
|
+
export interface SearchTransactionsState extends FetchStateAndError {
|
|
81
|
+
searchResults: JEScheduleTransactionKey[];
|
|
82
|
+
searchString?: string;
|
|
83
|
+
}
|
|
84
|
+
export declare const MIN_NEW_SCHEDULE_SEARCH_LENGTH = 2;
|
|
85
|
+
export interface NewJeScheduleState extends FetchStateAndError {
|
|
86
|
+
newScheduleState: {
|
|
87
|
+
fixed_assets: NewScheduleLocalDataFixedAssets;
|
|
88
|
+
prepaid_expenses: NewScheduleLocalData;
|
|
89
|
+
};
|
|
90
|
+
saveStatus: FetchStateAndError;
|
|
91
|
+
searchTransactions: SearchTransactionsState;
|
|
92
|
+
selectedDetailScheduleType?: ScheduleTypes;
|
|
93
|
+
}
|
|
44
94
|
export interface AccountSettingsLocalData {
|
|
45
95
|
previousAccruedExpensesAccount: AccountBase[];
|
|
46
96
|
previousFixedAssetsAccount: AccountBase[];
|
|
@@ -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;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateInvoicingCreditNotes } from '../../../entity/invoicing/creditNote/creditNoteReducer';
|
|
4
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
5
|
import { RootState } from '../../../reducer';
|
|
5
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
7
|
import { createCreditNoteFailure, createCreditNoteSuccess, submitCreateCreditNote } from './createCreditNoteReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof submitCreateCreditNote> | ReturnType<typeof createCreditNoteSuccess> | ReturnType<typeof createCreditNoteFailure> | ReturnType<typeof updateInvoicingCreditNotes>;
|
|
8
|
+
export type ActionType = ReturnType<typeof submitCreateCreditNote> | ReturnType<typeof createCreditNoteSuccess> | ReturnType<typeof createCreditNoteFailure> | ReturnType<typeof updateInvoicingCreditNotes> | ReturnType<typeof openSnackbar>;
|
|
8
9
|
export declare const createCreditNoteEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,6 +4,7 @@ exports.createCreditNoteEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const creditNoteReducer_1 = require("../../../entity/invoicing/creditNote/creditNoteReducer");
|
|
7
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
7
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
9
|
const createCreditNotePayload_1 = require("./createCreditNotePayload");
|
|
9
10
|
const createCreditNoteReducer_1 = require("./createCreditNoteReducer");
|
|
@@ -18,10 +19,29 @@ const createCreditNoteEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
|
|
|
18
19
|
return [
|
|
19
20
|
(0, creditNoteReducer_1.updateInvoicingCreditNotes)([response.data], 'merge'),
|
|
20
21
|
(0, createCreditNoteReducer_1.createCreditNoteSuccess)({ creditNoteId: response.data.id }),
|
|
22
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
23
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
24
|
+
messageText: 'success',
|
|
25
|
+
type: 'success',
|
|
26
|
+
}),
|
|
21
27
|
];
|
|
22
28
|
}
|
|
23
|
-
return (0, rxjs_1.
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
return (0, rxjs_1.from)([
|
|
30
|
+
(0, createCreditNoteReducer_1.createCreditNoteFailure)(response.status),
|
|
31
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
32
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
33
|
+
messageText: 'failed',
|
|
34
|
+
type: 'error',
|
|
35
|
+
}),
|
|
36
|
+
]);
|
|
37
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
38
|
+
(0, createCreditNoteReducer_1.createCreditNoteFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create credit note REST API call errored out ' +
|
|
39
|
+
JSON.stringify(error))),
|
|
40
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
41
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
42
|
+
messageText: 'failed',
|
|
43
|
+
type: 'error',
|
|
44
|
+
}),
|
|
45
|
+
])));
|
|
26
46
|
}));
|
|
27
47
|
exports.createCreditNoteEpic = createCreditNoteEpic;
|
|
@@ -2,9 +2,10 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
5
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
6
|
import { RootState } from '../../../reducer';
|
|
6
7
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
8
|
import { addInvoiceToList } from '../invoiceList/invoiceListReducer';
|
|
8
9
|
import { createInvoice, createInvoiceFailure, createInvoiceSuccess } from './createInvoiceReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof createInvoice> | ReturnType<typeof createInvoiceSuccess> | ReturnType<typeof createInvoiceFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoices> | ReturnType<typeof addInvoiceToList>;
|
|
10
|
+
export type ActionType = ReturnType<typeof createInvoice> | ReturnType<typeof createInvoiceSuccess> | ReturnType<typeof createInvoiceFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoices> | ReturnType<typeof addInvoiceToList> | ReturnType<typeof openSnackbar>;
|
|
10
11
|
export declare const createInvoiceEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const addressReducer_1 = require("../../../entity/address/addressReducer");
|
|
7
7
|
const invoicePayload_1 = require("../../../entity/invoicing/invoice/invoicePayload");
|
|
8
8
|
const invoiceReducer_1 = require("../../../entity/invoicing/invoice/invoiceReducer");
|
|
9
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
10
|
const responsePayload_1 = require("../../../responsePayload");
|
|
10
11
|
const invoiceListReducer_1 = require("../invoiceList/invoiceListReducer");
|
|
11
12
|
const createInvoiceReducer_1 = require("./createInvoiceReducer");
|
|
@@ -25,10 +26,29 @@ const createInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
25
26
|
status: response.data.status,
|
|
26
27
|
}),
|
|
27
28
|
(0, createInvoiceReducer_1.createInvoiceSuccess)({ invoiceId: response.data.id }),
|
|
29
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
30
|
+
messageSection: 'invoicing_invoice_saved',
|
|
31
|
+
messageText: 'success',
|
|
32
|
+
type: 'success',
|
|
33
|
+
}),
|
|
28
34
|
];
|
|
29
35
|
}
|
|
30
|
-
return (0, rxjs_1.
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
return (0, rxjs_1.from)([
|
|
37
|
+
(0, createInvoiceReducer_1.createInvoiceFailure)(response.status),
|
|
38
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
39
|
+
messageSection: 'invoicing_invoice_saved',
|
|
40
|
+
messageText: 'failed',
|
|
41
|
+
type: 'error',
|
|
42
|
+
}),
|
|
43
|
+
]);
|
|
44
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
45
|
+
(0, createInvoiceReducer_1.createInvoiceFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create invoice REST API call errored out ' +
|
|
46
|
+
JSON.stringify(error))),
|
|
47
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
48
|
+
messageSection: 'invoicing_invoice_saved',
|
|
49
|
+
messageText: 'failed',
|
|
50
|
+
type: 'error',
|
|
51
|
+
}),
|
|
52
|
+
])));
|
|
33
53
|
}));
|
|
34
54
|
exports.createInvoiceEpic = createInvoiceEpic;
|