amp-workflow-ui 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2,15 +2,14 @@ import React7, { createContext, useState, useEffect, useCallback, useContext, us
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import Button7 from '@mui/material/Button';
4
4
  import Dialog from '@mui/material/Dialog';
5
- import { useTheme } from '@mui/material/styles';
5
+ import { styled, useTheme } from '@mui/material/styles';
6
6
  import useMediaQuery from '@mui/material/useMediaQuery';
7
7
  import DialogActions5 from '@mui/material/DialogActions';
8
8
  import DialogContent from '@mui/material/DialogContent';
9
- import { styled, Chip, IconButton, useTheme as useTheme$1, Tooltip, Card, CardContent, Typography, Divider, CircularProgress, Box as Box$1, TextField, InputAdornment, Button, Menu, MenuItem, DialogTitle, Grid, DialogActions, FormControl, InputLabel, Select } from '@mui/material';
9
+ import { Card, styled as styled$1, Chip, IconButton, useTheme as useTheme$1, Tooltip, CardContent, Typography, Divider, CircularProgress, Box as Box$1, TextField, InputAdornment, Button, Menu, MenuItem, DialogTitle, Grid, DialogActions, Snackbar, Alert, FormControl, InputLabel, Select } from '@mui/material';
10
10
  import HighlightOffIcon from '@mui/icons-material/HighlightOff';
11
11
  import { Box } from '@mui/system';
12
12
  import moment from 'moment';
13
- import toast from 'react-hot-toast';
14
13
 
15
14
  // src/context.tsx
16
15
  var WorkflowContext = createContext(null);
@@ -32,6 +31,7 @@ var ActionMenu = ({
32
31
  onApprove,
33
32
  onReject,
34
33
  onHold,
34
+ level,
35
35
  statusList
36
36
  }) => {
37
37
  const [anchorEl, setAnchorEl] = useState(null);
@@ -42,31 +42,40 @@ var ActionMenu = ({
42
42
  const handleClose = () => setAnchorEl(null);
43
43
  return /* @__PURE__ */ jsxs(Fragment, { children: [
44
44
  /* @__PURE__ */ jsx(Button, { variant: "contained", color: "primary", onClick: handleActionClick, children: "Apply Action" }),
45
- /* @__PURE__ */ jsxs(Menu, { anchorEl, open, onClose: handleClose, MenuListProps: { "aria-labelledby": "basic-button" }, children: [
46
- /* @__PURE__ */ jsx(
47
- MenuItem,
48
- {
49
- onClick: () => {
50
- onSendBack();
51
- handleClose();
52
- },
53
- children: "Send Back"
54
- }
55
- ),
56
- statusList.map((list) => /* @__PURE__ */ jsx(
57
- MenuItem,
58
- {
59
- onClick: () => {
60
- if (list.status === 1) onApprove();
61
- else if (list.status === 2) onHold();
62
- else if (list.status === 3) onReject();
63
- handleClose();
64
- },
65
- children: list.name
66
- },
67
- list.id
68
- ))
69
- ] })
45
+ /* @__PURE__ */ jsxs(
46
+ Menu,
47
+ {
48
+ anchorEl,
49
+ open,
50
+ onClose: handleClose,
51
+ MenuListProps: { "aria-labelledby": "basic-button" },
52
+ children: [
53
+ !level && /* @__PURE__ */ jsx(
54
+ MenuItem,
55
+ {
56
+ onClick: () => {
57
+ onSendBack();
58
+ handleClose();
59
+ },
60
+ children: "Send Back"
61
+ }
62
+ ),
63
+ statusList.map((list) => /* @__PURE__ */ jsx(
64
+ MenuItem,
65
+ {
66
+ onClick: () => {
67
+ if (list.status === 1) onApprove();
68
+ else if (list.status === 2) onHold();
69
+ else if (list.status === 3) onReject();
70
+ handleClose();
71
+ },
72
+ children: list.name
73
+ },
74
+ list.id
75
+ ))
76
+ ]
77
+ }
78
+ )
70
79
  ] });
71
80
  };
72
81
  var Statusselector_default = ActionMenu;
@@ -84,6 +93,12 @@ function SendBackDialog({
84
93
  const [loading, setLoading] = useState(false);
85
94
  const [fileLoading, setFileLoading] = useState(false);
86
95
  const fileInputRef = useRef(null);
96
+ const [snackbar, setSnackbar] = useState({
97
+ open: false,
98
+ message: "",
99
+ severity: "success"
100
+ });
101
+ const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
87
102
  const handleAttachment = () => {
88
103
  var _a;
89
104
  return (_a = fileInputRef.current) == null ? void 0 : _a.click();
@@ -96,12 +111,22 @@ function SendBackDialog({
96
111
  const response = await api.post({
97
112
  url: "/workflow/upload-document",
98
113
  data: formData,
114
+ serviceURL: "api",
99
115
  headers: { "Content-Type": "multipart/form-data" }
100
116
  });
101
117
  setFileName(response.data.file);
102
118
  setSelectedFile(response.data.file);
119
+ setSnackbar({
120
+ open: true,
121
+ message: "File uploaded successfully!",
122
+ severity: "success"
123
+ });
103
124
  } catch (error2) {
104
- toast.error("File upload failed");
125
+ setSnackbar({
126
+ open: true,
127
+ message: "File upload failed.",
128
+ severity: "error"
129
+ });
105
130
  } finally {
106
131
  setFileLoading(false);
107
132
  }
@@ -127,7 +152,7 @@ function SendBackDialog({
127
152
  return isValid;
128
153
  };
129
154
  const onSubmit = async () => {
130
- var _a, _b, _c;
155
+ var _a, _b, _c, _d;
131
156
  if (!validateFields()) return;
132
157
  setLoading(true);
133
158
  try {
@@ -140,127 +165,186 @@ function SendBackDialog({
140
165
  },
141
166
  serviceURL: "api"
142
167
  });
143
- if ((res == null ? void 0 : res.status) === 200) toast.success("Successfully sent back!");
144
- if ((_b = res == null ? void 0 : res.error) == null ? void 0 : _b.message) {
145
- toast.error((_c = res == null ? void 0 : res.error) == null ? void 0 : _c.message, { duration: 2e3 });
168
+ if ((res == null ? void 0 : res.status) === 200) {
169
+ setSnackbar({
170
+ open: true,
171
+ message: "Workflow sent back successfully!",
172
+ severity: "success"
173
+ });
174
+ } else {
175
+ setSnackbar({
176
+ open: true,
177
+ message: ((_b = res == null ? void 0 : res.error) == null ? void 0 : _b.message) || "Something went wrong. Try again.",
178
+ severity: "error"
179
+ });
146
180
  }
147
- closeModal && closeModal();
148
- } catch {
149
- toast.error("Opps! something went wrong.");
181
+ } catch (e) {
182
+ setSnackbar({
183
+ open: true,
184
+ message: ((_d = (_c = e == null ? void 0 : e.response) == null ? void 0 : _c.data) == null ? void 0 : _d.message) || "Oops! Something went wrong.",
185
+ severity: "error"
186
+ });
150
187
  } finally {
188
+ setComment("");
189
+ setSelectedFile(null);
190
+ setFileName("");
151
191
  setLoading(false);
192
+ closeModal && closeModal();
152
193
  }
153
194
  };
154
- return /* @__PURE__ */ jsxs(
155
- Dialog,
156
- {
157
- open: openModal,
158
- onClose: closeModal,
159
- "aria-labelledby": "responsive-dialog-title",
160
- sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
161
- children: [
162
- /* @__PURE__ */ jsxs(
163
- Box$1,
164
- {
165
- sx: {
166
- display: "flex",
167
- justifyContent: "space-between",
168
- alignItems: "center"
169
- },
170
- children: [
171
- /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
172
- /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
173
- ]
174
- }
175
- ),
176
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
177
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
178
- TextField,
195
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
196
+ /* @__PURE__ */ jsxs(
197
+ Dialog,
198
+ {
199
+ open: openModal,
200
+ onClose: closeModal,
201
+ "aria-labelledby": "responsive-dialog-title",
202
+ sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
203
+ children: [
204
+ /* @__PURE__ */ jsxs(
205
+ Box$1,
179
206
  {
180
- fullWidth: true,
181
- label: "Comment",
182
- value: comment,
183
- placeholder: "Comment Here",
184
- onChange: (e) => setComment(e.target.value),
185
- required: true,
186
- error: !!error.comment,
187
- helperText: error.comment
207
+ sx: {
208
+ display: "flex",
209
+ justifyContent: "space-between",
210
+ alignItems: "center"
211
+ },
212
+ children: [
213
+ /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
214
+ /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
215
+ ]
188
216
  }
189
- ) }),
190
- /* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
191
- /* @__PURE__ */ jsx(
217
+ ),
218
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
219
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
192
220
  TextField,
193
221
  {
194
- type: "text",
195
222
  fullWidth: true,
196
- label: "Attachment",
197
- placeholder: "Attachment",
198
- InputProps: {
199
- endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx("span", { className: "icon-export-1" }) })
200
- },
201
- onClick: handleAttachment,
202
- value: fileName,
203
- error: !!error.file,
204
- helperText: error.file
205
- }
206
- ),
207
- /* @__PURE__ */ jsx(
208
- "input",
209
- {
210
- type: "file",
211
- ref: fileInputRef,
212
- style: { display: "none" },
213
- onChange: handleFileChange
223
+ label: "Comment",
224
+ value: comment,
225
+ placeholder: "Comment Here",
226
+ onChange: (e) => setComment(e.target.value),
227
+ required: true,
228
+ error: !!error.comment,
229
+ helperText: error.comment
214
230
  }
215
- )
216
- ] })
217
- ] }) }) }),
218
- /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
219
- Box$1,
220
- {
221
- sx: {
222
- display: "flex",
223
- justifyContent: "flex-end",
224
- alignItems: "center"
225
- },
226
- children: [
231
+ ) }),
232
+ /* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
227
233
  /* @__PURE__ */ jsx(
228
- Button,
234
+ TextField,
229
235
  {
230
- onClick: closeModal,
231
- size: "large",
232
- variant: "outlined",
233
- color: "primary",
234
- sx: { mr: 2 },
235
- children: "Close"
236
+ type: "text",
237
+ fullWidth: true,
238
+ label: "Attachment",
239
+ placeholder: "Attachment",
240
+ InputProps: {
241
+ endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: fileLoading ? /* @__PURE__ */ jsx(CircularProgress, { size: 20, color: "inherit" }) : /* @__PURE__ */ jsx(
242
+ "span",
243
+ {
244
+ className: "icon-export-1",
245
+ style: { cursor: "pointer" },
246
+ onClick: handleAttachment
247
+ }
248
+ ) })
249
+ },
250
+ onClick: handleAttachment,
251
+ value: fileName,
252
+ error: !!error.file,
253
+ helperText: error.file
236
254
  }
