Skip to content

Commit 512faec

Browse files
vishalshrm539Vishal
andauthored
Add support for Approve and Reject Case (#362)
* Add support for Approve and Reject Case --------- Co-authored-by: Vishal <[email protected]>
1 parent bbe73dd commit 512faec

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

packages/react-sdk-components/src/bridge/react_pconnect.jsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,11 @@ const connectRedux = (component, c11nEnv) => {
9696
}
9797
}
9898

99-
// For CaseSummary (when status === ".pyStatusWork"), we need to compare changes in
100-
// primaryFields and secondary Fields
101-
if (allStateProps.status === '.pyStatusWork') {
102-
for (const key of Object.keys(prev)) {
103-
if (!PCore.isDeepEqual(next[key], prev[key])) {
104-
return false;
105-
}
99+
// status === ".pyStatusWork" condition was not allowing the CaseSummary component to re-render,
100+
// hence got rid of that
101+
for (const key of Object.keys(prev)) {
102+
if (!PCore.isDeepEqual(next[key], prev[key])) {
103+
return false;
106104
}
107105
}
108106
/* TODO For some rawConfig we are not getting routingInfo under allStateProps */

packages/react-sdk-components/src/components/infra/Assignment/Assignment.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
4141
const cancelAssignment = actionsAPI.cancelAssignment.bind(actionsAPI);
4242
const saveAssignment = actionsAPI.saveAssignment?.bind(actionsAPI);
4343
const cancelCreateStageAssignment = actionsAPI.cancelCreateStageAssignment.bind(actionsAPI);
44+
const approveCase = actionsAPI.approveCase?.bind(actionsAPI);
45+
const rejectCase = actionsAPI.rejectCase?.bind(actionsAPI);
4446
// const showPage = actionsAPI.showPage.bind(actionsAPI);
4547

4648
const [showSnackbar, setShowSnackbar] = useState(false);
@@ -212,6 +214,18 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
212214
break;
213215
}
214216

217+
case 'rejectCase': {
218+
const rejectPromise = rejectCase(itemKey);
219+
220+
rejectPromise
221+
.then(() => {})
222+
.catch(() => {
223+
showToast(`${localizedVal('Rejection failed!', localeCategory)}`);
224+
});
225+
226+
break;
227+
}
228+
215229
default:
216230
break;
217231
}
@@ -230,6 +244,18 @@ export default function Assignment(props: PropsWithChildren<AssignmentProps>) {
230244
break;
231245
}
232246

247+
case 'approveCase': {
248+
const approvePromise = approveCase(itemKey);
249+
250+
approvePromise
251+
.then(() => {})
252+
.catch(() => {
253+
showToast(`${localizedVal('Approve failed!', localeCategory)}`);
254+
});
255+
256+
break;
257+
}
258+
233259
default:
234260
break;
235261
}

0 commit comments

Comments
 (0)