amp-workflow-ui 0.1.0 → 0.1.1

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/dist/index.mjs CHANGED
@@ -1,15 +1,16 @@
1
- import React2, { createContext, useState, useEffect, useContext } from 'react';
1
+ import React7, { createContext, useState, useEffect, useContext, useRef } from 'react';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
- import Button2 from '@mui/material/Button';
3
+ import Button7 from '@mui/material/Button';
4
4
  import Dialog from '@mui/material/Dialog';
5
5
  import { useTheme } from '@mui/material/styles';
6
6
  import useMediaQuery from '@mui/material/useMediaQuery';
7
- import DialogActions from '@mui/material/DialogActions';
7
+ import DialogActions5 from '@mui/material/DialogActions';
8
8
  import DialogContent from '@mui/material/DialogContent';
9
- import { styled, Chip, Typography, IconButton, useTheme as useTheme$1, Tooltip, Card, CardContent, Divider, Grid, CircularProgress } from '@mui/material';
9
+ import { styled, Chip, Typography, IconButton, useTheme as useTheme$1, Tooltip, Card, CardContent, Divider, Grid, CircularProgress, Button, Menu, MenuItem, Box as Box$1, DialogTitle, TextField, InputAdornment, DialogActions, FormControl, InputLabel, Select } from '@mui/material';
10
10
  import HighlightOffIcon from '@mui/icons-material/HighlightOff';
11
11
  import { Box } from '@mui/system';
12
12
  import moment from 'moment';
13
+ import toast from 'react-hot-toast';
13
14
 
14
15
  // src/context.tsx
15
16
  var WorkflowContext = createContext(null);
@@ -26,6 +27,333 @@ function useWorkflowContext() {
26
27
  }
27
28
  return ctx;
28
29
  }