237
255
  ),
238
256
  /* @__PURE__ */ jsx(
239
- Button,
257
+ "input",
240
258
  {
241
- onClick: onSubmit,
242
- size: "large",
243
- variant: "contained",
244
- color: "primary",
245
- disabled: loading || fileLoading,
246
- children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit"
259
+ type: "file",
260
+ ref: fileInputRef,
261
+ style: { display: "none" },
262
+ onChange: handleFileChange
247
263
  }
248
264
  )
249
- ]
265
+ ] })
266
+ ] }) }) }),
267
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
268
+ Box$1,
269
+ {
270
+ sx: {
271
+ display: "flex",
272
+ justifyContent: "flex-end",
273
+ alignItems: "center"
274
+ },
275
+ children: [
276
+ /* @__PURE__ */ jsx(
277
+ Button,
278
+ {
279
+ onClick: closeModal,
280
+ size: "large",
281
+ variant: "outlined",
282
+ color: "primary",
283
+ sx: { mr: 2 },
284
+ children: "Close"
285
+ }
286
+ ),
287
+ /* @__PURE__ */ jsx(
288
+ Button,
289
+ {
290
+ onClick: onSubmit,
291
+ size: "large",
292
+ variant: "contained",
293
+ color: "primary",
294
+ disabled: loading || fileLoading,
295
+ children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit"
296
+ }
297
+ )
298
+ ]
299
+ }
300
+ ) })
301
+ ]
302
+ }
303
+ ),
304
+ /* @__PURE__ */ jsx(
305
+ Snackbar,
306
+ {
307
+ open: snackbar.open,
308
+ autoHideDuration: 3e3,
309
+ onClose: handleCloseSnackbar,
310
+ anchorOrigin: { vertical: "top", horizontal: "right" },
311
+ children: /* @__PURE__ */ jsx(
312
+ Alert,
313
+ {
314
+ onClose: handleCloseSnackbar,
315
+ severity: snackbar.severity,
316
+ sx: {
317
+ width: "100%",
318
+ color: snackbar.severity === "error" ? "#fff" : "inherit",
319
+ bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
320
+ },
321
+ children: snackbar.message
250
322
  }
251
- ) })
252
- ]
253
- }
254
- );
323
+ )
324
+ }
325
+ )
326
+ ] });
255
327
  }
256
328
  var SendBackDialog_default = SendBackDialog;
257
- function ApproveDialog({ openModal, closeModal, header, workflowLogId, statusId }) {
329
+ function ApproveDialog({
330
+ openModal,
331
+ closeModal,
332
+ header,
333
+ workflowLogId,
334
+ statusId
335
+ }) {
258
336
  const { userInfo, api } = useWorkflowContext();
259
337
  const theme = useTheme();
260
338
  useMediaQuery(theme.breakpoints.down("lg"));
261
339
  const [comment, setComment] = useState("");
262
340
  const [error, setError] = useState({});
263
341
  const [loading, setLoading] = useState(false);
342
+ const [snackbar, setSnackbar] = useState({
343
+ open: false,
344
+ message: "",
345
+ severity: "success"
346
+ });
347
+ const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
264
348
  const validateFields = () => {
265
349
  let isValid = true;
266
350
  const newError = {};
@@ -272,60 +356,185 @@ function ApproveDialog({ openModal, closeModal, header, workflowLogId, statusId
272
356
  return isValid;
273
357
  };
274
358
  const onSubmit = async () => {
275
- var _a;
359
+ var _a, _b, _c;
276
360
  if (!validateFields()) return;
277
361
  setLoading(true);
278
362
  try {
279
- await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
280
- comment,
281
- created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
363
+ await api.post({
364
+ url: `/workflow/update-status/${workflowLogId}/${statusId}`,
365
+ data: {
366
+ comment,
367
+ created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
368
+ },
369
+ serviceURL: "api"
370
+ });
371
+ setSnackbar({
372
+ open: true,
373
+ message: "Approved successfully!",
374
+ severity: "success"
375
+ });
376
+ } catch (e) {
377
+ setSnackbar({
378
+ open: true,
379
+ message: ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Something unexpected occurred!",
380
+ severity: "error"
282
381
  });
283
- toast.success("approved successfully!!!");
284
- closeModal && closeModal();
285
- } catch {
286
- toast.error("something unexpected occured!!!");
287
382
  } finally {
383
+ setComment("");
288
384
  setLoading(false);
385
+ closeModal && closeModal();
289
386
  }
290
387
  };
291
- return /* @__PURE__ */ jsxs(Dialog, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
292
- /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
293
- /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
294
- /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
295
- ] }),
296
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(TextField, { fullWidth: true, label: "Comment", value: comment, placeholder: "Comment Here", onChange: (e) => setComment(e.target.value), required: true, error: !!error.comment, helperText: error.comment }) }) }) }) }),
297
- /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
298
- /* @__PURE__ */ jsx(Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
299
- /* @__PURE__ */ jsx(Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
300
- ] }) })
388
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
389
+ /* @__PURE__ */ jsxs(
390
+ Dialog,
391
+ {
392
+ open: openModal,
393
+ onClose: closeModal,
394
+ "aria-labelledby": "responsive-dialog-title",
395
+ sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
396
+ children: [
397
+ /* @__PURE__ */ jsxs(
398
+ Box$1,
399
+ {
400
+ sx: {
401
+ display: "flex",
402
+ justifyContent: "space-between",
403
+ alignItems: "center"
404
+ },
405
+ children: [
406
+ /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
407
+ /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
408
+ ]
409
+ }
410
+ ),
411
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
412
+ TextField,
413
+ {
414
+ fullWidth: true,
415
+ label: "Comment",
416
+ value: comment,
417
+ placeholder: "Comment Here",
418
+ onChange: (e) => setComment(e.target.value),
419
+ required: true,
420
+ error: !!error.comment,
421
+ helperText: error.comment
422
+ }
423
+ ) }) }) }) }),
424
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
425
+ Box$1,
426
+ {
427
+ sx: {
428
+ display: "flex",
429
+ justifyContent: "flex-end",
430
+ alignItems: "center"
431
+ },
432
+ children: [
433
+ /* @__PURE__ */ jsx(
434
+ Button,
435
+ {
436
+ onClick: closeModal,
437
+ size: "large",
438
+ variant: "outlined",
439
+ color: "primary",
440
+ sx: { mr: 2 },
441
+ children: "Close"
442
+ }
443
+ ),
444
+ /* @__PURE__ */ jsx(
445
+ Button,
446
+ {
447
+ onClick: onSubmit,
448
+ size: "large",
449
+ variant: "contained",
450
+ color: "primary",
451
+ disabled: loading,
452
+ children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit"
453
+ }
454
+ )
455
+ ]
456
+ }
457
+ ) })
458
+ ]
459
+ }
460
+ ),
461
+ /* @__PURE__ */ jsx(
462
+ Snackbar,
463
+ {
464
+ open: snackbar.open,
465
+ autoHideDuration: 3e3,
466
+ onClose: handleCloseSnackbar,
467
+ anchorOrigin: { vertical: "top", horizontal: "right" },
468
+ children: /* @__PURE__ */ jsx(
469
+ Alert,
470
+ {
471
+ onClose: handleCloseSnackbar,
472
+ severity: snackbar.severity,
473
+ sx: {
474
+ width: "100%",
475
+ color: snackbar.severity === "error" ? "#fff" : "inherit",
476
+ bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
477
+ },
478
+ children: snackbar.message
479
+ }
480
+ )
481
+ }
482
+ )
301
483
  ] });
302
484
  }
303
485
  var ApproveDialog_default = ApproveDialog;
