@zeniai/client-epic-state 5.1.66 → 5.1.68-beta0GS
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/approvalRule/approvalRuleState.d.ts +1 -0
- package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.d.ts +1 -0
- package/lib/entity/entityApprovalStatus/entityApprovalStatusPayload.js +1 -0
- package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +1 -0
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
- package/lib/entity/tenant/clearAllEpic.js +2 -0
- package/lib/epic.d.ts +6 -3
- package/lib/epic.js +6 -3
- package/lib/esm/entity/entityApprovalStatus/entityApprovalStatusPayload.js +1 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -0
- package/lib/esm/epic.js +6 -3
- package/lib/esm/index.js +7 -4
- package/lib/esm/reducer.js +3 -0
- package/lib/esm/view/invoicing/createInvoice/createInvoiceReducer.js +15 -1
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +5 -1
- package/lib/esm/view/invoicing/createInvoice/epics/fetchCreateInvoiceFormPageEpic.js +50 -0
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +0 -1
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.js +21 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRulesEpic.js +20 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesPayload.js +1 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesReducer.js +76 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesSelector.js +9 -0
- package/lib/esm/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesState.js +1 -0
- package/lib/esm/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +76 -37
- package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +14 -17
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +1 -3
- package/lib/esm/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +0 -14
- package/lib/esm/view/spendManagement/helpers.js +14 -0
- package/lib/esm/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.js +42 -17
- package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +14 -17
- package/lib/index.d.ts +9 -4
- package/lib/index.js +58 -49
- package/lib/reducer.d.ts +3 -0
- package/lib/reducer.js +3 -0
- package/lib/view/invoicing/createInvoice/createInvoiceReducer.d.ts +5 -1
- package/lib/view/invoicing/createInvoice/createInvoiceReducer.js +16 -2
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +1 -0
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +5 -1
- package/lib/view/invoicing/createInvoice/epics/fetchCreateInvoiceFormPageEpic.d.ts +15 -0
- package/lib/view/invoicing/createInvoice/epics/fetchCreateInvoiceFormPageEpic.js +54 -0
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +0 -1
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.d.ts +7 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/fetchJEScheduleApprovalRulesEpic.js +25 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRulesEpic.d.ts +6 -0
- package/lib/view/settings/jeScheduleApprovalRules/epic/saveJEScheduleApprovalRulesEpic.js +24 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesPayload.d.ts +29 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesPayload.js +2 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesReducer.d.ts +16 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesReducer.js +80 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesSelector.d.ts +12 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesSelector.js +12 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesState.d.ts +8 -0
- package/lib/view/settings/jeScheduleApprovalRules/jeScheduleApprovalRulesState.js +2 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +3 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +75 -36
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +13 -16
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +1 -3
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.d.ts +1 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +0 -14
- package/lib/view/spendManagement/helpers.d.ts +5 -1
- package/lib/view/spendManagement/helpers.js +18 -1
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +2 -0
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.js +41 -16
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +13 -16
- package/package.json +1 -1
|
@@ -5,6 +5,10 @@ import { CreateInvoiceState, InvoicingCreateInvoiceFormLocalData } from './creat
|
|
|
5
5
|
export declare const initialState: CreateInvoiceState;
|
|
6
6
|
export declare const createInvoice: import("@reduxjs/toolkit").ActionCreatorWithPayload<CreateInvoiceRequest, "invoicingCreateInvoice/createInvoice">, createInvoiceSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
7
7
|
invoiceId: ID;
|
|
8
|
-
}, "invoicingCreateInvoice/createInvoiceSuccess">, createInvoiceFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCreateInvoice/createInvoiceFailure">,
|
|
8
|
+
}, "invoicingCreateInvoice/createInvoiceSuccess">, createInvoiceFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCreateInvoice/createInvoiceFailure">, fetchCreateInvoiceFormPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
|
|
9
|
+
cacheOverride: boolean;
|
|
10
|
+
}], {
|
|
11
|
+
cacheOverride: boolean;
|
|
12
|
+
}, "invoicingCreateInvoice/fetchCreateInvoiceFormPage", never, never>, resetCreateInvoice: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCreateInvoice/resetCreateInvoice">, updateInvoicingCreateInvoiceFormDraft: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingCreateInvoiceFormLocalData, "invoicingCreateInvoice/updateInvoicingCreateInvoiceFormDraft">;
|
|
9
13
|
declare const _default: import("redux").Reducer<CreateInvoiceState>;
|
|
10
14
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateInvoicingCreateInvoiceFormDraft = exports.resetCreateInvoice = exports.createInvoiceFailure = exports.createInvoiceSuccess = exports.createInvoice = exports.initialState = void 0;
|
|
4
|
+
exports.updateInvoicingCreateInvoiceFormDraft = exports.resetCreateInvoice = exports.fetchCreateInvoiceFormPage = exports.createInvoiceFailure = exports.createInvoiceSuccess = exports.createInvoice = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const createInvoiceFormConfig_1 = require("./createInvoiceFormConfig");
|
|
7
7
|
exports.initialState = {
|
|
@@ -18,6 +18,20 @@ const createInvoiceSlice = (0, toolkit_1.createSlice)({
|
|
|
18
18
|
name: 'invoicingCreateInvoice',
|
|
19
19
|
initialState: exports.initialState,
|
|
20
20
|
reducers: {
|
|
21
|
+
/**
|
|
22
|
+
* Trigger-only action for {@link fetchCreateInvoiceFormPageEpic}: fans out to
|
|
23
|
+
* the customer/plan/product/settings fetches, skipping any already cached
|
|
24
|
+
* unless `cacheOverride` is set. Holds no state of its own.
|
|
25
|
+
*/
|
|
26
|
+
fetchCreateInvoiceFormPage: {
|
|
27
|
+
reducer() {
|
|
28
|
+
// No state mutation; fetchCreateInvoiceFormPageEpic fans out to the
|
|
29
|
+
// customer/plan/product/settings fetches in response to this action.
|
|
30
|
+
},
|
|
31
|
+
prepare(payload) {
|
|
32
|
+
return { payload };
|
|
33
|
+
},
|
|
34
|
+
},
|
|
21
35
|
updateInvoicingCreateInvoiceFormDraft(draft, action) {
|
|
22
36
|
draft.formDraft = action.payload;
|
|
23
37
|
},
|
|
@@ -41,5 +55,5 @@ const createInvoiceSlice = (0, toolkit_1.createSlice)({
|
|
|
41
55
|
},
|
|
42
56
|
},
|
|
43
57
|
});
|
|
44
|
-
_a = createInvoiceSlice.actions, exports.createInvoice = _a.createInvoice, exports.createInvoiceSuccess = _a.createInvoiceSuccess, exports.createInvoiceFailure = _a.createInvoiceFailure, exports.resetCreateInvoice = _a.resetCreateInvoice, exports.updateInvoicingCreateInvoiceFormDraft = _a.updateInvoicingCreateInvoiceFormDraft;
|
|
58
|
+
_a = createInvoiceSlice.actions, exports.createInvoice = _a.createInvoice, exports.createInvoiceSuccess = _a.createInvoiceSuccess, exports.createInvoiceFailure = _a.createInvoiceFailure, exports.fetchCreateInvoiceFormPage = _a.fetchCreateInvoiceFormPage, exports.resetCreateInvoice = _a.resetCreateInvoice, exports.updateInvoicingCreateInvoiceFormDraft = _a.updateInvoicingCreateInvoiceFormDraft;
|
|
45
59
|
exports.default = createInvoiceSlice.reducer;
|
|
@@ -8,6 +8,7 @@ import { InvoicingCreateInvoiceFormLocalData } from './createInvoiceState';
|
|
|
8
8
|
export interface CreateInvoiceFormView extends SelectorView {
|
|
9
9
|
customers: InvoicingCustomer[];
|
|
10
10
|
localData: InvoicingCreateInvoiceFormLocalData;
|
|
11
|
+
planNames: string[];
|
|
11
12
|
plans: InvoicingProduct[];
|
|
12
13
|
products: InvoicingProduct[];
|
|
13
14
|
savedInvoiceId?: ID;
|
|
@@ -15,10 +15,14 @@ const settingsViewSelector_1 = require("../settingsView/settingsViewSelector");
|
|
|
15
15
|
const getCreateInvoiceFormView = (state) => {
|
|
16
16
|
const createInvoiceState = state.invoicingCreateInvoiceState;
|
|
17
17
|
const catalogListView = (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogListView)(state);
|
|
18
|
+
const plans = (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogPrices)(catalogListView.plans);
|
|
18
19
|
return {
|
|
19
20
|
customers: (0, invoicingCustomerListViewSelector_1.getInvoicingCustomerListView)(state).customers,
|
|
20
21
|
localData: createInvoiceState.formDraft,
|
|
21
|
-
|
|
22
|
+
planNames: plans
|
|
23
|
+
.map((plan) => plan.name ?? '')
|
|
24
|
+
.filter((name) => name !== ''),
|
|
25
|
+
plans,
|
|
22
26
|
products: (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogPrices)(catalogListView.products),
|
|
23
27
|
savedInvoiceId: createInvoiceState.createdInvoiceId,
|
|
24
28
|
settings: (0, settingsViewSelector_1.getInvoicingSettings)(state),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { fetchInvoicingCatalogPlanList, fetchInvoicingCatalogProductList } from '../../invoicingCatalogListView/invoicingCatalogListViewReducer';
|
|
5
|
+
import { fetchInvoicingCustomerList } from '../../invoicingCustomerListView/invoicingCustomerListViewReducer';
|
|
6
|
+
import { fetchInvoicingSettings } from '../../settingsView/settingsViewReducer';
|
|
7
|
+
import { fetchCreateInvoiceFormPage } from '../createInvoiceReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof fetchCreateInvoiceFormPage> | ReturnType<typeof fetchInvoicingCustomerList> | ReturnType<typeof fetchInvoicingCatalogPlanList> | ReturnType<typeof fetchInvoicingCatalogProductList> | ReturnType<typeof fetchInvoicingSettings>;
|
|
9
|
+
/**
|
|
10
|
+
* Orchestrates the create-invoice form's option sources: on
|
|
11
|
+
* `fetchCreateInvoiceFormPage`, fans out to the customer, catalog plan, catalog
|
|
12
|
+
* product and settings fetches, skipping any already cached unless
|
|
13
|
+
* `cacheOverride` is set.
|
|
14
|
+
*/
|
|
15
|
+
export declare const fetchCreateInvoiceFormPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchCreateInvoiceFormPageEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const invoicingCatalogListViewReducer_1 = require("../../invoicingCatalogListView/invoicingCatalogListViewReducer");
|
|
7
|
+
const invoicingCustomerListViewReducer_1 = require("../../invoicingCustomerListView/invoicingCustomerListViewReducer");
|
|
8
|
+
const settingsViewReducer_1 = require("../../settingsView/settingsViewReducer");
|
|
9
|
+
const createInvoiceReducer_1 = require("../createInvoiceReducer");
|
|
10
|
+
/**
|
|
11
|
+
* Fetch unless the resource is already loaded or in flight — or always when the
|
|
12
|
+
* caller forces a refresh via `cacheOverride` (false on a plain page open, true
|
|
13
|
+
* to force a reload).
|
|
14
|
+
*/
|
|
15
|
+
const shouldFetch = (fetchStateAndError, cacheOverride) => cacheOverride ||
|
|
16
|
+
(fetchStateAndError.fetchState !== 'Completed' &&
|
|
17
|
+
fetchStateAndError.fetchState !== 'In-Progress');
|
|
18
|
+
/**
|
|
19
|
+
* Orchestrates the create-invoice form's option sources: on
|
|
20
|
+
* `fetchCreateInvoiceFormPage`, fans out to the customer, catalog plan, catalog
|
|
21
|
+
* product and settings fetches, skipping any already cached unless
|
|
22
|
+
* `cacheOverride` is set.
|
|
23
|
+
*/
|
|
24
|
+
const fetchCreateInvoiceFormPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(createInvoiceReducer_1.fetchCreateInvoiceFormPage.match), (0, operators_1.mergeMap)((action) => {
|
|
25
|
+
const { cacheOverride } = action.payload;
|
|
26
|
+
const state = state$.value;
|
|
27
|
+
const customerState = state.invoicingCustomerListViewState;
|
|
28
|
+
const catalogState = state.invoicingCatalogListViewState;
|
|
29
|
+
const settingsState = state.invoicingSettingsViewState;
|
|
30
|
+
const pageActions = [];
|
|
31
|
+
if (shouldFetch({ fetchState: customerState.fetchState, error: customerState.error }, cacheOverride)) {
|
|
32
|
+
pageActions.push((0, invoicingCustomerListViewReducer_1.fetchInvoicingCustomerList)({
|
|
33
|
+
filters: {},
|
|
34
|
+
keepExistingListItems: false,
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
if (shouldFetch({ fetchState: catalogState.fetchState, error: catalogState.error }, cacheOverride)) {
|
|
38
|
+
pageActions.push((0, invoicingCatalogListViewReducer_1.fetchInvoicingCatalogPlanList)({
|
|
39
|
+
filters: { type: 'plan' },
|
|
40
|
+
keepExistingListItems: false,
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
if (shouldFetch(catalogState.productFetchState, cacheOverride)) {
|
|
44
|
+
pageActions.push((0, invoicingCatalogListViewReducer_1.fetchInvoicingCatalogProductList)({
|
|
45
|
+
filters: { type: 'addon|charge' },
|
|
46
|
+
keepExistingListItems: false,
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
if (shouldFetch({ fetchState: settingsState.fetchState, error: settingsState.error }, cacheOverride)) {
|
|
50
|
+
pageActions.push((0, settingsViewReducer_1.fetchInvoicingSettings)());
|
|
51
|
+
}
|
|
52
|
+
return (0, rxjs_1.from)(pageActions);
|
|
53
|
+
}));
|
|
54
|
+
exports.fetchCreateInvoiceFormPageEpic = fetchCreateInvoiceFormPageEpic;
|
package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js
CHANGED
|
@@ -12,7 +12,6 @@ const localDataToSaveInvoicingCouponPayload = (localData, isCreate) => {
|
|
|
12
12
|
discount_type: localData.discountType,
|
|
13
13
|
duration_type: localData.durationType,
|
|
14
14
|
name: localData.name.trim(),
|
|
15
|
-
status: 'active',
|
|
16
15
|
};
|
|
17
16
|
if (isCreate) {
|
|
18
17
|
data.id = localData.couponId.trim();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
+
import { fetchJEScheduleApprovalRules, fetchJEScheduleApprovalRulesFailure, fetchJEScheduleApprovalRulesSuccess } from '../jeScheduleApprovalRulesReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof fetchJEScheduleApprovalRules> | ReturnType<typeof fetchJEScheduleApprovalRulesSuccess> | ReturnType<typeof fetchJEScheduleApprovalRulesFailure>;
|
|
7
|
+
export declare const fetchJEScheduleApprovalRulesEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchJEScheduleApprovalRulesEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const jeScheduleApprovalRulesReducer_1 = require("../jeScheduleApprovalRulesReducer");
|
|
8
|
+
const fetchJEScheduleApprovalRulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeScheduleApprovalRulesReducer_1.fetchJEScheduleApprovalRules.match), (0, operators_1.switchMap)((action) => {
|
|
9
|
+
const { cacheOverride } = action.payload;
|
|
10
|
+
const { jeScheduleApprovalRulesState } = state$.value;
|
|
11
|
+
const cachedSettings = jeScheduleApprovalRulesState.settings;
|
|
12
|
+
if (cacheOverride !== true &&
|
|
13
|
+
jeScheduleApprovalRulesState.hasValidState() === true &&
|
|
14
|
+
cachedSettings != null) {
|
|
15
|
+
return (0, rxjs_1.of)((0, jeScheduleApprovalRulesReducer_1.fetchJEScheduleApprovalRulesSuccess)(cachedSettings));
|
|
16
|
+
}
|
|
17
|
+
const endpoint = `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/je-schedules/approval-rules`;
|
|
18
|
+
return zeniAPI.getJSON(endpoint).pipe((0, operators_1.mergeMap)((response) => {
|
|
19
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
20
|
+
return (0, rxjs_1.of)((0, jeScheduleApprovalRulesReducer_1.fetchJEScheduleApprovalRulesSuccess)(response.data.settings));
|
|
21
|
+
}
|
|
22
|
+
return (0, rxjs_1.of)((0, jeScheduleApprovalRulesReducer_1.fetchJEScheduleApprovalRulesFailure)(response.status));
|
|
23
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, jeScheduleApprovalRulesReducer_1.fetchJEScheduleApprovalRulesFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch JE approval rules errored out' + JSON.stringify(error))))));
|
|
24
|
+
}));
|
|
25
|
+
exports.fetchJEScheduleApprovalRulesEpic = fetchJEScheduleApprovalRulesEpic;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActionsObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
4
|
+
import { saveJEScheduleApprovalRules, saveJEScheduleApprovalRulesConflict, saveJEScheduleApprovalRulesFailure, saveJEScheduleApprovalRulesSuccess } from '../jeScheduleApprovalRulesReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof saveJEScheduleApprovalRules> | ReturnType<typeof saveJEScheduleApprovalRulesSuccess> | ReturnType<typeof saveJEScheduleApprovalRulesConflict> | ReturnType<typeof saveJEScheduleApprovalRulesFailure>;
|
|
6
|
+
export declare const saveJEScheduleApprovalRulesEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveJEScheduleApprovalRulesEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const jeScheduleApprovalRulesReducer_1 = require("../jeScheduleApprovalRulesReducer");
|
|
8
|
+
const HTTP_CONFLICT = 409;
|
|
9
|
+
const saveJEScheduleApprovalRulesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeScheduleApprovalRulesReducer_1.saveJEScheduleApprovalRules.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
+
const { body } = action.payload;
|
|
11
|
+
const endpoint = `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/je-schedules/approval-rules`;
|
|
12
|
+
return zeniAPI
|
|
13
|
+
.postAndGetJSON(endpoint, body)
|
|
14
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
16
|
+
return (0, rxjs_1.of)((0, jeScheduleApprovalRulesReducer_1.saveJEScheduleApprovalRulesSuccess)(response.data.settings, response.data.reevaluation_triggered));
|
|
17
|
+
}
|
|
18
|
+
if (response.status.code === HTTP_CONFLICT) {
|
|
19
|
+
return (0, rxjs_1.of)((0, jeScheduleApprovalRulesReducer_1.saveJEScheduleApprovalRulesConflict)(response.status));
|
|
20
|
+
}
|
|
21
|
+
return (0, rxjs_1.of)((0, jeScheduleApprovalRulesReducer_1.saveJEScheduleApprovalRulesFailure)(response.status));
|
|
22
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, jeScheduleApprovalRulesReducer_1.saveJEScheduleApprovalRulesFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save JE approval rules errored out' + JSON.stringify(error))))));
|
|
23
|
+
}));
|
|
24
|
+
exports.saveJEScheduleApprovalRulesEpic = saveJEScheduleApprovalRulesEpic;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
2
|
+
export type JEScheduleType = 'prepaid_expenses' | 'fixed_assets' | 'accrued_expenses';
|
|
3
|
+
export interface JEApprovalThresholdRow {
|
|
4
|
+
account_id: string;
|
|
5
|
+
account_name: string;
|
|
6
|
+
max_auto_post_amount: number | null;
|
|
7
|
+
schedule_type: JEScheduleType;
|
|
8
|
+
}
|
|
9
|
+
export interface JEApprovalSettings {
|
|
10
|
+
approver_roles: string[];
|
|
11
|
+
reevaluate_ongoing_on_threshold_change: boolean;
|
|
12
|
+
thresholds: JEApprovalThresholdRow[];
|
|
13
|
+
version: number;
|
|
14
|
+
}
|
|
15
|
+
export interface JEScheduleApprovalRulesResponseData {
|
|
16
|
+
exists: boolean;
|
|
17
|
+
settings: JEApprovalSettings;
|
|
18
|
+
}
|
|
19
|
+
export type JEScheduleApprovalRulesResponse = ZeniAPIResponse<JEScheduleApprovalRulesResponseData>;
|
|
20
|
+
export interface SaveJEScheduleApprovalRulesResponseData extends JEScheduleApprovalRulesResponseData {
|
|
21
|
+
reevaluation_triggered: boolean;
|
|
22
|
+
}
|
|
23
|
+
export type SaveJEScheduleApprovalRulesResponse = ZeniAPIResponse<SaveJEScheduleApprovalRulesResponseData>;
|
|
24
|
+
export interface SaveJEScheduleApprovalRulesRequestBody extends Record<string, unknown> {
|
|
25
|
+
approver_roles: string[];
|
|
26
|
+
reevaluate_ongoing_on_threshold_change: boolean;
|
|
27
|
+
thresholds: JEApprovalThresholdRow[];
|
|
28
|
+
expected_version?: number;
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
2
|
+
import { JEApprovalSettings, SaveJEScheduleApprovalRulesRequestBody } from './jeScheduleApprovalRulesPayload';
|
|
3
|
+
import { JEScheduleApprovalRulesState } from './jeScheduleApprovalRulesState';
|
|
4
|
+
export declare const initialState: JEScheduleApprovalRulesState;
|
|
5
|
+
export declare const fetchJEScheduleApprovalRules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any], {
|
|
6
|
+
cacheOverride: any;
|
|
7
|
+
}, "jeScheduleApprovalRules/fetchJEScheduleApprovalRules", never, never>, fetchJEScheduleApprovalRulesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[settings: JEApprovalSettings], {
|
|
8
|
+
settings: JEApprovalSettings;
|
|
9
|
+
}, "jeScheduleApprovalRules/fetchJEScheduleApprovalRulesSuccess", never, never>, fetchJEScheduleApprovalRulesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "jeScheduleApprovalRules/fetchJEScheduleApprovalRulesFailure">, saveJEScheduleApprovalRules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[body: SaveJEScheduleApprovalRulesRequestBody], {
|
|
10
|
+
body: SaveJEScheduleApprovalRulesRequestBody;
|
|
11
|
+
}, "jeScheduleApprovalRules/saveJEScheduleApprovalRules", never, never>, saveJEScheduleApprovalRulesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[settings: JEApprovalSettings, reevaluationTriggered: boolean], {
|
|
12
|
+
settings: JEApprovalSettings;
|
|
13
|
+
reevaluationTriggered: boolean;
|
|
14
|
+
}, "jeScheduleApprovalRules/saveJEScheduleApprovalRulesSuccess", never, never>, saveJEScheduleApprovalRulesConflict: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "jeScheduleApprovalRules/saveJEScheduleApprovalRulesConflict">, saveJEScheduleApprovalRulesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "jeScheduleApprovalRules/saveJEScheduleApprovalRulesFailure">, clearJEScheduleApprovalRules: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeScheduleApprovalRules/clearJEScheduleApprovalRules">;
|
|
15
|
+
declare const _default: import("redux").Reducer<JEScheduleApprovalRulesState>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearJEScheduleApprovalRules = exports.saveJEScheduleApprovalRulesFailure = exports.saveJEScheduleApprovalRulesConflict = exports.saveJEScheduleApprovalRulesSuccess = exports.saveJEScheduleApprovalRules = exports.fetchJEScheduleApprovalRulesFailure = exports.fetchJEScheduleApprovalRulesSuccess = exports.fetchJEScheduleApprovalRules = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
exports.initialState = {
|
|
7
|
+
fetchState: 'Not-Started',
|
|
8
|
+
error: undefined,
|
|
9
|
+
saveStatus: { fetchState: 'Not-Started', error: undefined },
|
|
10
|
+
settings: undefined,
|
|
11
|
+
hadVersionConflict: false,
|
|
12
|
+
reevaluationTriggered: false,
|
|
13
|
+
hasValidState() {
|
|
14
|
+
return this.fetchState === 'Completed';
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const jeScheduleApprovalRules = (0, toolkit_1.createSlice)({
|
|
18
|
+
name: 'jeScheduleApprovalRules',
|
|
19
|
+
initialState: exports.initialState,
|
|
20
|
+
reducers: {
|
|
21
|
+
fetchJEScheduleApprovalRules: {
|
|
22
|
+
reducer(draft) {
|
|
23
|
+
draft.fetchState = 'In-Progress';
|
|
24
|
+
draft.error = undefined;
|
|
25
|
+
},
|
|
26
|
+
prepare(cacheOverride = false) {
|
|
27
|
+
return { payload: { cacheOverride } };
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
fetchJEScheduleApprovalRulesSuccess: {
|
|
31
|
+
reducer(draft, action) {
|
|
32
|
+
draft.fetchState = 'Completed';
|
|
33
|
+
draft.error = undefined;
|
|
34
|
+
draft.settings = action.payload.settings;
|
|
35
|
+
},
|
|
36
|
+
prepare(settings) {
|
|
37
|
+
return { payload: { settings } };
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
fetchJEScheduleApprovalRulesFailure(draft, action) {
|
|
41
|
+
draft.fetchState = 'Error';
|
|
42
|
+
draft.error = action.payload;
|
|
43
|
+
},
|
|
44
|
+
saveJEScheduleApprovalRules: {
|
|
45
|
+
reducer(draft) {
|
|
46
|
+
draft.saveStatus = { fetchState: 'In-Progress', error: undefined };
|
|
47
|
+
draft.hadVersionConflict = false;
|
|
48
|
+
draft.reevaluationTriggered = false;
|
|
49
|
+
},
|
|
50
|
+
prepare(body) {
|
|
51
|
+
return { payload: { body } };
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
saveJEScheduleApprovalRulesSuccess: {
|
|
55
|
+
reducer(draft, action) {
|
|
56
|
+
draft.saveStatus = { fetchState: 'Completed', error: undefined };
|
|
57
|
+
draft.settings = action.payload.settings;
|
|
58
|
+
draft.reevaluationTriggered = action.payload.reevaluationTriggered;
|
|
59
|
+
draft.hadVersionConflict = false;
|
|
60
|
+
},
|
|
61
|
+
prepare(settings, reevaluationTriggered) {
|
|
62
|
+
return { payload: { settings, reevaluationTriggered } };
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
// 409 — the stored version moved under us. The screen should re-fetch and
|
|
66
|
+
// ask the user to re-apply. Kept distinct from a generic save failure.
|
|
67
|
+
saveJEScheduleApprovalRulesConflict(draft, action) {
|
|
68
|
+
draft.saveStatus = { fetchState: 'Error', error: action.payload };
|
|
69
|
+
draft.hadVersionConflict = true;
|
|
70
|
+
},
|
|
71
|
+
saveJEScheduleApprovalRulesFailure(draft, action) {
|
|
72
|
+
draft.saveStatus = { fetchState: 'Error', error: action.payload };
|
|
73
|
+
},
|
|
74
|
+
clearJEScheduleApprovalRules() {
|
|
75
|
+
return exports.initialState;
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
_a = jeScheduleApprovalRules.actions, exports.fetchJEScheduleApprovalRules = _a.fetchJEScheduleApprovalRules, exports.fetchJEScheduleApprovalRulesSuccess = _a.fetchJEScheduleApprovalRulesSuccess, exports.fetchJEScheduleApprovalRulesFailure = _a.fetchJEScheduleApprovalRulesFailure, exports.saveJEScheduleApprovalRules = _a.saveJEScheduleApprovalRules, exports.saveJEScheduleApprovalRulesSuccess = _a.saveJEScheduleApprovalRulesSuccess, exports.saveJEScheduleApprovalRulesConflict = _a.saveJEScheduleApprovalRulesConflict, exports.saveJEScheduleApprovalRulesFailure = _a.saveJEScheduleApprovalRulesFailure, exports.clearJEScheduleApprovalRules = _a.clearJEScheduleApprovalRules;
|
|
80
|
+
exports.default = jeScheduleApprovalRules.reducer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
|
+
import { RootState } from '../../../reducer';
|
|
3
|
+
import { JEApprovalSettings } from './jeScheduleApprovalRulesPayload';
|
|
4
|
+
export interface JEScheduleApprovalRulesView {
|
|
5
|
+
error: FetchStateAndError['error'];
|
|
6
|
+
fetchState: FetchState;
|
|
7
|
+
hadVersionConflict: boolean;
|
|
8
|
+
reevaluationTriggered: boolean;
|
|
9
|
+
saveStatus: FetchStateAndError;
|
|
10
|
+
settings?: JEApprovalSettings;
|
|
11
|
+
}
|
|
12
|
+
export declare const getJEScheduleApprovalRulesView: (state: RootState) => JEScheduleApprovalRulesView;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getJEScheduleApprovalRulesView = void 0;
|
|
4
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
+
exports.getJEScheduleApprovalRulesView = (0, toolkit_1.createSelector)((state) => state.jeScheduleApprovalRulesState, (jeScheduleApprovalRulesState) => ({
|
|
6
|
+
fetchState: jeScheduleApprovalRulesState.fetchState,
|
|
7
|
+
error: jeScheduleApprovalRulesState.error,
|
|
8
|
+
saveStatus: jeScheduleApprovalRulesState.saveStatus,
|
|
9
|
+
settings: jeScheduleApprovalRulesState.settings,
|
|
10
|
+
hadVersionConflict: jeScheduleApprovalRulesState.hadVersionConflict ?? false,
|
|
11
|
+
reevaluationTriggered: jeScheduleApprovalRulesState.reevaluationTriggered ?? false,
|
|
12
|
+
}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FetchStateAndError, FetchedState } from '../../../commonStateTypes/common';
|
|
2
|
+
import { JEApprovalSettings } from './jeScheduleApprovalRulesPayload';
|
|
3
|
+
export interface JEScheduleApprovalRulesState extends FetchedState {
|
|
4
|
+
saveStatus: FetchStateAndError;
|
|
5
|
+
hadVersionConflict?: boolean;
|
|
6
|
+
reevaluationTriggered?: boolean;
|
|
7
|
+
settings?: JEApprovalSettings;
|
|
8
|
+
}
|
|
@@ -54,6 +54,7 @@ export interface BillDetailViewSelector extends SelectorView {
|
|
|
54
54
|
export interface StepWithStatus extends StepWithUser {
|
|
55
55
|
actorsActivity: ActorActivityWithUser[];
|
|
56
56
|
isOriginalApprovalStep: boolean;
|
|
57
|
+
displayPendingApproverAsAdmin?: boolean;
|
|
57
58
|
}
|
|
58
59
|
export interface ActorActivityWithUser {
|
|
59
60
|
activity: ActivityStatus;
|
|
@@ -62,6 +63,7 @@ export interface ActorActivityWithUser {
|
|
|
62
63
|
type: string;
|
|
63
64
|
userId: ID;
|
|
64
65
|
actor?: User;
|
|
66
|
+
isImplicitActor?: boolean;
|
|
65
67
|
lastUpdateTime?: ZeniDate;
|
|
66
68
|
subType?: string;
|
|
67
69
|
}
|
|
@@ -77,6 +79,7 @@ export interface BillActivity {
|
|
|
77
79
|
currentPendingStepIndex?: number;
|
|
78
80
|
entityApprovalId?: ID;
|
|
79
81
|
isAdminFallbackApprover?: boolean;
|
|
82
|
+
sodExcludedApproverUserId?: ID;
|
|
80
83
|
}
|
|
81
84
|
export declare const getBillActivities: (state: RootState, billId: ID, billStageCode?: BillStageCodeType) => BillActivity[];
|
|
82
85
|
export declare const getBillDetailView: (state: RootState, billId: ID) => BillDetailViewSelector;
|
|
@@ -63,7 +63,7 @@ const getBillActivities = (state, billId, billStageCode) => {
|
|
|
63
63
|
const approvalRules = (0, approvalRuleSelector_1.getApprovalRulesByIds)(approvalRuleState, billDetail.approvalRuleIds);
|
|
64
64
|
const entityApprovalStatusByIds = (0, entityApprovalStatusSelector_1.getEntityApprovalStatusByIds)(entityApprovalStatusState, billDetail.entityApprovalIds);
|
|
65
65
|
billActivities = entityApprovalStatusByIds.map((entityApprovalStatus) => {
|
|
66
|
-
const { approvalRuleId, entityType, createTime, updateTime, stepsApprovalStatus, areApprovalsSerialized, isAdminFallbackApprover, isRealTimeApprovalEnabled, currentPendingStepIndex, } = entityApprovalStatus;
|
|
66
|
+
const { approvalRuleId, entityType, createTime, updateTime, stepsApprovalStatus, areApprovalsSerialized, isAdminFallbackApprover, isRealTimeApprovalEnabled, currentPendingStepIndex, sodExcludedApproverUserId, } = entityApprovalStatus;
|
|
67
67
|
const approvalRule = approvalRules.find((rule) => rule.approvalRuleId === approvalRuleId);
|
|
68
68
|
return {
|
|
69
69
|
approvalRuleId,
|
|
@@ -75,21 +75,22 @@ const getBillActivities = (state, billId, billStageCode) => {
|
|
|
75
75
|
isAdminFallbackApprover,
|
|
76
76
|
isRealTimeApprovalEnabled,
|
|
77
77
|
currentPendingStepIndex,
|
|
78
|
+
sodExcludedApproverUserId,
|
|
78
79
|
entityApprovalId: entityApprovalStatus.entityApprovalId,
|
|
79
80
|
stepsWithStatus: stepsApprovalStatus.map((step) => {
|
|
81
|
+
const actorsActivity = step.actorsActivity.map((activity) => ({
|
|
82
|
+
...activity,
|
|
83
|
+
actor: (0, userSelector_1.getUserByUserId)(userState, activity.userId),
|
|
84
|
+
}));
|
|
80
85
|
return {
|
|
81
86
|
...step,
|
|
82
87
|
actors: step.actors
|
|
83
88
|
.map((actor) => (0, userSelector_1.getUserByUserId)(userState, actor.userId))
|
|
84
89
|
.filter((user) => user != null),
|
|
85
90
|
nonUserActors: step.actors.filter((actor) => actor.userId == null && actor.type !== 'user'),
|
|
86
|
-
actorsActivity
|
|
87
|
-
return {
|
|
88
|
-
...activity,
|
|
89
|
-
actor: (0, userSelector_1.getUserByUserId)(userState, activity.userId),
|
|
90
|
-
};
|
|
91
|
-
}),
|
|
91
|
+
actorsActivity,
|
|
92
92
|
isOriginalApprovalStep: step.isOriginalApprovalStep,
|
|
93
|
+
displayPendingApproverAsAdmin: (0, helpers_1.isSodAdminFallbackEligibleForStep)(sodExcludedApproverUserId, isAdminFallbackApprover, actorsActivity),
|
|
93
94
|
};
|
|
94
95
|
}),
|
|
95
96
|
};
|
|
@@ -256,7 +257,7 @@ const checkApproveRejectBtnShow = (billActivities, isUserAdmin, signedInUser) =>
|
|
|
256
257
|
let isMarkAsPaidBtnVisible = false;
|
|
257
258
|
let rejectedId = -1;
|
|
258
259
|
const stepsWithStatusData = billActivities[0].stepsWithStatus;
|
|
259
|
-
const { areApprovalsSerialized, isAdminFallbackApprover, currentPendingStepIndex, } = billActivities[0];
|
|
260
|
+
const { areApprovalsSerialized, isAdminFallbackApprover, currentPendingStepIndex, sodExcludedApproverUserId, } = billActivities[0];
|
|
260
261
|
for (const [index, stepWithStatus] of stepsWithStatusData.entries()) {
|
|
261
262
|
if (stepWithStatus.action === 'require_approval') {
|
|
262
263
|
for (const actorActivity of stepWithStatus.actorsActivity) {
|
|
@@ -297,23 +298,42 @@ const checkApproveRejectBtnShow = (billActivities, isUserAdmin, signedInUser) =>
|
|
|
297
298
|
break;
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
301
|
+
const sodBlocked = (0, helpers_1.isSodExcludedViewerBlocked)(sodExcludedApproverUserId, signedInUser?.userId, pendingStep.actorsActivity);
|
|
302
|
+
if (isAllActivitiesPending) {
|
|
303
|
+
for (const actorActivity of pendingStep.actorsActivity) {
|
|
304
|
+
if (!sodBlocked &&
|
|
305
|
+
actorActivity.actor?.userId === signedInUser?.userId) {
|
|
306
|
+
isApprovalorRejectBtnVisible = true;
|
|
307
|
+
isMarkAsPaidBtnVisible = isLastApprovalStep;
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
305
310
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
actorActivity.
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
311
|
+
}
|
|
312
|
+
if (!isApprovalorRejectBtnVisible) {
|
|
313
|
+
for (const actorActivity of pendingStep.actorsActivity) {
|
|
314
|
+
// admin will be fallback approver if vendor-owner/manager are not assigned any user id
|
|
315
|
+
if (actorActivity.type === 'attribute' &&
|
|
316
|
+
(actorActivity.subType === 'manager' ||
|
|
317
|
+
actorActivity.subType === 'vendor_owner') &&
|
|
318
|
+
actorActivity.userId === null &&
|
|
319
|
+
isAdminFallbackApprover === true &&
|
|
320
|
+
isUserAdmin &&
|
|
321
|
+
signedInUser?.userId != null &&
|
|
322
|
+
signedInUser.userId !== sodExcludedApproverUserId) {
|
|
323
|
+
isApprovalorRejectBtnVisible = true;
|
|
324
|
+
isMarkAsPaidBtnVisible = isLastApprovalStep;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
315
327
|
}
|
|
316
328
|
}
|
|
329
|
+
if (!isApprovalorRejectBtnVisible &&
|
|
330
|
+
isUserAdmin &&
|
|
331
|
+
signedInUser?.userId != null &&
|
|
332
|
+
signedInUser.userId !== sodExcludedApproverUserId &&
|
|
333
|
+
pendingStep.displayPendingApproverAsAdmin === true) {
|
|
334
|
+
isApprovalorRejectBtnVisible = true;
|
|
335
|
+
isMarkAsPaidBtnVisible = isLastApprovalStep;
|
|
336
|
+
}
|
|
317
337
|
}
|
|
318
338
|
}
|
|
319
339
|
}
|
|
@@ -327,23 +347,42 @@ const checkApproveRejectBtnShow = (billActivities, isUserAdmin, signedInUser) =>
|
|
|
327
347
|
break;
|
|
328
348
|
}
|
|
329
349
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
350
|
+
const sodBlocked = (0, helpers_1.isSodExcludedViewerBlocked)(sodExcludedApproverUserId, signedInUser?.userId, stepWithStatus.actorsActivity);
|
|
351
|
+
if (isAllActivitiesPending) {
|
|
352
|
+
for (const actorActivity of stepWithStatus.actorsActivity) {
|
|
353
|
+
if (!sodBlocked &&
|
|
354
|
+
actorActivity.actor?.userId === signedInUser?.userId) {
|
|
355
|
+
isApprovalorRejectBtnVisible = true;
|
|
356
|
+
isMarkAsPaidBtnVisible = true;
|
|
357
|
+
break;
|
|
358
|
+
}
|
|
335
359
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
actorActivity.
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
360
|
+
}
|
|
361
|
+
if (!isApprovalorRejectBtnVisible) {
|
|
362
|
+
for (const actorActivity of stepWithStatus.actorsActivity) {
|
|
363
|
+
// admin will be fallback approver if vendor-owner/manager are not assigned any user id
|
|
364
|
+
if (actorActivity.type === 'attribute' &&
|
|
365
|
+
(actorActivity.subType === 'manager' ||
|
|
366
|
+
actorActivity.subType === 'vendor_owner') &&
|
|
367
|
+
actorActivity.userId === null &&
|
|
368
|
+
isAdminFallbackApprover === true &&
|
|
369
|
+
isUserAdmin &&
|
|
370
|
+
signedInUser?.userId != null &&
|
|
371
|
+
signedInUser.userId !== sodExcludedApproverUserId) {
|
|
372
|
+
isApprovalorRejectBtnVisible = true;
|
|
373
|
+
isMarkAsPaidBtnVisible = true;
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
345
376
|
}
|
|
346
377
|
}
|
|
378
|
+
if (!isApprovalorRejectBtnVisible &&
|
|
379
|
+
isUserAdmin &&
|
|
380
|
+
signedInUser?.userId != null &&
|
|
381
|
+
signedInUser.userId !== sodExcludedApproverUserId &&
|
|
382
|
+
stepWithStatus.displayPendingApproverAsAdmin === true) {
|
|
383
|
+
isApprovalorRejectBtnVisible = true;
|
|
384
|
+
isMarkAsPaidBtnVisible = true;
|
|
385
|
+
}
|
|
347
386
|
}
|
|
348
387
|
if (isApprovalorRejectBtnVisible) {
|
|
349
388
|
break;
|