@pega/react-sdk-overrides 0.23.6
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/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.css +19 -0
- package/lib/designSystemExtensions/CaseSummaryFields/CaseSummaryFields.tsx +156 -0
- package/lib/designSystemExtensions/CaseSummaryFields/index.tsx +1 -0
- package/lib/designSystemExtensions/DetailsFields/DetailsFields.tsx +154 -0
- package/lib/designSystemExtensions/DetailsFields/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldGroup/FieldGroup.tsx +113 -0
- package/lib/designSystemExtensions/FieldGroup/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldGroupList/FieldGroupList.tsx +53 -0
- package/lib/designSystemExtensions/FieldGroupList/index.tsx +1 -0
- package/lib/designSystemExtensions/FieldValueList/FieldValueList.tsx +106 -0
- package/lib/designSystemExtensions/FieldValueList/index.tsx +1 -0
- package/lib/designSystemExtensions/Operator/Operator.tsx +195 -0
- package/lib/designSystemExtensions/Operator/index.tsx +1 -0
- package/lib/designSystemExtensions/Pulse/Pulse.tsx +31 -0
- package/lib/designSystemExtensions/Pulse/index.tsx +1 -0
- package/lib/forms/AutoComplete/AutoComplete.tsx +183 -0
- package/lib/forms/AutoComplete/index.tsx +1 -0
- package/lib/forms/CancelAlert/CancelAlert.css +24 -0
- package/lib/forms/CancelAlert/CancelAlert.tsx +126 -0
- package/lib/forms/CancelAlert/index.tsx +1 -0
- package/lib/forms/Checkbox/Checkbox.tsx +68 -0
- package/lib/forms/Checkbox/index.tsx +1 -0
- package/lib/forms/Currency/Currency.tsx +89 -0
- package/lib/forms/Currency/index.tsx +1 -0
- package/lib/forms/Date/Date.tsx +79 -0
- package/lib/forms/Date/index.tsx +1 -0
- package/lib/forms/DateTime/DateTime.tsx +75 -0
- package/lib/forms/DateTime/index.tsx +1 -0
- package/lib/forms/Decimal/Decimal.tsx +51 -0
- package/lib/forms/Decimal/index.tsx +1 -0
- package/lib/forms/Dropdown/Dropdown.tsx +82 -0
- package/lib/forms/Dropdown/index.tsx +1 -0
- package/lib/forms/Email/Email.tsx +68 -0
- package/lib/forms/Email/index.tsx +1 -0
- package/lib/forms/Integer/Integer.tsx +77 -0
- package/lib/forms/Integer/index.tsx +1 -0
- package/lib/forms/Percentage/Percentage.tsx +82 -0
- package/lib/forms/Percentage/index.tsx +1 -0
- package/lib/forms/Phone/Phone.tsx +90 -0
- package/lib/forms/Phone/index.tsx +1 -0
- package/lib/forms/RadioButtons/RadioButtons.tsx +73 -0
- package/lib/forms/RadioButtons/index.tsx +1 -0
- package/lib/forms/SemanticLink/SemanticLink.tsx +69 -0
- package/lib/forms/SemanticLink/index.tsx +1 -0
- package/lib/forms/SemanticLink/utils.ts +51 -0
- package/lib/forms/TextArea/TextArea.tsx +66 -0
- package/lib/forms/TextArea/index.tsx +1 -0
- package/lib/forms/TextContent/TextContent.tsx +40 -0
- package/lib/forms/TextContent/index.tsx +1 -0
- package/lib/forms/TextInput/TextInput.tsx +61 -0
- package/lib/forms/TextInput/index.tsx +1 -0
- package/lib/forms/Time/Time.tsx +71 -0
- package/lib/forms/Time/index.tsx +1 -0
- package/lib/forms/URL/URL.tsx +53 -0
- package/lib/forms/URL/index.tsx +1 -0
- package/lib/forms/UserReference/UserReference.tsx +197 -0
- package/lib/forms/UserReference/UserReferenceUtils.ts +13 -0
- package/lib/forms/UserReference/index.tsx +1 -0
- package/lib/helpers/auth.js +483 -0
- package/lib/helpers/authManager.js +630 -0
- package/lib/helpers/config_access.js +268 -0
- package/lib/helpers/data_page.ts +24 -0
- package/lib/helpers/event-utils.js +20 -0
- package/lib/helpers/field-group-utils.js +61 -0
- package/lib/helpers/formatters/Boolean.js +38 -0
- package/lib/helpers/formatters/Currency.js +74 -0
- package/lib/helpers/formatters/CurrencyMap.js +908 -0
- package/lib/helpers/formatters/Date.js +77 -0
- package/lib/helpers/formatters/common.js +10 -0
- package/lib/helpers/formatters/index.js +120 -0
- package/lib/helpers/utils.ts +334 -0
- package/lib/helpers/versionHelpers.ts +50 -0
- package/lib/infra/ActionButtons/ActionButtons.tsx +70 -0
- package/lib/infra/ActionButtons/index.tsx +1 -0
- package/lib/infra/Assignment/Assignment.tsx +301 -0
- package/lib/infra/Assignment/index.tsx +1 -0
- package/lib/infra/AssignmentCard/AssignmentCard.tsx +47 -0
- package/lib/infra/AssignmentCard/index.tsx +1 -0
- package/lib/infra/Attachment/Attachment.css +18 -0
- package/lib/infra/Attachment/Attachment.tsx +404 -0
- package/lib/infra/Attachment/AttachmentUtils.js +71 -0
- package/lib/infra/Attachment/index.tsx +1 -0
- package/lib/infra/Containers/FlowContainer/FlowContainer.tsx +511 -0
- package/lib/infra/Containers/FlowContainer/helpers.js +147 -0
- package/lib/infra/Containers/FlowContainer/index.tsx +1 -0
- package/lib/infra/Containers/ModalViewContainer/ModalViewContainer.tsx +320 -0
- package/lib/infra/Containers/ModalViewContainer/index.tsx +1 -0
- package/lib/infra/Containers/ViewContainer/ViewContainer.tsx +216 -0
- package/lib/infra/Containers/ViewContainer/index.tsx +1 -0
- package/lib/infra/DashboardFilter/DashboardFilter.tsx +180 -0
- package/lib/infra/DashboardFilter/filterUtils.tsx +188 -0
- package/lib/infra/DashboardFilter/index.tsx +1 -0
- package/lib/infra/DeferLoad/DeferLoad.tsx +175 -0
- package/lib/infra/DeferLoad/index.tsx +1 -0
- package/lib/infra/ErrorBoundary/ErrorBoundary.tsx +103 -0
- package/lib/infra/ErrorBoundary/index.tsx +1 -0
- package/lib/infra/MultiStep/MultiStep.css +261 -0
- package/lib/infra/MultiStep/MultiStep.tsx +225 -0
- package/lib/infra/MultiStep/index.tsx +1 -0
- package/lib/infra/NavBar/NavBar.css +170 -0
- package/lib/infra/NavBar/NavBar.tsx +393 -0
- package/lib/infra/NavBar/index.tsx +1 -0
- package/lib/infra/Reference/Reference.tsx +58 -0
- package/lib/infra/Reference/index.tsx +1 -0
- package/lib/infra/Region/Region.tsx +17 -0
- package/lib/infra/Region/index.tsx +1 -0
- package/lib/infra/RootContainer/RootContainer.tsx +336 -0
- package/lib/infra/RootContainer/index.tsx +1 -0
- package/lib/infra/Stages/Stages.tsx +120 -0
- package/lib/infra/Stages/index.tsx +1 -0
- package/lib/infra/ToDo/ToDo.css +87 -0
- package/lib/infra/ToDo/ToDo.tsx +285 -0
- package/lib/infra/ToDo/index.tsx +1 -0
- package/lib/infra/VerticalTabs/LeftAlignVerticalTab.tsx +27 -0
- package/lib/infra/VerticalTabs/VerticalTabs.tsx +75 -0
- package/lib/infra/VerticalTabs/index.tsx +1 -0
- package/lib/infra/View/View.css +8 -0
- package/lib/infra/View/View.tsx +175 -0
- package/lib/infra/View/index.tsx +1 -0
- package/lib/templates/AppShell/AppShell.css +40 -0
- package/lib/templates/AppShell/AppShell.tsx +439 -0
- package/lib/templates/AppShell/index.tsx +1 -0
- package/lib/templates/CaseSummary/CaseSummary.tsx +50 -0
- package/lib/templates/CaseSummary/index.tsx +1 -0
- package/lib/templates/CaseView/CaseView.tsx +261 -0
- package/lib/templates/CaseView/CaseViewActionsMenu.tsx +73 -0
- package/lib/templates/CaseView/index.tsx +1 -0
- package/lib/templates/DataReference/DataReference.tsx +290 -0
- package/lib/templates/DataReference/index.tsx +1 -0
- package/lib/templates/DefaultForm/DefaultForm.css +25 -0
- package/lib/templates/DefaultForm/DefaultForm.tsx +52 -0
- package/lib/templates/DefaultForm/index.tsx +1 -0
- package/lib/templates/Details/Details/Details.tsx +35 -0
- package/lib/templates/Details/Details/index.tsx +1 -0
- package/lib/templates/Details/DetailsSubTabs/DetailsSubTabs.tsx +65 -0
- package/lib/templates/Details/DetailsSubTabs/index.tsx +1 -0
- package/lib/templates/Details/DetailsThreeColumn/DetailsThreeColumn.tsx +45 -0
- package/lib/templates/Details/DetailsThreeColumn/index.tsx +1 -0
- package/lib/templates/Details/DetailsTwoColumn/DetailsTwoColumn.tsx +43 -0
- package/lib/templates/Details/DetailsTwoColumn/index.tsx +1 -0
- package/lib/templates/FieldGroupTemplate/FieldGroupTemplate.tsx +94 -0
- package/lib/templates/FieldGroupTemplate/index.tsx +1 -0
- package/lib/templates/InlineDashboard/InlineDashboard.tsx +72 -0
- package/lib/templates/InlineDashboard/index.tsx +1 -0
- package/lib/templates/InlineDashboardPage/InlineDashboardPage.tsx +41 -0
- package/lib/templates/InlineDashboardPage/index.tsx +1 -0
- package/lib/templates/ListPage/ListPage.tsx +20 -0
- package/lib/templates/ListPage/index.tsx +1 -0
- package/lib/templates/ListView/ListView.css +10 -0
- package/lib/templates/ListView/ListView.tsx +1230 -0
- package/lib/templates/ListView/index.tsx +1 -0
- package/lib/templates/MultiReferenceReadOnly/MultiReferenceReadOnly.tsx +42 -0
- package/lib/templates/MultiReferenceReadOnly/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWide/NarrowWide.css +21 -0
- package/lib/templates/NarrowWide/NarrowWide/NarrowWide.tsx +35 -0
- package/lib/templates/NarrowWide/NarrowWide/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWideDetails/NarrowWideDetails.tsx +53 -0
- package/lib/templates/NarrowWide/NarrowWideDetails/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.css +21 -0
- package/lib/templates/NarrowWide/NarrowWideForm/NarrowWideForm.tsx +24 -0
- package/lib/templates/NarrowWide/NarrowWideForm/index.tsx +1 -0
- package/lib/templates/NarrowWide/NarrowWidePage/NarrowWidePage.tsx +38 -0
- package/lib/templates/NarrowWide/NarrowWidePage/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumn/OneColumn.tsx +32 -0
- package/lib/templates/OneColumn/OneColumn/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumnPage/OneColumnPage.tsx +24 -0
- package/lib/templates/OneColumn/OneColumnPage/index.tsx +1 -0
- package/lib/templates/OneColumn/OneColumnTab/OneColumnTab.tsx +17 -0
- package/lib/templates/OneColumn/OneColumnTab/index.tsx +1 -0
- package/lib/templates/PromotedFilters/PromotedFilters.css +7 -0
- package/lib/templates/PromotedFilters/PromotedFilters.tsx +160 -0
- package/lib/templates/PromotedFilters/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTable/SimpleTable.tsx +28 -0
- package/lib/templates/SimpleTable/SimpleTable/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTableManual/SimpleTableManual.tsx +719 -0
- package/lib/templates/SimpleTable/SimpleTableManual/index.tsx +1 -0
- package/lib/templates/SimpleTable/SimpleTableSelect/SimpleTableSelect.tsx +129 -0
- package/lib/templates/SimpleTable/SimpleTableSelect/index.tsx +1 -0
- package/lib/templates/SimpleTable/helpers.ts +360 -0
- package/lib/templates/SingleReferenceReadOnly/SingleReferenceReadOnly.tsx +66 -0
- package/lib/templates/SingleReferenceReadOnly/index.tsx +1 -0
- package/lib/templates/SubTabs/SubTabs.tsx +65 -0
- package/lib/templates/SubTabs/index.tsx +1 -0
- package/lib/templates/SubTabs/tabUtils.ts +73 -0
- package/lib/templates/TwoColumn/TwoColumn/TwoColumn.css +13 -0
- package/lib/templates/TwoColumn/TwoColumn/TwoColumn.tsx +58 -0
- package/lib/templates/TwoColumn/TwoColumn/index.tsx +1 -0
- package/lib/templates/TwoColumn/TwoColumnPage/TwoColumnPage.tsx +25 -0
- package/lib/templates/TwoColumn/TwoColumnPage/index.tsx +1 -0
- package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.css +12 -0
- package/lib/templates/TwoColumn/TwoColumnTab/TwoColumnTab.tsx +55 -0
- package/lib/templates/TwoColumn/TwoColumnTab/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrow/WideNarrow.css +21 -0
- package/lib/templates/WideNarrow/WideNarrow/WideNarrow.tsx +35 -0
- package/lib/templates/WideNarrow/WideNarrow/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowDetails/WideNarrowDetails.tsx +54 -0
- package/lib/templates/WideNarrow/WideNarrowDetails/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.css +21 -0
- package/lib/templates/WideNarrow/WideNarrowForm/WideNarrowForm.tsx +24 -0
- package/lib/templates/WideNarrow/WideNarrowForm/index.tsx +1 -0
- package/lib/templates/WideNarrow/WideNarrowPage/WideNarrowPage.tsx +38 -0
- package/lib/templates/WideNarrow/WideNarrowPage/index.tsx +1 -0
- package/lib/templates/utils.ts +23 -0
- package/lib/widgets/AppAnnouncement/AppAnnouncement.tsx +67 -0
- package/lib/widgets/AppAnnouncement/index.tsx +1 -0
- package/lib/widgets/CaseHistory/CaseHistory.tsx +169 -0
- package/lib/widgets/CaseHistory/index.tsx +1 -0
- package/lib/widgets/FileUtility/ActionButtonsForFileUtil.css +27 -0
- package/lib/widgets/FileUtility/ActionButtonsForFileUtil.tsx +22 -0
- package/lib/widgets/FileUtility/FileUtility.css +117 -0
- package/lib/widgets/FileUtility/FileUtility.tsx +567 -0
- package/lib/widgets/FileUtility/index.tsx +0 -0
- package/lib/widgets/Followers/Followers.tsx +43 -0
- package/lib/widgets/Followers/index.tsx +1 -0
- package/lib/widgets/SummaryItem/SummaryItem.css +78 -0
- package/lib/widgets/SummaryItem/SummaryItem.tsx +80 -0
- package/lib/widgets/SummaryItem/index.tsx +1 -0
- package/lib/widgets/SummaryList/SummaryList.tsx +12 -0
- package/lib/widgets/SummaryList/index.tsx +1 -0
- package/package.json +14 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import AssignmentCard from '@pega/react-sdk-components/lib/components/infra/AssignmentCard';
|
|
5
|
+
import MultiStep from '@pega/react-sdk-components/lib/components/infra/MultiStep';
|
|
6
|
+
import Snackbar from '@material-ui/core/Snackbar';
|
|
7
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
8
|
+
import CloseIcon from '@material-ui/icons/Close';
|
|
9
|
+
|
|
10
|
+
declare const PCore: any;
|
|
11
|
+
|
|
12
|
+
export default function Assignment(props) {
|
|
13
|
+
const { getPConnect, children, itemKey, isCreateStage } = props;
|
|
14
|
+
const thePConn = getPConnect();
|
|
15
|
+
|
|
16
|
+
const [bHasNavigation, setHasNavigation] = useState(false);
|
|
17
|
+
const [actionButtons, setActionButtons] = useState( {} );
|
|
18
|
+
const [bIsVertical, setIsVertical] = useState(false);
|
|
19
|
+
const [arCurrentStepIndicies, setArCurrentStepIndicies] = useState<Array<any>>([]);
|
|
20
|
+
const [arNavigationSteps, setArNavigationSteps] = useState<Array<any>>([]);
|
|
21
|
+
|
|
22
|
+
const actionsAPI = thePConn.getActionsApi();
|
|
23
|
+
|
|
24
|
+
// store off bound functions to above pointers
|
|
25
|
+
const finishAssignment = actionsAPI.finishAssignment.bind(actionsAPI);
|
|
26
|
+
const navigateToStep = actionsAPI.navigateToStep.bind(actionsAPI);
|
|
27
|
+
const cancelAssignment = actionsAPI.cancelAssignment.bind(actionsAPI);
|
|
28
|
+
const saveAssignment = actionsAPI.saveAssignment?.bind(actionsAPI);
|
|
29
|
+
const cancelCreateStageAssignment = actionsAPI.cancelCreateStageAssignment.bind(actionsAPI);
|
|
30
|
+
// const showPage = actionsAPI.showPage.bind(actionsAPI);
|
|
31
|
+
|
|
32
|
+
const [showSnackbar, setShowSnackbar] = useState(false);
|
|
33
|
+
const [snackbarMessage, setSnackbarMessage] = useState("");
|
|
34
|
+
|
|
35
|
+
function findCurrentIndicies(arStepperSteps: Array<any>, arIndicies: Array<number>, depth: number) : Array<number> {
|
|
36
|
+
|
|
37
|
+
let count = 0;
|
|
38
|
+
arStepperSteps.forEach( (step) => {
|
|
39
|
+
if (step.visited_status === "current") {
|
|
40
|
+
arIndicies[depth] = count;
|
|
41
|
+
|
|
42
|
+
// add in
|
|
43
|
+
step["step_status"] = "";
|
|
44
|
+
}
|
|
45
|
+
else if (step.visited_status === "success") {
|
|
46
|
+
count += 1;
|
|
47
|
+
step.step_status = "completed"
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
count += 1;
|
|
51
|
+
step.step_status = "";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (step.steps) {
|
|
55
|
+
arIndicies = findCurrentIndicies(step.steps, arIndicies, depth + 1)
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return arIndicies;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
useEffect( ()=> {
|
|
64
|
+
|
|
65
|
+
if (children && children.length > 0) {
|
|
66
|
+
|
|
67
|
+
// debugger;
|
|
68
|
+
|
|
69
|
+
const oWorkItem = children[0].props.getPConnect();
|
|
70
|
+
const oWorkData = oWorkItem.getDataObject();
|
|
71
|
+
const oData = thePConn.getDataObject();
|
|
72
|
+
|
|
73
|
+
if (oWorkData?.caseInfo && oWorkData.caseInfo.assignments !== null) {
|
|
74
|
+
const oCaseInfo = oData.caseInfo;
|
|
75
|
+
|
|
76
|
+
if (oCaseInfo && oCaseInfo.actionButtons) {
|
|
77
|
+
setActionButtons(oCaseInfo.actionButtons);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if ( oCaseInfo?.navigation /* was oCaseInfo.navigation != null */) {
|
|
81
|
+
setHasNavigation(true);
|
|
82
|
+
|
|
83
|
+
if (oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === "standard") {
|
|
84
|
+
setHasNavigation(false);
|
|
85
|
+
}
|
|
86
|
+
else if (oCaseInfo.navigation.template && oCaseInfo.navigation.template.toLowerCase() === "vertical") {
|
|
87
|
+
setIsVertical(true);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
setIsVertical(false);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
setArNavigationSteps(JSON.parse(JSON.stringify(oCaseInfo.navigation.steps)));
|
|
94
|
+
setArCurrentStepIndicies(findCurrentIndicies(arNavigationSteps, arCurrentStepIndicies, 0));
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
}, [children]);
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
function showToast(message: string) {
|
|
107
|
+
const theMessage = `Assignment: ${message}`;
|
|
108
|
+
// eslint-disable-next-line no-console
|
|
109
|
+
console.error(theMessage);
|
|
110
|
+
setSnackbarMessage(message);
|
|
111
|
+
setShowSnackbar(true);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
function handleSnackbarClose(event: React.SyntheticEvent | React.MouseEvent, reason?: string) {
|
|
116
|
+
if (reason === 'clickaway') {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
setShowSnackbar(false);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
function onSaveActionSuccess(data) {
|
|
123
|
+
actionsAPI.cancelAssignment(itemKey).then(() => {
|
|
124
|
+
PCore.getPubSubUtils().publish(PCore.getConstants().PUB_SUB_EVENTS.CASE_EVENTS.CREATE_STAGE_SAVED, data);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function buttonPress(sAction: string, sButtonType: string) {
|
|
129
|
+
|
|
130
|
+
if (sButtonType === "secondary") {
|
|
131
|
+
|
|
132
|
+
switch (sAction) {
|
|
133
|
+
case "navigateToStep": {
|
|
134
|
+
const navigatePromise = navigateToStep( "previous", itemKey );
|
|
135
|
+
|
|
136
|
+
navigatePromise
|
|
137
|
+
.then(() => {
|
|
138
|
+
})
|
|
139
|
+
.catch(() => {
|
|
140
|
+
showToast( `Navigation failed!`);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
case "saveAssignment": {
|
|
147
|
+
const caseID = thePConn.getCaseInfo().getKey();
|
|
148
|
+
const assignmentID = thePConn.getCaseInfo().getAssignmentID();
|
|
149
|
+
const savePromise = saveAssignment(itemKey);
|
|
150
|
+
|
|
151
|
+
savePromise
|
|
152
|
+
.then(() => {
|
|
153
|
+
const caseType = thePConn.getCaseInfo().c11nEnv.getValue(PCore.getConstants().CASE_INFO.CASE_TYPE_ID);
|
|
154
|
+
onSaveActionSuccess({ caseType, caseID, assignmentID });
|
|
155
|
+
})
|
|
156
|
+
.catch(() => {
|
|
157
|
+
showToast('Save failed');
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
case "cancelAssignment": {
|
|
164
|
+
// check if create stage (modal)
|
|
165
|
+
const { PUB_SUB_EVENTS } = PCore.getConstants();
|
|
166
|
+
const { publish } = PCore.getPubSubUtils();
|
|
167
|
+
if (isCreateStage) {
|
|
168
|
+
const cancelPromise = cancelCreateStageAssignment(itemKey);
|
|
169
|
+
|
|
170
|
+
cancelPromise
|
|
171
|
+
.then(data => {
|
|
172
|
+
publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
|
|
173
|
+
})
|
|
174
|
+
.catch(() => {
|
|
175
|
+
showToast(`Cancel failed!`);
|
|
176
|
+
});
|
|
177
|
+
} else {
|
|
178
|
+
const cancelPromise = cancelAssignment(itemKey);
|
|
179
|
+
|
|
180
|
+
cancelPromise
|
|
181
|
+
.then(data => {
|
|
182
|
+
publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
|
|
183
|
+
})
|
|
184
|
+
.catch(() => {
|
|
185
|
+
showToast(`Cancel failed!`);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
default:
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else if (sButtonType === "primary") {
|
|
196
|
+
// eslint-disable-next-line sonarjs/no-small-switch
|
|
197
|
+
switch (sAction) {
|
|
198
|
+
case "finishAssignment" :
|
|
199
|
+
{
|
|
200
|
+
const finishPromise = finishAssignment(itemKey);
|
|
201
|
+
|
|
202
|
+
finishPromise
|
|
203
|
+
.then(() => {
|
|
204
|
+
})
|
|
205
|
+
.catch(() => {
|
|
206
|
+
showToast( `Submit failed!`);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
default:
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
return (
|
|
221
|
+
<div id="Assignment">
|
|
222
|
+
{ bHasNavigation ?
|
|
223
|
+
<React.Fragment>
|
|
224
|
+
<MultiStep getPConnect={getPConnect} itemKey={itemKey} actionButtons={actionButtons} onButtonPress={buttonPress}
|
|
225
|
+
bIsVertical={bIsVertical} arCurrentStepIndicies={arCurrentStepIndicies} arNavigationSteps={arNavigationSteps}>
|
|
226
|
+
{children}
|
|
227
|
+
</MultiStep>
|
|
228
|
+
<Snackbar
|
|
229
|
+
open={showSnackbar}
|
|
230
|
+
autoHideDuration={3000}
|
|
231
|
+
onClose={handleSnackbarClose}
|
|
232
|
+
message={snackbarMessage}
|
|
233
|
+
action={
|
|
234
|
+
<IconButton size="small" aria-label="close" color="inherit" onClick={handleSnackbarClose}>
|
|
235
|
+
<CloseIcon fontSize="small" />
|
|
236
|
+
</IconButton>
|
|
237
|
+
}
|
|
238
|
+
/>
|
|
239
|
+
</React.Fragment>
|
|
240
|
+
: (
|
|
241
|
+
<React.Fragment>
|
|
242
|
+
<AssignmentCard getPConnect={getPConnect} itemKey={itemKey} actionButtons={actionButtons} onButtonPress={buttonPress} >
|
|
243
|
+
{children}
|
|
244
|
+
</AssignmentCard>
|
|
245
|
+
<Snackbar
|
|
246
|
+
open={showSnackbar}
|
|
247
|
+
autoHideDuration={3000}
|
|
248
|
+
onClose={handleSnackbarClose}
|
|
249
|
+
message={snackbarMessage}
|
|
250
|
+
action={
|
|
251
|
+
<IconButton size="small" aria-label="close" color="inherit" onClick={handleSnackbarClose}>
|
|
252
|
+
<CloseIcon fontSize="small" />
|
|
253
|
+
</IconButton>
|
|
254
|
+
}
|
|
255
|
+
/>
|
|
256
|
+
</React.Fragment>
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
</div>
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// From WC SDK
|
|
264
|
+
// const aHtml = html`
|
|
265
|
+
// ${this.bHasNavigation?
|
|
266
|
+
// html`
|
|
267
|
+
// <div class="psdk-stepper">
|
|
268
|
+
// <multi-step-component .pConn=${this.pConn} .arChildren=${this.arChildren} itemKey=${this.itemKey}
|
|
269
|
+
// .arMainButtons=${this.arMainButtons} .arSecondaryButtons=${this.arSecondaryButtons}
|
|
270
|
+
// .bIsVertical=${this.bIsVertical} .arCurrentStepIndicies=${this.arCurrentStepIndicies}
|
|
271
|
+
// .arNavigationSteps=${this.arNavigationSteps}
|
|
272
|
+
// @MultiStepActionButtonClick="${this._onActionButtonClick}">
|
|
273
|
+
// </multi-step-component>
|
|
274
|
+
// <lit-toast></lit-toast>
|
|
275
|
+
// </div>`
|
|
276
|
+
// :
|
|
277
|
+
// html`
|
|
278
|
+
// <div>
|
|
279
|
+
// <assignment-card-component .pConn=${this.pConn} .arChildren=${this.arChildren} itemKey=${this.itemKey}
|
|
280
|
+
// .arMainButtons=${this.arMainButtons} .arSecondaryButtons=${this.arSecondaryButtons}
|
|
281
|
+
// @AssignmentActionButtonClick="${this._onActionButtonClick}">
|
|
282
|
+
// </assignment-card-component>
|
|
283
|
+
// <lit-toast></lit-toast>
|
|
284
|
+
// </div>`}
|
|
285
|
+
// `;
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
Assignment.propTypes = {
|
|
289
|
+
children: PropTypes.node.isRequired,
|
|
290
|
+
getPConnect: PropTypes.func.isRequired,
|
|
291
|
+
itemKey: PropTypes.string,
|
|
292
|
+
isCreateStage: PropTypes.bool
|
|
293
|
+
// actionButtons: PropTypes.object
|
|
294
|
+
// buildName: PropTypes.string
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
Assignment.defaultProps = {
|
|
298
|
+
itemKey: null,
|
|
299
|
+
isCreateStage: false
|
|
300
|
+
// buildName: null
|
|
301
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Assignment';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import ActionButtons from "@pega/react-sdk-components/lib/components/infra/ActionButtons";
|
|
5
|
+
|
|
6
|
+
export default function AssignmentCard(props) {
|
|
7
|
+
const { children, actionButtons, onButtonPress} = props;
|
|
8
|
+
|
|
9
|
+
const [arMainButtons, setArMainButtons] = useState([]);
|
|
10
|
+
const [arSecondaryButtons, setArSecondaryButtons] = useState([]);
|
|
11
|
+
|
|
12
|
+
useEffect( ()=> {
|
|
13
|
+
if (actionButtons) {
|
|
14
|
+
setArMainButtons(actionButtons.main);
|
|
15
|
+
setArSecondaryButtons(actionButtons.secondary);
|
|
16
|
+
}
|
|
17
|
+
}, [actionButtons]);
|
|
18
|
+
|
|
19
|
+
function buttonPress(sAction, sType) {
|
|
20
|
+
onButtonPress(sAction, sType);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
{children}
|
|
26
|
+
{
|
|
27
|
+
arMainButtons && arSecondaryButtons && <ActionButtons arMainButtons={arMainButtons} arSecondaryButtons={arSecondaryButtons} onButtonPress={buttonPress}></ActionButtons>
|
|
28
|
+
}
|
|
29
|
+
</>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
AssignmentCard.propTypes = {
|
|
34
|
+
children: PropTypes.node.isRequired,
|
|
35
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
36
|
+
getPConnect: PropTypes.func.isRequired,
|
|
37
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
38
|
+
itemKey: PropTypes.string,
|
|
39
|
+
actionButtons: PropTypes.object,
|
|
40
|
+
onButtonPress: PropTypes.func
|
|
41
|
+
// buildName: PropTypes.string
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
AssignmentCard.defaultProps = {
|
|
45
|
+
itemKey: null,
|
|
46
|
+
// buildName: null
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './AssignmentCard';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.label {
|
|
2
|
+
display: block;
|
|
3
|
+
margin-bottom: 10px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.file-div {
|
|
7
|
+
border: 1px dashed #262626;
|
|
8
|
+
width: 100%;
|
|
9
|
+
padding: 0.5rem;
|
|
10
|
+
text-align: center;
|
|
11
|
+
position: relative;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.progress-div {
|
|
15
|
+
text-align: center;
|
|
16
|
+
position: absolute;
|
|
17
|
+
left: 47%;
|
|
18
|
+
}
|