304
- function RejectDialog({ openModal, closeModal, header, workflowLogId, statusId, rejection_reason_master }) {
486
+ function RejectDialog({
487
+ openModal,
488
+ closeModal,
489
+ header,
490
+ workflowLogId,
491
+ statusId,
492
+ rejection_reason_master
493
+ }) {
305
494
  const { userInfo, api } = useWorkflowContext();
306
495
  const theme = useTheme();
307
496
  useMediaQuery(theme.breakpoints.down("lg"));
308
497
  const DownArrow = () => {
309
498
  var _a;
310
- return /* @__PURE__ */ jsx("span", { style: { color: ((_a = theme.palette.customColors) == null ? void 0 : _a.mainText) || "#333" }, className: "icon-arrow-down-1" });
499
+ return /* @__PURE__ */ jsx(
500
+ "span",
501
+ {
502
+ style: { color: ((_a = theme.palette.customColors) == null ? void 0 : _a.mainText) || "#333" },
503
+ className: "icon-arrow-down-1"
504
+ }
505
+ );
311
506
  };
312
507
  const [rejectReasons, setRejectReasons] = useState("");
313
508
  const [comment, setComment] = useState("");
314
509
  const [error, setError] = useState({ reason: "", comment: "" });
315
510
  const [statusApplicableList, setStatusApplicableList] = useState([]);
316
511
  const [loading, setLoading] = useState(false);
512
+ const [snackbar, setSnackbar] = useState({
513
+ open: false,
514
+ message: "",
515
+ severity: "success"
516
+ });
517
+ const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
317
518
  useEffect(() => {
318
519
  (async () => {
319
520
  var _a;
320
521
  try {
321
522
  if (!statusApplicableList.length) {
322
- const res = await api.get(`/workflow/applicableStatuses?type=${rejection_reason_master}`);
523
+ const res = await api.get({
524
+ url: `/workflow/applicableStatuses?type=${rejection_reason_master}`,
525
+ serviceURL: "api"
526
+ });
323
527
  setStatusApplicableList(((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || []);
324
528
  }
325
529
  } catch (e) {
530
+ setSnackbar({
531
+ open: true,
532
+ message: "Failed to load reject reasons.",
533
+ severity: "error"
534
+ });
326
535
  }
327
536
  })();
328
- }, []);
537
+ }, [rejection_reason_master]);
329
538
  const validateFields = () => {
330
539
  let isValid = true;
331
540
  const errors = { reason: "", comment: "" };
@@ -341,48 +550,174 @@ function RejectDialog({ openModal, closeModal, header, workflowLogId, statusId,
341
550
  return isValid;
342
551
  };
343
552
  const onSubmit = async () => {
344
- var _a;
553
+ var _a, _b, _c;
345
554
  if (!validateFields()) return;
346
555
  setLoading(true);
347
556
  try {
348
- await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
349
- reason: rejectReasons,
350
- comment,
351
- created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
557
+ await api.post({
558
+ url: `/workflow/update-status/${workflowLogId}/${statusId}`,
559
+ data: {
560
+ reason: rejectReasons,
561
+ comment,
562
+ created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
563
+ },
564
+ serviceURL: "api"
565
+ });
566
+ setSnackbar({
567
+ open: true,
568
+ message: "Rejected successfully!",
569
+ severity: "success"
352
570
  });
353
- closeModal && closeModal();
354
571
  } catch (e) {
572
+ const message = ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Something went wrong!";
573
+ console.error("\u274C Reject Error:", message);
574
+ setSnackbar({
575
+ open: true,
576
+ message,
577
+ severity: "error"
578
+ });
355
579
  } finally {
580
+ setComment("");
581
+ setRejectReasons("");
356
582
  setLoading(false);
583
+ closeModal && closeModal();
357
584
  }
358
585
  };
359
- return /* @__PURE__ */ jsxs(Dialog, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
360
- /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
361
- /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
362
- /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
363
- ] }),
364
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
365
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, required: true, error: !!error.reason, children: [
366
- /* @__PURE__ */ jsx(InputLabel, { required: true, id: "reject-reason-label", children: "Reject Reasons" }),
367
- /* @__PURE__ */ jsx(Select, { IconComponent: DownArrow, label: "Reject Reasons", value: rejectReasons, id: "reject-reason", labelId: "reject-reason-label", onChange: (e) => setRejectReasons(e.target.value), children: statusApplicableList == null ? void 0 : statusApplicableList.map((reason_) => /* @__PURE__ */ jsx(MenuItem, { value: reason_ == null ? void 0 : reason_.id, children: reason_ == null ? void 0 : reason_.name }, reason_ == null ? void 0 : reason_.id)) }),
368
- error.reason && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "error", children: error.reason })
369
- ] }) }),
370
- /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(TextField, { fullWidth: true, label: "Comment", value: comment, placeholder: "Comment Here", onChange: (e) => setComment(e.target.value), required: true, error: !!error.comment, helperText: error.comment }) })
371
- ] }) }) }),
372
- /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
373
- /* @__PURE__ */ jsx(Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
374
- /* @__PURE__ */ jsx(Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
375
- ] }) })
586
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
587
+ /* @__PURE__ */ jsxs(
588
+ Dialog,
589
+ {
590
+ open: openModal,
591
+ onClose: closeModal,
592
+ "aria-labelledby": "responsive-dialog-title",
593
+ sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
594
+ children: [
595
+ /* @__PURE__ */ jsxs(
596
+ Box$1,
597
+ {
598
+ sx: {
599
+ display: "flex",
600
+ justifyContent: "space-between",
601
+ alignItems: "center"
602
+ },
603
+ children: [
604
+ /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
605
+ /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
606
+ ]
607
+ }
608
+ ),
609
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
610
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, required: true, error: !!error.reason, children: [
611
+ /* @__PURE__ */ jsx(InputLabel, { required: true, id: "reject-reason-label", children: "Reject Reasons" }),
612
+ /* @__PURE__ */ jsx(
613
+ Select,
614
+ {
615
+ IconComponent: DownArrow,
616
+ label: "Reject Reasons",
617
+ value: rejectReasons,
618
+ id: "reject-reason",
619
+ labelId: "reject-reason-label",
620
+ onChange: (e) => setRejectReasons(e.target.value),
621
+ children: statusApplicableList == null ? void 0 : statusApplicableList.map((reason_) => /* @__PURE__ */ jsx(MenuItem, { value: reason_ == null ? void 0 : reason_.id, children: reason_ == null ? void 0 : reason_.name }, reason_ == null ? void 0 : reason_.id))
622
+ }
623
+ ),
624
+ error.reason && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "error", children: error.reason })
625
+ ] }) }),
626
+ /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
627
+ TextField,
628
+ {
629
+ fullWidth: true,
630
+ label: "Comment",
631
+ value: comment,
632
+ placeholder: "Comment Here",
633
+ onChange: (e) => setComment(e.target.value),
634
+ required: true,
635
+ error: !!error.comment,
636
+ helperText: error.comment
637
+ }
638
+ ) })
639
+ ] }) }) }),
640
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
641
+ Box$1,
642
+ {
643
+ sx: {
644
+ display: "flex",
645
+ justifyContent: "flex-end",
646
+ alignItems: "center"
647
+ },
648
+ children: [
649
+ /* @__PURE__ */ jsx(
650
+ Button,
651
+ {
652
+ onClick: closeModal,
653
+ size: "large",
654
+ variant: "outlined",
655
+ color: "primary",
656
+ sx: { mr: 2 },
657
+ children: "Close"
658
+ }
659
+ ),
660
+ /* @__PURE__ */ jsx(
661
+ Button,
662
+ {
663
+ onClick: onSubmit,
664
+ size: "large",
665
+ variant: "contained",
666
+ color: "primary",
667
+ disabled: loading,
668
+ children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit"
669
+ }
670
+ )
671
+ ]
672
+ }
673
+ ) })
674
+ ]
675
+ }
676
+ ),
677
+ /* @__PURE__ */ jsx(
678
+ Snackbar,
679
+ {
680
+ open: snackbar.open,
681
+ autoHideDuration: 3e3,
682
+ onClose: handleCloseSnackbar,
683
+ anchorOrigin: { vertical: "top", horizontal: "right" },
684
+ children: /* @__PURE__ */ jsx(
685
+ Alert,
686
+ {
687
+ onClose: handleCloseSnackbar,
688
+ severity: snackbar.severity,
689
+ sx: {
690
+ width: "100%",
691
+ color: snackbar.severity === "error" ? "#fff" : "inherit",
692
+ bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
693
+ },
694
+ children: snackbar.message
695
+ }
696
+ )
697
+ }
698
+ )
376
699
  ] });
377
700
  }
378
701
  var RejectDialog_default = RejectDialog;
