@zeniai/client-epic-state 4.20.3-betaRD2 → 4.20.3-betaRD21
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/commonPayloadTypes/subAccountView/reportBySubAccountPayload.d.ts +0 -2
- package/lib/commonStateTypes/common.d.ts +1 -1
- package/lib/commonStateTypes/viewAndReport/reportIDHelper.d.ts +0 -1
- package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +1 -3
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -1
- package/lib/entity/account/accountPayload.d.ts +2 -0
- package/lib/entity/account/accountReducer.d.ts +5 -2
- package/lib/entity/account/accountReducer.js +10 -7
- package/lib/entity/account/accountSelector.d.ts +0 -7
- package/lib/entity/account/accountSelector.js +2 -4
- package/lib/entity/account/accountState.d.ts +1 -3
- package/lib/entity/account/accountState.js +1 -4
- package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +0 -1
- package/lib/entity/accountGroup/accountGroupSelector.d.ts +0 -22
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.d.ts +44 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +55 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.d.ts +10 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +51 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +48 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +66 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.d.ts +52 -0
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.js +37 -0
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
- package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
- package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +2 -2
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/tenant/clearAllEpic.d.ts +4 -5
- package/lib/entity/tenant/clearAllEpic.js +4 -6
- package/lib/entity/tenant/tenantPayload.d.ts +0 -1
- package/lib/entity/tenant/tenantReducer.js +0 -1
- package/lib/entity/tenant/tenantSelector.d.ts +0 -1
- package/lib/entity/tenant/tenantSelector.js +1 -9
- package/lib/entity/tenant/tenantState.d.ts +0 -1
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +1 -0
- package/lib/entity/userRole/userRoleType.d.ts +2 -2
- package/lib/epic.d.ts +3 -4
- package/lib/epic.js +3 -4
- package/lib/esm/commonStateTypes/viewAndReport/reportIDHelper.js +0 -1
- package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +1 -1
- package/lib/esm/entity/account/accountReducer.js +9 -6
- package/lib/esm/entity/account/accountSelector.js +2 -4
- package/lib/esm/entity/account/accountState.js +1 -4
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +49 -0
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +47 -0
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +62 -0
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerState.js +31 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +4 -6
- package/lib/esm/entity/tenant/tenantReducer.js +0 -1
- package/lib/esm/entity/tenant/tenantSelector.js +0 -7
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +1 -0
- package/lib/esm/epic.js +3 -4
- package/lib/esm/index.js +15 -11
- package/lib/esm/reducer.js +6 -9
- package/lib/esm/view/aiAccountantView/aiAccountantViewPayload.js +2 -0
- package/lib/esm/view/aiAccountantView/aiAccountantViewReducer.js +149 -0
- package/lib/esm/view/aiAccountantView/aiAccountantViewSelector.js +72 -0
- package/lib/esm/view/aiAccountantView/aiAccountantViewState.js +11 -0
- package/lib/esm/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +46 -0
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +27 -0
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +47 -0
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +52 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -9
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +44 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +5 -1
- package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +163 -3
- package/lib/esm/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +1 -2
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +112 -0
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +10 -6
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -0
- package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -12
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +4 -2
- package/lib/esm/view/reportsResync/reportsClassViewRefetchingEpic.js +0 -4
- package/lib/index.d.ts +16 -14
- package/lib/index.js +65 -45
- package/lib/reducer.d.ts +6 -9
- package/lib/reducer.js +6 -9
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +31 -0
- package/lib/view/aiAccountantView/aiAccountantViewPayload.js +8 -0
- package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +29 -0
- package/lib/view/aiAccountantView/aiAccountantViewReducer.js +153 -0
- package/lib/view/aiAccountantView/aiAccountantViewSelector.d.ts +14 -0
- package/lib/view/aiAccountantView/aiAccountantViewSelector.js +78 -0
- package/lib/view/aiAccountantView/aiAccountantViewState.d.ts +27 -0
- package/lib/view/aiAccountantView/aiAccountantViewState.js +13 -0
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.d.ts +33 -0
- package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +50 -0
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.d.ts +23 -0
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +31 -0
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.d.ts +33 -0
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +51 -0
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.d.ts +28 -0
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +56 -0
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -2
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -2
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +6 -5
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +48 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -9
- package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +48 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +33 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +5 -1
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +18 -4
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +164 -4
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +6 -2
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +2 -2
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +112 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +9 -5
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +3 -0
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +13 -0
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/financeStatement/financeStatementSelector.d.ts +0 -2
- package/lib/view/financeStatement/financeStatementSelector.js +1 -12
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +4 -2
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reportsResync/reportsClassViewRefetchingEpic.d.ts +1 -2
- package/lib/view/reportsResync/reportsClassViewRefetchingEpic.js +0 -4
- package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
- package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -4
- package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +3 -3
- package/lib/view/subscriptionView/types/subscriptionTypes.d.ts +1 -1
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/package.json +1 -1
- package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.d.ts +0 -13
- package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +0 -9
- package/lib/commonStateTypes/projectView/projectViewParentID.d.ts +0 -5
- package/lib/commonStateTypes/projectView/projectViewParentID.js +0 -2
- package/lib/entity/project/projectPayload.d.ts +0 -13
- package/lib/entity/project/projectPayload.js +0 -30
- package/lib/entity/project/projectReducer.d.ts +0 -10
- package/lib/entity/project/projectReducer.js +0 -31
- package/lib/entity/project/projectSelector.d.ts +0 -5
- package/lib/entity/project/projectSelector.js +0 -12
- package/lib/entity/project/projectState.d.ts +0 -13
- package/lib/entity/project/projectState.js +0 -2
- package/lib/entity/sectionProjectView/sectionProjectView.d.ts +0 -10
- package/lib/entity/sectionProjectView/sectionProjectView.js +0 -6
- package/lib/entity/sectionProjectView/sectionProjectViewEpic.d.ts +0 -6
- package/lib/entity/sectionProjectView/sectionProjectViewEpic.js +0 -51
- package/lib/entity/sectionProjectView/sectionProjectViewHelper.d.ts +0 -9
- package/lib/entity/sectionProjectView/sectionProjectViewHelper.js +0 -13
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +0 -15
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.js +0 -50
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.d.ts +0 -11
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +0 -77
- package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.d.ts +0 -16
- package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +0 -2
- package/lib/entity/sectionProjectView/sectionProjectViewState.d.ts +0 -4
- package/lib/entity/sectionProjectView/sectionProjectViewState.js +0 -2
- package/lib/esm/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +0 -5
- package/lib/esm/commonStateTypes/projectView/projectViewParentID.js +0 -1
- package/lib/esm/entity/project/projectPayload.js +0 -26
- package/lib/esm/entity/project/projectReducer.js +0 -27
- package/lib/esm/entity/project/projectSelector.js +0 -8
- package/lib/esm/entity/project/projectState.js +0 -1
- package/lib/esm/entity/sectionProjectView/sectionProjectView.js +0 -3
- package/lib/esm/entity/sectionProjectView/sectionProjectViewEpic.js +0 -47
- package/lib/esm/entity/sectionProjectView/sectionProjectViewHelper.js +0 -9
- package/lib/esm/entity/sectionProjectView/sectionProjectViewReducer.js +0 -46
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +0 -70
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +0 -1
- package/lib/esm/entity/sectionProjectView/sectionProjectViewState.js +0 -1
- package/lib/esm/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +0 -45
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +0 -30
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +0 -1
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +0 -113
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +0 -66
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +0 -1
- package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewState.js +0 -1
- package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.d.ts +0 -8
- package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +0 -49
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.d.ts +0 -6
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +0 -34
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.d.ts +0 -33
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +0 -2
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.d.ts +0 -33
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +0 -117
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.d.ts +0 -9
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +0 -70
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +0 -18
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +0 -2
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.d.ts +0 -22
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.js +0 -2
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearAllSectionsProjectView = exports.updateSectionProjectView = exports.initialState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const coaBalancePayload_1 = require("../../commonPayloadTypes/v2/coaBalancePayload");
|
|
7
|
-
const sectionProjectView_1 = require("./sectionProjectView");
|
|
8
|
-
const sectionProjectViewHelper_1 = require("./sectionProjectViewHelper");
|
|
9
|
-
exports.initialState = {
|
|
10
|
-
sectionsByKey: {},
|
|
11
|
-
};
|
|
12
|
-
const sectionProjectView = (0, toolkit_1.createSlice)({
|
|
13
|
-
name: 'sectionProjectView',
|
|
14
|
-
initialState: exports.initialState,
|
|
15
|
-
reducers: {
|
|
16
|
-
updateSectionProjectView: {
|
|
17
|
-
prepare(timeframe, sectionId, reportId, sectionPayload, accountsMetadataPayload, currencyPayload) {
|
|
18
|
-
return {
|
|
19
|
-
payload: {
|
|
20
|
-
timeframe,
|
|
21
|
-
reportId,
|
|
22
|
-
sectionId,
|
|
23
|
-
sectionPayload,
|
|
24
|
-
accountsMetadataPayload,
|
|
25
|
-
currencyPayload,
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
reducer(draft, action) {
|
|
30
|
-
updateSection(draft, action.payload.timeframe, action.payload.sectionPayload, action.payload.sectionId, action.payload.reportId, action.payload.currencyPayload);
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
clearAllSectionsProjectView(draft) {
|
|
34
|
-
Object.assign(draft, exports.initialState);
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
_a = sectionProjectView.actions, exports.updateSectionProjectView = _a.updateSectionProjectView, exports.clearAllSectionsProjectView = _a.clearAllSectionsProjectView;
|
|
39
|
-
exports.default = sectionProjectView.reducer;
|
|
40
|
-
const updateSection = (draft, timeframe, sectionPayload, sectionId, reportId, currencyPayload) => {
|
|
41
|
-
const sectionKey = (0, sectionProjectView_1.getSectionProjectViewKey)(sectionId, reportId);
|
|
42
|
-
const section = draft.sectionsByKey[sectionKey];
|
|
43
|
-
if (section != null) {
|
|
44
|
-
draft.sectionsByKey[sectionKey].balancesByPeriod = Object.assign({}, draft.sectionsByKey[sectionKey].balancesByPeriod, (0, coaBalancePayload_1.mapCOABalanceGroupedByPeriodPayloadV2ToCOABalanceGroupedByPeriod)(sectionPayload, currencyPayload, timeframe));
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
draft.sectionsByKey[sectionKey] =
|
|
48
|
-
(0, sectionProjectViewHelper_1.mapSectionByProjectCOABalanceGroupedPayloadToSection)(timeframe, sectionPayload, currencyPayload, { sectionId, reportId });
|
|
49
|
-
}
|
|
50
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { COABalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
2
|
-
import { ID } from '../../commonStateTypes/common';
|
|
3
|
-
import { ReportID } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
|
-
import { AccountState } from '../account/accountState';
|
|
5
|
-
import { ProjectState } from '../project/projectReducer';
|
|
6
|
-
import { SectionProjectViewReport } from './sectionProjectViewSelectorTypes';
|
|
7
|
-
import { SectionProjectViewState } from './sectionProjectViewState';
|
|
8
|
-
export declare const getSectionProjectViewReport: (accountState: AccountState, projectState: ProjectState, sectionState: SectionProjectViewState, projectIds: ID[], id: {
|
|
9
|
-
reportId: ReportID;
|
|
10
|
-
sectionId: ID;
|
|
11
|
-
}, filter: COABalancesFilterProjectView) => SectionProjectViewReport;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getSectionProjectViewReport = void 0;
|
|
7
|
-
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
-
const coaBalance_1 = require("../../commonStateTypes/coaBalance/coaBalance");
|
|
9
|
-
const getSumOfBalancesGroupedByPeriod_1 = require("../../commonStateTypes/coaBalance/classBalances/getSumOfBalancesGroupedByPeriod");
|
|
10
|
-
const accountSelector_1 = require("../account/accountSelector");
|
|
11
|
-
const accountState_1 = require("../account/accountState");
|
|
12
|
-
const projectSelector_1 = require("../project/projectSelector");
|
|
13
|
-
const sectionProjectView_1 = require("./sectionProjectView");
|
|
14
|
-
const getSectionProjectViewReport = (accountState, projectState, sectionState, projectIds, id, filter) => {
|
|
15
|
-
const sectionKey = (0, sectionProjectView_1.getSectionProjectViewKey)(id.sectionId, id.reportId);
|
|
16
|
-
const sectionView = (0, get_1.default)(sectionState.sectionsByKey, sectionKey, undefined);
|
|
17
|
-
const projectIdsToShow = projectIds.filter((projectId) => !filter.projectsToFilterOut.includes(projectId));
|
|
18
|
-
const projectReports = [];
|
|
19
|
-
const sectionBalancesTotalByPeriodArray = [];
|
|
20
|
-
const accountsByProject = getAccountsByProject(accountState, id.sectionId, id.reportId);
|
|
21
|
-
projectIdsToShow.forEach((projectId) => {
|
|
22
|
-
const project = (0, projectSelector_1.getProjectById)(projectState, projectId);
|
|
23
|
-
if (project == null) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const projectAccountIds = accountsByProject[projectId] ?? [];
|
|
27
|
-
const accountReports = projectAccountIds.map((accountId) => (0, accountSelector_1.getAccount)(accountState, {
|
|
28
|
-
accountId,
|
|
29
|
-
reportId: id.reportId,
|
|
30
|
-
projectsViewParentId: {
|
|
31
|
-
projectId,
|
|
32
|
-
sectionId: id.sectionId,
|
|
33
|
-
},
|
|
34
|
-
}, filter));
|
|
35
|
-
const accountBalancesByPeriod = projectAccountIds
|
|
36
|
-
.map((accountId) => {
|
|
37
|
-
const key = (0, accountState_1.getAccountKey)(id.reportId, accountId, undefined, undefined, { projectId, sectionId: id.sectionId });
|
|
38
|
-
const account = accountState.accountsByKey[key];
|
|
39
|
-
return account?.balancesByPeriod;
|
|
40
|
-
})
|
|
41
|
-
.filter((balancesByPeriod) => balancesByPeriod != null);
|
|
42
|
-
const projectBalancesTotalByPeriod = (0, getSumOfBalancesGroupedByPeriod_1.getSumOfBalancesByGroupedByPeriod)(accountBalancesByPeriod) ?? {};
|
|
43
|
-
const projectReport = {
|
|
44
|
-
projectId,
|
|
45
|
-
projectName: project.projectName,
|
|
46
|
-
accounts: accountReports,
|
|
47
|
-
...(0, coaBalance_1.getCOABalances)(projectBalancesTotalByPeriod, filter),
|
|
48
|
-
projectBalancesTotalByPeriod,
|
|
49
|
-
};
|
|
50
|
-
projectReports.push(projectReport);
|
|
51
|
-
sectionBalancesTotalByPeriodArray.push(projectBalancesTotalByPeriod);
|
|
52
|
-
});
|
|
53
|
-
const sectionBalancesTotalByPeriod = sectionView?.balancesByPeriod != null
|
|
54
|
-
? sectionView.balancesByPeriod
|
|
55
|
-
: ((0, getSumOfBalancesGroupedByPeriod_1.getSumOfBalancesByGroupedByPeriod)(sectionBalancesTotalByPeriodArray) ?? {});
|
|
56
|
-
return {
|
|
57
|
-
projects: projectReports,
|
|
58
|
-
...(0, coaBalance_1.getCOABalances)(sectionBalancesTotalByPeriod, filter),
|
|
59
|
-
sectionBalancesTotalByPeriod,
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
exports.getSectionProjectViewReport = getSectionProjectViewReport;
|
|
63
|
-
const getAccountsByProject = (accountState, sectionId, reportId) => {
|
|
64
|
-
const result = {};
|
|
65
|
-
Object.values(accountState.accountsByKey).forEach((account) => {
|
|
66
|
-
if (account.projectsViewParentId != null &&
|
|
67
|
-
account.projectsViewParentId.sectionId === sectionId &&
|
|
68
|
-
account.key.endsWith(reportId)) {
|
|
69
|
-
const projectId = account.projectsViewParentId.projectId;
|
|
70
|
-
if (result[projectId] == null) {
|
|
71
|
-
result[projectId] = [];
|
|
72
|
-
}
|
|
73
|
-
result[projectId].push(account.accountId);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return result;
|
|
77
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { COABalanceGroupedByPeriod } from '../../commonStateTypes/coaBalance/coaBalance';
|
|
2
|
-
import { COABalancesSlice } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
|
|
3
|
-
import { ID } from '../../commonStateTypes/common';
|
|
4
|
-
import { AccountReport } from '../account/accountSelector';
|
|
5
|
-
export interface ProjectReportV2 {
|
|
6
|
-
accounts: AccountReport[];
|
|
7
|
-
projectId: ID;
|
|
8
|
-
projectName: string;
|
|
9
|
-
}
|
|
10
|
-
export interface ProjectReportWithBalances extends ProjectReportV2, COABalancesSlice {
|
|
11
|
-
projectBalancesTotalByPeriod: COABalanceGroupedByPeriod;
|
|
12
|
-
}
|
|
13
|
-
export interface SectionProjectViewReport extends COABalancesSlice {
|
|
14
|
-
projects: ProjectReportWithBalances[];
|
|
15
|
-
sectionBalancesTotalByPeriod: COABalanceGroupedByPeriod;
|
|
16
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { newBalancesFilter } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
|
|
2
|
-
export const newBalancesFilterProjectView = (firstMonthOfFY, timeframe, numberOfPeriods = 8, thisPeriod, orderBy = 'ascending_date', additionalBalances = [], projectsToFilterOut = []) => ({
|
|
3
|
-
...newBalancesFilter(firstMonthOfFY, timeframe, numberOfPeriods, thisPeriod, orderBy, additionalBalances),
|
|
4
|
-
projectsToFilterOut,
|
|
5
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { date } from '../../zeniDayJS';
|
|
2
|
-
export const mapProjectMetadataPayloadToProject = (payload) => ({
|
|
3
|
-
projectId: payload.zeni_project_id,
|
|
4
|
-
projectName: payload.project_name,
|
|
5
|
-
...(payload.status != null ? { status: payload.status } : {}),
|
|
6
|
-
...(payload.start_date != null ? { startDate: date(payload.start_date) } : {}),
|
|
7
|
-
...(payload.parent_customer_payment_provider_id != null
|
|
8
|
-
? {
|
|
9
|
-
parentCustomerPaymentProviderId: payload.parent_customer_payment_provider_id,
|
|
10
|
-
}
|
|
11
|
-
: {}),
|
|
12
|
-
...(payload.payment_provider_project_customer_id != null
|
|
13
|
-
? {
|
|
14
|
-
paymentProviderProjectCustomerId: payload.payment_provider_project_customer_id,
|
|
15
|
-
}
|
|
16
|
-
: {}),
|
|
17
|
-
...(payload.payment_provider_project_id != null
|
|
18
|
-
? { paymentProviderProjectId: payload.payment_provider_project_id }
|
|
19
|
-
: {}),
|
|
20
|
-
...(payload.zeni_parent_customer_id != null
|
|
21
|
-
? { zeniParentCustomerId: payload.zeni_parent_customer_id }
|
|
22
|
-
: {}),
|
|
23
|
-
...(payload.zeni_project_customer_id != null
|
|
24
|
-
? { zeniProjectCustomerId: payload.zeni_project_customer_id }
|
|
25
|
-
: {}),
|
|
26
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { mapProjectMetadataPayloadToProject, } from './projectPayload';
|
|
3
|
-
export const initialState = {
|
|
4
|
-
projects: {},
|
|
5
|
-
};
|
|
6
|
-
const projectSlice = createSlice({
|
|
7
|
-
name: 'project',
|
|
8
|
-
initialState,
|
|
9
|
-
reducers: {
|
|
10
|
-
updateProjects: {
|
|
11
|
-
reducer(draft, action) {
|
|
12
|
-
action.payload.forEach((projectPayload) => {
|
|
13
|
-
const project = mapProjectMetadataPayloadToProject(projectPayload);
|
|
14
|
-
draft.projects[project.projectId] = project;
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
prepare(payload) {
|
|
18
|
-
return { payload };
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
clearAllProjects(draft) {
|
|
22
|
-
Object.assign(draft, initialState);
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
export const { updateProjects, clearAllProjects } = projectSlice.actions;
|
|
27
|
-
export default projectSlice.reducer;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export function getProjectById(projectState, projectId) {
|
|
2
|
-
return projectState.projects[projectId];
|
|
3
|
-
}
|
|
4
|
-
export function getProjectsByIds(projectState, projectIds) {
|
|
5
|
-
return projectIds
|
|
6
|
-
.map((projectId) => getProjectById(projectState, projectId))
|
|
7
|
-
.filter((project) => project != null);
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { getAllAccountMetadataRecordsByID } from '../../commonStateTypes/accountView/getNestedAccountIDHierarchyForReport';
|
|
4
|
-
import { updateMultipleSubAccountsWithBalances } from '../account/accountReducer';
|
|
5
|
-
import { updateSectionProjectView } from './sectionProjectViewReducer';
|
|
6
|
-
export const updateSectionProjectViewEpic = (actions$) => actions$.pipe(filter(updateSectionProjectView.match), mergeMap((action) => {
|
|
7
|
-
const actions = [];
|
|
8
|
-
const sectionPayload = action.payload.sectionPayload;
|
|
9
|
-
const sectionId = action.payload.sectionId;
|
|
10
|
-
const timeframe = action.payload.timeframe;
|
|
11
|
-
const reportId = action.payload.reportId;
|
|
12
|
-
const currencyPayload = action.payload.currencyPayload;
|
|
13
|
-
const accountsMetadataPayload = action.payload.accountsMetadataPayload;
|
|
14
|
-
const accountMetadataRecordsByID = getAllAccountMetadataRecordsByID(accountsMetadataPayload);
|
|
15
|
-
const accountMetadataWithBalancesPayloads = [];
|
|
16
|
-
if (sectionPayload.projects != null) {
|
|
17
|
-
Object.keys(sectionPayload.projects).forEach((projectId) => {
|
|
18
|
-
const projectAccounts = sectionPayload.projects[projectId].accounts;
|
|
19
|
-
const projectsViewParentID = {
|
|
20
|
-
projectId,
|
|
21
|
-
sectionId,
|
|
22
|
-
};
|
|
23
|
-
getSubAccountsMetadataForProjectAccountList(projectAccounts, accountMetadataRecordsByID, sectionId, projectsViewParentID, accountMetadataWithBalancesPayloads);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
if (accountMetadataWithBalancesPayloads.length > 0) {
|
|
27
|
-
actions.push(updateMultipleSubAccountsWithBalances(accountMetadataWithBalancesPayloads, currencyPayload, reportId, timeframe));
|
|
28
|
-
}
|
|
29
|
-
return from(actions);
|
|
30
|
-
}));
|
|
31
|
-
const getSubAccountsMetadataForProjectAccountList = (accountListWithBalances, accountMetadataRecordsByID, sectionId, projectsViewParentID, result) => {
|
|
32
|
-
if (accountListWithBalances != null) {
|
|
33
|
-
Object.keys(accountListWithBalances).forEach((eachAccountId) => {
|
|
34
|
-
const accountMetadataRecord = accountMetadataRecordsByID[eachAccountId];
|
|
35
|
-
if (accountMetadataRecord != null) {
|
|
36
|
-
result.push({
|
|
37
|
-
accountMetadataPayload: accountMetadataRecord.accountMetadataPayload,
|
|
38
|
-
accountBalancesPayload: accountListWithBalances[eachAccountId],
|
|
39
|
-
projectsViewParentID,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
console.warn(`Account ${eachAccountId} in Section ${sectionId} Project ${projectsViewParentID.projectId} is missing metadata.`);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { mapCOABalanceGroupedByPeriodPayloadV2ToCOABalanceGroupedByPeriod, } from '../../commonPayloadTypes/v2/coaBalancePayload';
|
|
2
|
-
import { getSectionProjectViewKey, } from './sectionProjectView';
|
|
3
|
-
export const mapSectionByProjectCOABalanceGroupedPayloadToSection = (timeframe, sectionPayload, currencyPayload, id) => {
|
|
4
|
-
return {
|
|
5
|
-
key: getSectionProjectViewKey(id.sectionId, id.reportId),
|
|
6
|
-
sectionId: id.sectionId,
|
|
7
|
-
balancesByPeriod: mapCOABalanceGroupedByPeriodPayloadV2ToCOABalanceGroupedByPeriod(sectionPayload, currencyPayload, timeframe),
|
|
8
|
-
};
|
|
9
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { mapCOABalanceGroupedByPeriodPayloadV2ToCOABalanceGroupedByPeriod } from '../../commonPayloadTypes/v2/coaBalancePayload';
|
|
3
|
-
import { getSectionProjectViewKey } from './sectionProjectView';
|
|
4
|
-
import { mapSectionByProjectCOABalanceGroupedPayloadToSection } from './sectionProjectViewHelper';
|
|
5
|
-
export const initialState = {
|
|
6
|
-
sectionsByKey: {},
|
|
7
|
-
};
|
|
8
|
-
const sectionProjectView = createSlice({
|
|
9
|
-
name: 'sectionProjectView',
|
|
10
|
-
initialState,
|
|
11
|
-
reducers: {
|
|
12
|
-
updateSectionProjectView: {
|
|
13
|
-
prepare(timeframe, sectionId, reportId, sectionPayload, accountsMetadataPayload, currencyPayload) {
|
|
14
|
-
return {
|
|
15
|
-
payload: {
|
|
16
|
-
timeframe,
|
|
17
|
-
reportId,
|
|
18
|
-
sectionId,
|
|
19
|
-
sectionPayload,
|
|
20
|
-
accountsMetadataPayload,
|
|
21
|
-
currencyPayload,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
reducer(draft, action) {
|
|
26
|
-
updateSection(draft, action.payload.timeframe, action.payload.sectionPayload, action.payload.sectionId, action.payload.reportId, action.payload.currencyPayload);
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
clearAllSectionsProjectView(draft) {
|
|
30
|
-
Object.assign(draft, initialState);
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
export const { updateSectionProjectView, clearAllSectionsProjectView } = sectionProjectView.actions;
|
|
35
|
-
export default sectionProjectView.reducer;
|
|
36
|
-
const updateSection = (draft, timeframe, sectionPayload, sectionId, reportId, currencyPayload) => {
|
|
37
|
-
const sectionKey = getSectionProjectViewKey(sectionId, reportId);
|
|
38
|
-
const section = draft.sectionsByKey[sectionKey];
|
|
39
|
-
if (section != null) {
|
|
40
|
-
draft.sectionsByKey[sectionKey].balancesByPeriod = Object.assign({}, draft.sectionsByKey[sectionKey].balancesByPeriod, mapCOABalanceGroupedByPeriodPayloadV2ToCOABalanceGroupedByPeriod(sectionPayload, currencyPayload, timeframe));
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
draft.sectionsByKey[sectionKey] =
|
|
44
|
-
mapSectionByProjectCOABalanceGroupedPayloadToSection(timeframe, sectionPayload, currencyPayload, { sectionId, reportId });
|
|
45
|
-
}
|
|
46
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import recordGet from 'lodash/get';
|
|
2
|
-
import { getCOABalances, } from '../../commonStateTypes/coaBalance/coaBalance';
|
|
3
|
-
import { getSumOfBalancesByGroupedByPeriod } from '../../commonStateTypes/coaBalance/classBalances/getSumOfBalancesGroupedByPeriod';
|
|
4
|
-
import { getAccount } from '../account/accountSelector';
|
|
5
|
-
import { getAccountKey } from '../account/accountState';
|
|
6
|
-
import { getProjectById } from '../project/projectSelector';
|
|
7
|
-
import { getSectionProjectViewKey } from './sectionProjectView';
|
|
8
|
-
export const getSectionProjectViewReport = (accountState, projectState, sectionState, projectIds, id, filter) => {
|
|
9
|
-
const sectionKey = getSectionProjectViewKey(id.sectionId, id.reportId);
|
|
10
|
-
const sectionView = recordGet(sectionState.sectionsByKey, sectionKey, undefined);
|
|
11
|
-
const projectIdsToShow = projectIds.filter((projectId) => !filter.projectsToFilterOut.includes(projectId));
|
|
12
|
-
const projectReports = [];
|
|
13
|
-
const sectionBalancesTotalByPeriodArray = [];
|
|
14
|
-
const accountsByProject = getAccountsByProject(accountState, id.sectionId, id.reportId);
|
|
15
|
-
projectIdsToShow.forEach((projectId) => {
|
|
16
|
-
const project = getProjectById(projectState, projectId);
|
|
17
|
-
if (project == null) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const projectAccountIds = accountsByProject[projectId] ?? [];
|
|
21
|
-
const accountReports = projectAccountIds.map((accountId) => getAccount(accountState, {
|
|
22
|
-
accountId,
|
|
23
|
-
reportId: id.reportId,
|
|
24
|
-
projectsViewParentId: {
|
|
25
|
-
projectId,
|
|
26
|
-
sectionId: id.sectionId,
|
|
27
|
-
},
|
|
28
|
-
}, filter));
|
|
29
|
-
const accountBalancesByPeriod = projectAccountIds
|
|
30
|
-
.map((accountId) => {
|
|
31
|
-
const key = getAccountKey(id.reportId, accountId, undefined, undefined, { projectId, sectionId: id.sectionId });
|
|
32
|
-
const account = accountState.accountsByKey[key];
|
|
33
|
-
return account?.balancesByPeriod;
|
|
34
|
-
})
|
|
35
|
-
.filter((balancesByPeriod) => balancesByPeriod != null);
|
|
36
|
-
const projectBalancesTotalByPeriod = getSumOfBalancesByGroupedByPeriod(accountBalancesByPeriod) ?? {};
|
|
37
|
-
const projectReport = {
|
|
38
|
-
projectId,
|
|
39
|
-
projectName: project.projectName,
|
|
40
|
-
accounts: accountReports,
|
|
41
|
-
...getCOABalances(projectBalancesTotalByPeriod, filter),
|
|
42
|
-
projectBalancesTotalByPeriod,
|
|
43
|
-
};
|
|
44
|
-
projectReports.push(projectReport);
|
|
45
|
-
sectionBalancesTotalByPeriodArray.push(projectBalancesTotalByPeriod);
|
|
46
|
-
});
|
|
47
|
-
const sectionBalancesTotalByPeriod = sectionView?.balancesByPeriod != null
|
|
48
|
-
? sectionView.balancesByPeriod
|
|
49
|
-
: (getSumOfBalancesByGroupedByPeriod(sectionBalancesTotalByPeriodArray) ?? {});
|
|
50
|
-
return {
|
|
51
|
-
projects: projectReports,
|
|
52
|
-
...getCOABalances(sectionBalancesTotalByPeriod, filter),
|
|
53
|
-
sectionBalancesTotalByPeriod,
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
const getAccountsByProject = (accountState, sectionId, reportId) => {
|
|
57
|
-
const result = {};
|
|
58
|
-
Object.values(accountState.accountsByKey).forEach((account) => {
|
|
59
|
-
if (account.projectsViewParentId != null &&
|
|
60
|
-
account.projectsViewParentId.sectionId === sectionId &&
|
|
61
|
-
account.key.endsWith(reportId)) {
|
|
62
|
-
const projectId = account.projectsViewParentId.projectId;
|
|
63
|
-
if (result[projectId] == null) {
|
|
64
|
-
result[projectId] = [];
|
|
65
|
-
}
|
|
66
|
-
result[projectId].push(account.accountId);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
return result;
|
|
70
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { from, of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { updateSectionProjectView } from '../../entity/sectionProjectView/sectionProjectViewReducer';
|
|
4
|
-
import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
|
|
5
|
-
import { fetchProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectViewFailure, } from './profitAndLossProjectViewReducer';
|
|
6
|
-
export const fetchProfitAndLossForTimeframeProjectViewEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchProfitAndLossForTimeframeProjectView.match), mergeMap((action) => {
|
|
7
|
-
const getTimeSeriesGroup = (timeframe) => {
|
|
8
|
-
switch (timeframe) {
|
|
9
|
-
case 'month':
|
|
10
|
-
return 'months';
|
|
11
|
-
case 'quarter':
|
|
12
|
-
return 'quarters';
|
|
13
|
-
case 'year':
|
|
14
|
-
return 'years';
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const queryValue = {
|
|
18
|
-
is_full_response: action.payload.fetchFullReport,
|
|
19
|
-
time_series_groups: [getTimeSeriesGroup(action.payload.timeframe)],
|
|
20
|
-
is_group_by_project: true,
|
|
21
|
-
};
|
|
22
|
-
return zeniAPI
|
|
23
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/2.0/reports/profit_and_loss?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
|
|
24
|
-
.pipe(mergeMap((response) => {
|
|
25
|
-
if (response.data != null && isSuccessResponse(response)) {
|
|
26
|
-
const actions = [];
|
|
27
|
-
const report = response.data.report;
|
|
28
|
-
const currency = report.currency;
|
|
29
|
-
actions.push(updateSectionProjectView(action.payload.timeframe, 'cogs', 'profit_and_loss_by_projects', report.cogs, report.accounts, currency));
|
|
30
|
-
actions.push(updateSectionProjectView(action.payload.timeframe, 'expenses', 'profit_and_loss_by_projects', report.expenses, report.accounts, currency));
|
|
31
|
-
actions.push(updateSectionProjectView(action.payload.timeframe, 'income', 'profit_and_loss_by_projects', report.income, report.accounts, currency));
|
|
32
|
-
actions.push(updateSectionProjectView(action.payload.timeframe, 'otherExpenses', 'profit_and_loss_by_projects', report.other_expenses, report.accounts, currency));
|
|
33
|
-
actions.push(updateSectionProjectView(action.payload.timeframe, 'otherIncome', 'profit_and_loss_by_projects', report.other_income, report.accounts, currency));
|
|
34
|
-
actions.push(updateProfitAndLossForTimeframeProjectView({
|
|
35
|
-
timeframe: action.payload.timeframe,
|
|
36
|
-
report: response.data,
|
|
37
|
-
}));
|
|
38
|
-
return from(actions);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
return of(updateProfitAndLossForTimeframeProjectViewFailure(response.status, action.payload.timeframe));
|
|
42
|
-
}
|
|
43
|
-
}), catchError((error) => of(updateProfitAndLossForTimeframeProjectViewFailure(createZeniAPIStatus('Unexpected Error', 'P&L by Projects REST API call errored out' +
|
|
44
|
-
JSON.stringify(error)), action.payload.timeframe))));
|
|
45
|
-
}));
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { filter, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { fetchProfitAndLossForTimeframeProjectView, fetchProfitAndLossProjectView, } from './profitAndLossProjectViewReducer';
|
|
4
|
-
export const fetchProfitAndLossProjectViewEpic = (actions$, state) => actions$.pipe(filter(fetchProfitAndLossProjectView.match), switchMap((action) => {
|
|
5
|
-
const { cacheOverride } = action.payload;
|
|
6
|
-
if (cacheOverride === true) {
|
|
7
|
-
return from([
|
|
8
|
-
fetchProfitAndLossForTimeframeProjectView('month'),
|
|
9
|
-
fetchProfitAndLossForTimeframeProjectView('quarter'),
|
|
10
|
-
fetchProfitAndLossForTimeframeProjectView('year'),
|
|
11
|
-
]);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
const fetchActions = [];
|
|
15
|
-
const projectFetchState = state.value.profitAndLossProjectViewState.fetchState;
|
|
16
|
-
if (projectFetchState['month'].fetchState !== 'In-Progress' &&
|
|
17
|
-
projectFetchState['month'].fetchState !== 'Completed') {
|
|
18
|
-
fetchActions.push(fetchProfitAndLossForTimeframeProjectView('month'));
|
|
19
|
-
}
|
|
20
|
-
if (projectFetchState['quarter'].fetchState !== 'In-Progress' &&
|
|
21
|
-
projectFetchState['quarter'].fetchState !== 'Completed') {
|
|
22
|
-
fetchActions.push(fetchProfitAndLossForTimeframeProjectView('quarter'));
|
|
23
|
-
}
|
|
24
|
-
if (projectFetchState['year'].fetchState !== 'In-Progress' &&
|
|
25
|
-
projectFetchState['year'].fetchState !== 'Completed') {
|
|
26
|
-
fetchActions.push(fetchProfitAndLossForTimeframeProjectView('year'));
|
|
27
|
-
}
|
|
28
|
-
return from(fetchActions);
|
|
29
|
-
}
|
|
30
|
-
}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { mapReportPayloadV2ToReportV2 } from '../../commonPayloadTypes/v2/viewAndReportPayloadv2';
|
|
3
|
-
export const initialState = {
|
|
4
|
-
bookCloseDate: undefined,
|
|
5
|
-
fetchState: {
|
|
6
|
-
month: {
|
|
7
|
-
fetchState: 'Not-Started',
|
|
8
|
-
error: undefined,
|
|
9
|
-
},
|
|
10
|
-
quarter: {
|
|
11
|
-
fetchState: 'Not-Started',
|
|
12
|
-
error: undefined,
|
|
13
|
-
},
|
|
14
|
-
year: {
|
|
15
|
-
fetchState: 'Not-Started',
|
|
16
|
-
error: undefined,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
firstMonthOfFY: 1,
|
|
20
|
-
projectIds: [],
|
|
21
|
-
reportId: 'profit_and_loss_by_projects',
|
|
22
|
-
reportTitle: 'profit_and_loss_by_projects',
|
|
23
|
-
uiState: {
|
|
24
|
-
accountViewMode: 'project',
|
|
25
|
-
nodeCollapseState: {},
|
|
26
|
-
projectsToFilterOut: [],
|
|
27
|
-
scrollPosition: undefined,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
const profitAndLossProjectView = createSlice({
|
|
31
|
-
name: 'profitAndLossProjectView',
|
|
32
|
-
initialState,
|
|
33
|
-
reducers: {
|
|
34
|
-
fetchProfitAndLossProjectView: {
|
|
35
|
-
prepare(cacheOverride = false) {
|
|
36
|
-
return { payload: { cacheOverride } };
|
|
37
|
-
},
|
|
38
|
-
reducer(
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
40
|
-
_draft,
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
42
|
-
_action) {
|
|
43
|
-
// nothing to do here
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
fetchProfitAndLossForTimeframeProjectView: {
|
|
47
|
-
prepare(timeframe, fetchFullReport = true, cacheOverride = false) {
|
|
48
|
-
return { payload: { timeframe, fetchFullReport, cacheOverride } };
|
|
49
|
-
},
|
|
50
|
-
reducer(draft, action) {
|
|
51
|
-
const timeframe = action.payload.timeframe;
|
|
52
|
-
draft.fetchState[timeframe].fetchState = 'In-Progress';
|
|
53
|
-
draft.fetchState[timeframe].error = undefined;
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
updateProfitAndLossForTimeframeProjectView(draft, action) {
|
|
57
|
-
doUpdateProfitAndLossProjectView(draft, action.payload.timeframe, action.payload.report);
|
|
58
|
-
},
|
|
59
|
-
updateProfitAndLossForTimeframeProjectViewFailure: {
|
|
60
|
-
prepare(error, timeframe) {
|
|
61
|
-
return {
|
|
62
|
-
payload: {
|
|
63
|
-
error,
|
|
64
|
-
timeframe,
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
reducer(draft, action) {
|
|
69
|
-
draft.fetchState[action.payload.timeframe] = {
|
|
70
|
-
fetchState: 'Error',
|
|
71
|
-
error: action.payload.error,
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
updateProjectsToFilterOut(draft, action) {
|
|
76
|
-
draft.uiState.projectsToFilterOut = action.payload.projectsToFilterOut;
|
|
77
|
-
},
|
|
78
|
-
updateProfitAndLossProjectViewUIState(draft, action) {
|
|
79
|
-
const { nodeCollapseState, scrollPosition } = action.payload;
|
|
80
|
-
if (nodeCollapseState != null) {
|
|
81
|
-
draft.uiState.nodeCollapseState = Object.assign({}, draft.uiState.nodeCollapseState, {
|
|
82
|
-
[nodeCollapseState.nodeId]: nodeCollapseState.isCollapsed,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
if (scrollPosition != null) {
|
|
86
|
-
draft.uiState.scrollPosition = scrollPosition;
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
updateProjectViewAccountViewMode(draft, action) {
|
|
90
|
-
draft.uiState.accountViewMode = action.payload.viewMode;
|
|
91
|
-
},
|
|
92
|
-
resetProfitAndLossProjectNodeCollapseState(draft) {
|
|
93
|
-
draft.uiState.nodeCollapseState = {};
|
|
94
|
-
},
|
|
95
|
-
clearProfitAndLossProjectView(draft) {
|
|
96
|
-
Object.assign(draft, initialState);
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
export const { fetchProfitAndLossProjectView, fetchProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectView, updateProfitAndLossForTimeframeProjectViewFailure, updateProjectsToFilterOut, updateProfitAndLossProjectViewUIState, updateProjectViewAccountViewMode, resetProfitAndLossProjectNodeCollapseState, clearProfitAndLossProjectView, } = profitAndLossProjectView.actions;
|
|
101
|
-
export default profitAndLossProjectView.reducer;
|
|
102
|
-
const doUpdateProfitAndLossProjectView = (draft, timeframe, pandLReport) => {
|
|
103
|
-
const report = mapReportPayloadV2ToReportV2(pandLReport.report);
|
|
104
|
-
draft.currency = report.currency;
|
|
105
|
-
draft.dataAvailable = report.dataAvailable;
|
|
106
|
-
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
107
|
-
draft.bookCloseDate = report.bookCloseDate;
|
|
108
|
-
draft.status = report.status;
|
|
109
|
-
draft.fetchState[timeframe].fetchState = 'Completed';
|
|
110
|
-
if (draft.projectIds.length <= 0) {
|
|
111
|
-
draft.projectIds = pandLReport.report.projects.map((project) => project.zeni_project_id);
|
|
112
|
-
}
|
|
113
|
-
};
|