amp-workflow-ui 0.1.0 → 0.1.2

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,561 @@ 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;
371
+ var Bull = ({
372
+ count,
373
+ isDisabled
374
+ }) => {
375
+ const theme = material.useTheme();
376
+ const color = isDisabled ? theme.palette.success.main : theme.palette.primary.main;
377
+ return /* @__PURE__ */ jsxRuntime.jsx(
378
+ material.Box,
379
+ {
380
+ sx: {
381
+ display: "flex",
382
+ justifyContent: "center",
383
+ alignItems: "center",
384
+ width: 32,
385
+ height: 32,
386
+ borderRadius: "50%",
387
+ border: `2px solid ${color}`,
388
+ color,
389
+ fontWeight: 600,
390
+ fontSize: 14
391
+ },
392
+ children: count
393
+ }
394
+ );
395
+ };
396
+ var getStatus = (status, theme) => {
397
+ const s = status == null ? void 0 : status.toLowerCase();
398
+ const colors = {
399
+ approved: {
400
+ bg: theme.palette.success.light,
401
+ text: theme.palette.success.main
402
+ },
403
+ rejected: { bg: theme.palette.error.light, text: theme.palette.error.main },
404
+ onhold: {
405
+ bg: theme.palette.warning.light,
406
+ text: theme.palette.warning.main
407
+ },
408
+ inprogress: { bg: theme.palette.info.light, text: theme.palette.info.main },
409
+ pending: { bg: theme.palette.grey[200], text: theme.palette.text.primary }
410
+ };
411
+ return colors[s] || colors.pending;
412
+ };
413
+ function CustomTimelineWithStatus({ events }) {
414
+ const { api } = useWorkflowContext();
415
+ const theme = material.useTheme();
416
+ const [isMobile, setIsMobile] = React7.useState(false);
417
+ React7.useEffect(() => {
418
+ const checkScreen = () => setIsMobile(window.innerWidth < 768);
419
+ checkScreen();
420
+ window.addEventListener("resize", checkScreen);
421
+ return () => window.removeEventListener("resize", checkScreen);
422
+ }, []);
423
+ const handleAttachmentClick = (attachment) => {
424
+ api.get({
425
+ url: `/workflow/uploaded-document-url/${attachment.split("/").reverse()[0]}`,
426
+ serviceURL: "api"
427
+ }).then((res) => window.open(res.data, "_blank"));
428
+ };
429
+ const rows = [];
430
+ for (let i = 0; i < (events == null ? void 0 : events.length); i += 4) rows.push(events.slice(i, i + 4));
431
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { p: 2 }, children: rows.map((row, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(
432
+ material.Box,
433
+ {
434
+ sx: {
435
+ display: "flex",
436
+ flexDirection: isMobile ? "column" : rowIndex % 2 === 0 ? "row" : "row-reverse",
437
+ gap: isMobile ? 3 : 6,
438
+ alignItems: "center",
439
+ mb: 6
440
+ },
441
+ children: row.map((event, index) => {
442
+ var _a;
443
+ const status = getStatus((_a = event.status) == null ? void 0 : _a.title, theme);
444
+ const isDisabled = event.cardType === "disableCard";
445
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: isMobile ? 12 : 3, children: /* @__PURE__ */ jsxRuntime.jsx(
446
+ material.Card,
447
+ {
448
+ variant: "outlined",
449
+ sx: {
450
+ width: "100%",
451
+ borderRadius: 3,
452
+ p: 2,
453
+ borderColor: isDisabled ? theme.palette.success.main : theme.palette.divider,
454
+ backgroundColor: isDisabled ? theme.palette.action.hover : theme.palette.background.paper,
455
+ textAlign: "center",
456
+ boxShadow: 2,
457
+ "&:hover": { boxShadow: 5 }
458
+ },
459
+ children: /* @__PURE__ */ jsxRuntime.jsxs(material.CardContent, { children: [
460
+ /* @__PURE__ */ jsxRuntime.jsxs(
461
+ material.Box,
462
+ {
463
+ sx: {
464
+ display: "flex",
465
+ justifyContent: "space-between",
466
+ alignItems: "center",
467
+ mb: 1
468
+ },
469
+ children: [
470
+ /* @__PURE__ */ jsxRuntime.jsx(
471
+ material.Typography,
472
+ {
473
+ variant: "body2",
474
+ color: theme.palette.text.secondary,
475
+ children: event.date
476
+ }
477
+ ),
478
+ event.status && /* @__PURE__ */ jsxRuntime.jsx(
479
+ material.Chip,
480
+ {
481
+ label: event.status.title,
482
+ sx: {
483
+ backgroundColor: status.bg,
484
+ color: status.text,
485
+ fontSize: 12,
486
+ height: 26,
487
+ fontWeight: 600,
488
+ borderRadius: "16px"
489
+ }
490
+ }
491
+ )
492
+ ]
493
+ }
494
+ ),
495
+ /* @__PURE__ */ jsxRuntime.jsx(Bull, { count: event.count, isDisabled }),
496
+ /* @__PURE__ */ jsxRuntime.jsx(
497
+ material.Typography,
498
+ {
499
+ variant: "subtitle1",
500
+ fontWeight: 600,
501
+ color: isDisabled ? theme.palette.text.secondary : theme.palette.text.primary,
502
+ sx: { mt: 2, mb: 0.5 },
503
+ children: event.title
504
+ }
505
+ ),
506
+ /* @__PURE__ */ jsxRuntime.jsx(
507
+ material.Typography,
508
+ {
509
+ variant: "body2",
510
+ color: theme.palette.text.secondary,
511
+ sx: { mb: 1 },
512
+ children: event.subTitle
513
+ }
514
+ ),
515
+ event.attachment && /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "View attachment", children: /* @__PURE__ */ jsxRuntime.jsx(
516
+ material.Typography,
517
+ {
518
+ variant: "body2",
519
+ sx: {
520
+ color: theme.palette.primary.main,
521
+ cursor: "pointer",
522
+ fontWeight: 500,
523
+ textDecoration: "underline",
524
+ "&:hover": {
525
+ color: theme.palette.primary.dark
526
+ }
527
+ },
528
+ onClick: () => handleAttachmentClick(event.attachment),
529
+ children: "Attachment"
530
+ }
531
+ ) }),
532
+ /* @__PURE__ */ jsxRuntime.jsx(
533
+ material.Typography,
534
+ {
535
+ variant: "caption",
536
+ display: "block",
537
+ color: theme.palette.text.disabled,
538
+ sx: { mt: 2 },
539
+ children: event.time
540
+ }
541
+ )
542
+ ] })
543
+ }
544
+ ) }, index);
545
+ })
546
+ },
547
+ rowIndex
548
+ )) });
549
+ }
550
+ var useDebounce = (value, delay) => {
551
+ const [debouncedValue, setDebouncedValue] = React7.useState(value);
552
+ React7.useEffect(() => {
553
+ const timeoutId = setTimeout(() => {
554
+ setDebouncedValue(value);
555
+ }, delay);
556
+ return () => clearTimeout(timeoutId);
557
+ }, [value, delay]);
558
+ return debouncedValue;
559
+ };
560
+ var useDebounce_default = useDebounce;
561
+ var SearchBox = ({
562
+ placeHolderTitle,
563
+ searchText,
564
+ handleClearSearch,
565
+ handleInputChange
566
+ }) => {
567
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(
568
+ material.TextField,
569
+ {
570
+ variant: "outlined",
571
+ value: searchText,
572
+ onChange: handleInputChange,
573
+ placeholder: placeHolderTitle,
574
+ autoComplete: "off",
575
+ className: "custom-search",
576
+ InputProps: {
577
+ startAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "start", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-search-normal-1" }) }),
578
+ endAdornment: searchText ? /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
579
+ material.IconButton,
580
+ {
581
+ disableFocusRipple: true,
582
+ disableRipple: true,
583
+ disableTouchRipple: true,
584
+ onClick: handleClearSearch,
585
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-close-circle" })
586
+ }
587
+ ) }) : null
588
+ }
589
+ }
590
+ ) });
591
+ };
592
+ var SearchBox_default = SearchBox;
42
593
  var StyledChipProps = material.styled(material.Chip)(({ theme }) => {
43
594
  var _a, _b, _c, _d, _e, _f, _g;
44
595
  return {
@@ -68,7 +619,7 @@ var StyledChipProps = material.styled(material.Chip)(({ theme }) => {
68
619
  }
69
620
  };
70
621
  });
71
- var TruncatedTypography = material.styled(material.Typography)(({ theme }) => ({
622
+ material.styled(material.Typography)(({ theme }) => ({
72
623
  overflow: "hidden",
73
624
  textOverflow: "ellipsis",
74
625
  whiteSpace: "nowrap",
@@ -81,23 +632,71 @@ function ApprovalWorkflow({
81
632
  selectedWorkflowsList = [],
82
633
  userInfo
83
634
  }) {
635
+ var _a, _b, _c, _d, _e, _f, _g;
84
636
  const theme = material.useTheme();
85
637
  const { api, urlBuilder, loadingComponent } = useWorkflowContext();
86
- const [selectedApprovalOtions, setSelectedApprovalOtions] = React2.useState(
638
+ const [selectedApprovalOtions, setSelectedApprovalOtions] = React7.useState(
87
639
  selectedWorkflowsList.length ? "selected" : "Action Required"
88
640
  );
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);
641
+ const [expandedId, setExpandedId] = React7.useState(null);
642
+ const [sendDialog, setSendDialog] = React7__default.default.useState(null);
643
+ const [approveTarget, setApproveTarget] = React7__default.default.useState(null);
644
+ const [rejectTarget, setRejectTarget] = React7__default.default.useState(null);
645
+ const [onHoldTarget, setOnHoldTarget] = React7__default.default.useState(null);
646
+ const [expandedDetails, setExpandedDetails] = React7.useState([]);
647
+ const [statusCount, setStatusCount] = React7.useState({});
648
+ const [urlConfig, setUrlConfig] = React7.useState({});
649
+ const [allRequestArray, setAllRequestArray] = React7.useState([]);
650
+ const [pendingRequestArray, setPendingRequestArray] = React7.useState([]);
651
+ const [selectedRequestArray, setSelectedRequestArray] = React7.useState([]);
652
+ const [isLoading, setIsLoading] = React7.useState(false);
653
+ const [searchText, setSearchText] = React7.useState("");
654
+ const handleClearSearch = React7.useCallback(() => {
655
+ setSearchText("");
656
+ }, []);
657
+ const handleSearchChange = React7.useCallback((value) => {
658
+ setSearchText(value);
659
+ }, []);
660
+ const debouncedSearchTerm = useDebounce_default(searchText, 500);
661
+ const filteredSelectedRequestArray = React7__default.default.useMemo(() => {
662
+ if (!debouncedSearchTerm) return selectedRequestArray;
663
+ const q = debouncedSearchTerm.toLowerCase();
664
+ return selectedRequestArray.filter((item) => {
665
+ const name = ((item == null ? void 0 : item.activity_name) || "").toString().toLowerCase();
666
+ const desc = ((item == null ? void 0 : item.description_data) || "").toString().toLowerCase();
667
+ return name.includes(q) || desc.includes(q);
668
+ });
669
+ }, [selectedRequestArray, debouncedSearchTerm]);
670
+ const filteredAllRequestArray = React7__default.default.useMemo(() => {
671
+ if (!debouncedSearchTerm) return allRequestArray;
672
+ const q = debouncedSearchTerm.toLowerCase();
673
+ return allRequestArray.filter((item) => {
674
+ const name = ((item == null ? void 0 : item.activity_name) || "").toString().toLowerCase();
675
+ const desc = ((item == null ? void 0 : item.description_data) || "").toString().toLowerCase();
676
+ return name.includes(q) || desc.includes(q);
677
+ });
678
+ }, [allRequestArray, debouncedSearchTerm]);
679
+ const filteredPendingRequestArray = React7__default.default.useMemo(() => {
680
+ if (!debouncedSearchTerm) return pendingRequestArray;
681
+ const q = debouncedSearchTerm.toLowerCase();
682
+ return pendingRequestArray.filter((item) => {
683
+ const name = ((item == null ? void 0 : item.activity_name) || "").toString().toLowerCase();
684
+ const desc = ((item == null ? void 0 : item.description_data) || "").toString().toLowerCase();
685
+ return name.includes(q) || desc.includes(q);
686
+ });
687
+ }, [pendingRequestArray, debouncedSearchTerm]);
688
+ const handleSendBack = (workflowLogId) => {
689
+ setSendDialog(workflowLogId);
690
+ };
691
+ const handleApprove = (workflowLogId) => {
692
+ setApproveTarget(workflowLogId);
693
+ };
694
+ const handleReject = (workflowLogId) => {
695
+ setRejectTarget(workflowLogId);
696
+ };
697
+ const handleOnHold = (workflowLogId) => {
698
+ setOnHoldTarget(workflowLogId);
699
+ };
101
700
  const handleProfileToggle = (option) => {
102
701
  setSelectedApprovalOtions(option);
103
702
  if (option === "Action Required") fetchPendingActivities();
@@ -108,81 +707,122 @@ function ApprovalWorkflow({
108
707
  setExpandedId((prevId) => prevId === id ? null : id);
109
708
  fetchExpandedActivityLogs(id);
110
709
  };
111
- const getStatus = (status) => {
112
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
113
- switch (status) {
710
+ const getStatus2 = (status) => {
711
+ switch (status.toLowerCase()) {
114
712
  case "approved":
115
713
  return {
116
714
  title: "Approved",
117
715
  color: theme.palette.success.light,
118
- labelColor: theme.palette.success.main
716
+ // e.g. light green background
717
+ labelColor: theme.palette.grey[100]
718
+ // e.g. light grey text
119
719
  };
120
720
  case "rejected":
121
721
  return {
122
722
  title: "Rejected",
123
- color: (_c = (_b = (_a = theme.palette) == null ? void 0 : _a.customColors) == null ? void 0 : _b.chipWarningContainer) != null ? _c : theme.palette.error.light,
124
- labelColor: theme.palette.error.main
723
+ color: theme.palette.error.light,
724
+ // light red background
725
+ labelColor: theme.palette.text.primary
726
+ // normal text color
125
727
  };
126
728
  case "onhold":
729
+ case "on_hold":
127
730
  return {
128
731
  title: "On Hold",
129
- color: (_f = (_e = (_d = theme.palette) == null ? void 0 : _d.customColors) == null ? void 0 : _e.chipPendingContainer) != null ? _f : theme.palette.warning.light,
130
- labelColor: (_i = (_h = (_g = theme.palette) == null ? void 0 : _g.customColors) == null ? void 0 : _h.chipPendingText) != null ? _i : theme.palette.warning.main
732
+ color: theme.palette.warning.light,
733
+ // soft amber background
734
+ labelColor: theme.palette.warning.main
735
+ // strong amber text
736
+ };
737
+ case "inprogress":
738
+ case "in_progress":
739
+ return {
740
+ title: "In Progress",
741
+ color: theme.palette.info.light,
742
+ // light blue background
743
+ labelColor: theme.palette.info.main
744
+ // blue text
131
745
  };
132
746
  case "pending":
133
747
  default:
134
748
  return {
135
749
  title: "Pending",
136
- color: (_l = (_k = (_j = theme.palette) == null ? void 0 : _j.customColors) == null ? void 0 : _k.approvalPrimaryChipBG) != null ? _l : theme.palette.info.light,
137
- labelColor: (_o = (_n = (_m = theme.palette) == null ? void 0 : _m.customColors) == null ? void 0 : _n.approvalPrimaryChipText) != null ? _o : theme.palette.info.main
750
+ color: theme.palette.grey[200],
751
+ // light grey background
752
+ labelColor: theme.palette.text.primary
753
+ // normal text color
138
754
  };
139
755
  }
140
756
  };
141
757
  const approvalChipLabel = [
142
- { label: "Action Required", icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-document-forward" }), count: (statusCount == null ? void 0 : statusCount.pending_activities_count) || "" },
143
- { label: "All Requests", icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-document-copy" }), count: (statusCount == null ? void 0 : statusCount.total_activities_count) || "" }
758
+ {
759
+ label: "Action Required",
760
+ icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-document-forward" }),
761
+ count: (statusCount == null ? void 0 : statusCount.pending_activities_count) || ""
762
+ },
763
+ {
764
+ label: "All Requests",
765
+ icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-document-copy" }),
766
+ count: (statusCount == null ? void 0 : statusCount.total_activities_count) || ""
767
+ }
144
768
  ];
145
769
  const fetchExpandedActivityLogs = (workflowLogId) => {
146
770
  setExpandedDetails([]);
147
- api.get({ url: `/workflow/workflow-activity-logs/${workflowLogId}`, serviceURL: "api" }).then((res) => setExpandedDetails(res == null ? void 0 : res.data));
771
+ api.get({
772
+ url: `/workflow/workflow-activity-logs/${workflowLogId}`,
773
+ serviceURL: "api"
774
+ }).then((res) => setExpandedDetails(res == null ? void 0 : res.data));
148
775
  };
149
776
  const fetchPendingActivities = () => {
150
- var _a;
777
+ var _a2;
151
778
  setIsLoading(true);
152
- api.get({ url: `/workflow/activity-workflow/${(_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id}?paginate=false&type=pending`, serviceURL: "api" }).then((res) => {
153
- var _a2;
154
- return setPendingRequestArray((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.activities);
779
+ api.get({
780
+ url: `/workflow/activity-workflow/${(_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id}?paginate=false&type=pending`,
781
+ serviceURL: "api"
782
+ }).then((res) => {
783
+ var _a3;
784
+ return setPendingRequestArray((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.activities);
155
785
  }).finally(() => setIsLoading(false));
156
786
  };
157
787
  const fetchAllActivites = () => {
158
- var _a;
788
+ var _a2;
159
789
  setIsLoading(true);
160
- api.get({ url: `/workflow/activity-workflow/${(_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id}?paginate=false`, serviceURL: "api" }).then((res) => {
161
- var _a2;
162
- return setAllRequestArray((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.activities);
790
+ api.get({
791
+ url: `/workflow/activity-workflow/${(_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id}?paginate=false`,
792
+ serviceURL: "api"
793
+ }).then((res) => {
794
+ var _a3;
795
+ return setAllRequestArray((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.activities);
163
796
  }).finally(() => setIsLoading(false));
164
797
  };
165
798
  const fetchSelectedActivites = () => {
166
799
  setIsLoading(true);
167
- api.post({ url: `/workflow/bulk-details`, serviceURL: "api", data: { workflowIds: selectedWorkflowsList } }).then((res) => setSelectedRequestArray(res == null ? void 0 : res.data)).finally(() => setIsLoading(false));
800
+ api.post({
801
+ url: `/workflow/bulk-details`,
802
+ serviceURL: "api",
803
+ data: { workflowIds: selectedWorkflowsList }
804
+ }).then((res) => setSelectedRequestArray(res == null ? void 0 : res.data)).finally(() => setIsLoading(false));
168
805
  };
169
806
  const fetchStatusCount = () => {
170
- var _a;
171
- api.get({ url: `/workflow/status-count/${(_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id}`, serviceURL: "api" }).then((res) => {
172
- var _a2;
173
- setStatusCount((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2[0]);
807
+ var _a2;
808
+ api.get({
809
+ url: `/workflow/status-count/${(_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id}`,
810
+ serviceURL: "api"
811
+ }).then((res) => {
812
+ var _a3;
813
+ setStatusCount((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3[0]);
174
814
  });
175
815
  };
176
- React2.useEffect(() => {
177
- if (!sendDialog && !approveDialog && !onHoldDialog && !rejectDialog) {
816
+ React7.useEffect(() => {
817
+ if (!sendDialog && !approveTarget && !onHoldTarget && !rejectTarget) {
178
818
  fetchAllActivites();
179
819
  fetchStatusCount();
180
820
  fetchPendingActivities();
181
821
  setExpandedDetails([]);
182
822
  setExpandedId(null);
183
823
  }
184
- }, [sendDialog, approveDialog, onHoldDialog, rejectDialog, userInfo]);
185
- React2.useEffect(() => {
824
+ }, [sendDialog, approveTarget, onHoldTarget, rejectTarget, userInfo]);
825
+ React7.useEffect(() => {
186
826
  api.get({ url: `/workflow/url-config`, serviceURL: "api" }).then((res) => {
187
827
  const data = (res == null ? void 0 : res.data) || [];
188
828
  const map = data.reduce((acc, { module_name, ...details }) => {
@@ -192,452 +832,948 @@ function ApprovalWorkflow({
192
832
  setUrlConfig(map);
193
833
  });
194
834
  }, []);
195
- React2.useEffect(() => {
835
+ React7.useEffect(() => {
196
836
  if (selectedWorkflowsList.length && !selectedRequestArray.length) {
197
837
  fetchSelectedActivites();
198
838
  }
199
839
  }, [selectedWorkflowsList]);
200
840
  const buildRedirectionUrl = (info) => {
201
841
  if (info == null ? void 0 : info.redirection_link) return info.redirection_link;
202
- if (urlBuilder) return urlBuilder(info == null ? void 0 : info.module_name, info == null ? void 0 : info.module_id, urlConfig, info == null ? void 0 : info.reference_id);
842
+ if (urlBuilder)
843
+ return urlBuilder(
844
+ info == null ? void 0 : info.module_name,
845
+ info == null ? void 0 : info.module_id,
846
+ urlConfig,
847
+ info == null ? void 0 : info.reference_id
848
+ );
203
849
  const ref = urlConfig == null ? void 0 : urlConfig[info == null ? void 0 : info.module_name];
204
850
  if ((ref == null ? void 0 : ref.base_url) && (ref == null ? void 0 : ref.sub_url)) {
205
851
  const qs = new URLSearchParams();
206
- if (info == null ? void 0 : info.reference_id) qs.set("reference_id", String(info == null ? void 0 : info.reference_id));
852
+ if (info == null ? void 0 : info.reference_id)
853
+ qs.set("reference_id", String(info == null ? void 0 : info.reference_id));
207
854
  if (info == null ? void 0 : info.module_name) qs.set("module_name", String(info == null ? void 0 : info.module_name));
208
855
  return `${ref.base_url}${ref.sub_url}${qs.toString() ? `?${qs.toString()}` : ""}`;
209
856
  }
210
857
  return "#";
211
858
  };
212
859
  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,
246
- {
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
- ] })
385
- }
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,
408
- {
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,
860
+ ({
861
+ approved: {
862
+ color: theme.palette.success.light,
863
+ labelColor: theme.palette.success.main
864
+ },
865
+ rejected: {
866
+ color: theme.palette.success.light,
867
+ labelColor: theme.palette.success.main
868
+ },
869
+ onhold: {
870
+ color: theme.palette.success.light,
871
+ labelColor: theme.palette.success.main
872
+ },
873
+ sendback: {
874
+ color: theme.palette.success.light,
875
+ labelColor: theme.palette.success.main
876
+ },
877
+ pending: {
878
+ color: theme.palette.success.light,
879
+ labelColor: theme.palette.success.main
880
+ }
881
+ });
882
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
883
+ /* @__PURE__ */ jsxRuntime.jsx(
884
+ system.Box,
885
+ {
886
+ sx: { display: "flex", justifyContent: "center", flexWrap: "nowrap" },
887
+ children: /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { width: "100%", height: "100%" }, children: [
888
+ /* @__PURE__ */ jsxRuntime.jsxs(
889
+ system.Box,
890
+ {
891
+ sx: {
892
+ display: "flex",
893
+ justifyContent: "space-between",
894
+ alignItems: "center"
895
+ },
896
+ children: [
897
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { mt: 2, mb: 2 }, children: [
898
+ (selectedWorkflowsList == null ? void 0 : selectedWorkflowsList.length) ? /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Selected Workflows", children: /* @__PURE__ */ jsxRuntime.jsx(
899
+ StyledChipProps,
900
+ {
901
+ label: "Selected",
902
+ icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-eye" }),
903
+ color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes("selected")) ? "primary" : "default",
904
+ variant: "filled",
905
+ sx: {
906
+ mr: 4,
907
+ mb: 4,
908
+ "& .MuiChip-icon": { fontSize: "18px !important" }
909
+ },
910
+ onClick: () => handleProfileToggle("selected")
911
+ }
912
+ ) }) : "",
913
+ approvalChipLabel.map(({ label, icon, count }, index) => /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: `${count} ${label}`, children: /* @__PURE__ */ jsxRuntime.jsx(
914
+ StyledChipProps,
915
+ {
916
+ label: `${count} ${label}`,
917
+ icon,
918
+ color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes(label)) ? "primary" : "default",
919
+ variant: "filled",
920
+ sx: {
921
+ mr: 4,
922
+ mb: 4,
923
+ "& .MuiChip-icon": { fontSize: "18px !important" }
924
+ },
925
+ onClick: () => handleProfileToggle(label)
926
+ }
927
+ ) }, index))
928
+ ] }),
929
+ /* @__PURE__ */ jsxRuntime.jsx(system.Box, { sx: { flexGrow: 1, maxWidth: 250, ml: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(
930
+ SearchBox_default,
422
931
  {
423
- variant: "body2",
424
- color: "customColors.mainText",
425
- sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
426
- children: info.description_data
932
+ placeHolderTitle: "Search",
933
+ searchText,
934
+ handleClearSearch,
935
+ handleInputChange: (e) => handleSearchChange(e.target.value)
427
936
  }
428
937
  ) })
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,
938
+ ]
939
+ }
940
+ ),
941
+ selectedApprovalOtions === "selected" && /* @__PURE__ */ jsxRuntime.jsx(
942
+ system.Box,
943
+ {
944
+ className: "fixedModal",
945
+ sx: {
946
+ overflowY: "auto",
947
+ height: "calc(100vh - 180px)",
948
+ px: 2,
949
+ pb: 3
950
+ },
951
+ children: filteredSelectedRequestArray == null ? void 0 : filteredSelectedRequestArray.map((info, index) => {
952
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o;
953
+ const currentLevel = info == null ? void 0 : info.levels.find(
954
+ (level_) => level_.id === (info == null ? void 0 : info.current_level)
955
+ );
956
+ const statusList = currentLevel ? currentLevel.status_list : [];
957
+ (statusList || []).reduce(
958
+ (acc, s) => {
959
+ if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
960
+ return acc;
961
+ },
962
+ {}
963
+ );
964
+ const redir = buildRedirectionUrl(info);
965
+ const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
966
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
967
+ )) == null ? void 0 : _b2.selected_status) == null ? void 0 : _c2.status_id) === 1 ? "approved" : ((_f2 = (_e2 = (_d2 = info == null ? void 0 : info.levels) == null ? void 0 : _d2.find(
968
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
969
+ )) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
970
+ const statusData = getStatus2(currentStatus);
971
+ return /* @__PURE__ */ jsxRuntime.jsxs(
972
+ material.Card,
453
973
  {
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
974
  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
- }
975
+ mb: 3,
976
+ borderRadius: "14px",
977
+ boxShadow: "0px 2px 10px rgba(76, 78, 100, 0.1)",
978
+ px: 3,
979
+ py: 2
492
980
  },
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,
981
+ children: [
982
+ /* @__PURE__ */ jsxRuntime.jsxs(
983
+ material.CardContent,
984
+ {
985
+ sx: {
986
+ display: "flex",
987
+ justifyContent: "space-between",
988
+ alignItems: "center",
989
+ flexWrap: { xs: "wrap", md: "nowrap" },
990
+ gap: 2
991
+ },
992
+ children: [
993
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "22%", minWidth: 220 }, children: [
994
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsxRuntime.jsx(
995
+ material.Typography,
996
+ {
997
+ variant: "h6",
998
+ fontWeight: 600,
999
+ noWrap: true,
1000
+ color: "text.primary",
1001
+ children: info.activity_name
1002
+ }
1003
+ ) }),
1004
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsxRuntime.jsx(
1005
+ material.Typography,
1006
+ {
1007
+ variant: "body2",
1008
+ color: "text.secondary",
1009
+ noWrap: true,
1010
+ sx: { mt: 0.5 },
1011
+ children: info.description_data
1012
+ }
1013
+ ) })
1014
+ ] }),
1015
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "20%", minWidth: 180 }, children: [
1016
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
1017
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: redir, children: /* @__PURE__ */ jsxRuntime.jsx(
1018
+ material.Typography,
1019
+ {
1020
+ component: "a",
1021
+ href: redir,
1022
+ target: "_blank",
1023
+ rel: "noreferrer",
1024
+ sx: {
1025
+ display: "block",
1026
+ color: "primary.dark",
1027
+ fontWeight: 500,
1028
+ textDecoration: "none",
1029
+ overflow: "hidden",
1030
+ textOverflow: "ellipsis",
1031
+ whiteSpace: "nowrap",
1032
+ mt: 0.8
1033
+ },
1034
+ children: redir
1035
+ }
1036
+ ) })
1037
+ ] }),
1038
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
1039
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
1040
+ /* @__PURE__ */ jsxRuntime.jsx(
1041
+ material.Typography,
1042
+ {
1043
+ variant: "body2",
1044
+ noWrap: true,
1045
+ sx: {
1046
+ mt: 0.8,
1047
+ color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1048
+ },
1049
+ children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1050
+ }
1051
+ )
1052
+ ] }),
1053
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
1054
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
1055
+ /* @__PURE__ */ jsxRuntime.jsx(
1056
+ material.Typography,
1057
+ {
1058
+ variant: "body2",
1059
+ sx: {
1060
+ mt: 0.8,
1061
+ fontWeight: 500,
1062
+ color: "text.primary"
1063
+ },
1064
+ children: (currentLevel == null ? void 0 : currentLevel.tat_expiry) ? moment__default.default(currentLevel.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY hh:mm A") : "N/A"
1065
+ }
1066
+ )
1067
+ ] }),
1068
+ /* @__PURE__ */ jsxRuntime.jsxs(
1069
+ system.Box,
1070
+ {
1071
+ sx: {
1072
+ flexBasis: "8%",
1073
+ minWidth: 80,
1074
+ textAlign: "center"
1075
+ },
1076
+ children: [
1077
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1078
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.findIndex(
1079
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1080
+ )) != null ? _j : -1) + 1 || "") })
1081
+ ]
1082
+ }
1083
+ ),
1084
+ /* @__PURE__ */ jsxRuntime.jsxs(
1085
+ system.Box,
1086
+ {
1087
+ sx: {
1088
+ flexBasis: "18%",
1089
+ minWidth: 200,
1090
+ display: "flex",
1091
+ alignItems: "center",
1092
+ justifyContent: "flex-end",
1093
+ gap: 1.5
1094
+ },
1095
+ children: [
1096
+ (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1097
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1098
+ )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1099
+ (lvl) => {
1100
+ var _a3;
1101
+ return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1102
+ }
1103
+ )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1104
+ Statusselector_default,
1105
+ {
1106
+ onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
1107
+ onApprove: () => {
1108
+ var _a3;
1109
+ return handleApprove(
1110
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
1111
+ );
1112
+ },
1113
+ onReject: () => {
1114
+ var _a3;
1115
+ return handleReject(
1116
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
1117
+ );
1118
+ },
1119
+ onHold: () => {
1120
+ var _a3;
1121
+ return handleOnHold(
1122
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1123
+ );
1124
+ },
1125
+ statusList: (info == null ? void 0 : info.isLevelZero) && (info == null ? void 0 : info.created_by) === ((_o = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _o.id) ? statusList == null ? void 0 : statusList.filter(
1126
+ (app) => app.status == 1
1127
+ ) : statusList
1128
+ }
1129
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1130
+ material.Chip,
1131
+ {
1132
+ variant: "filled",
1133
+ sx: {
1134
+ backgroundColor: getStatus2(currentStatus).color,
1135
+ color: getStatus2(currentStatus).labelColor,
1136
+ height: "40px",
1137
+ px: 2,
1138
+ borderRadius: "100px !important",
1139
+ "& .MuiChip-label": {
1140
+ fontSize: "14px",
1141
+ lineHeight: "15.4px",
1142
+ fontWeight: "500",
1143
+ textTransform: "capitalize"
1144
+ }
1145
+ },
1146
+ label: statusData.title
1147
+ }
1148
+ ),
1149
+ /* @__PURE__ */ jsxRuntime.jsx(
1150
+ material.Divider,
1151
+ {
1152
+ orientation: "vertical",
1153
+ flexItem: true,
1154
+ sx: {
1155
+ borderColor: "#E0E0E0",
1156
+ height: "40px"
1157
+ }
1158
+ }
1159
+ ),
1160
+ /* @__PURE__ */ jsxRuntime.jsx(
1161
+ material.IconButton,
1162
+ {
1163
+ disableFocusRipple: true,
1164
+ disableRipple: true,
1165
+ color: "primary",
1166
+ sx: {
1167
+ background: "rgba(25,118,210,0.08)",
1168
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
1169
+ "& span": { color: "primary.dark" }
1170
+ },
1171
+ onClick: () => handleExpandClick(info._id),
1172
+ children: expandedId === info._id ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-right-3" })
1173
+ }
1174
+ )
1175
+ ]
1176
+ }
1177
+ )
1178
+ ]
1179
+ }
1180
+ ),
1181
+ expandedId === info._id && /* @__PURE__ */ jsxRuntime.jsx(system.Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsxRuntime.jsx(
1182
+ system.Box,
1183
+ {
1184
+ sx: {
1185
+ height: 150,
1186
+ display: "flex",
1187
+ justifyContent: "center",
1188
+ alignItems: "center"
1189
+ },
1190
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
1191
+ }
1192
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1193
+ CustomTimelineWithStatus,
1194
+ {
1195
+ events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
1196
+ var _a3, _b3, _c3, _d3;
1197
+ return {
1198
+ date: moment__default.default(item == null ? void 0 : item.created_at).format(
1199
+ "DD-MM-YYYY"
1200
+ ),
1201
+ time: moment__default.default(item == null ? void 0 : item.created_at).format("HH:mm"),
1202
+ title: (item == null ? void 0 : item.type) === "create" ? `Raised by - ${(_a3 = item == null ? void 0 : item.created_by_user) == null ? void 0 : _a3.full_name}` : ((_b3 = item == null ? void 0 : item.created_by_user) == null ? void 0 : _b3.full_name) || "N/A",
1203
+ subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
1204
+ attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
1205
+ count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
1206
+ cardType: "card"
1207
+ };
1208
+ })
1209
+ }
1210
+ ) })
1211
+ ]
1212
+ },
1213
+ index
1214
+ );
1215
+ })
1216
+ }
1217
+ ),
1218
+ selectedApprovalOtions === "All Requests" && /* @__PURE__ */ jsxRuntime.jsx(
1219
+ system.Box,
1220
+ {
1221
+ className: "fixedModal",
1222
+ sx: {
1223
+ overflowY: "auto",
1224
+ height: "calc(100vh - 180px)",
1225
+ px: 2,
1226
+ pb: 3
1227
+ },
1228
+ children: filteredAllRequestArray == null ? void 0 : filteredAllRequestArray.map((info, index) => {
1229
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o;
1230
+ const currentLevel = info == null ? void 0 : info.levels.find(
1231
+ (level_) => level_.id === (info == null ? void 0 : info.current_level)
1232
+ );
1233
+ const statusList = currentLevel ? currentLevel.status_list : [];
1234
+ (statusList || []).reduce(
1235
+ (acc, s) => {
1236
+ if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
1237
+ return acc;
1238
+ },
1239
+ {}
1240
+ );
1241
+ const redir = buildRedirectionUrl(info);
1242
+ const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
1243
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1244
+ )) == null ? void 0 : _b2.selected_status) == null ? void 0 : _c2.status_id) === 1 ? "approved" : ((_f2 = (_e2 = (_d2 = info == null ? void 0 : info.levels) == null ? void 0 : _d2.find(
1245
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1246
+ )) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
1247
+ const statusData = getStatus2(currentStatus);
1248
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1249
+ material.Card,
499
1250
  {
500
- disableFocusRipple: true,
501
- disableRipple: true,
502
- color: "primary",
503
1251
  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 }
1252
+ mb: 3,
1253
+ borderRadius: "14px",
1254
+ boxShadow: "0px 2px 10px rgba(76, 78, 100, 0.1)",
1255
+ px: 3,
1256
+ py: 2
508
1257
  },
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
- ] })
515
- }
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,
1258
+ children: [
1259
+ /* @__PURE__ */ jsxRuntime.jsxs(
1260
+ material.CardContent,
1261
+ {
1262
+ sx: {
1263
+ display: "flex",
1264
+ justifyContent: "space-between",
1265
+ alignItems: "center",
1266
+ flexWrap: { xs: "wrap", md: "nowrap" },
1267
+ gap: 2
1268
+ },
1269
+ children: [
1270
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "20%", minWidth: 220 }, children: [
1271
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsxRuntime.jsx(
1272
+ material.Typography,
1273
+ {
1274
+ variant: "h6",
1275
+ fontWeight: 600,
1276
+ noWrap: true,
1277
+ color: "text.primary",
1278
+ children: info.activity_name
1279
+ }
1280
+ ) }),
1281
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsxRuntime.jsx(
1282
+ material.Typography,
1283
+ {
1284
+ variant: "body2",
1285
+ noWrap: true,
1286
+ sx: { mt: 0.5, color: "text.secondary" },
1287
+ children: info.description_data
1288
+ }
1289
+ ) })
1290
+ ] }),
1291
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "18%", minWidth: 180 }, children: [
1292
+ /* @__PURE__ */ jsxRuntime.jsx(
1293
+ material.Typography,
1294
+ {
1295
+ variant: "caption",
1296
+ color: "text.secondary",
1297
+ sx: { display: "block" },
1298
+ children: "Links"
1299
+ }
1300
+ ),
1301
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: redir, children: /* @__PURE__ */ jsxRuntime.jsx(
1302
+ material.Typography,
1303
+ {
1304
+ component: "a",
1305
+ href: redir,
1306
+ target: "_blank",
1307
+ rel: "noreferrer",
1308
+ sx: {
1309
+ display: "block",
1310
+ color: "primary.dark",
1311
+ fontWeight: 500,
1312
+ textDecoration: "none",
1313
+ overflow: "hidden",
1314
+ textOverflow: "ellipsis",
1315
+ whiteSpace: "nowrap",
1316
+ mt: 0.8
1317
+ },
1318
+ children: redir
1319
+ }
1320
+ ) })
1321
+ ] }),
1322
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
1323
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
1324
+ /* @__PURE__ */ jsxRuntime.jsx(
1325
+ material.Typography,
1326
+ {
1327
+ variant: "body2",
1328
+ noWrap: true,
1329
+ sx: {
1330
+ mt: 0.8,
1331
+ color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1332
+ },
1333
+ children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1334
+ }
1335
+ )
1336
+ ] }),
1337
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
1338
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
1339
+ /* @__PURE__ */ jsxRuntime.jsx(
1340
+ material.Typography,
1341
+ {
1342
+ variant: "body2",
1343
+ sx: {
1344
+ mt: 0.8,
1345
+ fontWeight: 500,
1346
+ color: "text.primary"
1347
+ },
1348
+ children: (currentLevel == null ? void 0 : currentLevel.tat_expiry) ? moment__default.default(currentLevel.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY hh:mm A") : "N/A"
1349
+ }
1350
+ )
1351
+ ] }),
1352
+ /* @__PURE__ */ jsxRuntime.jsxs(
1353
+ system.Box,
1354
+ {
1355
+ sx: {
1356
+ flexBasis: "8%",
1357
+ minWidth: 80,
1358
+ textAlign: "center"
1359
+ },
1360
+ children: [
1361
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1362
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.findIndex(
1363
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1364
+ )) != null ? _j : -1) + 1 || "") })
1365
+ ]
1366
+ }
1367
+ ),
1368
+ /* @__PURE__ */ jsxRuntime.jsxs(
1369
+ system.Box,
1370
+ {
1371
+ sx: {
1372
+ flexBasis: "18%",
1373
+ minWidth: 200,
1374
+ display: "flex",
1375
+ alignItems: "center",
1376
+ justifyContent: "flex-end",
1377
+ gap: 1.5
1378
+ },
1379
+ children: [
1380
+ (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1381
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1382
+ )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1383
+ (lvl) => {
1384
+ var _a3;
1385
+ return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1386
+ }
1387
+ )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1388
+ Statusselector_default,
1389
+ {
1390
+ onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
1391
+ onApprove: () => {
1392
+ var _a3;
1393
+ return handleApprove(
1394
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
1395
+ );
1396
+ },
1397
+ onReject: () => {
1398
+ var _a3;
1399
+ return handleReject(
1400
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
1401
+ );
1402
+ },
1403
+ onHold: () => {
1404
+ var _a3;
1405
+ return handleOnHold(
1406
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1407
+ );
1408
+ },
1409
+ statusList: (info == null ? void 0 : info.isLevelZero) && (info == null ? void 0 : info.created_by) === ((_o = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _o.id) ? statusList == null ? void 0 : statusList.filter(
1410
+ (app) => app.status == 1
1411
+ ) : statusList
1412
+ }
1413
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1414
+ material.Chip,
1415
+ {
1416
+ variant: "filled",
1417
+ sx: {
1418
+ backgroundColor: getStatus2(currentStatus).color,
1419
+ color: getStatus2(currentStatus).labelColor,
1420
+ height: "40px",
1421
+ px: 2,
1422
+ borderRadius: "100px !important",
1423
+ "& .MuiChip-label": {
1424
+ fontSize: "14px",
1425
+ lineHeight: "15.4px",
1426
+ fontWeight: "500",
1427
+ textTransform: "capitalize"
1428
+ }
1429
+ },
1430
+ label: statusData.title
1431
+ }
1432
+ ),
1433
+ /* @__PURE__ */ jsxRuntime.jsx(
1434
+ material.Divider,
1435
+ {
1436
+ orientation: "vertical",
1437
+ flexItem: true,
1438
+ sx: {
1439
+ borderColor: "#E0E0E0",
1440
+ height: "40px"
1441
+ }
1442
+ }
1443
+ ),
1444
+ /* @__PURE__ */ jsxRuntime.jsx(
1445
+ material.IconButton,
1446
+ {
1447
+ disableFocusRipple: true,
1448
+ disableRipple: true,
1449
+ color: "primary",
1450
+ sx: {
1451
+ background: "rgba(25,118,210,0.08)",
1452
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
1453
+ "& span": { color: "primary.dark" }
1454
+ },
1455
+ onClick: () => handleExpandClick(info._id),
1456
+ children: expandedId === info._id ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-right-3" })
1457
+ }
1458
+ )
1459
+ ]
1460
+ }
1461
+ )
1462
+ ]
1463
+ }
1464
+ ),
1465
+ expandedId === info._id && /* @__PURE__ */ jsxRuntime.jsx(system.Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsxRuntime.jsx(
1466
+ system.Box,
1467
+ {
1468
+ sx: {
1469
+ height: 150,
1470
+ display: "flex",
1471
+ justifyContent: "center",
1472
+ alignItems: "center"
1473
+ },
1474
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
1475
+ }
1476
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1477
+ CustomTimelineWithStatus,
1478
+ {
1479
+ events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
1480
+ var _a3, _b3, _c3, _d3;
1481
+ return {
1482
+ date: moment__default.default(item == null ? void 0 : item.created_at).format(
1483
+ "DD-MM-YYYY"
1484
+ ),
1485
+ time: moment__default.default(item == null ? void 0 : item.created_at).format("HH:mm"),
1486
+ title: (item == null ? void 0 : item.type) === "create" ? `Raised by - ${(_a3 = item == null ? void 0 : item.created_by_user) == null ? void 0 : _a3.full_name}` : ((_b3 = item == null ? void 0 : item.created_by_user) == null ? void 0 : _b3.full_name) || "N/A",
1487
+ subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
1488
+ attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
1489
+ count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
1490
+ cardType: "card"
1491
+ };
1492
+ })
1493
+ }
1494
+ ) })
1495
+ ]
1496
+ },
1497
+ index
1498
+ );
1499
+ })
1500
+ }
1501
+ ),
1502
+ selectedApprovalOtions === "Action Required" && /* @__PURE__ */ jsxRuntime.jsx(
1503
+ system.Box,
1504
+ {
1505
+ className: "fixedModal",
1506
+ sx: {
1507
+ overflowY: "auto",
1508
+ height: "calc(100vh - 180px)",
1509
+ px: 2,
1510
+ pb: 3
1511
+ },
1512
+ children: filteredPendingRequestArray == null ? void 0 : filteredPendingRequestArray.map((info, index) => {
1513
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l;
1514
+ const currentLevel = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
1515
+ (level_) => level_.id === (info == null ? void 0 : info.current_level)
1516
+ );
1517
+ const statusList = currentLevel ? currentLevel.status_list : [];
1518
+ (statusList || []).reduce(
1519
+ (acc, s) => {
1520
+ if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
1521
+ return acc;
1522
+ },
1523
+ {}
1524
+ );
1525
+ const redir = buildRedirectionUrl(info);
1526
+ const currentStatus = ((_d2 = (_c2 = (_b2 = info == null ? void 0 : info.levels) == null ? void 0 : _b2.find(
1527
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1528
+ )) == null ? void 0 : _c2.selected_status) == null ? void 0 : _d2.status_id) === 1 ? "approved" : ((_g2 = (_f2 = (_e2 = info == null ? void 0 : info.levels) == null ? void 0 : _e2.find(
1529
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1530
+ )) == null ? void 0 : _f2.selected_status) == null ? void 0 : _g2.status_id) === 3 ? "rejected" : "pending";
1531
+ const statusData = getStatus2(currentStatus);
1532
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1533
+ material.Card,
609
1534
  {
610
- disableFocusRipple: true,
611
- disableRipple: true,
612
- color: "primary",
613
1535
  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 }
1536
+ mb: 3,
1537
+ borderRadius: "14px",
1538
+ boxShadow: "0px 2px 10px rgba(76, 78, 100, 0.1)",
1539
+ px: 3,
1540
+ py: 2
618
1541
  },
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
- )
623
- ] })
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
- ] }) }) });
1542
+ children: [
1543
+ /* @__PURE__ */ jsxRuntime.jsxs(
1544
+ material.CardContent,
1545
+ {
1546
+ sx: {
1547
+ display: "flex",
1548
+ justifyContent: "space-between",
1549
+ alignItems: "center",
1550
+ flexWrap: { xs: "wrap", md: "nowrap" },
1551
+ gap: 2
1552
+ },
1553
+ children: [
1554
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "22%", minWidth: 220 }, children: [
1555
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsxRuntime.jsx(
1556
+ material.Typography,
1557
+ {
1558
+ variant: "h6",
1559
+ fontWeight: 600,
1560
+ noWrap: true,
1561
+ color: "text.primary",
1562
+ children: info.activity_name
1563
+ }
1564
+ ) }),
1565
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsxRuntime.jsx(
1566
+ material.Typography,
1567
+ {
1568
+ variant: "body2",
1569
+ color: "text.secondary",
1570
+ noWrap: true,
1571
+ sx: { mt: 0.5 },
1572
+ children: info.description_data
1573
+ }
1574
+ ) })
1575
+ ] }),
1576
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "20%", minWidth: 180 }, children: [
1577
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
1578
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: redir, children: /* @__PURE__ */ jsxRuntime.jsx(
1579
+ material.Typography,
1580
+ {
1581
+ component: "a",
1582
+ href: redir,
1583
+ target: "_blank",
1584
+ rel: "noreferrer",
1585
+ sx: {
1586
+ display: "block",
1587
+ color: "primary.dark",
1588
+ fontWeight: 500,
1589
+ textDecoration: "none",
1590
+ overflow: "hidden",
1591
+ textOverflow: "ellipsis",
1592
+ whiteSpace: "nowrap",
1593
+ mt: 0.8
1594
+ },
1595
+ children: redir
1596
+ }
1597
+ ) })
1598
+ ] }),
1599
+ /* @__PURE__ */ jsxRuntime.jsxs(
1600
+ system.Box,
1601
+ {
1602
+ sx: {
1603
+ flexBasis: "18%",
1604
+ minWidth: 200,
1605
+ display: "flex",
1606
+ alignItems: "center",
1607
+ justifyContent: "flex-end",
1608
+ gap: 1.5
1609
+ },
1610
+ children: [
1611
+ (info == null ? void 0 : info.current_status) !== "completed" && ((_i = (_h = info == null ? void 0 : info.levels) == null ? void 0 : _h.find(
1612
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1613
+ )) == null ? void 0 : _i.order) <= ((_k = (_j = info == null ? void 0 : info.levels) == null ? void 0 : _j.find(
1614
+ (lvl) => {
1615
+ var _a3;
1616
+ return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1617
+ }
1618
+ )) == null ? void 0 : _k.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1619
+ Statusselector_default,
1620
+ {
1621
+ onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
1622
+ onApprove: () => {
1623
+ var _a3;
1624
+ return handleApprove(
1625
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
1626
+ );
1627
+ },
1628
+ onReject: () => {
1629
+ var _a3;
1630
+ return handleReject(
1631
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
1632
+ );
1633
+ },
1634
+ onHold: () => {
1635
+ var _a3;
1636
+ return handleOnHold(
1637
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1638
+ );
1639
+ },
1640
+ statusList: (info == null ? void 0 : info.isLevelZero) && (info == null ? void 0 : info.created_by) === ((_l = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _l.id) ? statusList == null ? void 0 : statusList.filter(
1641
+ (app) => app.status == 1
1642
+ ) : statusList
1643
+ }
1644
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1645
+ material.Chip,
1646
+ {
1647
+ variant: "filled",
1648
+ sx: {
1649
+ backgroundColor: getStatus2(currentStatus).color,
1650
+ color: getStatus2(currentStatus).labelColor,
1651
+ height: "40px",
1652
+ px: 2,
1653
+ borderRadius: "100px !important",
1654
+ "& .MuiChip-label": {
1655
+ fontSize: "14px",
1656
+ lineHeight: "15.4px",
1657
+ fontWeight: "500",
1658
+ textTransform: "capitalize"
1659
+ }
1660
+ },
1661
+ label: statusData.title
1662
+ }
1663
+ ),
1664
+ /* @__PURE__ */ jsxRuntime.jsx(
1665
+ material.Divider,
1666
+ {
1667
+ orientation: "vertical",
1668
+ flexItem: true,
1669
+ sx: {
1670
+ borderColor: "#E0E0E0",
1671
+ height: "40px"
1672
+ }
1673
+ }
1674
+ ),
1675
+ /* @__PURE__ */ jsxRuntime.jsx(
1676
+ material.IconButton,
1677
+ {
1678
+ disableFocusRipple: true,
1679
+ disableRipple: true,
1680
+ color: "primary",
1681
+ sx: {
1682
+ background: "rgba(25,118,210,0.08)",
1683
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
1684
+ "& span": { color: "primary.dark" }
1685
+ },
1686
+ onClick: () => handleExpandClick(info._id),
1687
+ children: expandedId === info._id ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-right-3" })
1688
+ }
1689
+ )
1690
+ ]
1691
+ }
1692
+ )
1693
+ ]
1694
+ }
1695
+ ),
1696
+ expandedId === info._id && /* @__PURE__ */ jsxRuntime.jsx(system.Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsxRuntime.jsx(
1697
+ system.Box,
1698
+ {
1699
+ sx: {
1700
+ height: 150,
1701
+ display: "flex",
1702
+ justifyContent: "center",
1703
+ alignItems: "center"
1704
+ },
1705
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
1706
+ }
1707
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1708
+ CustomTimelineWithStatus,
1709
+ {
1710
+ events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
1711
+ var _a3, _b3, _c3, _d3;
1712
+ return {
1713
+ date: moment__default.default(item == null ? void 0 : item.created_at).format(
1714
+ "DD-MM-YYYY"
1715
+ ),
1716
+ time: moment__default.default(item == null ? void 0 : item.created_at).format("HH:mm"),
1717
+ title: (item == null ? void 0 : item.type) === "create" ? `Raised by - ${(_a3 = item == null ? void 0 : item.created_by_user) == null ? void 0 : _a3.full_name}` : ((_b3 = item == null ? void 0 : item.created_by_user) == null ? void 0 : _b3.full_name) || "N/A",
1718
+ subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
1719
+ attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
1720
+ count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
1721
+ cardType: "card"
1722
+ };
1723
+ })
1724
+ }
1725
+ ) })
1726
+ ]
1727
+ },
1728
+ index
1729
+ );
1730
+ })
1731
+ }
1732
+ )
1733
+ ] })
1734
+ }
1735
+ ),
1736
+ /* @__PURE__ */ jsxRuntime.jsx(
1737
+ SendBackDialog_default,
1738
+ {
1739
+ openModal: !!sendDialog,
1740
+ closeModal: () => setSendDialog(null),
1741
+ header: "Send Back",
1742
+ workflowLogId: sendDialog || ""
1743
+ }
1744
+ ),
1745
+ /* @__PURE__ */ jsxRuntime.jsx(
1746
+ ApproveDialog_default,
1747
+ {
1748
+ openModal: !!approveTarget,
1749
+ closeModal: () => setApproveTarget(null),
1750
+ header: "Approve",
1751
+ workflowLogId: (_a = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _a[0],
1752
+ statusId: (_b = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _b[1]
1753
+ }
1754
+ ),
1755
+ /* @__PURE__ */ jsxRuntime.jsx(
1756
+ RejectDialog_default,
1757
+ {
1758
+ openModal: !!rejectTarget,
1759
+ closeModal: () => setRejectTarget(null),
1760
+ header: "Reject",
1761
+ workflowLogId: (_c = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _c[0],
1762
+ statusId: (_d = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _d[1],
1763
+ rejection_reason_master: (_e = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _e[2]
1764
+ }
1765
+ ),
1766
+ /* @__PURE__ */ jsxRuntime.jsx(
1767
+ OnHoldDialog_default,
1768
+ {
1769
+ openModal: !!onHoldTarget,
1770
+ closeModal: () => setOnHoldTarget(null),
1771
+ header: "On Hold",
1772
+ workflowLogId: (_f = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _f[0],
1773
+ statusId: (_g = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _g[1]
1774
+ }
1775
+ )
1776
+ ] });
641
1777
  }
642
1778
  function DialogOpener({
643
1779
  openDialog,
@@ -647,8 +1783,8 @@ function DialogOpener({
647
1783
  }) {
648
1784
  const theme = styles.useTheme();
649
1785
  useMediaQuery__default.default(theme.breakpoints.down("lg"));
650
- const [screenWidth, setScreenWidth] = React2.useState(typeof window !== "undefined" ? window.innerWidth : 0);
651
- React2.useEffect(() => {
1786
+ const [screenWidth, setScreenWidth] = React7.useState(typeof window !== "undefined" ? window.innerWidth : 0);
1787
+ React7.useEffect(() => {
652
1788
  const updateScreenWidth = () => setScreenWidth(window.innerWidth);
653
1789
  window.addEventListener("resize", updateScreenWidth);
654
1790
  return () => window.removeEventListener("resize", updateScreenWidth);
@@ -666,8 +1802,8 @@ function DialogOpener({
666
1802
  /* @__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
1803
  /* @__PURE__ */ jsxRuntime.jsx(ApprovalWorkflow, { userInfo: userInfoData, selectedWorkflowsList })
668
1804
  ] }),
669
- /* @__PURE__ */ jsxRuntime.jsx(DialogActions__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(
670
- Button2__default.default,
1805
+ /* @__PURE__ */ jsxRuntime.jsx(DialogActions5__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(
1806
+ Button7__default.default,
671
1807
  {
672
1808
  variant: "contained",
673
1809
  color: "primary",