379
- function OnHoldDialog({ openModal, closeModal, header, workflowLogId, statusId }) {
702
+ function OnHoldDialog({
703
+ openModal,
704
+ closeModal,
705
+ header,
706
+ workflowLogId,
707
+ statusId
708
+ }) {
380
709
  const { userInfo, api } = useWorkflowContext();
381
710
  const theme = useTheme();
382
711
  useMediaQuery(theme.breakpoints.down("lg"));
383
712
  const [comment, setComment] = useState("");
384
713
  const [error, setError] = useState({ comment: "" });
385
714
  const [loading, setLoading] = useState(false);
715
+ const [snackbar, setSnackbar] = useState({
716
+ open: false,
717
+ message: "",
718
+ severity: "success"
719
+ });
720
+ const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
386
721
  const validateFields = () => {
387
722
  let isValid = true;
388
723
  const errors = { comment: "" };
@@ -394,271 +729,322 @@ function OnHoldDialog({ openModal, closeModal, header, workflowLogId, statusId }
394
729
  return isValid;
395
730
  };
396
731
  const onSubmit = async () => {
397
- var _a;
732
+ var _a, _b, _c;
398
733
  if (!validateFields()) return;
399
734
  setLoading(true);
400
735
  try {
401
- await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
402
- comment,
403
- created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
736
+ await api.post({
737
+ url: `/workflow/update-status/${workflowLogId}/${statusId}`,
738
+ data: {
739
+ comment,
740
+ created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
741
+ },
742
+ serviceURL: "api"
743
+ });
744
+ setSnackbar({
745
+ open: true,
746
+ message: "Moved to On-Hold successfully!",
747
+ severity: "success"
748
+ });
749
+ } catch (e) {
750
+ setSnackbar({
751
+ open: true,
752
+ message: ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Failed to submit the form",
753
+ severity: "error"
404
754
  });
405
- closeModal && closeModal();
406
- } catch {
407
- toast.error("Failed to submit the form");
408
755
  } finally {
756
+ setComment("");
757
+ closeModal && closeModal();
409
758
  setLoading(false);
410
759
  }
411
760
  };
412
- return /* @__PURE__ */ jsxs(Dialog, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
413
- /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
414
- /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
415
- /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
416
- ] }),
417
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(TextField, { fullWidth: true, label: "Comment", value: comment, placeholder: "Comment Here", onChange: (e) => setComment(e.target.value), required: true, error: !!error.comment, helperText: error.comment }) }) }) }) }),
418
- /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
419
- /* @__PURE__ */ jsx(Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
420
- /* @__PURE__ */ jsx(Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
421
- ] }) })
422
- ] });
423
- }
424
- var OnHoldDialog_default = OnHoldDialog;
425
- var getStatus = (status, theme) => {
426
- const s = status == null ? void 0 : status.toLowerCase();
427
- const colors = {
428
- approved: {
429
- bg: theme.palette.success.light,
430
- text: theme.palette.success.main
431
- },
432
- rejected: { bg: theme.palette.error.light, text: theme.palette.error.main },
433
- onhold: {
434
- bg: theme.palette.warning.light,
435
- text: theme.palette.warning.main
436
- },
437
- inprogress: { bg: theme.palette.info.light, text: theme.palette.info.main },
438
- pending: { bg: theme.palette.grey[200], text: theme.palette.text.primary }
439
- };
440
- return colors[s] || colors.pending;
441
- };
442
- function ConnectedTimeline({ events }) {
443
- const { api } = useWorkflowContext();
444
- const theme = useTheme$1();
445
- const [isMobile, setIsMobile] = useState(false);
446
- useEffect(() => {
447
- const checkScreen = () => setIsMobile(window.innerWidth < 768);
448
- checkScreen();
449
- window.addEventListener("resize", checkScreen);
450
- return () => window.removeEventListener("resize", checkScreen);
451
- }, []);
452
- const handleAttachmentClick = (attachment) => {
453
- api.get({
454
- url: `/workflow/uploaded-document-url/${attachment.split("/").reverse()[0]}`,
455
- serviceURL: "api"
456
- }).then((res) => window.open(res.data, "_blank"));
457
- };
458
- const columns = 4;
459
- const rows = [];
460
- for (let i = 0; i < (events == null ? void 0 : events.length); i += columns)
461
- rows.push(events.slice(i, i + columns));
462
- return /* @__PURE__ */ jsx(Box$1, { sx: { py: 4, position: "relative" }, children: rows.map((row, rowIndex) => {
463
- const reversed = rowIndex % 2 === 1;
464
- return /* @__PURE__ */ jsx(
465
- Box$1,
761
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
762
+ /* @__PURE__ */ jsxs(
763
+ Dialog,
466
764
  {
467
- sx: {
468
- display: "flex",
469
- flexDirection: reversed ? "row-reverse" : "row",
470
- justifyContent: "left",
471
- alignItems: "center",
472
- gap: 6,
473
- position: "relative",
474
- mb: 8,
475
- flexWrap: isMobile ? "wrap" : "nowrap"
476
- },
477
- children: row.map((event, index) => {
478
- var _a;
479
- const globalIndex = rowIndex * columns + index;
480
- const status = getStatus((_a = event.status) == null ? void 0 : _a.title, theme);
481
- const isDisabled = event.cardType === "disableCard";
482
- return /* @__PURE__ */ jsxs(
765
+ open: openModal,
766
+ onClose: closeModal,
767
+ "aria-labelledby": "responsive-dialog-title",
768
+ sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
769
+ children: [
770
+ /* @__PURE__ */ jsxs(
483
771
  Box$1,
484
772
  {
485
773
  sx: {
486
- position: "relative",
487
774
  display: "flex",
488
- justifyContent: "center",
775
+ justifyContent: "space-between",
489
776
  alignItems: "center"
490
777
  },
491
778
  children: [
492
- !isMobile && index < row.length - 1 && /* @__PURE__ */ jsx(
493
- Box$1,
494
- {
495
- sx: {
496
- position: "absolute",
497
- top: "50%",
498
- [reversed ? "right" : "left"]: "100%",
499
- width: "60px",
500
- height: "2px",
501
- background: theme.palette.primary.main,
502
- zIndex: 0
503
- }
504
- }
505
- ),
506
- !isMobile && globalIndex === (rowIndex + 1) * columns - 1 && globalIndex < events.length - 1 && /* @__PURE__ */ jsx(
507
- Box$1,
779
+ /* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
780
+ /* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
781
+ ]
782
+ }
783
+ ),
784
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
785
+ TextField,
786
+ {
787
+ fullWidth: true,
788
+ label: "Comment",
789
+ value: comment,
790
+ placeholder: "Comment Here",
791
+ onChange: (e) => setComment(e.target.value),
792
+ required: true,
793
+ error: !!error.comment,
794
+ helperText: error.comment
795
+ }
796
+ ) }) }) }) }),
797
+ /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
798
+ Box$1,
799
+ {
800
+ sx: {
801
+ display: "flex",
802
+ justifyContent: "flex-end",
803
+ alignItems: "center"
804
+ },
805
+ children: [
806
+ /* @__PURE__ */ jsx(
807
+ Button,
508
808
  {
509
- sx: {
510
- position: "absolute",
511
- bottom: "-48px",
512
- left: reversed ? "0%" : "100%",
513
- width: "2px",
514
- height: "48px",
515
- background: theme.palette.primary.main,
516
- zIndex: 0
517
- }
809
+ onClick: closeModal,
810
+ size: "large",
811
+ variant: "outlined",
812
+ color: "primary",
813
+ sx: { mr: 2 },
814
+ children: "Close"
518
815
  }
519
816
  ),
520
817
  /* @__PURE__ */ jsx(
521
- Card,
818
+ Button,
522
819
  {
523
- sx: {
524
- width: "230px",
525
- minHeight: "180px",
526
- borderRadius: "16px",
527
- border: `1px solid ${isDisabled ? theme.palette.success.light : theme.palette.divider}`,
528
- backgroundColor: isDisabled ? theme.palette.action.hover : theme.palette.background.paper,
529
- textAlign: "center",
530
- boxShadow: "0px 4px 10px rgba(0,0,0,0.05)",
531
- transition: "all 0.25s ease-in-out",
532
- "&:hover": {
533
- boxShadow: "0px 6px 14px rgba(0,0,0,0.1)",
534
- transform: "translateY(-2px)"
535
- }
536
- },
537
- children: /* @__PURE__ */ jsxs(CardContent, { children: [
538
- /* @__PURE__ */ jsxs(
539
- Box$1,
540
- {
541
- sx: {
542
- display: "flex",
543
- justifyContent: "space-between",
544
- alignItems: "center",
545
- mb: 1
546
- },
547
- children: [
548
- /* @__PURE__ */ jsx(
549
- Typography,
550
- {
551
- variant: "body2",
552
- color: theme.palette.text.secondary,
553
- children: event.date
554
- }
555
- ),
556
- event.status && /* @__PURE__ */ jsx(
557
- Chip,
558
- {
559
- label: event.status.title,
560
- sx: {
561
- backgroundColor: status.bg,
562
- color: status.text,
563
- fontSize: 12,
564
- height: 24,
565
- fontWeight: 600,
566
- borderRadius: "16px"
567
- }
568
- }
569
- )
570
- ]
571
- }
572
- ),
573
- /* @__PURE__ */ jsx(
574
- Box$1,
575
- {
576
- sx: {
577
- width: 36,
578
- height: 36,
579
- borderRadius: "50%",
580
- border: `2px solid ${theme.palette.primary.main}`,
581
- display: "flex",
582
- justifyContent: "center",
583
- alignItems: "center",
584
- color: theme.palette.primary.main,
585
- fontWeight: 600,
586
- fontSize: 14,
587
- mx: "auto",
588
- mb: 1.5
589
- },
590
- children: event.count
591
- }
592
- ),
593
- /* @__PURE__ */ jsx(Tooltip, { title: event.title, children: /* @__PURE__ */ jsx(
594
- Typography,
595
- {
596
- variant: "subtitle1",
597
- fontWeight: 600,
598
- color: isDisabled ? theme.palette.text.secondary : theme.palette.text.primary,
599
- sx: {
600
- overflow: "hidden",
601
- textOverflow: "ellipsis",
602
- whiteSpace: "nowrap",
603
- mb: 0.5
604
- },
605
- children: event.title
606
- }
607
- ) }),
608
- /* @__PURE__ */ jsx(
609
- Typography,
610
- {
611
- variant: "body2",
612
- color: theme.palette.text.secondary,
613
- sx: {
614
- minHeight: "20px",
615
- mb: 0.8,
616
- textOverflow: "ellipsis",
617
- whiteSpace: "nowrap",
618
- overflow: "hidden"
619
- },
620
- children: event.subTitle || "No Comments"
621
- }
622
- ),
623
- event.attachment && /* @__PURE__ */ jsx(Tooltip, { title: "View attachment", children: /* @__PURE__ */ jsx(
624
- Typography,
820
+ onClick: onSubmit,
821
+ size: "large",
822
+ variant: "contained",
823
+ color: "primary",
824
+ disabled: loading,
825
+ children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit"
826
+ }
827
+ )
828
+ ]
829
+ }
830
+ ) })
831
+ ]
832
+ }
833
+ ),
834
+ /* @__PURE__ */ jsx(
835
+ Snackbar,
836
+ {
837
+ open: snackbar.open,
838
+ autoHideDuration: 3e3,
839
+ onClose: handleCloseSnackbar,
840
+ anchorOrigin: { vertical: "top", horizontal: "right" },
841
+ children: /* @__PURE__ */ jsx(
842
+ Alert,
843
+ {
844
+ onClose: handleCloseSnackbar,
845
+ severity: snackbar.severity,
846
+ sx: {
847
+ width: "100%",
848
+ color: snackbar.severity === "error" ? "#fff" : "inherit",
849
+ bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
850
+ },
851
+ children: snackbar.message
852
+ }
853
+ )
854
+ }
855
+ )
856
+ ] });
857
+ }
858
+ var OnHoldDialog_default = OnHoldDialog;
859
+ var CONNECTOR = {
860
+ horizontal: {
861
+ thickness: 3,
862
+ lengthExtra: 0,
863
+ offsetReverseExtra: 30,
864
+ color: "#2C35FF"
865
+ },
866
+ vertical: {
867
+ thickness: 3,
868
+ height: 60,
869
+ color: "#2C35FF"
870
+ }
871
+ };
872
+ var CARD_WIDTH = 200;
873
+ var CARD_HEIGHT = 220;
874
+ var GAP = 65;
875
+ var ROW_GAP = 60;
876
+ var CustomCard = styled(Card)(
877
+ ({ theme, cardType }) => ({
878
+ width: CARD_WIDTH,
879
+ height: CARD_HEIGHT,
880
+ borderRadius: 16,
881
+ backgroundColor: cardType === "subCard" ? "#FFF2D8" : cardType === "disableCard" ? "#ECECEC" : "#F1F1FF",
882
+ border: cardType === "disableCard" ? "none" : `1px solid ${theme.palette.primary.dark}`,
883
+ overflow: "hidden",
884
+ position: "relative"
885
+ })
886
+ );
887
+ var Bull = ({ count, cardType }) => {
888
+ const theme = useTheme();
889
+ return /* @__PURE__ */ jsx(
890
+ Box$1,
891
+ {
892
+ sx: {
893
+ width: 40,
894
+ height: 40,
895
+ display: "flex",
896
+ justifyContent: "center",
897
+ alignItems: "center",
898
+ borderRadius: "50%",
899
+ background: "#fff",
900
+ border: cardType === "disableCard" ? `2px solid ${theme.palette.grey[400]}` : `2px solid ${theme.palette.primary.dark}`,
901
+ color: cardType === "disableCard" ? theme.palette.grey[700] : theme.palette.primary.dark,
902
+ fontWeight: 600,
903
+ fontSize: 16
904
+ },
905
+ children: count
906
+ }
907
+ );
908
+ };
909
+ function CustomTimelineWithStatus({ events }) {
910
+ useTheme();
911
+ const rows = [];
912
+ for (let i = 0; i < events.length; i += 4) rows.push(events.slice(i, i + 4));
913
+ const computeColumn = (index) => {
914
+ const row = Math.floor(index / 4);
915
+ const pos = index % 4;
916
+ return row % 2 === 0 ? pos : 3 - pos;
917
+ };
918
+ const hasNextCard = (i) => i + 1 < events.length;
919
+ const getHorizontalY = (rowIndex) => {
920
+ const centerY = CARD_HEIGHT / 2 - CONNECTOR.horizontal.thickness / 2;
921
+ return rowIndex % 2 === 0 ? centerY : centerY + CONNECTOR.horizontal.offsetReverseExtra;
922
+ };
923
+ const isVerticalNeeded = (index) => (index + 1) % 4 === 0 && hasNextCard(index);
924
+ return /* @__PURE__ */ jsx(Box$1, { sx: { width: "100%", overflowX: "auto", p: 1 }, children: /* @__PURE__ */ jsx(
925
+ Box$1,
926
+ {
927
+ sx: {
928
+ position: "relative",
929
+ display: "grid",
930
+ gridTemplateColumns: `repeat(4, ${CARD_WIDTH}px)`,
931
+ columnGap: `${GAP}px`,
932
+ rowGap: `${ROW_GAP}px`,
933
+ width: "max-content"
934
+ },
935
+ children: events.map((event, index) => {
936
+ const row = Math.floor(index / 4);
937
+ const col = computeColumn(index);
938
+ const isLast = index % 4 === 3;
939
+ return /* @__PURE__ */ jsxs(
940
+ Box$1,
941
+ {
942
+ sx: {
943
+ gridColumn: col + 1,
944
+ gridRow: row + 1,
945
+ position: "relative"
946
+ },
947
+ children: [
948
+ !isLast && hasNextCard(index) && /* @__PURE__ */ jsx(
949
+ Box$1,
950
+ {
951
+ sx: {
952
+ position: "absolute",
953
+ top: getHorizontalY(row),
954
+ left: row % 2 === 0 ? CARD_WIDTH : "auto",
955
+ right: row % 2 !== 0 ? CARD_WIDTH : "auto",
956
+ width: GAP + CONNECTOR.horizontal.lengthExtra,
957
+ borderTop: `${CONNECTOR.horizontal.thickness}px dashed ${CONNECTOR.horizontal.color}`,
958
+ zIndex: 10
959
+ }
960
+ }
961
+ ),
962
+ isVerticalNeeded(index) && /* @__PURE__ */ jsx(
963
+ Box$1,
964
+ {
965
+ sx: {
966
+ position: "absolute",
967
+ top: CARD_HEIGHT,
968
+ left: CARD_WIDTH / 2 - CONNECTOR.vertical.thickness / 2,
969
+ width: CONNECTOR.vertical.thickness,
970
+ height: CONNECTOR.vertical.height,
971
+ borderLeft: `${CONNECTOR.vertical.thickness}px dashed ${CONNECTOR.vertical.color}`,
972
+ zIndex: 10
973
+ }
974
+ }
975
+ ),
976
+ /* @__PURE__ */ jsx(CustomCard, { cardType: event.cardType, children: /* @__PURE__ */ jsxs(CardContent, { sx: { px: 2, pt: 2, pb: 1 }, children: [
977
+ /* @__PURE__ */ jsxs(
978
+ Box$1,
979
+ {
980
+ sx: {
981
+ mb: 1,
982
+ display: "flex",
983
+ justifyContent: "space-between",
984
+ alignItems: "center",
985
+ height: 28
986
+ },
987
+ children: [
988
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", children: event.date }),
989
+ event.status && /* @__PURE__ */ jsx(
990
+ Chip,
625
991
  {
626
- variant: "body2",
992
+ label: event.status.title,
627
993
  sx: {
628
- color: theme.palette.primary.main,
629
- cursor: "pointer",
630
- textDecoration: "underline",
631
- fontWeight: 500,
632
- "&:hover": {
633
- color: theme.palette.primary.dark
634
- }
635
- },
636
- onClick: () => handleAttachmentClick(event.attachment),
637
- children: "Attachment"
638
- }
639
- ) }),
640
- /* @__PURE__ */ jsx(
641
- Typography,
642
- {
643
- variant: "caption",
644
- display: "block",
645
- color: theme.palette.text.disabled,
646
- sx: { mt: 1 },
647
- children: event.time
994
+ backgroundColor: event.status.color,
995
+ color: event.status.labelColor,
996
+ borderRadius: "40px",
997
+ height: 28,
998
+ fontWeight: 600,
999
+ px: 1
1000
+ }
648
1001
  }
649
1002
  )
650
- ] })
1003
+ ]
1004
+ }
1005
+ ),
1006
+ /* @__PURE__ */ jsx(Bull, { count: event.count, cardType: event.cardType }),
1007
+ /* @__PURE__ */ jsx(
1008
+ Typography,
1009
+ {
1010
+ variant: "subtitle2",
1011
+ sx: { mt: 2, fontWeight: 600 },
1012
+ children: event.title
1013
+ }
1014
+ ),
1015
+ /* @__PURE__ */ jsx(Typography, { sx: { mb: 1 }, variant: "body2", children: event.subTitle }),
1016
+ event.attachment && /* @__PURE__ */ jsx(
1017
+ Typography,
1018
+ {
1019
+ sx: {
1020
+ cursor: "pointer",
1021
+ color: "#0B56CA",
1022
+ fontWeight: 600
1023
+ },
1024
+ children: "Attachment"
1025
+ }
1026
+ ),
1027
+ /* @__PURE__ */ jsx(
1028
+ Typography,
1029
+ {
1030
+ variant: "body2",
1031
+ sx: {
1032
+ position: "absolute",
1033
+ bottom: 12,
1034
+ left: 14,
1035
+ color: "#777"
1036
+ },
1037
+ children: event.time
651
1038
  }
652
1039
  )
653
- ]
654
- },
655
- index
656
- );
657
- })
658
- },
659
- rowIndex
660
- );
661
- }) });
1040
+ ] }) })
1041
+ ]
1042
+ },
1043
+ index
1044
+ );
1045
+ })
1046
+ }
1047
+ ) });
662
1048
  }
