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