30
+ var ActionMenu = ({
31
+ onSendBack,
32
+ onApprove,
33
+ onReject,
34
+ onHold,
35
+ statusList
36
+ }) => {
37
+ const [anchorEl, setAnchorEl] = useState(null);
38
+ const open = Boolean(anchorEl);
39
+ const handleActionClick = (event) => {
40
+ setAnchorEl(event.currentTarget);
41
+ };
42
+ const handleClose = () => setAnchorEl(null);
43
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
44
+ /* @__PURE__ */ jsx(Button, { variant: "contained", color: "primary", onClick: handleActionClick, children: "Apply Action" }),
45
+ /* @__PURE__ */ jsxs(Menu, { anchorEl, open, onClose: handleClose, MenuListProps: { "aria-labelledby": "basic-button" }, children: [
46
+ /* @__PURE__ */ jsx(
47
+ MenuItem,
48
+ {
49
+ onClick: () => {
50
+ onSendBack();
51
+ handleClose();
52
+ },
53
+ children: "Send Back"
54
+ }
55
+ ),
56
+ statusList.map((list) => /* @__PURE__ */ jsx(
57
+ MenuItem,
58
+ {
59
+ onClick: () => {
60
+ if (list.status === 1) onApprove();
61
+ else if (list.status === 2) onHold();
62
+ else if (list.status === 3) onReject();
63
+ handleClose();
64
+ },
65
+ children: list.name
66
+ },
67
+ list.id
68
+ ))
69
+ ] })
70
+ ] });
71
+ };
72
+ var Statusselector_default = ActionMenu;
73
+ function SendBackDialog({ openModal, closeModal, header, workflowLogId }) {
74
+ const { userInfo, api } = useWorkflowContext();
75
+ const [comment, setComment] = useState("");
76
+ const [selectedFile, setSelectedFile] = useState(null);
77
+ const [fileName, setFileName] = useState("");
78
+ const [error, setError] = useState({});
79
+ const [loading, setLoading] = useState(false);
80
+ const [fileLoading, setFileLoading] = useState(false);
81
+ const fileInputRef = useRef(null);
82
+ const handleAttachment = () => {
83
+ var _a;
84
+ return (_a = fileInputRef.current) == null ? void 0 : _a.click();
85
+ };
86
+ const handleUpload = async (file) => {
87
+ setFileLoading(true);
88
+ const formData = new FormData();
89
+ formData.append("file", file);
90
+ try {
91
+ const response = await api.post("/workflow/upload-document", formData, {
92
+ headers: { "Content-Type": "multipart/form-data" }
93
+ });
94
+ setFileName(response.data.file);
95
+ setSelectedFile(response.data.file);
96
+ } catch (error2) {
97
+ toast.error("File upload failed");
98
+ } finally {
99
+ setFileLoading(false);
100
+ }
101
+ };
102
+ const handleFileChange = async (event) => {
103
+ if (event.target.files && event.target.files.length > 0) {
104
+ const file = event.target.files[0];
105
+ await handleUpload(file);
106
+ setError((prev) => ({ ...prev, file: "" }));
107
+ } else {
108
+ setSelectedFile(null);
109
+ setFileName("");
110
+ }
111
+ };
112
+ const validateFields = () => {
113
+ let isValid = true;
114
+ const errors = { comment: "", file: "" };
115
+ if (!comment) {
116
+ errors.comment = "Please enter a comment";
117
+ isValid = false;
118
+ }
119
+ setError(errors);
120
+ return isValid;
121
+ };
122
+ const onSubmit = async () => {
123
+ var _a, _b, _c;
124
+ if (!validateFields()) return;
125
+ setLoading(true);
126
+ try {
127
+ const res = await api.post(`/workflow/send-back/${workflowLogId}`, {
128
+ comment,
129
+ file: selectedFile,
130
+ created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
131
+ });
132
+ if ((res == null ? void 0 : res.status) === 200) toast.success("Successfully sent back!");
133
+ if ((_b = res == null ? void 0 : res.error) == null ? void 0 : _b.message) {
134
+ toast.error((_c = res == null ? void 0 : res.error) == null ? void 0 : _c.message, { duration: 2e3 });
135
+ }
136
+ closeModal && closeModal();
137
+ } catch {
138
+ toast.error("Opps! something went wrong.");
139
+ } finally {
140
+ setLoading(false);
141
+ }
142
+ };
143
+ return /* @__PURE__ */ jsxs(Dialog, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
144
+ /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
145
+ /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
146
+ /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
147
+ ] }),
148
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
149
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
150
+ TextField,
151
+ {
152
+ fullWidth: true,
153
+ label: "Comment",
154
+ value: comment,
155
+ placeholder: "Comment Here",
156
+ onChange: (e) => setComment(e.target.value),
157
+ required: true,
158
+ error: !!error.comment,
159
+ helperText: error.comment
160
+ }
161
+ ) }),
162
+ /* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
163
+ /* @__PURE__ */ jsx(
164
+ TextField,
165
+ {
166
+ type: "text",
167
+ fullWidth: true,
168
+ label: "Attachment",
169
+ placeholder: "Attachment",
170
+ InputProps: {
171
+ endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx("span", { className: "icon-export-1" }) })
172
+ },
173
+ onClick: handleAttachment,
174
+ value: fileName,
175
+ error: !!error.file,
176
+ helperText: error.file
177
+ }
178
+ ),
179
+ /* @__PURE__ */ jsx("input", { type: "file", ref: fileInputRef, style: { display: "none" }, onChange: handleFileChange })
180
+ ] })
181
+ ] }) }) }),
182
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
183
+ /* @__PURE__ */ jsx(Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
184
+ /* @__PURE__ */ jsx(Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading || fileLoading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
185
+ ] }) })
186
+ ] });
187
+ }
188
+ var SendBackDialog_default = SendBackDialog;
189
+ function ApproveDialog({ openModal, closeModal, header, workflowLogId, statusId }) {
190
+ const { userInfo, api } = useWorkflowContext();
191
+ const theme = useTheme();
192
+ useMediaQuery(theme.breakpoints.down("lg"));
193
+ const [comment, setComment] = useState("");
194
+ const [error, setError] = useState({});
195
+ const [loading, setLoading] = useState(false);
196
+ const validateFields = () => {
197
+ let isValid = true;
198
+ const newError = {};
199
+ if (!comment) {
200
+ newError.comment = "Please provide a comment";
201
+ isValid = false;
202
+ }
203
+ setError(newError);
204
+ return isValid;
205
+ };
206
+ const onSubmit = async () => {
207
+ var _a;
208
+ if (!validateFields()) return;
209
+ setLoading(true);
210
+ try {
211
+ await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
212
+ comment,
213
+ created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
214
+ });
215
+ toast.success("approved successfully!!!");
216
+ closeModal && closeModal();
217
+ } catch {
218
+ toast.error("something unexpected occured!!!");
219
+ } finally {
220
+ setLoading(false);
221
+ }
222
+ };
223
+ return /* @__PURE__ */ jsxs(Dialog, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
224
+ /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
225
+ /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
226
+ /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
227
+ ] }),
228
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(TextField, { fullWidth: true, label: "Comment", value: comment, placeholder: "Comment Here", onChange: (e) => setComment(e.target.value), required: true, error: !!error.comment, helperText: error.comment }) }) }) }) }),
229
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
230
+ /* @__PURE__ */ jsx(Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
231
+ /* @__PURE__ */ jsx(Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
232
+ ] }) })
233
+ ] });
234
+ }
235
+ var ApproveDialog_default = ApproveDialog;
236
+ function RejectDialog({ openModal, closeModal, header, workflowLogId, statusId, rejection_reason_master }) {
237
+ const { userInfo, api } = useWorkflowContext();
238
+ const theme = useTheme();
239
+ useMediaQuery(theme.breakpoints.down("lg"));
240
+ const DownArrow = () => {
241
+ var _a;
242
+ return /* @__PURE__ */ jsx("span", { style: { color: ((_a = theme.palette.customColors) == null ? void 0 : _a.mainText) || "#333" }, className: "icon-arrow-down-1" });
243
+ };
244
+ const [rejectReasons, setRejectReasons] = useState("");
245
+ const [comment, setComment] = useState("");
246
+ const [error, setError] = useState({ reason: "", comment: "" });
247
+ const [statusApplicableList, setStatusApplicableList] = useState([]);
248
+ const [loading, setLoading] = useState(false);
249
+ useEffect(() => {
250
+ (async () => {
251
+ var _a;
252
+ try {
253
+ if (!statusApplicableList.length) {
254
+ const res = await api.get(`/workflow/applicableStatuses?type=${rejection_reason_master}`);
255
+ setStatusApplicableList(((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || []);
256
+ }
257
+ } catch (e) {
258
+ }
259
+ })();
260
+ }, []);
261
+ const validateFields = () => {
262
+ let isValid = true;
263
+ const errors = { reason: "", comment: "" };
264
+ if (!rejectReasons) {
265
+ errors.reason = "Please select a reject reason";
266
+ isValid = false;
267
+ }
268
+ if (!comment) {
269
+ errors.comment = "Please enter a comment";
270
+ isValid = false;
271
+ }
272
+ setError(errors);
273
+ return isValid;
274
+ };
275
+ const onSubmit = async () => {
276
+ var _a;
277
+ if (!validateFields()) return;
278
+ setLoading(true);
279
+ try {
280
+ await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
281
+ reason: rejectReasons,
282
+ comment,
283
+ created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
284
+ });
285
+ closeModal && closeModal();
286
+ } catch (e) {
287
+ } finally {
288
+ setLoading(false);
289
+ }
290
+ };
291
+ return /* @__PURE__ */ jsxs(Dialog, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
292
+ /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
293
+ /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
294
+ /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
295
+ ] }),
296
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
297
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, required: true, error: !!error.reason, children: [
298
+ /* @__PURE__ */ jsx(InputLabel, { required: true, id: "reject-reason-label", children: "Reject Reasons" }),
299
+ /* @__PURE__ */ jsx(Select, { IconComponent: DownArrow, label: "Reject Reasons", value: rejectReasons, id: "reject-reason", labelId: "reject-reason-label", onChange: (e) => setRejectReasons(e.target.value), children: statusApplicableList == null ? void 0 : statusApplicableList.map((reason_) => /* @__PURE__ */ jsx(MenuItem, { value: reason_ == null ? void 0 : reason_.id, children: reason_ == null ? void 0 : reason_.name }, reason_ == null ? void 0 : reason_.id)) }),
300
+ error.reason && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "error", children: error.reason })
301
+ ] }) }),
302
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(TextField, { fullWidth: true, label: "Comment", value: comment, placeholder: "Comment Here", onChange: (e) => setComment(e.target.value), required: true, error: !!error.comment, helperText: error.comment }) })
303
+ ] }) }) }),
304
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
305
+ /* @__PURE__ */ jsx(Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
306
+ /* @__PURE__ */ jsx(Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
307
+ ] }) })
308
+ ] });
309
+ }
310
+ var RejectDialog_default = RejectDialog;
311
+ function OnHoldDialog({ openModal, closeModal, header, workflowLogId, statusId }) {
312
+ const { userInfo, api } = useWorkflowContext();
313
+ const theme = useTheme();
314
+ useMediaQuery(theme.breakpoints.down("lg"));
315
+ const [comment, setComment] = useState("");
316
+ const [error, setError] = useState({ comment: "" });
317
+ const [loading, setLoading] = useState(false);
318
+ const validateFields = () => {
319
+ let isValid = true;
320
+ const errors = { comment: "" };
321
+ if (!comment) {
322
+ errors.comment = "Please enter a comment";
323
+ isValid = false;
324
+ }
325
+ setError(errors);
326
+ return isValid;
327
+ };
328
+ const onSubmit = async () => {
329
+ var _a;
330
+ if (!validateFields()) return;
331
+ setLoading(true);
332
+ try {
333
+ await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
334
+ comment,
335
+ created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
336
+ });
337
+ closeModal && closeModal();
338
+ } catch {
339
+ toast.error("Failed to submit the form");
340
+ } finally {
341
+ setLoading(false);
342
+ }
343
+ };
344
+ return /* @__PURE__ */ jsxs(Dialog, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
345
+ /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
346
+ /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
347
+ /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
348
+ ] }),
349
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(TextField, { fullWidth: true, label: "Comment", value: comment, placeholder: "Comment Here", onChange: (e) => setComment(e.target.value), required: true, error: !!error.comment, helperText: error.comment }) }) }) }) }),
350
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
351
+ /* @__PURE__ */ jsx(Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
352
+ /* @__PURE__ */ jsx(Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
353
+ ] }) })
354
+ ] });
355
+ }
356
+ var OnHoldDialog_default = OnHoldDialog;
29
357
  var StyledChipProps = styled(Chip)(({ theme }) => {
30
358
  var _a, _b, _c, _d, _e, _f, _g;
31
359
  return {
@@ -74,10 +402,10 @@ function ApprovalWorkflow({
74
402
  selectedWorkflowsList.length ? "selected" : "Action Required"
75
403
  );
76
404
  const [expandedId, setExpandedId] = useState(null);
77
- const [sendDialog, setSendDialog] = React2.useState(null);
78
- const [approveDialog, setApproveDialog] = React2.useState(null);
79
- const [rejectDialog, setRejectDialog] = React2.useState(null);
80
- const [onHoldDialog, setOnHoldDialog] = React2.useState(null);
405
+ const [sendDialog, setSendDialog] = React7.useState(null);
406
+ const [approveTarget, setApproveTarget] = React7.useState(null);
407
+ const [rejectTarget, setRejectTarget] = React7.useState(null);
408
+ const [onHoldTarget, setOnHoldTarget] = React7.useState(null);
81
409
  const [expandedDetails, setExpandedDetails] = useState([]);
82
410
  const [statusCount, setStatusCount] = useState({});
83
411
  const [urlConfig, setUrlConfig] = useState({});
@@ -161,14 +489,14 @@ function ApprovalWorkflow({
161
489
  });
162
490
  };
163
491
  useEffect(() => {
164
- if (!sendDialog && !approveDialog && !onHoldDialog && !rejectDialog) {
492
+ if (!sendDialog && !approveTarget && !onHoldTarget && !rejectTarget) {
165
493
  fetchAllActivites();
166
494
  fetchStatusCount();
167
495
  fetchPendingActivities();
168
496
  setExpandedDetails([]);
169
497
  setExpandedId(null);
170
498
  }
171
- }, [sendDialog, approveDialog, onHoldDialog, rejectDialog, userInfo]);
499
+ }, [sendDialog, approveTarget, onHoldTarget, rejectTarget, userInfo]);
172
500
  useEffect(() => {
173
501
  api.get({ url: `/workflow/url-config`, serviceURL: "api" }).then((res) => {
174
502
  const data = (res == null ? void 0 : res.data) || [];
@@ -197,434 +525,518 @@ function ApprovalWorkflow({
197
525
  return "#";
198
526
  };
199
527
  if (isLoading && loadingComponent) return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
200
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center", flexWrap: "nowrap" }, children: /* @__PURE__ */ jsxs(Box, { sx: { width: "100%", height: "100%" }, children: [
201
- /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: /* @__PURE__ */ jsxs(Box, { sx: { mt: 2, mb: 2 }, children: [
202
- (selectedWorkflowsList == null ? void 0 : selectedWorkflowsList.length) ? /* @__PURE__ */ jsx(Tooltip, { title: "Selected Workflows", children: /* @__PURE__ */ jsx(
203
- StyledChipProps,
204
- {
205
- label: "Selected",
206
- icon: /* @__PURE__ */ jsx("span", { className: "icon-eye" }),
207
- color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes("selected")) ? "primary" : "default",
208
- variant: "filled",
209
- sx: { mr: 4, mb: 4, "& .MuiChip-icon": { fontSize: "18px !important" } },
210
- onClick: () => handleProfileToggle("selected")
211
- }
212
- ) }) : "",
213
- approvalChipLabel.map(({ label, icon, count }, index) => /* @__PURE__ */ jsx(Tooltip, { title: `${count} ${label}`, children: /* @__PURE__ */ jsx(
214
- StyledChipProps,
215
- {
216
- label: `${count} ${label}`,
217
- icon,
218
- color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes(label)) ? "primary" : "default",
219
- variant: "filled",
220
- sx: { mr: 4, mb: 4, "& .MuiChip-icon": { fontSize: "18px !important" } },
221
- onClick: () => handleProfileToggle(label)
222
- }
223
- ) }, index))
224
- ] }) }),
225
- selectedApprovalOtions === "selected" && /* @__PURE__ */ jsx(Box, { className: "fixedModal", sx: { overflowY: "auto", height: "calc(100vh - 180px)" }, children: selectedRequestArray && selectedRequestArray.map((info, index) => {
226
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H;
227
- const currentLevel = info == null ? void 0 : info.levels.find((level_) => level_.id === (info == null ? void 0 : info.current_level));
228
- currentLevel ? currentLevel.status_list : [];
229
- const redir = buildRedirectionUrl(info);
230
- return /* @__PURE__ */ jsxs(React2.Fragment, { children: [
231
- /* @__PURE__ */ jsx(
232
- Card,
528
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
529
+ /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center", flexWrap: "nowrap" }, children: /* @__PURE__ */ jsxs(Box, { sx: { width: "100%", height: "100%" }, children: [
530
+ /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: /* @__PURE__ */ jsxs(Box, { sx: { mt: 2, mb: 2 }, children: [
531
+ (selectedWorkflowsList == null ? void 0 : selectedWorkflowsList.length) ? /* @__PURE__ */ jsx(Tooltip, { title: "Selected Workflows", children: /* @__PURE__ */ jsx(
532
+ StyledChipProps,
233
533
  {
234
- sx: {
235
- mb: 8,
236
- "&.MuiCard-root.MuiPaper-elevation": {
237
- boxShadow: "2px 2px 10px 0px #4C4E6426",
238
- padding: "20px",
239
- borderRadius: "10px"
240
- }
241
- },
242
- children: /* @__PURE__ */ jsxs(CardContent, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
243
- /* @__PURE__ */ jsxs(Box, { children: [
244
- /* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(TruncatedTypography, { variant: "h6", color: "text.primary", sx: { textTransform: "capitalize", lineHeight: "22px" }, children: info.activity_name }) }),
245
- /* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
246
- TruncatedTypography,
247
- {
248
- variant: "body2",
249
- color: "customColors.mainText",
250
- sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
251
- children: info.description_data
252
- }
253
- ) })
254
- ] }),
255
- /* @__PURE__ */ jsxs(Box, { children: [
256
- /* @__PURE__ */ jsx(Tooltip, { title: "Links", children: /* @__PURE__ */ jsx(
257
- TruncatedTypography,
258
- {
259
- variant: "caption",
260
- color: "customColors.text3",
261
- sx: { textTransform: "capitalize", lineHeight: "13.2px" },
262
- children: "Links"
263
- }
264
- ) }),
265
- /* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx("a", { href: redir, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
266
- TruncatedTypography,
267
- {
268
- variant: "subtitle2",
269
- color: "primary.dark",
270
- sx: { mt: "13px", lineHeight: "15.4px" },
271
- children: redir
272
- }
273
- ) }) })
274
- ] }),
275
- /* @__PURE__ */ jsxs(Box, { children: [
276
- /* @__PURE__ */ jsx(Tooltip, { title: "Attachments", children: /* @__PURE__ */ jsx(
277
- TruncatedTypography,
278
- {
279
- variant: "caption",
280
- color: "customColors.text3",
281
- sx: { textTransform: "capitalize", lineHeight: "13.2px" },
282
- children: "Attachments"
283
- }
284
- ) }),
285
- ((_a = info == null ? void 0 : info.attachment_links) == null ? void 0 : _a.length) ? info == null ? void 0 : info.attachment_links.map((link, idx) => /* @__PURE__ */ jsx(Tooltip, { title: `Attachment ${idx + 1}`, children: /* @__PURE__ */ jsx("a", { href: link, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
286
- TruncatedTypography,
287
- {
288
- variant: "subtitle2",
289
- color: "primary.dark",
290
- sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
291
- children: link || "N/A"
292
- }
293
- ) }) }, idx)) : /* @__PURE__ */ jsx(Box, { sx: { display: "flex", mt: 2, justifyContent: "center", alignItems: "center", lineHeight: "15.4px" }, children: "N/A" })
294
- ] }),
295
- /* @__PURE__ */ jsxs(Box, { children: [
296
- /* @__PURE__ */ jsx(Tooltip, { title: "Date and Time", children: /* @__PURE__ */ jsx(
297
- TruncatedTypography,
298
- {
299
- variant: "caption",
300
- color: "customColors.text3",
301
- sx: { textTransform: "capitalize", lineHeight: "13.2px" },
302
- children: "TAT"
303
- }
304
- ) }),
305
- /* @__PURE__ */ jsx(Tooltip, { title: info.dateTime, children: /* @__PURE__ */ jsx(
306
- TruncatedTypography,
307
- {
308
- variant: "subtitle2",
309
- color: "customColors.mainText",
310
- sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
311
- children: ((_c = (_b = info == null ? void 0 : info.levels) == null ? void 0 : _b.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _c.tat_expiry) ? moment((_e = (_d = info == null ? void 0 : info.levels) == null ? void 0 : _d.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _e.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY HH:MM A") : "N/A"
312
- }
313
- ) })
314
- ] }),
315
- /* @__PURE__ */ jsxs(Box, { children: [
316
- /* @__PURE__ */ jsx(Tooltip, { title: "Current active level of Workflow", children: /* @__PURE__ */ jsx(
317
- TruncatedTypography,
318
- {
319
- variant: "caption",
320
- color: "customColors.text3",
321
- sx: { textTransform: "capitalize", lineHeight: "13.2px" },
322
- children: "Current Level"
323
- }
324
- ) }),
325
- /* @__PURE__ */ jsx(Box, { sx: { display: "flex", mt: 2, justifyContent: "center", alignItems: "center" }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_g = (_f = info == null ? void 0 : info.levels) == null ? void 0 : _f.findIndex((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) != null ? _g : -1) + 1 || "") })
326
- ] }),
327
- /* @__PURE__ */ jsxs(Box, { sx: { mt: 2, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
328
- /* @__PURE__ */ jsx(
329
- Chip,
330
- {
331
- variant: "filled",
332
- sx: {
333
- backgroundColor: `${(_n = getStatus(
334
- ((_j = (_i = (_h = info == null ? void 0 : info.levels) == null ? void 0 : _h.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _i.selected_status) == null ? void 0 : _j.status_id) === 1 ? "approved" : ((_m = (_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _l.selected_status) == null ? void 0 : _m.status_id) === 3 ? "rejected" : "pending"
335
- )) == null ? void 0 : _n.color} !important`,
336
- color: `${(_u = getStatus(
337
- ((_q = (_p = (_o = info == null ? void 0 : info.levels) == null ? void 0 : _o.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _p.selected_status) == null ? void 0 : _q.status_id) === 1 ? "approved" : ((_t = (_s = (_r = info == null ? void 0 : info.levels) == null ? void 0 : _r.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _s.selected_status) == null ? void 0 : _t.status_id) === 3 ? "rejected" : "pending"
338
- )) == null ? void 0 : _u.labelColor} !important`,
339
- height: "40px",
340
- padding: "8px",
341
- borderRadius: "100px !important",
342
- border: "0px !important",
343
- "& .MuiChip-label": {
344
- fontSize: "14px",
345
- lineHeight: "15.4px",
346
- fontWeight: "500",
347
- textTransform: "capitalize"
348
- }
349
- },
350
- label: `${((_x = (_w = (_v = info == null ? void 0 : info.levels) == null ? void 0 : _v.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _w.selected_status) == null ? void 0 : _x.status_id) === 2 || (info == null ? void 0 : info.isLevelZero) || !((_z = (_y = info == null ? void 0 : info.levels) == null ? void 0 : _y.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _z.selected_status) ? "pending" : (_C = (_B = (_A = info == null ? void 0 : info.levels) == null ? void 0 : _A.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _B.selected_status) == null ? void 0 : _C.name}`
351
- }
352
- ),
353
- /* @__PURE__ */ jsx(Divider, { orientation: "vertical", sx: { ml: 5, borderColor: (_E = (_D = theme.palette) == null ? void 0 : _D.customColors) == null ? void 0 : _E.text4, height: "50px" } }),
354
- /* @__PURE__ */ jsx(
355
- IconButton,
356
- {
357
- disableFocusRipple: true,
358
- disableRipple: true,
359
- color: "primary",
360
- sx: {
361
- ml: 5,
362
- background: (_H = (_G = (_F = theme.palette) == null ? void 0 : _F.customColors) == null ? void 0 : _G.primaryLightest) != null ? _H : "rgba(25,118,210,0.08)",
363
- boxShadow: "2px 2px 10px 0px #4C4E6426",
364
- "& span": { color: theme.palette.primary.dark }
365
- },
366
- onClick: () => handleExpandClick(info._id),
367
- children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
368
- }
369
- )
370
- ] })
371
- ] })
534
+ label: "Selected",
535
+ icon: /* @__PURE__ */ jsx("span", { className: "icon-eye" }),
536
+ color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes("selected")) ? "primary" : "default",
537
+ variant: "filled",
538
+ sx: { mr: 4, mb: 4, "& .MuiChip-icon": { fontSize: "18px !important" } },
539
+ onClick: () => handleProfileToggle("selected")
372
540
  }
373
- ),
374
- expandedId === info._id && /* @__PURE__ */ jsx(Grid, { container: true, xs: 12, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sx: { transform: "translateX(3.9%)" }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(Box, { sx: { height: "200px", display: "flex", justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ jsx(CircularProgress, { size: 40, sx: { color: theme.palette.primary.dark } }) }) : /* @__PURE__ */ jsx(Box, { sx: { pl: 2 }, children: expandedDetails == null ? void 0 : expandedDetails.map((item, idx) => {
375
- var _a2;
376
- return /* @__PURE__ */ jsxs(Box, { sx: { mb: 2 }, children: [
377
- /* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { mr: 2 }, children: moment(item == null ? void 0 : item.created_at).format("DD-MM-YYYY HH:mm") }),
378
- /* @__PURE__ */ jsxs(Typography, { variant: "body2", component: "span", children: [
379
- item == null ? void 0 : item.type,
380
- " - ",
381
- ((_a2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _a2.comment) || "No Comments"
382
- ] })
383
- ] }, idx);
384
- }) }) }) })
385
- ] }, index);
386
- }) }),
387
- selectedApprovalOtions === "All Requests" && /* @__PURE__ */ jsx(Box, { className: "fixedModal", sx: { overflowY: "auto", height: "calc(100vh - 180px)" }, children: allRequestArray && allRequestArray.map((info, index) => {
388
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
389
- const currentLevel = info == null ? void 0 : info.levels.find((level_) => level_.id === (info == null ? void 0 : info.current_level));
390
- currentLevel ? currentLevel.status_list : [];
391
- const redir = buildRedirectionUrl(info);
392
- return /* @__PURE__ */ jsxs(React2.Fragment, { children: [
393
- /* @__PURE__ */ jsx(
394
- Card,
541
+ ) }) : "",
542
+ approvalChipLabel.map(({ label, icon, count }, index) => /* @__PURE__ */ jsx(Tooltip, { title: `${count} ${label}`, children: /* @__PURE__ */ jsx(
543
+ StyledChipProps,
395
544
  {
396
- sx: {
397
- mb: 8,
398
- "&.MuiCard-root.MuiPaper-elevation": {
399
- boxShadow: "2px 2px 10px 0px #4C4E6426",
400
- padding: "20px",
401
- borderRadius: "10px"
402
- }
403
- },
404
- children: /* @__PURE__ */ jsxs(CardContent, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
405
- /* @__PURE__ */ jsxs(Box, { children: [
406
- /* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(TruncatedTypography, { variant: "h6", color: "text.primary", sx: { textTransform: "capitalize", lineHeight: "22px" }, children: info.activity_name }) }),
407
- /* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
408
- TruncatedTypography,
409
- {
410
- variant: "body2",
411
- color: "customColors.mainText",
412
- sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
413
- children: info.description_data
414
- }
415
- ) })
416
- ] }),
417
- /* @__PURE__ */ jsxs(Box, { children: [
418
- /* @__PURE__ */ jsx(Tooltip, { title: "Links", children: /* @__PURE__ */ jsx(
419
- TruncatedTypography,
420
- {
421
- variant: "caption",
422
- color: "customColors.text3",
423
- sx: { textTransform: "capitalize", lineHeight: "13.2px" },
424
- children: "Links"
425
- }
426
- ) }),
427
- /* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx("a", { href: redir, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
428
- TruncatedTypography,
429
- {
430
- variant: "subtitle2",
431
- color: "primary.dark",
432
- sx: { mt: "13px", lineHeight: "15.4px" },
433
- children: redir
434
- }
435
- ) }) })
436
- ] }),
437
- /* @__PURE__ */ jsxs(Box, { children: [
438
- /* @__PURE__ */ jsx(Tooltip, { title: "Attachments", children: /* @__PURE__ */ jsx(
439
- TruncatedTypography,
440
- {
441
- variant: "caption",
442
- color: "customColors.text3",
443
- sx: { textTransform: "capitalize", lineHeight: "13.2px" },
444
- children: "Attachments"
445
- }
446
- ) }),
447
- ((_a = info == null ? void 0 : info.attachment_links) == null ? void 0 : _a.length) ? info == null ? void 0 : info.attachment_links.map((link, idx) => /* @__PURE__ */ jsx(Tooltip, { title: `Attachment ${idx + 1}`, children: /* @__PURE__ */ jsx("a", { href: link, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
448
- TruncatedTypography,
449
- {
450
- variant: "subtitle2",
451
- color: "primary.dark",
452
- sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
453
- children: link || "N/A"
454
- }
455
- ) }) }, idx)) : /* @__PURE__ */ jsx(Box, { sx: { display: "flex", mt: 2, justifyContent: "center", alignItems: "center", lineHeight: "15.4px" }, children: "N/A" })
456
- ] }),
457
- /* @__PURE__ */ jsxs(Box, { sx: { mt: 2, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
458
- /* @__PURE__ */ jsx(
459
- Chip,
460
- {
461
- variant: "filled",
462
- sx: {
463
- backgroundColor: `${(_h = getStatus(
464
- ((_d = (_c = (_b = info == null ? void 0 : info.levels) == null ? void 0 : _b.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _c.selected_status) == null ? void 0 : _d.status_id) === 1 ? "approved" : ((_g = (_f = (_e = info == null ? void 0 : info.levels) == null ? void 0 : _e.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _f.selected_status) == null ? void 0 : _g.status_id) === 3 ? "rejected" : "pending"
465
- )) == null ? void 0 : _h.color} !important`,
466
- color: `${(_o = getStatus(
467
- ((_k = (_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _j.selected_status) == null ? void 0 : _k.status_id) === 1 ? "approved" : ((_n = (_m = (_l = info == null ? void 0 : info.levels) == null ? void 0 : _l.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _m.selected_status) == null ? void 0 : _n.status_id) === 3 ? "rejected" : "pending"
468
- )) == null ? void 0 : _o.labelColor} !important`,
469
- height: "40px",
470
- padding: "8px",
471
- borderRadius: "100px !important",
472
- border: "0px !important",
473
- "& .MuiChip-label": {
474
- fontSize: "14px",
475
- lineHeight: "15.4px",
476
- fontWeight: "500",
477
- textTransform: "capitalize"
478
- }
479
- },
480
- label: `${((_r = (_q = (_p = info == null ? void 0 : info.levels) == null ? void 0 : _p.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _q.selected_status) == null ? void 0 : _r.status_id) === 2 || (info == null ? void 0 : info.isLevelZero) || !((_t = (_s = info == null ? void 0 : info.levels) == null ? void 0 : _s.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _t.selected_status) ? "pending" : (_w = (_v = (_u = info == null ? void 0 : info.levels) == null ? void 0 : _u.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _v.selected_status) == null ? void 0 : _w.name}`
481
- }
482
- ),
483
- /* @__PURE__ */ jsx(Divider, { orientation: "vertical", sx: { ml: 5, borderColor: (_y = (_x = theme.palette) == null ? void 0 : _x.customColors) == null ? void 0 : _y.text4, height: "50px" } }),
484
- /* @__PURE__ */ jsx(
485
- IconButton,
486
- {
487
- disableFocusRipple: true,
488
- disableRipple: true,
489
- color: "primary",
490
- sx: {
491
- ml: 5,
492
- background: (_B = (_A = (_z = theme.palette) == null ? void 0 : _z.customColors) == null ? void 0 : _A.primaryLightest) != null ? _B : "rgba(25,118,210,0.08)",
493
- boxShadow: "2px 2px 10px 0px #4C4E6426",
494
- "& span": { color: theme.palette.primary.dark }
495
- },
496
- onClick: () => handleExpandClick(info._id),
497
- children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
498
- }
499
- )
500
- ] })
501
- ] })
545
+ label: `${count} ${label}`,
546
+ icon,
547
+ color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes(label)) ? "primary" : "default",
548
+ variant: "filled",
549
+ sx: { mr: 4, mb: 4, "& .MuiChip-icon": { fontSize: "18px !important" } },
550
+ onClick: () => handleProfileToggle(label)
502
551
  }
503
- ),
504
- expandedId === info._id && /* @__PURE__ */ jsx(Grid, { container: true, xs: 12, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sx: { transform: "translateX(3.9%)" }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(Box, { sx: { height: "200px", display: "flex", justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ jsx(CircularProgress, { size: 40, sx: { color: theme.palette.primary.dark } }) }) : /* @__PURE__ */ jsx(Box, { sx: { pl: 2 }, children: expandedDetails == null ? void 0 : expandedDetails.map((item, idx) => {
505
- var _a2;
506
- return /* @__PURE__ */ jsxs(Box, { sx: { mb: 2 }, children: [
507
- /* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { mr: 2 }, children: moment(item == null ? void 0 : item.created_at).format("DD-MM-YYYY HH:mm") }),
508
- /* @__PURE__ */ jsxs(Typography, { variant: "body2", component: "span", children: [
509
- item == null ? void 0 : item.type,
510
- " - ",
511
- ((_a2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _a2.comment) || "No Comments"
512
- ] })
513
- ] }, idx);
514
- }) }) }) })
515
- ] }, index);
516
- }) }),
517
- selectedApprovalOtions === "Action Required" && /* @__PURE__ */ jsx(Box, { className: "fixedModal", sx: { overflowY: "auto", height: "calc(100vh - 180px)" }, children: pendingRequestArray && pendingRequestArray.map((info, index) => {
518
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
519
- const currentLevel = (_a = info == null ? void 0 : info.levels) == null ? void 0 : _a.find((level_) => level_.id === (info == null ? void 0 : info.current_level));
520
- currentLevel ? currentLevel.status_list : [];
521
- const redir = buildRedirectionUrl(info);
522
- return /* @__PURE__ */ jsxs(React2.Fragment, { children: [
523
- /* @__PURE__ */ jsx(
524
- Card,
525
- {
526
- sx: {
527
- mb: 8,
528
- "&.MuiCard-root.MuiPaper-elevation": {
529
- boxShadow: "2px 2px 10px 0px #4C4E6426",
530
- padding: "20px",
531
- borderRadius: "10px"
532
- }
533
- },
534
- children: /* @__PURE__ */ jsxs(CardContent, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
535
- /* @__PURE__ */ jsxs(Box, { children: [
536
- /* @__PURE__ */ jsx(Tooltip, { title: info.title, children: /* @__PURE__ */ jsx(TruncatedTypography, { variant: "h6", color: "text.primary", sx: { textTransform: "capitalize", lineHeight: "22px" }, children: info.activity_name }) }),
537
- /* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
538
- TruncatedTypography,
539
- {
540
- variant: "body2",
541
- color: "customColors.mainText",
542
- sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
543
- children: info.description_data
544
- }
545
- ) })
546
- ] }),
547
- /* @__PURE__ */ jsxs(Box, { children: [
548
- /* @__PURE__ */ jsx(Tooltip, { title: "Links", children: /* @__PURE__ */ jsx(
549
- TruncatedTypography,
550
- {
551
- variant: "caption",
552
- color: "customColors.text3",
553
- sx: { textTransform: "capitalize", lineHeight: "13.2px" },
554
- children: "Links"
555
- }
556
- ) }),
557
- /* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx("a", { href: redir, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
558
- TruncatedTypography,
559
- {
560
- variant: "subtitle2",
561
- color: "primary.dark",
562
- sx: { mt: "13px", lineHeight: "15.4px" },
563
- children: redir
564
- }
565
- ) }) })
566
- ] }),
567
- /* @__PURE__ */ jsxs(Box, { sx: { mt: 2, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
568
- /* @__PURE__ */ jsx(
569
- Chip,
570
- {
571
- variant: "filled",
572
- sx: {
573
- backgroundColor: `${(_h = getStatus(
574
- ((_d = (_c = (_b = info == null ? void 0 : info.levels) == null ? void 0 : _b.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _c.selected_status) == null ? void 0 : _d.status_id) === 1 ? "approved" : ((_g = (_f = (_e = info == null ? void 0 : info.levels) == null ? void 0 : _e.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _f.selected_status) == null ? void 0 : _g.status_id) === 3 ? "rejected" : "pending"
575
- )) == null ? void 0 : _h.color} !important`,
576
- color: `${(_o = getStatus(
577
- ((_k = (_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _j.selected_status) == null ? void 0 : _k.status_id) === 1 ? "approved" : ((_n = (_m = (_l = info == null ? void 0 : info.levels) == null ? void 0 : _l.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _m.selected_status) == null ? void 0 : _n.status_id) === 3 ? "rejected" : "pending"
578
- )) == null ? void 0 : _o.labelColor} !important`,
579
- height: "40px",
580
- padding: "8px",
581
- borderRadius: "100px !important",
582
- border: "0px !important",
583
- "& .MuiChip-label": {
584
- fontSize: "14px",
585
- lineHeight: "15.4px",
586
- fontWeight: "500",
587
- textTransform: "capitalize"
588
- }
589
- },
590
- label: `${((_r = (_q = (_p = info == null ? void 0 : info.levels) == null ? void 0 : _p.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _q.selected_status) == null ? void 0 : _r.status_id) === 2 || (info == null ? void 0 : info.isLevelZero) || !((_t = (_s = info == null ? void 0 : info.levels) == null ? void 0 : _s.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _t.selected_status) ? "pending" : (_w = (_v = (_u = info == null ? void 0 : info.levels) == null ? void 0 : _u.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _v.selected_status) == null ? void 0 : _w.name}`
591
- }
592
- ),
593
- /* @__PURE__ */ jsx(Divider, { orientation: "vertical", sx: { ml: 5, borderColor: (_y = (_x = theme.palette) == null ? void 0 : _x.customColors) == null ? void 0 : _y.text4, height: "50px" } }),
594
- /* @__PURE__ */ jsx(
595
- IconButton,
596
- {
597
- disableFocusRipple: true,
598
- disableRipple: true,
599
- color: "primary",
600
- sx: {
601
- ml: 5,
602
- background: (_B = (_A = (_z = theme.palette) == null ? void 0 : _z.customColors) == null ? void 0 : _A.primaryLightest) != null ? _B : "rgba(25,118,210,0.08)",
603
- boxShadow: "2px 2px 10px 0px #4C4E6426",
604
- "& span": { color: theme.palette.primary.dark }
605
- },
606
- onClick: () => handleExpandClick(info._id),
607
- children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
608
- }
609
- )
552
+ ) }, index))
553
+ ] }) }),
554
+ selectedApprovalOtions === "selected" && /* @__PURE__ */ jsx(Box, { className: "fixedModal", sx: { overflowY: "auto", height: "calc(100vh - 180px)" }, children: selectedRequestArray && selectedRequestArray.map((info, index) => {
555
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H;
556
+ const currentLevel = info == null ? void 0 : info.levels.find((level_) => level_.id === (info == null ? void 0 : info.current_level));
557
+ const statusList = currentLevel ? currentLevel.status_list : [];
558
+ const statusByNum = (statusList || []).reduce((acc, s) => {
559
+ if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
560
+ return acc;
561
+ }, {});
562
+ const redir = buildRedirectionUrl(info);
563
+ return /* @__PURE__ */ jsxs(React7.Fragment, { children: [
564
+ /* @__PURE__ */ jsx(
565
+ Card,
566
+ {
567
+ sx: {
568
+ mb: 8,
569
+ "&.MuiCard-root.MuiPaper-elevation": {
570
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
571
+ padding: "20px",
572
+ borderRadius: "10px"
573
+ }
574
+ },
575
+ children: /* @__PURE__ */ jsxs(CardContent, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
576
+ /* @__PURE__ */ jsxs(Box, { children: [
577
+ /* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(TruncatedTypography, { variant: "h6", color: "text.primary", sx: { textTransform: "capitalize", lineHeight: "22px" }, children: info.activity_name }) }),
578
+ /* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
579
+ TruncatedTypography,
580
+ {
581
+ variant: "body2",
582
+ color: "customColors.mainText",
583
+ sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
584
+ children: info.description_data
585
+ }
586
+ ) })
587
+ ] }),
588
+ /* @__PURE__ */ jsxs(Box, { children: [
589
+ /* @__PURE__ */ jsx(Tooltip, { title: "Links", children: /* @__PURE__ */ jsx(
590
+ TruncatedTypography,
591
+ {
592
+ variant: "caption",
593
+ color: "customColors.text3",
594
+ sx: { textTransform: "capitalize", lineHeight: "13.2px" },
595
+ children: "Links"
596
+ }
597
+ ) }),
598
+ /* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx("a", { href: redir, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
599
+ TruncatedTypography,
600
+ {
601
+ variant: "subtitle2",
602
+ color: "primary.dark",
603
+ sx: { mt: "13px", lineHeight: "15.4px" },
604
+ children: redir
605
+ }
606
+ ) }) })
607
+ ] }),
608
+ /* @__PURE__ */ jsxs(Box, { children: [
609
+ /* @__PURE__ */ jsx(Tooltip, { title: "Attachments", children: /* @__PURE__ */ jsx(
610
+ TruncatedTypography,
611
+ {
612
+ variant: "caption",
613
+ color: "customColors.text3",
614
+ sx: { textTransform: "capitalize", lineHeight: "13.2px" },
615
+ children: "Attachments"
616
+ }
617
+ ) }),
618
+ ((_a = info == null ? void 0 : info.attachment_links) == null ? void 0 : _a.length) ? info == null ? void 0 : info.attachment_links.map((link, idx) => /* @__PURE__ */ jsx(Tooltip, { title: `Attachment ${idx + 1}`, children: /* @__PURE__ */ jsx("a", { href: link, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
619
+ TruncatedTypography,
620
+ {
621
+ variant: "subtitle2",
622
+ color: "primary.dark",
623
+ sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
624
+ children: link || "N/A"
625
+ }
626
+ ) }) }, idx)) : /* @__PURE__ */ jsx(Box, { sx: { display: "flex", mt: 2, justifyContent: "center", alignItems: "center", lineHeight: "15.4px" }, children: "N/A" })
627
+ ] }),
628
+ /* @__PURE__ */ jsxs(Box, { children: [
629
+ /* @__PURE__ */ jsx(Tooltip, { title: "Date and Time", children: /* @__PURE__ */ jsx(
630
+ TruncatedTypography,
631
+ {
632
+ variant: "caption",
633
+ color: "customColors.text3",
634
+ sx: { textTransform: "capitalize", lineHeight: "13.2px" },
635
+ children: "TAT"
636
+ }
637
+ ) }),
638
+ /* @__PURE__ */ jsx(Tooltip, { title: info.dateTime, children: /* @__PURE__ */ jsx(
639
+ TruncatedTypography,
640
+ {
641
+ variant: "subtitle2",
642
+ color: "customColors.mainText",
643
+ sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
644
+ children: ((_c = (_b = info == null ? void 0 : info.levels) == null ? void 0 : _b.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _c.tat_expiry) ? moment((_e = (_d = info == null ? void 0 : info.levels) == null ? void 0 : _d.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _e.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY HH:MM A") : "N/A"
645
+ }
646
+ ) })
647
+ ] }),
648
+ /* @__PURE__ */ jsxs(Box, { children: [
649
+ /* @__PURE__ */ jsx(Tooltip, { title: "Current active level of Workflow", children: /* @__PURE__ */ jsx(
650
+ TruncatedTypography,
651
+ {
652
+ variant: "caption",
653
+ color: "customColors.text3",
654
+ sx: { textTransform: "capitalize", lineHeight: "13.2px" },
655
+ children: "Current Level"
656
+ }
657
+ ) }),
658
+ /* @__PURE__ */ jsx(Box, { sx: { display: "flex", mt: 2, justifyContent: "center", alignItems: "center" }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_g = (_f = info == null ? void 0 : info.levels) == null ? void 0 : _f.findIndex((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) != null ? _g : -1) + 1 || "") })
659
+ ] }),
660
+ /* @__PURE__ */ jsxs(Box, { sx: { mt: 2, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
661
+ /* @__PURE__ */ jsx(
662
+ Chip,
663
+ {
664
+ variant: "filled",
665
+ sx: {
666
+ backgroundColor: `${(_n = getStatus(
667
+ ((_j = (_i = (_h = info == null ? void 0 : info.levels) == null ? void 0 : _h.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _i.selected_status) == null ? void 0 : _j.status_id) === 1 ? "approved" : ((_m = (_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _l.selected_status) == null ? void 0 : _m.status_id) === 3 ? "rejected" : "pending"
668
+ )) == null ? void 0 : _n.color} !important`,
669
+ color: `${(_u = getStatus(
670
+ ((_q = (_p = (_o = info == null ? void 0 : info.levels) == null ? void 0 : _o.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _p.selected_status) == null ? void 0 : _q.status_id) === 1 ? "approved" : ((_t = (_s = (_r = info == null ? void 0 : info.levels) == null ? void 0 : _r.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _s.selected_status) == null ? void 0 : _t.status_id) === 3 ? "rejected" : "pending"
671
+ )) == null ? void 0 : _u.labelColor} !important`,
672
+ height: "40px",
673
+ padding: "8px",
674
+ borderRadius: "100px !important",
675
+ border: "0px !important",
676
+ "& .MuiChip-label": {
677
+ fontSize: "14px",
678
+ lineHeight: "15.4px",
679
+ fontWeight: "500",
680
+ textTransform: "capitalize"
681
+ }
682
+ },
683
+ label: `${((_x = (_w = (_v = info == null ? void 0 : info.levels) == null ? void 0 : _v.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _w.selected_status) == null ? void 0 : _x.status_id) === 2 || (info == null ? void 0 : info.isLevelZero) || !((_z = (_y = info == null ? void 0 : info.levels) == null ? void 0 : _y.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _z.selected_status) ? "pending" : (_C = (_B = (_A = info == null ? void 0 : info.levels) == null ? void 0 : _A.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _B.selected_status) == null ? void 0 : _C.name}`
684
+ }
685
+ ),
686
+ /* @__PURE__ */ jsx(Divider, { orientation: "vertical", sx: { ml: 5, borderColor: (_E = (_D = theme.palette) == null ? void 0 : _D.customColors) == null ? void 0 : _E.text4, height: "50px" } }),
687
+ /* @__PURE__ */ jsx(
688
+ IconButton,
689
+ {
690
+ disableFocusRipple: true,
691
+ disableRipple: true,
692
+ color: "primary",
693
+ sx: {
694
+ ml: 5,
695
+ background: (_H = (_G = (_F = theme.palette) == null ? void 0 : _F.customColors) == null ? void 0 : _G.primaryLightest) != null ? _H : "rgba(25,118,210,0.08)",
696
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
697
+ "& span": { color: theme.palette.primary.dark }
698
+ },
699
+ onClick: () => handleExpandClick(info._id),
700
+ children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
701
+ }
702
+ ),
703
+ /* @__PURE__ */ jsx(Box, { sx: { ml: 5 }, children: /* @__PURE__ */ jsx(
704
+ Statusselector_default,
705
+ {
706
+ onSendBack: () => setSendDialog(info._id),
707
+ onApprove: () => {
708
+ var _a2, _b2;
709
+ const sid = String((_b2 = (_a2 = statusByNum == null ? void 0 : statusByNum[1]) == null ? void 0 : _a2.id) != null ? _b2 : "");
710
+ setApproveTarget({ id: info._id, statusId: sid });
711
+ },
712
+ onReject: () => {
713
+ var _a2, _b2;
714
+ const sid = String((_b2 = (_a2 = statusByNum == null ? void 0 : statusByNum[3]) == null ? void 0 : _a2.id) != null ? _b2 : "");
715
+ setRejectTarget({ id: info._id, statusId: sid });
716
+ },
717
+ onHold: () => {
718
+ var _a2, _b2;
719
+ const sid = String((_b2 = (_a2 = statusByNum == null ? void 0 : statusByNum[2]) == null ? void 0 : _a2.id) != null ? _b2 : "");
720
+ setOnHoldTarget({ id: info._id, statusId: sid });
721
+ },
722
+ statusList
723
+ }
724
+ ) })
725
+ ] })
610
726
  ] })
611
- ] })
612
- }
613
- ),
614
- expandedId === info._id && /* @__PURE__ */ jsx(Grid, { container: true, xs: 12, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sx: { transform: "translateX(3.9%)" }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(Box, { sx: { height: "200px", display: "flex", justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ jsx(CircularProgress, { size: 40, sx: { color: theme.palette.primary.dark } }) }) : /* @__PURE__ */ jsx(Box, { sx: { pl: 2 }, children: expandedDetails == null ? void 0 : expandedDetails.map((item, idx) => {
615
- var _a2;
616
- return /* @__PURE__ */ jsxs(Box, { sx: { mb: 2 }, children: [
617
- /* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { mr: 2 }, children: moment(item == null ? void 0 : item.created_at).format("DD-MM-YYYY HH:mm") }),
618
- /* @__PURE__ */ jsxs(Typography, { variant: "body2", component: "span", children: [
619
- item == null ? void 0 : item.type,
620
- " - ",
621
- ((_a2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _a2.comment) || "No Comments"
622
- ] })
623
- ] }, idx);
624
- }) }) }) })
625
- ] }, index);
626
- }) })
627
- ] }) }) });
727
+ }
728
+ ),
729
+ expandedId === info._id && /* @__PURE__ */ jsx(Grid, { container: true, xs: 12, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sx: { transform: "translateX(3.9%)" }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(Box, { sx: { height: "200px", display: "flex", justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ jsx(CircularProgress, { size: 40, sx: { color: theme.palette.primary.dark } }) }) : /* @__PURE__ */ jsx(Box, { sx: { pl: 2 }, children: expandedDetails == null ? void 0 : expandedDetails.map((item, idx) => {
730
+ var _a2;
731
+ return /* @__PURE__ */ jsxs(Box, { sx: { mb: 2 }, children: [
732
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { mr: 2 }, children: moment(item == null ? void 0 : item.created_at).format("DD-MM-YYYY HH:mm") }),
733
+ /* @__PURE__ */ jsxs(Typography, { variant: "body2", component: "span", children: [
734
+ item == null ? void 0 : item.type,
735
+ " - ",
736
+ ((_a2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _a2.comment) || "No Comments"
737
+ ] })
738
+ ] }, idx);
739
+ }) }) }) })
740
+ ] }, index);
741
+ }) }),
742
+ selectedApprovalOtions === "All Requests" && /* @__PURE__ */ jsx(Box, { className: "fixedModal", sx: { overflowY: "auto", height: "calc(100vh - 180px)" }, children: allRequestArray && allRequestArray.map((info, index) => {
743
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
744
+ const currentLevel = info == null ? void 0 : info.levels.find((level_) => level_.id === (info == null ? void 0 : info.current_level));
745
+ const statusList = currentLevel ? currentLevel.status_list : [];
746
+ const statusByNum = (statusList || []).reduce((acc, s) => {
747
+ if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
748
+ return acc;
749
+ }, {});
750
+ const redir = buildRedirectionUrl(info);
751
+ return /* @__PURE__ */ jsxs(React7.Fragment, { children: [
752
+ /* @__PURE__ */ jsx(
753
+ Card,
754
+ {
755
+ sx: {
756
+ mb: 8,
757
+ "&.MuiCard-root.MuiPaper-elevation": {
758
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
759
+ padding: "20px",
760
+ borderRadius: "10px"
761
+ }
762
+ },
763
+ children: /* @__PURE__ */ jsxs(CardContent, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
764
+ /* @__PURE__ */ jsxs(Box, { children: [
765
+ /* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(TruncatedTypography, { variant: "h6", color: "text.primary", sx: { textTransform: "capitalize", lineHeight: "22px" }, children: info.activity_name }) }),
766
+ /* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
767
+ TruncatedTypography,
768
+ {
769
+ variant: "body2",
770
+ color: "customColors.mainText",
771
+ sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
772
+ children: info.description_data
773
+ }
774
+ ) })
775
+ ] }),
776
+ /* @__PURE__ */ jsxs(Box, { children: [
777
+ /* @__PURE__ */ jsx(Tooltip, { title: "Links", children: /* @__PURE__ */ jsx(
778
+ TruncatedTypography,
779
+ {
780
+ variant: "caption",
781
+ color: "customColors.text3",
782
+ sx: { textTransform: "capitalize", lineHeight: "13.2px" },
783
+ children: "Links"
784
+ }
785
+ ) }),
786
+ /* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx("a", { href: redir, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
787
+ TruncatedTypography,
788
+ {
789
+ variant: "subtitle2",
790
+ color: "primary.dark",
791
+ sx: { mt: "13px", lineHeight: "15.4px" },
792
+ children: redir
793
+ }
794
+ ) }) })
795
+ ] }),
796
+ /* @__PURE__ */ jsxs(Box, { children: [
797
+ /* @__PURE__ */ jsx(Tooltip, { title: "Attachments", children: /* @__PURE__ */ jsx(
798
+ TruncatedTypography,
799
+ {
800
+ variant: "caption",
801
+ color: "customColors.text3",
802
+ sx: { textTransform: "capitalize", lineHeight: "13.2px" },
803
+ children: "Attachments"
804
+ }
805
+ ) }),
806
+ ((_a = info == null ? void 0 : info.attachment_links) == null ? void 0 : _a.length) ? info == null ? void 0 : info.attachment_links.map((link, idx) => /* @__PURE__ */ jsx(Tooltip, { title: `Attachment ${idx + 1}`, children: /* @__PURE__ */ jsx("a", { href: link, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
807
+ TruncatedTypography,
808
+ {
809
+ variant: "subtitle2",
810
+ color: "primary.dark",
811
+ sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
812
+ children: link || "N/A"
813
+ }
814
+ ) }) }, idx)) : /* @__PURE__ */ jsx(Box, { sx: { display: "flex", mt: 2, justifyContent: "center", alignItems: "center", lineHeight: "15.4px" }, children: "N/A" })
815
+ ] }),
816
+ /* @__PURE__ */ jsxs(Box, { sx: { mt: 2, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
817
+ /* @__PURE__ */ jsx(
818
+ Chip,
819
+ {
820
+ variant: "filled",
821
+ sx: {
822
+ backgroundColor: `${(_h = getStatus(
823
+ ((_d = (_c = (_b = info == null ? void 0 : info.levels) == null ? void 0 : _b.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _c.selected_status) == null ? void 0 : _d.status_id) === 1 ? "approved" : ((_g = (_f = (_e = info == null ? void 0 : info.levels) == null ? void 0 : _e.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _f.selected_status) == null ? void 0 : _g.status_id) === 3 ? "rejected" : "pending"
824
+ )) == null ? void 0 : _h.color} !important`,
825
+ color: `${(_o = getStatus(
826
+ ((_k = (_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _j.selected_status) == null ? void 0 : _k.status_id) === 1 ? "approved" : ((_n = (_m = (_l = info == null ? void 0 : info.levels) == null ? void 0 : _l.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _m.selected_status) == null ? void 0 : _n.status_id) === 3 ? "rejected" : "pending"
827
+ )) == null ? void 0 : _o.labelColor} !important`,
828
+ height: "40px",
829
+ padding: "8px",
830
+ borderRadius: "100px !important",
831
+ border: "0px !important",
832
+ "& .MuiChip-label": {
833
+ fontSize: "14px",
834
+ lineHeight: "15.4px",
835
+ fontWeight: "500",
836
+ textTransform: "capitalize"
837
+ }
838
+ },
839
+ label: `${((_r = (_q = (_p = info == null ? void 0 : info.levels) == null ? void 0 : _p.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _q.selected_status) == null ? void 0 : _r.status_id) === 2 || (info == null ? void 0 : info.isLevelZero) || !((_t = (_s = info == null ? void 0 : info.levels) == null ? void 0 : _s.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _t.selected_status) ? "pending" : (_w = (_v = (_u = info == null ? void 0 : info.levels) == null ? void 0 : _u.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _v.selected_status) == null ? void 0 : _w.name}`
840
+ }
841
+ ),
842
+ /* @__PURE__ */ jsx(Divider, { orientation: "vertical", sx: { ml: 5, borderColor: (_y = (_x = theme.palette) == null ? void 0 : _x.customColors) == null ? void 0 : _y.text4, height: "50px" } }),
843
+ /* @__PURE__ */ jsx(
844
+ IconButton,
845
+ {
846
+ disableFocusRipple: true,
847
+ disableRipple: true,
848
+ color: "primary",
849
+ sx: {
850
+ ml: 5,
851
+ background: (_B = (_A = (_z = theme.palette) == null ? void 0 : _z.customColors) == null ? void 0 : _A.primaryLightest) != null ? _B : "rgba(25,118,210,0.08)",
852
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
853
+ "& span": { color: theme.palette.primary.dark }
854
+ },
855
+ onClick: () => handleExpandClick(info._id),
856
+ children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
857
+ }
858
+ ),
859
+ /* @__PURE__ */ jsx(Box, { sx: { ml: 5 }, children: /* @__PURE__ */ jsx(
860
+ Statusselector_default,
861
+ {
862
+ onSendBack: () => setSendDialog(info._id),
863
+ onApprove: () => {
864
+ var _a2, _b2;
865
+ const sid = String((_b2 = (_a2 = statusByNum == null ? void 0 : statusByNum[1]) == null ? void 0 : _a2.id) != null ? _b2 : "");
866
+ setApproveTarget({ id: info._id, statusId: sid });
867
+ },
868
+ onReject: () => {
869
+ var _a2, _b2;
870
+ const sid = String((_b2 = (_a2 = statusByNum == null ? void 0 : statusByNum[3]) == null ? void 0 : _a2.id) != null ? _b2 : "");
871
+ setRejectTarget({ id: info._id, statusId: sid });
872
+ },
873
+ onHold: () => {
874
+ var _a2, _b2;
875
+ const sid = String((_b2 = (_a2 = statusByNum == null ? void 0 : statusByNum[2]) == null ? void 0 : _a2.id) != null ? _b2 : "");
876
+ setOnHoldTarget({ id: info._id, statusId: sid });
877
+ },
878
+ statusList
879
+ }
880
+ ) })
881
+ ] })
882
+ ] })
883
+ }
884
+ ),
885
+ expandedId === info._id && /* @__PURE__ */ jsx(Grid, { container: true, xs: 12, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sx: { transform: "translateX(3.9%)" }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(Box, { sx: { height: "200px", display: "flex", justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ jsx(CircularProgress, { size: 40, sx: { color: theme.palette.primary.dark } }) }) : /* @__PURE__ */ jsx(Box, { sx: { pl: 2 }, children: expandedDetails == null ? void 0 : expandedDetails.map((item, idx) => {
886
+ var _a2;
887
+ return /* @__PURE__ */ jsxs(Box, { sx: { mb: 2 }, children: [
888
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { mr: 2 }, children: moment(item == null ? void 0 : item.created_at).format("DD-MM-YYYY HH:mm") }),
889
+ /* @__PURE__ */ jsxs(Typography, { variant: "body2", component: "span", children: [
890
+ item == null ? void 0 : item.type,
891
+ " - ",
892
+ ((_a2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _a2.comment) || "No Comments"
893
+ ] })
894
+ ] }, idx);
895
+ }) }) }) })
896
+ ] }, index);
897
+ }) }),
898
+ selectedApprovalOtions === "Action Required" && /* @__PURE__ */ jsx(Box, { className: "fixedModal", sx: { overflowY: "auto", height: "calc(100vh - 180px)" }, children: pendingRequestArray && pendingRequestArray.map((info, index) => {
899
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
900
+ const currentLevel = (_a = info == null ? void 0 : info.levels) == null ? void 0 : _a.find((level_) => level_.id === (info == null ? void 0 : info.current_level));
901
+ const statusList = currentLevel ? currentLevel.status_list : [];
902
+ const statusByNum = (statusList || []).reduce((acc, s) => {
903
+ if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
904
+ return acc;
905
+ }, {});
906
+ const redir = buildRedirectionUrl(info);
907
+ return /* @__PURE__ */ jsxs(React7.Fragment, { children: [
908
+ /* @__PURE__ */ jsx(
909
+ Card,
910
+ {
911
+ sx: {
912
+ mb: 8,
913
+ "&.MuiCard-root.MuiPaper-elevation": {
914
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
915
+ padding: "20px",
916
+ borderRadius: "10px"
917
+ }
918
+ },
919
+ children: /* @__PURE__ */ jsxs(CardContent, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
920
+ /* @__PURE__ */ jsxs(Box, { children: [
921
+ /* @__PURE__ */ jsx(Tooltip, { title: info.title, children: /* @__PURE__ */ jsx(TruncatedTypography, { variant: "h6", color: "text.primary", sx: { textTransform: "capitalize", lineHeight: "22px" }, children: info.activity_name }) }),
922
+ /* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
923
+ TruncatedTypography,
924
+ {
925
+ variant: "body2",
926
+ color: "customColors.mainText",
927
+ sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
928
+ children: info.description_data
929
+ }
930
+ ) })
931
+ ] }),
932
+ /* @__PURE__ */ jsxs(Box, { children: [
933
+ /* @__PURE__ */ jsx(Tooltip, { title: "Links", children: /* @__PURE__ */ jsx(
934
+ TruncatedTypography,
935
+ {
936
+ variant: "caption",
937
+ color: "customColors.text3",
938
+ sx: { textTransform: "capitalize", lineHeight: "13.2px" },
939
+ children: "Links"
940
+ }
941
+ ) }),
942
+ /* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx("a", { href: redir, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
943
+ TruncatedTypography,
944
+ {
945
+ variant: "subtitle2",
946
+ color: "primary.dark",
947
+ sx: { mt: "13px", lineHeight: "15.4px" },
948
+ children: redir
949
+ }
950
+ ) }) })
951
+ ] }),
952
+ /* @__PURE__ */ jsxs(Box, { sx: { mt: 2, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
953
+ /* @__PURE__ */ jsx(
954
+ Chip,
955
+ {
956
+ variant: "filled",
957
+ sx: {
958
+ backgroundColor: `${(_h = getStatus(
959
+ ((_d = (_c = (_b = info == null ? void 0 : info.levels) == null ? void 0 : _b.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _c.selected_status) == null ? void 0 : _d.status_id) === 1 ? "approved" : ((_g = (_f = (_e = info == null ? void 0 : info.levels) == null ? void 0 : _e.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _f.selected_status) == null ? void 0 : _g.status_id) === 3 ? "rejected" : "pending"
960
+ )) == null ? void 0 : _h.color} !important`,
961
+ color: `${(_o = getStatus(
962
+ ((_k = (_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _j.selected_status) == null ? void 0 : _k.status_id) === 1 ? "approved" : ((_n = (_m = (_l = info == null ? void 0 : info.levels) == null ? void 0 : _l.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _m.selected_status) == null ? void 0 : _n.status_id) === 3 ? "rejected" : "pending"
963
+ )) == null ? void 0 : _o.labelColor} !important`,
964
+ height: "40px",
965
+ padding: "8px",
966
+ borderRadius: "100px !important",
967
+ border: "0px !important",
968
+ "& .MuiChip-label": {
969
+ fontSize: "14px",
970
+ lineHeight: "15.4px",
971
+ fontWeight: "500",
972
+ textTransform: "capitalize"
973
+ }
974
+ },
975
+ label: `${((_r = (_q = (_p = info == null ? void 0 : info.levels) == null ? void 0 : _p.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _q.selected_status) == null ? void 0 : _r.status_id) === 2 || (info == null ? void 0 : info.isLevelZero) || !((_t = (_s = info == null ? void 0 : info.levels) == null ? void 0 : _s.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _t.selected_status) ? "pending" : (_w = (_v = (_u = info == null ? void 0 : info.levels) == null ? void 0 : _u.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _v.selected_status) == null ? void 0 : _w.name}`
976
+ }
977
+ ),
978
+ /* @__PURE__ */ jsx(Divider, { orientation: "vertical", sx: { ml: 5, borderColor: (_y = (_x = theme.palette) == null ? void 0 : _x.customColors) == null ? void 0 : _y.text4, height: "50px" } }),
979
+ /* @__PURE__ */ jsx(
980
+ IconButton,
981
+ {
982
+ disableFocusRipple: true,
983
+ disableRipple: true,
984
+ color: "primary",
985
+ sx: {
986
+ ml: 5,
987
+ background: (_B = (_A = (_z = theme.palette) == null ? void 0 : _z.customColors) == null ? void 0 : _A.primaryLightest) != null ? _B : "rgba(25,118,210,0.08)",
988
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
989
+ "& span": { color: theme.palette.primary.dark }
990
+ },
991
+ onClick: () => handleExpandClick(info._id),
992
+ children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
993
+ }
994
+ ),
995
+ /* @__PURE__ */ jsx(Box, { sx: { ml: 5 }, children: /* @__PURE__ */ jsx(
996
+ Statusselector_default,
997
+ {
998
+ onSendBack: () => setSendDialog(info._id),
999
+ onApprove: () => {
1000
+ var _a2, _b2;
1001
+ const sid = String((_b2 = (_a2 = statusByNum == null ? void 0 : statusByNum[1]) == null ? void 0 : _a2.id) != null ? _b2 : "");
1002
+ setApproveTarget({ id: info._id, statusId: sid });
1003
+ },
1004
+ onReject: () => {
1005
+ var _a2, _b2;
1006
+ const sid = String((_b2 = (_a2 = statusByNum == null ? void 0 : statusByNum[3]) == null ? void 0 : _a2.id) != null ? _b2 : "");
1007
+ setRejectTarget({ id: info._id, statusId: sid });
1008
+ },
1009
+ onHold: () => {
1010
+ var _a2, _b2;
1011
+ const sid = String((_b2 = (_a2 = statusByNum == null ? void 0 : statusByNum[2]) == null ? void 0 : _a2.id) != null ? _b2 : "");
1012
+ setOnHoldTarget({ id: info._id, statusId: sid });
1013
+ },
1014
+ statusList
1015
+ }
1016
+ ) })
1017
+ ] })
1018
+ ] })
1019
+ }
1020
+ ),
1021
+ expandedId === info._id && /* @__PURE__ */ jsx(Grid, { container: true, xs: 12, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sx: { transform: "translateX(3.9%)" }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(Box, { sx: { height: "200px", display: "flex", justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ jsx(CircularProgress, { size: 40, sx: { color: theme.palette.primary.dark } }) }) : /* @__PURE__ */ jsx(Box, { sx: { pl: 2 }, children: expandedDetails == null ? void 0 : expandedDetails.map((item, idx) => {
1022
+ var _a2;
1023
+ return /* @__PURE__ */ jsxs(Box, { sx: { mb: 2 }, children: [
1024
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { mr: 2 }, children: moment(item == null ? void 0 : item.created_at).format("DD-MM-YYYY HH:mm") }),
1025
+ /* @__PURE__ */ jsxs(Typography, { variant: "body2", component: "span", children: [
1026
+ item == null ? void 0 : item.type,
1027
+ " - ",
1028
+ ((_a2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _a2.comment) || "No Comments"
1029
+ ] })
1030
+ ] }, idx);
1031
+ }) }) }) })
1032
+ ] }, index);
1033
+ }) })
1034
+ ] }) }),
1035
+ /* @__PURE__ */ jsx(SendBackDialog_default, { openModal: !!sendDialog, closeModal: () => setSendDialog(null), header: "Send Back", workflowLogId: sendDialog || "" }),
1036
+ /* @__PURE__ */ jsx(ApproveDialog_default, { openModal: !!approveTarget, closeModal: () => setApproveTarget(null), header: "Approve", workflowLogId: (approveTarget == null ? void 0 : approveTarget.id) || "", statusId: (approveTarget == null ? void 0 : approveTarget.statusId) || "" }),
1037
+ /* @__PURE__ */ jsx(RejectDialog_default, { openModal: !!rejectTarget, closeModal: () => setRejectTarget(null), header: "Reject", workflowLogId: (rejectTarget == null ? void 0 : rejectTarget.id) || "", statusId: (rejectTarget == null ? void 0 : rejectTarget.statusId) || "", rejection_reason_master: "workflow_reject_reason" }),
1038
+ /* @__PURE__ */ jsx(OnHoldDialog_default, { openModal: !!onHoldTarget, closeModal: () => setOnHoldTarget(null), header: "On Hold", workflowLogId: (onHoldTarget == null ? void 0 : onHoldTarget.id) || "", statusId: (onHoldTarget == null ? void 0 : onHoldTarget.statusId) || "" })
1039
+ ] });
628
1040
  }
629
1041
  function DialogOpener({
630
1042
  openDialog,
@@ -653,8 +1065,8 @@ function DialogOpener({
653
1065
  /* @__PURE__ */ jsx(IconButton, { onClick: handleClose, disableFocusRipple: true, disableRipple: true, sx: { float: "right" }, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) }),
654
1066
  /* @__PURE__ */ jsx(ApprovalWorkflow, { userInfo: userInfoData, selectedWorkflowsList })
655
1067
  ] }),
656
- /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(
657
- Button2,
1068
+ /* @__PURE__ */ jsx(DialogActions5, { children: /* @__PURE__ */ jsx(
1069
+ Button7,
658
1070
  {
659
1071
  variant: "contained",
660
1072
  color: "primary",