663
1049
  var useDebounce = (value, delay) => {
664
1050
  const [debouncedValue, setDebouncedValue] = useState(value);
@@ -703,7 +1089,7 @@ var SearchBox = ({
703
1089
  ) });
704
1090
  };
705
1091
  var SearchBox_default = SearchBox;
706
- var StyledChipProps = styled(Chip)(({ theme }) => {
1092
+ var StyledChipProps = styled$1(Chip)(({ theme }) => {
707
1093
  var _a, _b, _c;
708
1094
  return {
709
1095
  "&.MuiChip-colorPrimary": {
@@ -736,7 +1122,7 @@ function ApprovalWorkflow({
736
1122
  selectedWorkflowsList = [],
737
1123
  userInfo
738
1124
  }) {
739
- var _a, _b, _c, _d, _e, _f, _g;
1125
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
740
1126
  const theme = useTheme$1();
741
1127
  const { api, urlBuilder, loadingComponent, ENV_VARIABLES } = useWorkflowContext();
742
1128
  const [selectedApprovalOtions, setSelectedApprovalOtions] = useState(
@@ -845,7 +1231,7 @@ function ApprovalWorkflow({
845
1231
  setExpandedId((prevId) => prevId === id ? null : id);
846
1232
  fetchExpandedActivityLogs(id);
847
1233
  };
848
- const getStatus2 = (status) => {
1234
+ const getStatus = (status) => {
849
1235
  switch (status.toLowerCase()) {
850
1236
  case "approved":
851
1237
  return {
@@ -992,7 +1378,34 @@ function ApprovalWorkflow({
992
1378
  }
993
1379
  return "#";
994
1380
  };
1381
+ const StatusObj = {
1382
+ approved: {
1383
+ title: "Approved",
1384
+ color: theme.palette.success.light,
1385
+ labelColor: theme.palette.success.main
1386
+ },
1387
+ rejected: {
1388
+ title: "Rejected",
1389
+ color: ((_a = theme.palette.customColors) == null ? void 0 : _a.chipWarningContainer) || theme.palette.error.light,
1390
+ labelColor: theme.palette.error.main
1391
+ },
1392
+ onhold: {
1393
+ title: "On Hold",
1394
+ color: ((_c = (_b = theme.palette) == null ? void 0 : _b.customColors) == null ? void 0 : _c.chipPendingContainer) || theme.palette.warning.light,
1395
+ labelColor: ((_e = (_d = theme.palette) == null ? void 0 : _d.customColors) == null ? void 0 : _e.chipPendingText) || theme.palette.warning.dark
1396
+ },
1397
+ sendback: {
1398
+ title: "Send Back",
1399
+ color: ((_g = (_f = theme.palette) == null ? void 0 : _f.customColors) == null ? void 0 : _g.approvalPrimaryChipBG) || theme.palette.info.light,
1400
+ labelColor: ((_i = (_h = theme.palette) == null ? void 0 : _h.customColors) == null ? void 0 : _i.approvalPrimaryChipText) || theme.palette.info.dark
1401
+ },
1402
+ pending: {
1403
+ color: ((_j = theme.palette.customColors) == null ? void 0 : _j.approvalPrimaryChipBG) || theme.palette.grey[300],
1404
+ labelColor: ((_l = (_k = theme.palette) == null ? void 0 : _k.customColors) == null ? void 0 : _l.approvalPrimaryChipText) || theme.palette.text.primary
1405
+ }
1406
+ };
995
1407
  if (isLoading && loadingComponent) return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
1408
+ console.log("TEST LIB");
996
1409
  return /* @__PURE__ */ jsxs(Fragment, { children: [
997
1410
  /* @__PURE__ */ jsx(
998
1411
  Box,
@@ -1063,7 +1476,7 @@ function ApprovalWorkflow({
1063
1476
  pb: 3
1064
1477
  },
1065
1478
  children: visibleSelectedRequests == null ? void 0 : visibleSelectedRequests.map((info, index) => {
1066
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o;
1479
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
1067
1480
  const currentLevel = info == null ? void 0 : info.levels.find(
1068
1481
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
1069
1482
  );
@@ -1075,13 +1488,17 @@ function ApprovalWorkflow({
1075
1488
  },
1076
1489
  {}
1077
1490
  );
1491
+ const filterRejectForLevelZero = (statusList2, info2) => {
1492
+ if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
1493
+ return statusList2.filter((item) => item.status !== 3);
1494
+ };
1078
1495
  const redir = buildRedirectionUrl(info);
1079
1496
  const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
1080
1497
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1081
1498
  )) == 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(
1082
1499
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1083
1500
  )) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
1084
- const statusData = getStatus2(currentStatus);
1501
+ const statusData = getStatus(currentStatus);
1085
1502
  return /* @__PURE__ */ jsxs(
1086
1503
  Card,
1087
1504
  {
@@ -1168,7 +1585,7 @@ function ApprovalWorkflow({
1168
1585
  mt: 0.8,
1169
1586
  color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1170
1587
  },
1171
- children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1588
+ children: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1172
1589
  }
1173
1590
  )
1174
1591
  ] }),
@@ -1197,9 +1614,9 @@ function ApprovalWorkflow({
1197
1614
  },
1198
1615
  children: [
1199
1616
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1200
- /* @__PURE__ */ jsx(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(
1617
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j2 = (_i2 = info == null ? void 0 : info.levels) == null ? void 0 : _i2.findIndex(
1201
1618
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1202
- )) != null ? _j : -1) + 1 || "") })
1619
+ )) != null ? _j2 : -1) + 1 || "") })
1203
1620
  ]
1204
1621
  }
1205
1622
  ),
@@ -1215,14 +1632,14 @@ function ApprovalWorkflow({
1215
1632
  gap: 1.5
1216
1633
  },
1217
1634
  children: [
1218
- (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1635
+ (info == null ? void 0 : info.current_status) !== "completed" && ((_l2 = (_k2 = info == null ? void 0 : info.levels) == null ? void 0 : _k2.find(
1219
1636
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1220
- )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1637
+ )) == null ? void 0 : _l2.order) <= ((_n2 = (_m2 = info == null ? void 0 : info.levels) == null ? void 0 : _m2.find(
1221
1638
  (lvl) => {
1222
1639
  var _a3;
1223
1640
  return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1224
1641
  }
1225
- )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsx(
1642
+ )) == null ? void 0 : _n2.order) ? /* @__PURE__ */ jsx(
1226
1643
  Statusselector_default,
1227
1644
  {
1228
1645
  onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
@@ -1244,17 +1661,19 @@ function ApprovalWorkflow({
1244
1661
  `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1245
1662
  );
1246
1663
  },
1247
- 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(
1248
- (app) => app.status == 1
1249
- ) : statusList
1664
+ level: info == null ? void 0 : info.isLevelZero,
1665
+ statusList: filterRejectForLevelZero(
1666
+ statusList,
1667
+ info
1668
+ )
1250
1669
  }
1251
1670
  ) : /* @__PURE__ */ jsx(
1252
1671
  Chip,
1253
1672
  {
1254
1673
  variant: "filled",
1255
1674
  sx: {
1256
- backgroundColor: getStatus2(currentStatus).color,
1257
- color: getStatus2(currentStatus).labelColor,
1675
+ backgroundColor: getStatus(currentStatus).color,
1676
+ color: getStatus(currentStatus).labelColor,
1258
1677
  height: "40px",
1259
1678
  px: 2,
1260
1679
  borderRadius: "100px !important",
@@ -1312,7 +1731,7 @@ function ApprovalWorkflow({
1312
1731
  children: /* @__PURE__ */ jsx(CircularProgress, { size: 36, color: "primary" })
1313
1732
  }
1314
1733
  ) : /* @__PURE__ */ jsx(
1315
- ConnectedTimeline,
1734
+ CustomTimelineWithStatus,
1316
1735
  {
1317
1736
  events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
1318
1737
  var _a3, _b3, _c3, _d3;
@@ -1325,7 +1744,8 @@ function ApprovalWorkflow({
1325
1744
  subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
1326
1745
  attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
1327
1746
  count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
1328
- cardType: "card"
1747
+ cardType: "card",
1748
+ status: (item == null ? void 0 : item.type) === "approve" ? StatusObj.approved : (item == null ? void 0 : item.type) === "reject" ? StatusObj.rejected : (item == null ? void 0 : item.type) === "send_back" ? StatusObj.sendback : (item == null ? void 0 : item.type) === "onhold" ? StatusObj.onhold : null
1329
1749
  };
1330
1750
  })
1331
1751
  }
@@ -1348,7 +1768,7 @@ function ApprovalWorkflow({
1348
1768
  pb: 3
1349
1769
  },
1350
1770
  children: visibleAllRequests == null ? void 0 : visibleAllRequests.map((info, index) => {
1351
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o;
1771
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
1352
1772
  const currentLevel = info == null ? void 0 : info.levels.find(
1353
1773
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
1354
1774
  );
@@ -1360,13 +1780,17 @@ function ApprovalWorkflow({
1360
1780
  },
1361
1781
  {}
1362
1782
  );
1783
+ const filterRejectForLevelZero = (statusList2, info2) => {
1784
+ if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
1785
+ return statusList2.filter((item) => item.status !== 3);
1786
+ };
1363
1787
  const redir = buildRedirectionUrl(info);
1364
1788
  const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
1365
1789
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1366
1790
  )) == 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(
1367
1791
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1368
1792
  )) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
1369
- const statusData = getStatus2(currentStatus);
1793
+ const statusData = getStatus(currentStatus);
1370
1794
  return /* @__PURE__ */ jsxs(
1371
1795
  Card,
1372
1796
  {
@@ -1460,7 +1884,7 @@ function ApprovalWorkflow({
1460
1884
  mt: 0.8,
1461
1885
  color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1462
1886
  },
1463
- children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1887
+ children: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1464
1888
  }
1465
1889
  )
1466
1890
  ] }),
@@ -1489,9 +1913,9 @@ function ApprovalWorkflow({
1489
1913
  },
1490
1914
  children: [
1491
1915
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1492
- /* @__PURE__ */ jsx(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(
1916
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j2 = (_i2 = info == null ? void 0 : info.levels) == null ? void 0 : _i2.findIndex(
1493
1917
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1494
- )) != null ? _j : -1) + 1 || "") })
1918
+ )) != null ? _j2 : -1) + 1 || "") })
1495
1919
  ]
1496
1920
  }
1497
1921
  ),
@@ -1507,14 +1931,14 @@ function ApprovalWorkflow({
1507
1931
  gap: 1.5
1508
1932
  },
1509
1933
  children: [
1510
- (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1934
+ (info == null ? void 0 : info.current_status) !== "completed" && ((_l2 = (_k2 = info == null ? void 0 : info.levels) == null ? void 0 : _k2.find(
1511
1935
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1512
- )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1936
+ )) == null ? void 0 : _l2.order) <= ((_n2 = (_m2 = info == null ? void 0 : info.levels) == null ? void 0 : _m2.find(
1513
1937
  (lvl) => {
1514
1938
  var _a3;
1515
1939
  return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1516
1940
  }
1517
- )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsx(
1941
+ )) == null ? void 0 : _n2.order) ? /* @__PURE__ */ jsx(
1518
1942
  Statusselector_default,
1519
1943
  {
1520
1944
  onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
@@ -1536,17 +1960,19 @@ function ApprovalWorkflow({
1536
1960
  `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1537
1961
  );
1538
1962
  },
1539
- 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(
1540
- (app) => app.status == 1
1541
- ) : statusList
1963
+ level: info == null ? void 0 : info.isLevelZero,
1964
+ statusList: filterRejectForLevelZero(
1965
+ statusList,
1966
+ info
1967
+ )
1542
1968
  }
1543
1969
  ) : /* @__PURE__ */ jsx(
1544
1970
  Chip,
1545
1971
  {
1546
1972
  variant: "filled",
1547
1973
  sx: {
1548
- backgroundColor: getStatus2(currentStatus).color,
1549
- color: getStatus2(currentStatus).labelColor,
1974
+ backgroundColor: getStatus(currentStatus).color,
1975
+ color: getStatus(currentStatus).labelColor,
1550
1976
  height: "40px",
1551
1977
  px: 2,
1552
1978
  borderRadius: "100px !important",
@@ -1604,7 +2030,7 @@ function ApprovalWorkflow({
1604
2030
  children: /* @__PURE__ */ jsx(CircularProgress, { size: 36, color: "primary" })
1605
2031
  }
1606
2032
  ) : /* @__PURE__ */ jsx(
1607
- ConnectedTimeline,
2033
+ CustomTimelineWithStatus,
1608
2034
  {
1609
2035
  events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
1610
2036
  var _a3, _b3, _c3, _d3;
@@ -1617,7 +2043,8 @@ function ApprovalWorkflow({
1617
2043
  subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
1618
2044
  attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
1619
2045
  count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
1620
- cardType: "card"
2046
+ cardType: "card",
2047
+ status: (item == null ? void 0 : item.type) === "approve" ? StatusObj.approved : (item == null ? void 0 : item.type) === "reject" ? StatusObj.rejected : (item == null ? void 0 : item.type) === "send_back" ? StatusObj.sendback : (item == null ? void 0 : item.type) === "onhold" ? StatusObj.onhold : null
1621
2048
  };
1622
2049
  })
1623
2050
  }
@@ -1640,19 +2067,23 @@ function ApprovalWorkflow({
1640
2067
  pb: 3
1641
2068
  },
1642
2069
  children: visiblePendingRequests == null ? void 0 : visiblePendingRequests.map((info, index) => {
1643
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k;
2070
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2;
1644
2071
  const currentLevel = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
1645
2072
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
1646
2073
  );
1647
2074
  const statusList = currentLevel ? currentLevel.status_list : [];
2075
+ const filterRejectForLevelZero = (statusList2, info2) => {
2076
+ if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
2077
+ return statusList2.filter((item) => item.status !== 3);
2078
+ };
1648
2079
  const redir = buildRedirectionUrl(info);
1649
2080
  const currentStatus = ((_d2 = (_c2 = (_b2 = info == null ? void 0 : info.levels) == null ? void 0 : _b2.find(
1650
2081
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1651
2082
  )) == 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(
1652
2083
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1653
2084
  )) == null ? void 0 : _f2.selected_status) == null ? void 0 : _g2.status_id) === 3 ? "rejected" : "pending";
1654
- const statusData = getStatus2(currentStatus);
1655
- return /* @__PURE__ */ jsx(
2085
+ const statusData = getStatus(currentStatus);
2086
+ return /* @__PURE__ */ jsxs(
1656
2087
  Card,
1657
2088
  {
1658
2089
  ref: index === visiblePendingRequests.length - 1 ? lastCardRef : null,
@@ -1663,192 +2094,229 @@ function ApprovalWorkflow({
1663
2094
  px: 3,
1664
2095
  py: 2
1665
2096
  },
1666
- children: /* @__PURE__ */ jsxs(
1667
- CardContent,
1668
- {
1669
- sx: {
1670
- display: "flex",
1671
- justifyContent: "space-between",
1672
- alignItems: "center",
1673
- flexWrap: { xs: "wrap", md: "nowrap" },
1674
- gap: 2
1675
- },
1676
- children: [
1677
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "20%", minWidth: 220 }, children: [
1678
- /* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", fontWeight: 600, noWrap: true, children: info.activity_name }) }),
1679
- /* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
1680
- Typography,
1681
- {
1682
- variant: "body2",
1683
- color: "text.secondary",
1684
- noWrap: true,
1685
- sx: { mt: 0.5 },
1686
- children: info.description_data
1687
- }
1688
- ) })
1689
- ] }),
1690
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "18%", minWidth: 180 }, children: [
1691
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
1692
- /* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx(
1693
- "a",
1694
- {
1695
- href: redir,
1696
- target: "_blank",
1697
- rel: "noreferrer",
1698
- style: {
1699
- cursor: "pointer",
1700
- textDecoration: "none"
1701
- },
1702
- children: /* @__PURE__ */ jsx(
1703
- Typography,
1704
- {
1705
- variant: "subtitle2",
1706
- color: "primary.dark",
1707
- sx: {
1708
- mt: 0.8,
1709
- lineHeight: "15.4px",
1710
- overflow: "hidden",
1711
- textOverflow: "ellipsis",
1712
- whiteSpace: "nowrap"
1713
- },
1714
- children: redir
1715
- }
1716
- )
1717
- }
1718
- ) })
1719
- ] }),
1720
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
1721
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
1722
- /* @__PURE__ */ jsx(
1723
- Typography,
2097
+ children: [
2098
+ /* @__PURE__ */ jsxs(
2099
+ CardContent,
2100
+ {
2101
+ sx: {
2102
+ display: "flex",
2103
+ justifyContent: "space-between",
2104
+ alignItems: "center",
2105
+ flexWrap: { xs: "wrap", md: "nowrap" },
2106
+ gap: 2
2107
+ },
2108
+ children: [
2109
+ /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "20%", minWidth: 220 }, children: [
2110
+ /* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", fontWeight: 600, noWrap: true, children: info.activity_name }) }),
2111
+ /* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
2112
+ Typography,
2113
+ {
2114
+ variant: "body2",
2115
+ color: "text.secondary",
2116
+ noWrap: true,
2117
+ sx: { mt: 0.5 },
2118
+ children: info.description_data
2119
+ }
2120
+ ) })
2121
+ ] }),
2122
+ /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "18%", minWidth: 180 }, children: [
2123
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
2124
+ /* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx(
2125
+ "a",
2126
+ {
2127
+ href: redir,
2128
+ target: "_blank",
2129
+ rel: "noreferrer",
2130
+ style: {
2131
+ cursor: "pointer",
2132
+ textDecoration: "none"
2133
+ },
2134
+ children: /* @__PURE__ */ jsx(
2135
+ Typography,
2136
+ {
2137
+ variant: "subtitle2",
2138
+ color: "primary.dark",
2139
+ sx: {
2140
+ mt: 0.8,
2141
+ lineHeight: "15.4px",
2142
+ overflow: "hidden",
2143
+ textOverflow: "ellipsis",
2144
+ whiteSpace: "nowrap"
2145
+ },
2146
+ children: redir
2147
+ }
2148
+ )
2149
+ }
2150
+ ) })
2151
+ ] }),
2152
+ /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
2153
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
2154
+ /* @__PURE__ */ jsx(
2155
+ Typography,
2156
+ {
2157
+ variant: "body2",
2158
+ noWrap: true,
2159
+ sx: {
2160
+ mt: 0.8,
2161
+ color: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? "primary.dark" : "text.disabled"
2162
+ },
2163
+ children: ((_i2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _i2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
2164
+ }
2165
+ )
2166
+ ] }),
2167
+ /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
2168
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
2169
+ /* @__PURE__ */ jsx(
2170
+ Typography,
2171
+ {
2172
+ variant: "body2",
2173
+ sx: {
2174
+ mt: 0.8,
2175
+ fontWeight: 500,
2176
+ color: "text.primary"
2177
+ },
2178
+ children: (currentLevel == null ? void 0 : currentLevel.tat_expiry) ? moment(currentLevel.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY hh:mm A") : "N/A"
2179
+ }
2180
+ )
2181
+ ] }),
2182
+ /* @__PURE__ */ jsxs(
2183
+ Box,
1724
2184
  {
1725
- variant: "body2",
1726
- noWrap: true,
1727
2185
  sx: {
1728
- mt: 0.8,
1729
- color: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? "primary.dark" : "text.disabled"
2186
+ flexBasis: "8%",
2187
+ minWidth: 80,
2188
+ textAlign: "center"
1730
2189
  },
1731
- children: ((_i = info == null ? void 0 : info.attachment_links) == null ? void 0 : _i.length) ? `${info.attachment_links.length} file(s)` : "N/A"
2190
+ children: [
2191
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
2192
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_k2 = (_j2 = info == null ? void 0 : info.levels) == null ? void 0 : _j2.findIndex(
2193
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
2194
+ )) != null ? _k2 : -1) + 1 || "") })
2195
+ ]
1732
2196
  }
1733
- )
1734
- ] }),
1735
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
1736
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
1737
- /* @__PURE__ */ jsx(
1738
- Typography,
2197
+ ),
2198
+ /* @__PURE__ */ jsxs(
2199
+ Box,
1739
2200
  {
1740
- variant: "body2",
1741
2201
  sx: {
1742
- mt: 0.8,
1743
- fontWeight: 500,
1744
- color: "text.primary"
2202
+ flexBasis: "18%",
2203
+ minWidth: 200,
2204
+ display: "flex",
2205
+ alignItems: "center",
2206
+ justifyContent: "flex-end",
2207
+ gap: 1.5
1745
2208
  },
1746
- children: (currentLevel == null ? void 0 : currentLevel.tat_expiry) ? moment(currentLevel.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY hh:mm A") : "N/A"
1747
- }
1748
- )
1749
- ] }),
1750
- /* @__PURE__ */ jsxs(
1751
- Box,
1752
- {
1753
- sx: {
1754
- flexBasis: "8%",
1755
- minWidth: 80,
1756
- textAlign: "center"
1757
- },
1758
- children: [
1759
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1760
- /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_k = (_j = info == null ? void 0 : info.levels) == null ? void 0 : _j.findIndex(
1761
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1762
- )) != null ? _k : -1) + 1 || "") })
1763
- ]
1764
- }
1765
- ),
1766
- /* @__PURE__ */ jsxs(
1767
- Box,
1768
- {
1769
- sx: {
1770
- flexBasis: "18%",
1771
- minWidth: 200,
1772
- display: "flex",
1773
- alignItems: "center",
1774
- justifyContent: "flex-end",
1775
- gap: 1.5
1776
- },
1777
- children: [
1778
- (info == null ? void 0 : info.current_status) !== "completed" ? /* @__PURE__ */ jsx(
1779
- Statusselector_default,
1780
- {
1781
- onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
1782
- onApprove: () => {
1783
- var _a3;
1784
- return handleApprove(
1785
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
1786
- );
1787
- },
1788
- onReject: () => {
1789
- var _a3;
1790
- return handleReject(
1791
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
1792
- );
1793
- },
1794
- onHold: () => {
1795
- var _a3;
1796
- return handleOnHold(
1797
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1798
- );
1799
- },
1800
- statusList
1801
- }
1802
- ) : /* @__PURE__ */ jsx(
1803
- Chip,
1804
- {
1805
- variant: "filled",
1806
- sx: {
1807
- backgroundColor: statusData.color,
1808
- color: statusData.labelColor,
1809
- height: "40px",
1810
- px: 2,
1811
- borderRadius: "100px !important",
1812
- "& .MuiChip-label": {
1813
- fontSize: "14px",
1814
- lineHeight: "15.4px",
1815
- fontWeight: "500",
1816
- textTransform: "capitalize"
2209
+ children: [
2210
+ (info == null ? void 0 : info.current_status) !== "completed" ? /* @__PURE__ */ jsx(
2211
+ Statusselector_default,
2212
+ {
2213
+ onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
2214
+ onApprove: () => {
2215
+ var _a3;
2216
+ return handleApprove(
2217
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
2218
+ );
2219
+ },
2220
+ onReject: () => {
2221
+ var _a3;
2222
+ return handleReject(
2223
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
2224
+ );
2225
+ },
2226
+ onHold: () => {
2227
+ var _a3;
2228
+ return handleOnHold(
2229
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
2230
+ );
2231
+ },
2232
+ level: info == null ? void 0 : info.isLevelZero,
2233
+ statusList: filterRejectForLevelZero(
2234
+ statusList,
2235
+ info
2236
+ )
2237
+ }
2238
+ ) : /* @__PURE__ */ jsx(
2239
+ Chip,
2240
+ {
2241
+ variant: "filled",
2242
+ sx: {
2243
+ backgroundColor: statusData.color,
2244
+ color: statusData.labelColor,
2245
+ height: "40px",
2246
+ px: 2,
2247
+ borderRadius: "100px !important",
2248
+ "& .MuiChip-label": {
2249
+ fontSize: "14px",
2250
+ lineHeight: "15.4px",
2251
+ fontWeight: "500",
2252
+ textTransform: "capitalize"
2253
+ }
2254
+ },
2255
+ label: statusData.title
2256
+ }
2257
+ ),
2258
+ /* @__PURE__ */ jsx(
2259
+ Divider,
2260
+ {
2261
+ orientation: "vertical",
2262
+ flexItem: true,
2263
+ sx: {
2264
+ borderColor: "#E0E0E0",
2265
+ height: "40px"
1817
2266
  }
1818
- },
1819
- label: statusData.title
1820
- }
1821
- ),
1822
- /* @__PURE__ */ jsx(
1823
- Divider,
1824
- {
1825
- orientation: "vertical",
1826
- flexItem: true,
1827
- sx: {
1828
- borderColor: "#E0E0E0",
1829
- height: "40px"
1830
2267
  }
1831
- }
1832
- ),
1833
- /* @__PURE__ */ jsx(
1834
- IconButton,
1835
- {
1836
- color: "primary",
1837
- sx: {
1838
- background: "rgba(25,118,210,0.08)",
1839
- boxShadow: "2px 2px 10px 0px #4C4E6426",
1840
- "& span": { color: "primary.dark" }
1841
- },
1842
- onClick: () => handleExpandClick(info._id),
1843
- children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
1844
- }
1845
- )
1846
- ]
1847
- }
1848
- )
1849
- ]
1850
- }
1851
- )
2268
+ ),
2269
+ /* @__PURE__ */ jsx(
2270
+ IconButton,
2271
+ {
2272
+ color: "primary",
2273
+ sx: {
2274
+ background: "rgba(25,118,210,0.08)",
2275
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
2276
+ "& span": { color: "primary.dark" }
2277
+ },
2278
+ onClick: () => handleExpandClick(info._id),
2279
+ children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
2280
+ }
2281
+ )
2282
+ ]
2283
+ }
2284
+ )
2285
+ ]
2286
+ }
2287
+ ),
2288
+ expandedId === info._id && /* @__PURE__ */ jsx(Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(
2289
+ Box,
2290
+ {
2291
+ sx: {
2292
+ height: 150,
2293
+ display: "flex",
2294
+ justifyContent: "center",
2295
+ alignItems: "center"
2296
+ },
2297
+ children: /* @__PURE__ */ jsx(CircularProgress, { size: 36, color: "primary" })
2298
+ }
2299
+ ) : /* @__PURE__ */ jsx(
2300
+ CustomTimelineWithStatus,
2301
+ {
2302
+ events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
2303
+ var _a3, _b3, _c3, _d3;
2304
+ return {
2305
+ date: moment(item == null ? void 0 : item.created_at).format(
2306
+ "DD-MM-YYYY"
2307
+ ),
2308
+ time: moment(item == null ? void 0 : item.created_at).format("HH:mm"),
2309
+ 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",
2310
+ subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
2311
+ attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
2312
+ count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
2313
+ cardType: "card",
2314
+ status: (item == null ? void 0 : item.type) === "approve" ? StatusObj.approved : (item == null ? void 0 : item.type) === "reject" ? StatusObj.rejected : (item == null ? void 0 : item.type) === "send_back" ? StatusObj.sendback : (item == null ? void 0 : item.type) === "onhold" ? StatusObj.onhold : null
2315
+ };
2316
+ })
2317
+ }
2318
+ ) })
2319
+ ]
1852
2320
  },
1853
2321
  index
1854
2322
  );
@@ -1873,8 +2341,8 @@ function ApprovalWorkflow({
1873
2341
  openModal: !!approveTarget,
1874
2342
  closeModal: () => setApproveTarget(null),
1875
2343
  header: "Approve",
1876
- workflowLogId: (_a = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _a[0],
1877
- statusId: (_b = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _b[1]
2344
+ workflowLogId: (_m = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _m[0],
2345
+ statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1]
1878
2346
  }
1879
2347
  ),
1880
2348
  /* @__PURE__ */ jsx(
@@ -1883,9 +2351,9 @@ function ApprovalWorkflow({
1883
2351
  openModal: !!rejectTarget,
1884
2352
  closeModal: () => setRejectTarget(null),
1885
2353
  header: "Reject",
1886
- workflowLogId: (_c = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _c[0],
1887
- statusId: (_d = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _d[1],
1888
- rejection_reason_master: (_e = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _e[2]
2354
+ workflowLogId: (_o = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _o[0],
2355
+ statusId: (_p = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _p[1],
2356
+ rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2]
1889
2357
  }
1890
2358
  ),
1891
2359
  /* @__PURE__ */ jsx(
@@ -1894,8 +2362,8 @@ function ApprovalWorkflow({
1894
2362
  openModal: !!onHoldTarget,
1895
2363
  closeModal: () => setOnHoldTarget(null),
1896
2364
  header: "On Hold",
1897
- workflowLogId: (_f = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _f[0],
1898
- statusId: (_g = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _g[1]
2365
+ workflowLogId: (_r = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _r[0],
2366
+ statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1]
1899
2367
  }
1900
2368
  )
1901
2369
  ] });