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.js CHANGED
@@ -12,7 +12,6 @@ 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');
16
15
 
17
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
18
17
 
@@ -24,7 +23,6 @@ var DialogActions5__default = /*#__PURE__*/_interopDefault(DialogActions5);
24
23
  var DialogContent__default = /*#__PURE__*/_interopDefault(DialogContent);
25
24
  var HighlightOffIcon__default = /*#__PURE__*/_interopDefault(HighlightOffIcon);
26
25
  var moment__default = /*#__PURE__*/_interopDefault(moment);
27
- var toast__default = /*#__PURE__*/_interopDefault(toast);
28
26
 
29
27
  // src/context.tsx
30
28
  var WorkflowContext = React7.createContext(null);
@@ -46,6 +44,7 @@ var ActionMenu = ({
46
44
  onApprove,
47
45
  onReject,
48
46
  onHold,
47
+ level,
49
48
  statusList
50
49
  }) => {
51
50
  const [anchorEl, setAnchorEl] = React7.useState(null);
@@ -56,31 +55,40 @@ var ActionMenu = ({
56
55
  const handleClose = () => setAnchorEl(null);
57
56
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
58
57
  /* @__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
- ] })
58
+ /* @__PURE__ */ jsxRuntime.jsxs(
59
+ material.Menu,
60
+ {
61
+ anchorEl,
62
+ open,
63
+ onClose: handleClose,
64
+ MenuListProps: { "aria-labelledby": "basic-button" },
65
+ children: [
66
+ !level && /* @__PURE__ */ jsxRuntime.jsx(
67
+ material.MenuItem,
68
+ {
69
+ onClick: () => {
70
+ onSendBack();
71
+ handleClose();
72
+ },
73
+ children: "Send Back"
74
+ }
75
+ ),
76
+ statusList.map((list) => /* @__PURE__ */ jsxRuntime.jsx(
77
+ material.MenuItem,
78
+ {
79
+ onClick: () => {
80
+ if (list.status === 1) onApprove();
81
+ else if (list.status === 2) onHold();
82
+ else if (list.status === 3) onReject();
83
+ handleClose();
84
+ },
85
+ children: list.name
86
+ },
87
+ list.id
88
+ ))
89
+ ]
90
+ }
91
+ )
84
92
  ] });
85
93
  };
86
94
  var Statusselector_default = ActionMenu;
@@ -98,6 +106,12 @@ function SendBackDialog({
98
106
  const [loading, setLoading] = React7.useState(false);
99
107
  const [fileLoading, setFileLoading] = React7.useState(false);
100
108
  const fileInputRef = React7.useRef(null);
109
+ const [snackbar, setSnackbar] = React7.useState({
110
+ open: false,
111
+ message: "",
112
+ severity: "success"
113
+ });
114
+ const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
101
115
  const handleAttachment = () => {
102
116
  var _a;
103
117
  return (_a = fileInputRef.current) == null ? void 0 : _a.click();
@@ -110,12 +124,22 @@ function SendBackDialog({
110
124
  const response = await api.post({
111
125
  url: "/workflow/upload-document",
112
126
  data: formData,
127
+ serviceURL: "api",
113
128
  headers: { "Content-Type": "multipart/form-data" }
114
129
  });
115
130
  setFileName(response.data.file);
116
131
  setSelectedFile(response.data.file);
132
+ setSnackbar({
133
+ open: true,
134
+ message: "File uploaded successfully!",
135
+ severity: "success"
136
+ });
117
137
  } catch (error2) {
118
- toast__default.default.error("File upload failed");
138
+ setSnackbar({
139
+ open: true,
140
+ message: "File upload failed.",
141
+ severity: "error"
142
+ });
119
143
  } finally {
120
144
  setFileLoading(false);
121
145
  }
@@ -141,7 +165,7 @@ function SendBackDialog({
141
165
  return isValid;
142
166
  };
143
167
  const onSubmit = async () => {
144
- var _a, _b, _c;
168
+ var _a, _b, _c, _d;
145
169
  if (!validateFields()) return;
146
170
  setLoading(true);
147
171
  try {
@@ -154,127 +178,186 @@ function SendBackDialog({
154
178
  },
155
179
  serviceURL: "api"
156
180
  });
157
- if ((res == null ? void 0 : res.status) === 200) toast__default.default.success("Successfully sent back!");
158
- if ((_b = res == null ? void 0 : res.error) == null ? void 0 : _b.message) {
159
- toast__default.default.error((_c = res == null ? void 0 : res.error) == null ? void 0 : _c.message, { duration: 2e3 });
181
+ if ((res == null ? void 0 : res.status) === 200) {
182
+ setSnackbar({
183
+ open: true,
184
+ message: "Workflow sent back successfully!",
185
+ severity: "success"
186
+ });
187
+ } else {
188
+ setSnackbar({
189
+ open: true,
190
+ message: ((_b = res == null ? void 0 : res.error) == null ? void 0 : _b.message) || "Something went wrong. Try again.",
191
+ severity: "error"
192
+ });
160
193
  }
161
- closeModal && closeModal();
162
- } catch {
163
- toast__default.default.error("Opps! something went wrong.");
194
+ } catch (e) {
195
+ setSnackbar({
196
+ open: true,
197
+ message: ((_d = (_c = e == null ? void 0 : e.response) == null ? void 0 : _c.data) == null ? void 0 : _d.message) || "Oops! Something went wrong.",
198
+ severity: "error"
199
+ });
164
200
  } finally {
201
+ setComment("");
202
+ setSelectedFile(null);
203
+ setFileName("");
165
204
  setLoading(false);
205
+ closeModal && closeModal();
166
206
  }
167
207
  };
168
- return /* @__PURE__ */ jsxRuntime.jsxs(
169
- Dialog__default.default,
170
- {
171
- open: openModal,
172
- onClose: closeModal,
173
- "aria-labelledby": "responsive-dialog-title",
174
- sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
175
- children: [
176
- /* @__PURE__ */ jsxRuntime.jsxs(
177
- material.Box,
178
- {
179
- sx: {
180
- display: "flex",
181
- justifyContent: "space-between",
182
- alignItems: "center"
183
- },
184
- children: [
185
- /* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
186
- /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
187
- ]
188
- }
189
- ),
190
- /* @__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: [
191
- /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
192
- material.TextField,
208
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
209
+ /* @__PURE__ */ jsxRuntime.jsxs(
210
+ Dialog__default.default,
211
+ {
212
+ open: openModal,
213
+ onClose: closeModal,
214
+ "aria-labelledby": "responsive-dialog-title",
215
+ sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
216
+ children: [
217
+ /* @__PURE__ */ jsxRuntime.jsxs(
218
+ material.Box,
193
219
  {
194
- fullWidth: true,
195
- label: "Comment",
196
- value: comment,
197
- placeholder: "Comment Here",
198
- onChange: (e) => setComment(e.target.value),
199
- required: true,
200
- error: !!error.comment,
201
- helperText: error.comment
220
+ sx: {
221
+ display: "flex",
222
+ justifyContent: "space-between",
223
+ alignItems: "center"
224
+ },
225
+ children: [
226
+ /* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
227
+ /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
228
+ ]
202
229
  }
203
- ) }),
204
- /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { item: true, xs: 12, children: [
205
- /* @__PURE__ */ jsxRuntime.jsx(
230
+ ),
231
+ /* @__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: [
232
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
206
233
  material.TextField,
207
234
  {
208
- type: "text",
209
235
  fullWidth: true,
210
- label: "Attachment",
211
- placeholder: "Attachment",
212
- InputProps: {
213
- endAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-export-1" }) })
214
- },
215
- onClick: handleAttachment,
216
- value: fileName,
217
- error: !!error.file,
218
- helperText: error.file
219
- }
220
- ),
221
- /* @__PURE__ */ jsxRuntime.jsx(
222
- "input",
223
- {
224
- type: "file",
225
- ref: fileInputRef,
226
- style: { display: "none" },
227
- onChange: handleFileChange
236
+ label: "Comment",
237
+ value: comment,
238
+ placeholder: "Comment Here",
239
+ onChange: (e) => setComment(e.target.value),
240
+ required: true,
241
+ error: !!error.comment,
242
+ helperText: error.comment
228
243
  }
229
- )
230
- ] })
231
- ] }) }) }),
232
- /* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(
233
- material.Box,
234
- {
235
- sx: {
236
- display: "flex",
237
- justifyContent: "flex-end",
238
- alignItems: "center"
239
- },
240
- children: [
244
+ ) }),
245
+ /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { item: true, xs: 12, children: [
241
246
  /* @__PURE__ */ jsxRuntime.jsx(
242
- material.Button,
247
+ material.TextField,
243
248
  {
244
- onClick: closeModal,
245
- size: "large",
246
- variant: "outlined",
247
- color: "primary",
248
- sx: { mr: 2 },
249
- children: "Close"
249
+ type: "text",
250
+ fullWidth: true,
251
+ label: "Attachment",
252
+ placeholder: "Attachment",
253
+ InputProps: {
254
+ endAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: fileLoading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 20, color: "inherit" }) : /* @__PURE__ */ jsxRuntime.jsx(
255
+ "span",
256
+ {
257
+ className: "icon-export-1",
258
+ style: { cursor: "pointer" },
259
+ onClick: handleAttachment
260
+ }
261
+ ) })
262
+ },
263
+ onClick: handleAttachment,
264
+ value: fileName,
265
+ error: !!error.file,
266
+ helperText: error.file
250
267
  }
251
268
  ),
252
269
  /* @__PURE__ */ jsxRuntime.jsx(
253
- material.Button,
270
+ "input",
254
271
  {
255
- onClick: onSubmit,
256
- size: "large",
257
- variant: "contained",
258
- color: "primary",
259
- disabled: loading || fileLoading,
260
- children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit"
272
+ type: "file",
273
+ ref: fileInputRef,
274
+ style: { display: "none" },
275
+ onChange: handleFileChange
261
276
  }
262
277
  )
263
- ]
278
+ ] })
279
+ ] }) }) }),
280
+ /* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(
281
+ material.Box,
282
+ {
283
+ sx: {
284
+ display: "flex",
285
+ justifyContent: "flex-end",
286
+ alignItems: "center"
287
+ },
288
+ children: [
289
+ /* @__PURE__ */ jsxRuntime.jsx(
290
+ material.Button,
291
+ {
292
+ onClick: closeModal,
293
+ size: "large",
294
+ variant: "outlined",
295
+ color: "primary",
296
+ sx: { mr: 2 },
297
+ children: "Close"
298
+ }
299
+ ),
300
+ /* @__PURE__ */ jsxRuntime.jsx(
301
+ material.Button,
302
+ {
303
+ onClick: onSubmit,
304
+ size: "large",
305
+ variant: "contained",
306
+ color: "primary",
307
+ disabled: loading || fileLoading,
308
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit"
309
+ }
310
+ )
311
+ ]
312
+ }
313
+ ) })
314
+ ]
315
+ }
316
+ ),
317
+ /* @__PURE__ */ jsxRuntime.jsx(
318
+ material.Snackbar,
319
+ {
320
+ open: snackbar.open,
321
+ autoHideDuration: 3e3,
322
+ onClose: handleCloseSnackbar,
323
+ anchorOrigin: { vertical: "top", horizontal: "right" },
324
+ children: /* @__PURE__ */ jsxRuntime.jsx(
325
+ material.Alert,
326
+ {
327
+ onClose: handleCloseSnackbar,
328
+ severity: snackbar.severity,
329
+ sx: {
330
+ width: "100%",
331
+ color: snackbar.severity === "error" ? "#fff" : "inherit",
332
+ bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
333
+ },
334
+ children: snackbar.message
264
335
  }
265
- ) })
266
- ]
267
- }
268
- );
336
+ )
337
+ }
338
+ )
339
+ ] });
269
340
  }
270
341
  var SendBackDialog_default = SendBackDialog;
271
- function ApproveDialog({ openModal, closeModal, header, workflowLogId, statusId }) {
342
+ function ApproveDialog({
343
+ openModal,
344
+ closeModal,
345
+ header,
346
+ workflowLogId,
347
+ statusId
348
+ }) {
272
349
  const { userInfo, api } = useWorkflowContext();
273
350
  const theme = styles.useTheme();
274
351
  useMediaQuery__default.default(theme.breakpoints.down("lg"));
275
352
  const [comment, setComment] = React7.useState("");
276
353
  const [error, setError] = React7.useState({});
277
354
  const [loading, setLoading] = React7.useState(false);
355
+ const [snackbar, setSnackbar] = React7.useState({
356
+ open: false,
357
+ message: "",
358
+ severity: "success"
359
+ });
360
+ const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
278
361
  const validateFields = () => {
279
362
  let isValid = true;
280
363
  const newError = {};
@@ -286,60 +369,185 @@ function ApproveDialog({ openModal, closeModal, header, workflowLogId, statusId
286
369
  return isValid;
287
370
  };
288
371
  const onSubmit = async () => {
289
- var _a;
372
+ var _a, _b, _c;
290
373
  if (!validateFields()) return;
291
374
  setLoading(true);
292
375
  try {
293
- await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
294
- comment,
295
- created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
376
+ await api.post({
377
+ url: `/workflow/update-status/${workflowLogId}/${statusId}`,
378
+ data: {
379
+ comment,
380
+ created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
381
+ },
382
+ serviceURL: "api"
383
+ });
384
+ setSnackbar({
385
+ open: true,
386
+ message: "Approved successfully!",
387
+ severity: "success"
388
+ });
389
+ } catch (e) {
390
+ setSnackbar({
391
+ open: true,
392
+ message: ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Something unexpected occurred!",
393
+ severity: "error"
296
394
  });
297
- toast__default.default.success("approved successfully!!!");
298
- closeModal && closeModal();
299
- } catch {
300
- toast__default.default.error("something unexpected occured!!!");
301
395
  } finally {
396
+ setComment("");
302
397
  setLoading(false);
398
+ closeModal && closeModal();
303
399
  }
304
400
  };
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.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 }) }) }) }) }),
311
- /* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
312
- /* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
313
- /* @__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" })
314
- ] }) })
401
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
402
+ /* @__PURE__ */ jsxRuntime.jsxs(
403
+ Dialog__default.default,
404
+ {
405
+ open: openModal,
406
+ onClose: closeModal,
407
+ "aria-labelledby": "responsive-dialog-title",
408
+ sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
409
+ children: [
410
+ /* @__PURE__ */ jsxRuntime.jsxs(
411
+ material.Box,
412
+ {
413
+ sx: {
414
+ display: "flex",
415
+ justifyContent: "space-between",
416
+ alignItems: "center"
417
+ },
418
+ children: [
419
+ /* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
420
+ /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
421
+ ]
422
+ }
423
+ ),
424
+ /* @__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(
425
+ material.TextField,
426
+ {
427
+ fullWidth: true,
428
+ label: "Comment",
429
+ value: comment,
430
+ placeholder: "Comment Here",
431
+ onChange: (e) => setComment(e.target.value),
432
+ required: true,
433
+ error: !!error.comment,
434
+ helperText: error.comment
435
+ }
436
+ ) }) }) }) }),
437
+ /* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(
438
+ material.Box,
439
+ {
440
+ sx: {
441
+ display: "flex",
442
+ justifyContent: "flex-end",
443
+ alignItems: "center"
444
+ },
445
+ children: [
446
+ /* @__PURE__ */ jsxRuntime.jsx(
447
+ material.Button,
448
+ {
449
+ onClick: closeModal,
450
+ size: "large",
451
+ variant: "outlined",
452
+ color: "primary",
453
+ sx: { mr: 2 },
454
+ children: "Close"
455
+ }
456
+ ),
457
+ /* @__PURE__ */ jsxRuntime.jsx(
458
+ material.Button,
459
+ {
460
+ onClick: onSubmit,
461
+ size: "large",
462
+ variant: "contained",
463
+ color: "primary",
464
+ disabled: loading,
465
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit"
466
+ }
467
+ )
468
+ ]
469
+ }
470
+ ) })
471
+ ]
472
+ }
473
+ ),
474
+ /* @__PURE__ */ jsxRuntime.jsx(
475
+ material.Snackbar,
476
+ {
477
+ open: snackbar.open,
478
+ autoHideDuration: 3e3,
479
+ onClose: handleCloseSnackbar,
480
+ anchorOrigin: { vertical: "top", horizontal: "right" },
481
+ children: /* @__PURE__ */ jsxRuntime.jsx(
482
+ material.Alert,
483
+ {
484
+ onClose: handleCloseSnackbar,
485
+ severity: snackbar.severity,
486
+ sx: {
487
+ width: "100%",
488
+ color: snackbar.severity === "error" ? "#fff" : "inherit",
489
+ bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
490
+ },
491
+ children: snackbar.message
492
+ }
493
+ )
494
+ }
495
+ )
315
496
  ] });
316
497
  }
317
498
  var ApproveDialog_default = ApproveDialog;
318
- function RejectDialog({ openModal, closeModal, header, workflowLogId, statusId, rejection_reason_master }) {
499
+ function RejectDialog({
500
+ openModal,
501
+ closeModal,
502
+ header,
503
+ workflowLogId,
504
+ statusId,
505
+ rejection_reason_master
506
+ }) {
319
507
  const { userInfo, api } = useWorkflowContext();
320
508
  const theme = styles.useTheme();
321
509
  useMediaQuery__default.default(theme.breakpoints.down("lg"));
322
510
  const DownArrow = () => {
323
511
  var _a;
324
- return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: ((_a = theme.palette.customColors) == null ? void 0 : _a.mainText) || "#333" }, className: "icon-arrow-down-1" });
512
+ return /* @__PURE__ */ jsxRuntime.jsx(
513
+ "span",
514
+ {
515
+ style: { color: ((_a = theme.palette.customColors) == null ? void 0 : _a.mainText) || "#333" },
516
+ className: "icon-arrow-down-1"
517
+ }
518
+ );
325
519
  };
326
520
  const [rejectReasons, setRejectReasons] = React7.useState("");
327
521
  const [comment, setComment] = React7.useState("");
328
522
  const [error, setError] = React7.useState({ reason: "", comment: "" });
329
523
  const [statusApplicableList, setStatusApplicableList] = React7.useState([]);
330
524
  const [loading, setLoading] = React7.useState(false);
525
+ const [snackbar, setSnackbar] = React7.useState({
526
+ open: false,
527
+ message: "",
528
+ severity: "success"
529
+ });
530
+ const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
331
531
  React7.useEffect(() => {
332
532
  (async () => {
333
533
  var _a;
334
534
  try {
335
535
  if (!statusApplicableList.length) {
336
- const res = await api.get(`/workflow/applicableStatuses?type=${rejection_reason_master}`);
536
+ const res = await api.get({
537
+ url: `/workflow/applicableStatuses?type=${rejection_reason_master}`,
538
+ serviceURL: "api"
539
+ });
337
540
  setStatusApplicableList(((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || []);
338
541
  }
339
542
  } catch (e) {
543
+ setSnackbar({
544
+ open: true,
545
+ message: "Failed to load reject reasons.",
546
+ severity: "error"
547
+ });
340
548
  }
341
549
  })();
342
- }, []);
550
+ }, [rejection_reason_master]);
343
551
  const validateFields = () => {
344
552
  let isValid = true;
345
553
  const errors = { reason: "", comment: "" };
@@ -355,48 +563,174 @@ function RejectDialog({ openModal, closeModal, header, workflowLogId, statusId,
355
563
  return isValid;
356
564
  };
357
565
  const onSubmit = async () => {
358
- var _a;
566
+ var _a, _b, _c;
359
567
  if (!validateFields()) return;
360
568
  setLoading(true);
361
569
  try {
362
- await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
363
- reason: rejectReasons,
364
- comment,
365
- created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
570
+ await api.post({
571
+ url: `/workflow/update-status/${workflowLogId}/${statusId}`,
572
+ data: {
573
+ reason: rejectReasons,
574
+ comment,
575
+ created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
576
+ },
577
+ serviceURL: "api"
578
+ });
579
+ setSnackbar({
580
+ open: true,
581
+ message: "Rejected successfully!",
582
+ severity: "success"
366
583
  });
367
- closeModal && closeModal();
368
584
  } catch (e) {
585
+ const message = ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Something went wrong!";
586
+ console.error("\u274C Reject Error:", message);
587
+ setSnackbar({
588
+ open: true,
589
+ message,
590
+ severity: "error"
591
+ });
369
592
  } finally {
593
+ setComment("");
594
+ setRejectReasons("");
370
595
  setLoading(false);
596
+ closeModal && closeModal();
371
597
  }
372
598
  };
373
- return /* @__PURE__ */ jsxRuntime.jsxs(Dialog__default.default, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
374
- /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
375
- /* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
376
- /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
377
- ] }),
378
- /* @__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: [
379
- /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth: true, required: true, error: !!error.reason, children: [
380
- /* @__PURE__ */ jsxRuntime.jsx(material.InputLabel, { required: true, id: "reject-reason-label", children: "Reject Reasons" }),
381
- /* @__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)) }),
382
- error.reason && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "error", children: error.reason })
383
- ] }) }),
384
- /* @__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 }) })
385
- ] }) }) }),
386
- /* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
387
- /* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
388
- /* @__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" })
389
- ] }) })
599
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
600
+ /* @__PURE__ */ jsxRuntime.jsxs(
601
+ Dialog__default.default,
602
+ {
603
+ open: openModal,
604
+ onClose: closeModal,
605
+ "aria-labelledby": "responsive-dialog-title",
606
+ sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
607
+ children: [
608
+ /* @__PURE__ */ jsxRuntime.jsxs(
609
+ material.Box,
610
+ {
611
+ sx: {
612
+ display: "flex",
613
+ justifyContent: "space-between",
614
+ alignItems: "center"
615
+ },
616
+ children: [
617
+ /* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
618
+ /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
619
+ ]
620
+ }
621
+ ),
622
+ /* @__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: [
623
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth: true, required: true, error: !!error.reason, children: [
624
+ /* @__PURE__ */ jsxRuntime.jsx(material.InputLabel, { required: true, id: "reject-reason-label", children: "Reject Reasons" }),
625
+ /* @__PURE__ */ jsxRuntime.jsx(
626
+ material.Select,
627
+ {
628
+ IconComponent: DownArrow,
629
+ label: "Reject Reasons",
630
+ value: rejectReasons,
631
+ id: "reject-reason",
632
+ labelId: "reject-reason-label",
633
+ onChange: (e) => setRejectReasons(e.target.value),
634
+ 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))
635
+ }
636
+ ),
637
+ error.reason && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "error", children: error.reason })
638
+ ] }) }),
639
+ /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
640
+ material.TextField,
641
+ {
642
+ fullWidth: true,
643
+ label: "Comment",
644
+ value: comment,
645
+ placeholder: "Comment Here",
646
+ onChange: (e) => setComment(e.target.value),
647
+ required: true,
648
+ error: !!error.comment,
649
+ helperText: error.comment
650
+ }
651
+ ) })
652
+ ] }) }) }),
653
+ /* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(
654
+ material.Box,
655
+ {
656
+ sx: {
657
+ display: "flex",
658
+ justifyContent: "flex-end",
659
+ alignItems: "center"
660
+ },
661
+ children: [
662
+ /* @__PURE__ */ jsxRuntime.jsx(
663
+ material.Button,
664
+ {
665
+ onClick: closeModal,
666
+ size: "large",
667
+ variant: "outlined",
668
+ color: "primary",
669
+ sx: { mr: 2 },
670
+ children: "Close"
671
+ }
672
+ ),
673
+ /* @__PURE__ */ jsxRuntime.jsx(
674
+ material.Button,
675
+ {
676
+ onClick: onSubmit,
677
+ size: "large",
678
+ variant: "contained",
679
+ color: "primary",
680
+ disabled: loading,
681
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit"
682
+ }
683
+ )
684
+ ]
685
+ }
686
+ ) })
687
+ ]
688
+ }
689
+ ),
690
+ /* @__PURE__ */ jsxRuntime.jsx(
691
+ material.Snackbar,
692
+ {
693
+ open: snackbar.open,
694
+ autoHideDuration: 3e3,
695
+ onClose: handleCloseSnackbar,
696
+ anchorOrigin: { vertical: "top", horizontal: "right" },
697
+ children: /* @__PURE__ */ jsxRuntime.jsx(
698
+ material.Alert,
699
+ {
700
+ onClose: handleCloseSnackbar,
701
+ severity: snackbar.severity,
702
+ sx: {
703
+ width: "100%",
704
+ color: snackbar.severity === "error" ? "#fff" : "inherit",
705
+ bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
706
+ },
707
+ children: snackbar.message
708
+ }
709
+ )
710
+ }
711
+ )
390
712
  ] });
391
713
  }
392
714
  var RejectDialog_default = RejectDialog;
393
- function OnHoldDialog({ openModal, closeModal, header, workflowLogId, statusId }) {
715
+ function OnHoldDialog({
716
+ openModal,
717
+ closeModal,
718
+ header,
719
+ workflowLogId,
720
+ statusId
721
+ }) {
394
722
  const { userInfo, api } = useWorkflowContext();
395
723
  const theme = styles.useTheme();
396
724
  useMediaQuery__default.default(theme.breakpoints.down("lg"));
397
725
  const [comment, setComment] = React7.useState("");
398
726
  const [error, setError] = React7.useState({ comment: "" });
399
727
  const [loading, setLoading] = React7.useState(false);
728
+ const [snackbar, setSnackbar] = React7.useState({
729
+ open: false,
730
+ message: "",
731
+ severity: "success"
732
+ });
733
+ const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
400
734
  const validateFields = () => {
401
735
  let isValid = true;
402
736
  const errors = { comment: "" };
@@ -408,271 +742,322 @@ function OnHoldDialog({ openModal, closeModal, header, workflowLogId, statusId }
408
742
  return isValid;
409
743
  };
410
744
  const onSubmit = async () => {
411
- var _a;
745
+ var _a, _b, _c;
412
746
  if (!validateFields()) return;
413
747
  setLoading(true);
414
748
  try {
415
- await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
416
- comment,
417
- created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
749
+ await api.post({
750
+ url: `/workflow/update-status/${workflowLogId}/${statusId}`,
751
+ data: {
752
+ comment,
753
+ created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
754
+ },
755
+ serviceURL: "api"
756
+ });
757
+ setSnackbar({
758
+ open: true,
759
+ message: "Moved to On-Hold successfully!",
760
+ severity: "success"
761
+ });
762
+ } catch (e) {
763
+ setSnackbar({
764
+ open: true,
765
+ message: ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Failed to submit the form",
766
+ severity: "error"
418
767
  });
419
- closeModal && closeModal();
420
- } catch {
421
- toast__default.default.error("Failed to submit the form");
422
768
  } finally {
769
+ setComment("");
770
+ closeModal && closeModal();
423
771
  setLoading(false);
424
772
  }
425
773
  };
426
- return /* @__PURE__ */ jsxRuntime.jsxs(Dialog__default.default, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
427
- /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
428
- /* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
429
- /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
430
- ] }),
431
- /* @__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 }) }) }) }) }),
432
- /* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
433
- /* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
434
- /* @__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" })
435
- ] }) })
436
- ] });
437
- }
438
- var OnHoldDialog_default = OnHoldDialog;
439
- var getStatus = (status, theme) => {
440
- const s = status == null ? void 0 : status.toLowerCase();
441
- const colors = {
442
- approved: {
443
- bg: theme.palette.success.light,
444
- text: theme.palette.success.main
445
- },
446
- rejected: { bg: theme.palette.error.light, text: theme.palette.error.main },
447
- onhold: {
448
- bg: theme.palette.warning.light,
449
- text: theme.palette.warning.main
450
- },
451
- inprogress: { bg: theme.palette.info.light, text: theme.palette.info.main },
452
- pending: { bg: theme.palette.grey[200], text: theme.palette.text.primary }
453
- };
454
- return colors[s] || colors.pending;
455
- };
456
- function ConnectedTimeline({ events }) {
457
- const { api } = useWorkflowContext();
458
- const theme = material.useTheme();
459
- const [isMobile, setIsMobile] = React7.useState(false);
460
- React7.useEffect(() => {
461
- const checkScreen = () => setIsMobile(window.innerWidth < 768);
462
- checkScreen();
463
- window.addEventListener("resize", checkScreen);
464
- return () => window.removeEventListener("resize", checkScreen);
465
- }, []);
466
- const handleAttachmentClick = (attachment) => {
467
- api.get({
468
- url: `/workflow/uploaded-document-url/${attachment.split("/").reverse()[0]}`,
469
- serviceURL: "api"
470
- }).then((res) => window.open(res.data, "_blank"));
471
- };
472
- const columns = 4;
473
- const rows = [];
474
- for (let i = 0; i < (events == null ? void 0 : events.length); i += columns)
475
- rows.push(events.slice(i, i + columns));
476
- return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { py: 4, position: "relative" }, children: rows.map((row, rowIndex) => {
477
- const reversed = rowIndex % 2 === 1;
478
- return /* @__PURE__ */ jsxRuntime.jsx(
479
- material.Box,
774
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
775
+ /* @__PURE__ */ jsxRuntime.jsxs(
776
+ Dialog__default.default,
480
777
  {
481
- sx: {
482
- display: "flex",
483
- flexDirection: reversed ? "row-reverse" : "row",
484
- justifyContent: "left",
485
- alignItems: "center",
486
- gap: 6,
487
- position: "relative",
488
- mb: 8,
489
- flexWrap: isMobile ? "wrap" : "nowrap"
490
- },
491
- children: row.map((event, index) => {
492
- var _a;
493
- const globalIndex = rowIndex * columns + index;
494
- const status = getStatus((_a = event.status) == null ? void 0 : _a.title, theme);
495
- const isDisabled = event.cardType === "disableCard";
496
- return /* @__PURE__ */ jsxRuntime.jsxs(
778
+ open: openModal,
779
+ onClose: closeModal,
780
+ "aria-labelledby": "responsive-dialog-title",
781
+ sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
782
+ children: [
783
+ /* @__PURE__ */ jsxRuntime.jsxs(
497
784
  material.Box,
498
785
  {
499
786
  sx: {
500
- position: "relative",
501
787
  display: "flex",
502
- justifyContent: "center",
788
+ justifyContent: "space-between",
503
789
  alignItems: "center"
504
790
  },
505
791
  children: [
506
- !isMobile && index < row.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(
507
- material.Box,
508
- {
509
- sx: {
510
- position: "absolute",
511
- top: "50%",
512
- [reversed ? "right" : "left"]: "100%",
513
- width: "60px",
514
- height: "2px",
515
- background: theme.palette.primary.main,
516
- zIndex: 0
517
- }
518
- }
519
- ),
520
- !isMobile && globalIndex === (rowIndex + 1) * columns - 1 && globalIndex < events.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(
521
- material.Box,
792
+ /* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
793
+ /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
794
+ ]
795
+ }
796
+ ),
797
+ /* @__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(
798
+ material.TextField,
799
+ {
800
+ fullWidth: true,
801
+ label: "Comment",
802
+ value: comment,
803
+ placeholder: "Comment Here",
804
+ onChange: (e) => setComment(e.target.value),
805
+ required: true,
806
+ error: !!error.comment,
807
+ helperText: error.comment
808
+ }
809
+ ) }) }) }) }),
810
+ /* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(
811
+ material.Box,
812
+ {
813
+ sx: {
814
+ display: "flex",
815
+ justifyContent: "flex-end",
816
+ alignItems: "center"
817
+ },
818
+ children: [
819
+ /* @__PURE__ */ jsxRuntime.jsx(
820
+ material.Button,
522
821
  {
523
- sx: {
524
- position: "absolute",
525
- bottom: "-48px",
526
- left: reversed ? "0%" : "100%",
527
- width: "2px",
528
- height: "48px",
529
- background: theme.palette.primary.main,
530
- zIndex: 0
531
- }
822
+ onClick: closeModal,
823
+ size: "large",
824
+ variant: "outlined",
825
+ color: "primary",
826
+ sx: { mr: 2 },
827
+ children: "Close"
532
828
  }
533
829
  ),
534
830
  /* @__PURE__ */ jsxRuntime.jsx(
535
- material.Card,
831
+ material.Button,
536
832
  {
537
- sx: {
538
- width: "230px",
539
- minHeight: "180px",
540
- borderRadius: "16px",
541
- border: `1px solid ${isDisabled ? theme.palette.success.light : theme.palette.divider}`,
542
- backgroundColor: isDisabled ? theme.palette.action.hover : theme.palette.background.paper,
543
- textAlign: "center",
544
- boxShadow: "0px 4px 10px rgba(0,0,0,0.05)",
545
- transition: "all 0.25s ease-in-out",
546
- "&:hover": {
547
- boxShadow: "0px 6px 14px rgba(0,0,0,0.1)",
548
- transform: "translateY(-2px)"
549
- }
550
- },
551
- children: /* @__PURE__ */ jsxRuntime.jsxs(material.CardContent, { children: [
552
- /* @__PURE__ */ jsxRuntime.jsxs(
553
- material.Box,
554
- {
555
- sx: {
556
- display: "flex",
557
- justifyContent: "space-between",
558
- alignItems: "center",
559
- mb: 1
560
- },
561
- children: [
562
- /* @__PURE__ */ jsxRuntime.jsx(
563
- material.Typography,
564
- {
565
- variant: "body2",
566
- color: theme.palette.text.secondary,
567
- children: event.date
568
- }
569
- ),
570
- event.status && /* @__PURE__ */ jsxRuntime.jsx(
571
- material.Chip,
572
- {
573
- label: event.status.title,
574
- sx: {
575
- backgroundColor: status.bg,
576
- color: status.text,
577
- fontSize: 12,
578
- height: 24,
579
- fontWeight: 600,
580
- borderRadius: "16px"
581
- }
582
- }
583
- )
584
- ]
585
- }
586
- ),
587
- /* @__PURE__ */ jsxRuntime.jsx(
588
- material.Box,
589
- {
590
- sx: {
591
- width: 36,
592
- height: 36,
593
- borderRadius: "50%",
594
- border: `2px solid ${theme.palette.primary.main}`,
595
- display: "flex",
596
- justifyContent: "center",
597
- alignItems: "center",
598
- color: theme.palette.primary.main,
599
- fontWeight: 600,
600
- fontSize: 14,
601
- mx: "auto",
602
- mb: 1.5
603
- },
604
- children: event.count
605
- }
606
- ),
607
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: event.title, children: /* @__PURE__ */ jsxRuntime.jsx(
608
- material.Typography,
609
- {
610
- variant: "subtitle1",
611
- fontWeight: 600,
612
- color: isDisabled ? theme.palette.text.secondary : theme.palette.text.primary,
613
- sx: {
614
- overflow: "hidden",
615
- textOverflow: "ellipsis",
616
- whiteSpace: "nowrap",
617
- mb: 0.5
618
- },
619
- children: event.title
620
- }
621
- ) }),
622
- /* @__PURE__ */ jsxRuntime.jsx(
623
- material.Typography,
624
- {
625
- variant: "body2",
626
- color: theme.palette.text.secondary,
627
- sx: {
628
- minHeight: "20px",
629
- mb: 0.8,
630
- textOverflow: "ellipsis",
631
- whiteSpace: "nowrap",
632
- overflow: "hidden"
633
- },
634
- children: event.subTitle || "No Comments"
635
- }
636
- ),
637
- event.attachment && /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "View attachment", children: /* @__PURE__ */ jsxRuntime.jsx(
638
- material.Typography,
833
+ onClick: onSubmit,
834
+ size: "large",
835
+ variant: "contained",
836
+ color: "primary",
837
+ disabled: loading,
838
+ children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit"
839
+ }
840
+ )
841
+ ]
842
+ }
843
+ ) })
844
+ ]
845
+ }
846
+ ),
847
+ /* @__PURE__ */ jsxRuntime.jsx(
848
+ material.Snackbar,
849
+ {
850
+ open: snackbar.open,
851
+ autoHideDuration: 3e3,
852
+ onClose: handleCloseSnackbar,
853
+ anchorOrigin: { vertical: "top", horizontal: "right" },
854
+ children: /* @__PURE__ */ jsxRuntime.jsx(
855
+ material.Alert,
856
+ {
857
+ onClose: handleCloseSnackbar,
858
+ severity: snackbar.severity,
859
+ sx: {
860
+ width: "100%",
861
+ color: snackbar.severity === "error" ? "#fff" : "inherit",
862
+ bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
863
+ },
864
+ children: snackbar.message
865
+ }
866
+ )
867
+ }
868
+ )
869
+ ] });
870
+ }
871
+ var OnHoldDialog_default = OnHoldDialog;
872
+ var CONNECTOR = {
873
+ horizontal: {
874
+ thickness: 3,
875
+ lengthExtra: 0,
876
+ offsetReverseExtra: 30,
877
+ color: "#2C35FF"
878
+ },
879
+ vertical: {
880
+ thickness: 3,
881
+ height: 60,
882
+ color: "#2C35FF"
883
+ }
884
+ };
885
+ var CARD_WIDTH = 200;
886
+ var CARD_HEIGHT = 220;
887
+ var GAP = 65;
888
+ var ROW_GAP = 60;
889
+ var CustomCard = styles.styled(material.Card)(
890
+ ({ theme, cardType }) => ({
891
+ width: CARD_WIDTH,
892
+ height: CARD_HEIGHT,
893
+ borderRadius: 16,
894
+ backgroundColor: cardType === "subCard" ? "#FFF2D8" : cardType === "disableCard" ? "#ECECEC" : "#F1F1FF",
895
+ border: cardType === "disableCard" ? "none" : `1px solid ${theme.palette.primary.dark}`,
896
+ overflow: "hidden",
897
+ position: "relative"
898
+ })
899
+ );
900
+ var Bull = ({ count, cardType }) => {
901
+ const theme = styles.useTheme();
902
+ return /* @__PURE__ */ jsxRuntime.jsx(
903
+ material.Box,
904
+ {
905
+ sx: {
906
+ width: 40,
907
+ height: 40,
908
+ display: "flex",
909
+ justifyContent: "center",
910
+ alignItems: "center",
911
+ borderRadius: "50%",
912
+ background: "#fff",
913
+ border: cardType === "disableCard" ? `2px solid ${theme.palette.grey[400]}` : `2px solid ${theme.palette.primary.dark}`,
914
+ color: cardType === "disableCard" ? theme.palette.grey[700] : theme.palette.primary.dark,
915
+ fontWeight: 600,
916
+ fontSize: 16
917
+ },
918
+ children: count
919
+ }
920
+ );
921
+ };
922
+ function CustomTimelineWithStatus({ events }) {
923
+ styles.useTheme();
924
+ const rows = [];
925
+ for (let i = 0; i < events.length; i += 4) rows.push(events.slice(i, i + 4));
926
+ const computeColumn = (index) => {
927
+ const row = Math.floor(index / 4);
928
+ const pos = index % 4;
929
+ return row % 2 === 0 ? pos : 3 - pos;
930
+ };
931
+ const hasNextCard = (i) => i + 1 < events.length;
932
+ const getHorizontalY = (rowIndex) => {
933
+ const centerY = CARD_HEIGHT / 2 - CONNECTOR.horizontal.thickness / 2;
934
+ return rowIndex % 2 === 0 ? centerY : centerY + CONNECTOR.horizontal.offsetReverseExtra;
935
+ };
936
+ const isVerticalNeeded = (index) => (index + 1) % 4 === 0 && hasNextCard(index);
937
+ return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { width: "100%", overflowX: "auto", p: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(
938
+ material.Box,
939
+ {
940
+ sx: {
941
+ position: "relative",
942
+ display: "grid",
943
+ gridTemplateColumns: `repeat(4, ${CARD_WIDTH}px)`,
944
+ columnGap: `${GAP}px`,
945
+ rowGap: `${ROW_GAP}px`,
946
+ width: "max-content"
947
+ },
948
+ children: events.map((event, index) => {
949
+ const row = Math.floor(index / 4);
950
+ const col = computeColumn(index);
951
+ const isLast = index % 4 === 3;
952
+ return /* @__PURE__ */ jsxRuntime.jsxs(
953
+ material.Box,
954
+ {
955
+ sx: {
956
+ gridColumn: col + 1,
957
+ gridRow: row + 1,
958
+ position: "relative"
959
+ },
960
+ children: [
961
+ !isLast && hasNextCard(index) && /* @__PURE__ */ jsxRuntime.jsx(
962
+ material.Box,
963
+ {
964
+ sx: {
965
+ position: "absolute",
966
+ top: getHorizontalY(row),
967
+ left: row % 2 === 0 ? CARD_WIDTH : "auto",
968
+ right: row % 2 !== 0 ? CARD_WIDTH : "auto",
969
+ width: GAP + CONNECTOR.horizontal.lengthExtra,
970
+ borderTop: `${CONNECTOR.horizontal.thickness}px dashed ${CONNECTOR.horizontal.color}`,
971
+ zIndex: 10
972
+ }
973
+ }
974
+ ),
975
+ isVerticalNeeded(index) && /* @__PURE__ */ jsxRuntime.jsx(
976
+ material.Box,
977
+ {
978
+ sx: {
979
+ position: "absolute",
980
+ top: CARD_HEIGHT,
981
+ left: CARD_WIDTH / 2 - CONNECTOR.vertical.thickness / 2,
982
+ width: CONNECTOR.vertical.thickness,
983
+ height: CONNECTOR.vertical.height,
984
+ borderLeft: `${CONNECTOR.vertical.thickness}px dashed ${CONNECTOR.vertical.color}`,
985
+ zIndex: 10
986
+ }
987
+ }
988
+ ),
989
+ /* @__PURE__ */ jsxRuntime.jsx(CustomCard, { cardType: event.cardType, children: /* @__PURE__ */ jsxRuntime.jsxs(material.CardContent, { sx: { px: 2, pt: 2, pb: 1 }, children: [
990
+ /* @__PURE__ */ jsxRuntime.jsxs(
991
+ material.Box,
992
+ {
993
+ sx: {
994
+ mb: 1,
995
+ display: "flex",
996
+ justifyContent: "space-between",
997
+ alignItems: "center",
998
+ height: 28
999
+ },
1000
+ children: [
1001
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", children: event.date }),
1002
+ event.status && /* @__PURE__ */ jsxRuntime.jsx(
1003
+ material.Chip,
639
1004
  {
640
- variant: "body2",
1005
+ label: event.status.title,
641
1006
  sx: {
642
- color: theme.palette.primary.main,
643
- cursor: "pointer",
644
- textDecoration: "underline",
645
- fontWeight: 500,
646
- "&:hover": {
647
- color: theme.palette.primary.dark
648
- }
649
- },
650
- onClick: () => handleAttachmentClick(event.attachment),
651
- children: "Attachment"
652
- }
653
- ) }),
654
- /* @__PURE__ */ jsxRuntime.jsx(
655
- material.Typography,
656
- {
657
- variant: "caption",
658
- display: "block",
659
- color: theme.palette.text.disabled,
660
- sx: { mt: 1 },
661
- children: event.time
1007
+ backgroundColor: event.status.color,
1008
+ color: event.status.labelColor,
1009
+ borderRadius: "40px",
1010
+ height: 28,
1011
+ fontWeight: 600,
1012
+ px: 1
1013
+ }
662
1014
  }
663
1015
  )
664
- ] })
1016
+ ]
1017
+ }
1018
+ ),
1019
+ /* @__PURE__ */ jsxRuntime.jsx(Bull, { count: event.count, cardType: event.cardType }),
1020
+ /* @__PURE__ */ jsxRuntime.jsx(
1021
+ material.Typography,
1022
+ {
1023
+ variant: "subtitle2",
1024
+ sx: { mt: 2, fontWeight: 600 },
1025
+ children: event.title
1026
+ }
1027
+ ),
1028
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { sx: { mb: 1 }, variant: "body2", children: event.subTitle }),
1029
+ event.attachment && /* @__PURE__ */ jsxRuntime.jsx(
1030
+ material.Typography,
1031
+ {
1032
+ sx: {
1033
+ cursor: "pointer",
1034
+ color: "#0B56CA",
1035
+ fontWeight: 600
1036
+ },
1037
+ children: "Attachment"
1038
+ }
1039
+ ),
1040
+ /* @__PURE__ */ jsxRuntime.jsx(
1041
+ material.Typography,
1042
+ {
1043
+ variant: "body2",
1044
+ sx: {
1045
+ position: "absolute",
1046
+ bottom: 12,
1047
+ left: 14,
1048
+ color: "#777"
1049
+ },
1050
+ children: event.time
665
1051
  }
666
1052
  )
667
- ]
668
- },
669
- index
670
- );
671
- })
672
- },
673
- rowIndex
674
- );
675
- }) });
1053
+ ] }) })
1054
+ ]
1055
+ },
1056
+ index
1057
+ );
1058
+ })
1059
+ }
1060
+ ) });
676
1061
  }
677
1062
  var useDebounce = (value, delay) => {
678
1063
  const [debouncedValue, setDebouncedValue] = React7.useState(value);
@@ -750,7 +1135,7 @@ function ApprovalWorkflow({
750
1135
  selectedWorkflowsList = [],
751
1136
  userInfo
752
1137
  }) {
753
- var _a, _b, _c, _d, _e, _f, _g;
1138
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
754
1139
  const theme = material.useTheme();
755
1140
  const { api, urlBuilder, loadingComponent, ENV_VARIABLES } = useWorkflowContext();
756
1141
  const [selectedApprovalOtions, setSelectedApprovalOtions] = React7.useState(
@@ -859,7 +1244,7 @@ function ApprovalWorkflow({
859
1244
  setExpandedId((prevId) => prevId === id ? null : id);
860
1245
  fetchExpandedActivityLogs(id);
861
1246
  };
862
- const getStatus2 = (status) => {
1247
+ const getStatus = (status) => {
863
1248
  switch (status.toLowerCase()) {
864
1249
  case "approved":
865
1250
  return {
@@ -1006,7 +1391,34 @@ function ApprovalWorkflow({
1006
1391
  }
1007
1392
  return "#";
1008
1393
  };
1394
+ const StatusObj = {
1395
+ approved: {
1396
+ title: "Approved",
1397
+ color: theme.palette.success.light,
1398
+ labelColor: theme.palette.success.main
1399
+ },
1400
+ rejected: {
1401
+ title: "Rejected",
1402
+ color: ((_a = theme.palette.customColors) == null ? void 0 : _a.chipWarningContainer) || theme.palette.error.light,
1403
+ labelColor: theme.palette.error.main
1404
+ },
1405
+ onhold: {
1406
+ title: "On Hold",
1407
+ color: ((_c = (_b = theme.palette) == null ? void 0 : _b.customColors) == null ? void 0 : _c.chipPendingContainer) || theme.palette.warning.light,
1408
+ labelColor: ((_e = (_d = theme.palette) == null ? void 0 : _d.customColors) == null ? void 0 : _e.chipPendingText) || theme.palette.warning.dark
1409
+ },
1410
+ sendback: {
1411
+ title: "Send Back",
1412
+ color: ((_g = (_f = theme.palette) == null ? void 0 : _f.customColors) == null ? void 0 : _g.approvalPrimaryChipBG) || theme.palette.info.light,
1413
+ labelColor: ((_i = (_h = theme.palette) == null ? void 0 : _h.customColors) == null ? void 0 : _i.approvalPrimaryChipText) || theme.palette.info.dark
1414
+ },
1415
+ pending: {
1416
+ color: ((_j = theme.palette.customColors) == null ? void 0 : _j.approvalPrimaryChipBG) || theme.palette.grey[300],
1417
+ labelColor: ((_l = (_k = theme.palette) == null ? void 0 : _k.customColors) == null ? void 0 : _l.approvalPrimaryChipText) || theme.palette.text.primary
1418
+ }
1419
+ };
1009
1420
  if (isLoading && loadingComponent) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingComponent });
1421
+ console.log("TEST LIB");
1010
1422
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1011
1423
  /* @__PURE__ */ jsxRuntime.jsx(
1012
1424
  system.Box,
@@ -1077,7 +1489,7 @@ function ApprovalWorkflow({
1077
1489
  pb: 3
1078
1490
  },
1079
1491
  children: visibleSelectedRequests == null ? void 0 : visibleSelectedRequests.map((info, index) => {
1080
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o;
1492
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
1081
1493
  const currentLevel = info == null ? void 0 : info.levels.find(
1082
1494
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
1083
1495
  );
@@ -1089,13 +1501,17 @@ function ApprovalWorkflow({
1089
1501
  },
1090
1502
  {}
1091
1503
  );
1504
+ const filterRejectForLevelZero = (statusList2, info2) => {
1505
+ if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
1506
+ return statusList2.filter((item) => item.status !== 3);
1507
+ };
1092
1508
  const redir = buildRedirectionUrl(info);
1093
1509
  const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
1094
1510
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1095
1511
  )) == 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(
1096
1512
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1097
1513
  )) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
1098
- const statusData = getStatus2(currentStatus);
1514
+ const statusData = getStatus(currentStatus);
1099
1515
  return /* @__PURE__ */ jsxRuntime.jsxs(
1100
1516
  material.Card,
1101
1517
  {
@@ -1182,7 +1598,7 @@ function ApprovalWorkflow({
1182
1598
  mt: 0.8,
1183
1599
  color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1184
1600
  },
1185
- children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1601
+ children: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1186
1602
  }
1187
1603
  )
1188
1604
  ] }),
@@ -1211,9 +1627,9 @@ function ApprovalWorkflow({
1211
1627
  },
1212
1628
  children: [
1213
1629
  /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1214
- /* @__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(
1630
+ /* @__PURE__ */ jsxRuntime.jsx(material.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(
1215
1631
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1216
- )) != null ? _j : -1) + 1 || "") })
1632
+ )) != null ? _j2 : -1) + 1 || "") })
1217
1633
  ]
1218
1634
  }
1219
1635
  ),
@@ -1229,14 +1645,14 @@ function ApprovalWorkflow({
1229
1645
  gap: 1.5
1230
1646
  },
1231
1647
  children: [
1232
- (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1648
+ (info == null ? void 0 : info.current_status) !== "completed" && ((_l2 = (_k2 = info == null ? void 0 : info.levels) == null ? void 0 : _k2.find(
1233
1649
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1234
- )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1650
+ )) == null ? void 0 : _l2.order) <= ((_n2 = (_m2 = info == null ? void 0 : info.levels) == null ? void 0 : _m2.find(
1235
1651
  (lvl) => {
1236
1652
  var _a3;
1237
1653
  return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1238
1654
  }
1239
- )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1655
+ )) == null ? void 0 : _n2.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1240
1656
  Statusselector_default,
1241
1657
  {
1242
1658
  onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
@@ -1258,17 +1674,19 @@ function ApprovalWorkflow({
1258
1674
  `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1259
1675
  );
1260
1676
  },
1261
- 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(
1262
- (app) => app.status == 1
1263
- ) : statusList
1677
+ level: info == null ? void 0 : info.isLevelZero,
1678
+ statusList: filterRejectForLevelZero(
1679
+ statusList,
1680
+ info
1681
+ )
1264
1682
  }
1265
1683
  ) : /* @__PURE__ */ jsxRuntime.jsx(
1266
1684
  material.Chip,
1267
1685
  {
1268
1686
  variant: "filled",
1269
1687
  sx: {
1270
- backgroundColor: getStatus2(currentStatus).color,
1271
- color: getStatus2(currentStatus).labelColor,
1688
+ backgroundColor: getStatus(currentStatus).color,
1689
+ color: getStatus(currentStatus).labelColor,
1272
1690
  height: "40px",
1273
1691
  px: 2,
1274
1692
  borderRadius: "100px !important",
@@ -1326,7 +1744,7 @@ function ApprovalWorkflow({
1326
1744
  children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
1327
1745
  }
1328
1746
  ) : /* @__PURE__ */ jsxRuntime.jsx(
1329
- ConnectedTimeline,
1747
+ CustomTimelineWithStatus,
1330
1748
  {
1331
1749
  events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
1332
1750
  var _a3, _b3, _c3, _d3;
@@ -1339,7 +1757,8 @@ function ApprovalWorkflow({
1339
1757
  subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
1340
1758
  attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
1341
1759
  count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
1342
- cardType: "card"
1760
+ cardType: "card",
1761
+ 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
1343
1762
  };
1344
1763
  })
1345
1764
  }
@@ -1362,7 +1781,7 @@ function ApprovalWorkflow({
1362
1781
  pb: 3
1363
1782
  },
1364
1783
  children: visibleAllRequests == null ? void 0 : visibleAllRequests.map((info, index) => {
1365
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o;
1784
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
1366
1785
  const currentLevel = info == null ? void 0 : info.levels.find(
1367
1786
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
1368
1787
  );
@@ -1374,13 +1793,17 @@ function ApprovalWorkflow({
1374
1793
  },
1375
1794
  {}
1376
1795
  );
1796
+ const filterRejectForLevelZero = (statusList2, info2) => {
1797
+ if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
1798
+ return statusList2.filter((item) => item.status !== 3);
1799
+ };
1377
1800
  const redir = buildRedirectionUrl(info);
1378
1801
  const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
1379
1802
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1380
1803
  )) == 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(
1381
1804
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1382
1805
  )) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
1383
- const statusData = getStatus2(currentStatus);
1806
+ const statusData = getStatus(currentStatus);
1384
1807
  return /* @__PURE__ */ jsxRuntime.jsxs(
1385
1808
  material.Card,
1386
1809
  {
@@ -1474,7 +1897,7 @@ function ApprovalWorkflow({
1474
1897
  mt: 0.8,
1475
1898
  color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1476
1899
  },
1477
- children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1900
+ children: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1478
1901
  }
1479
1902
  )
1480
1903
  ] }),
@@ -1503,9 +1926,9 @@ function ApprovalWorkflow({
1503
1926
  },
1504
1927
  children: [
1505
1928
  /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1506
- /* @__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(
1929
+ /* @__PURE__ */ jsxRuntime.jsx(material.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(
1507
1930
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1508
- )) != null ? _j : -1) + 1 || "") })
1931
+ )) != null ? _j2 : -1) + 1 || "") })
1509
1932
  ]
1510
1933
  }
1511
1934
  ),
@@ -1521,14 +1944,14 @@ function ApprovalWorkflow({
1521
1944
  gap: 1.5
1522
1945
  },
1523
1946
  children: [
1524
- (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1947
+ (info == null ? void 0 : info.current_status) !== "completed" && ((_l2 = (_k2 = info == null ? void 0 : info.levels) == null ? void 0 : _k2.find(
1525
1948
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1526
- )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1949
+ )) == null ? void 0 : _l2.order) <= ((_n2 = (_m2 = info == null ? void 0 : info.levels) == null ? void 0 : _m2.find(
1527
1950
  (lvl) => {
1528
1951
  var _a3;
1529
1952
  return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1530
1953
  }
1531
- )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1954
+ )) == null ? void 0 : _n2.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1532
1955
  Statusselector_default,
1533
1956
  {
1534
1957
  onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
@@ -1550,17 +1973,19 @@ function ApprovalWorkflow({
1550
1973
  `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1551
1974
  );
1552
1975
  },
1553
- 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(
1554
- (app) => app.status == 1
1555
- ) : statusList
1976
+ level: info == null ? void 0 : info.isLevelZero,
1977
+ statusList: filterRejectForLevelZero(
1978
+ statusList,
1979
+ info
1980
+ )
1556
1981
  }
1557
1982
  ) : /* @__PURE__ */ jsxRuntime.jsx(
1558
1983
  material.Chip,
1559
1984
  {
1560
1985
  variant: "filled",
1561
1986
  sx: {
1562
- backgroundColor: getStatus2(currentStatus).color,
1563
- color: getStatus2(currentStatus).labelColor,
1987
+ backgroundColor: getStatus(currentStatus).color,
1988
+ color: getStatus(currentStatus).labelColor,
1564
1989
  height: "40px",
1565
1990
  px: 2,
1566
1991
  borderRadius: "100px !important",
@@ -1618,7 +2043,7 @@ function ApprovalWorkflow({
1618
2043
  children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
1619
2044
  }
1620
2045
  ) : /* @__PURE__ */ jsxRuntime.jsx(
1621
- ConnectedTimeline,
2046
+ CustomTimelineWithStatus,
1622
2047
  {
1623
2048
  events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
1624
2049
  var _a3, _b3, _c3, _d3;
@@ -1631,7 +2056,8 @@ function ApprovalWorkflow({
1631
2056
  subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
1632
2057
  attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
1633
2058
  count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
1634
- cardType: "card"
2059
+ cardType: "card",
2060
+ 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
1635
2061
  };
1636
2062
  })
1637
2063
  }
@@ -1654,19 +2080,23 @@ function ApprovalWorkflow({
1654
2080
  pb: 3
1655
2081
  },
1656
2082
  children: visiblePendingRequests == null ? void 0 : visiblePendingRequests.map((info, index) => {
1657
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k;
2083
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2;
1658
2084
  const currentLevel = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
1659
2085
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
1660
2086
  );
1661
2087
  const statusList = currentLevel ? currentLevel.status_list : [];
2088
+ const filterRejectForLevelZero = (statusList2, info2) => {
2089
+ if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
2090
+ return statusList2.filter((item) => item.status !== 3);
2091
+ };
1662
2092
  const redir = buildRedirectionUrl(info);
1663
2093
  const currentStatus = ((_d2 = (_c2 = (_b2 = info == null ? void 0 : info.levels) == null ? void 0 : _b2.find(
1664
2094
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1665
2095
  )) == 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(
1666
2096
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1667
2097
  )) == null ? void 0 : _f2.selected_status) == null ? void 0 : _g2.status_id) === 3 ? "rejected" : "pending";
1668
- const statusData = getStatus2(currentStatus);
1669
- return /* @__PURE__ */ jsxRuntime.jsx(
2098
+ const statusData = getStatus(currentStatus);
2099
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1670
2100
  material.Card,
1671
2101
  {
1672
2102
  ref: index === visiblePendingRequests.length - 1 ? lastCardRef : null,
@@ -1677,192 +2107,229 @@ function ApprovalWorkflow({
1677
2107
  px: 3,
1678
2108
  py: 2
1679
2109
  },
1680
- children: /* @__PURE__ */ jsxRuntime.jsxs(
1681
- material.CardContent,
1682
- {
1683
- sx: {
1684
- display: "flex",
1685
- justifyContent: "space-between",
1686
- alignItems: "center",
1687
- flexWrap: { xs: "wrap", md: "nowrap" },
1688
- gap: 2
1689
- },
1690
- children: [
1691
- /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "20%", minWidth: 220 }, children: [
1692
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h6", fontWeight: 600, noWrap: true, children: info.activity_name }) }),
1693
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsxRuntime.jsx(
1694
- material.Typography,
1695
- {
1696
- variant: "body2",
1697
- color: "text.secondary",
1698
- noWrap: true,
1699
- sx: { mt: 0.5 },
1700
- children: info.description_data
1701
- }
1702
- ) })
1703
- ] }),
1704
- /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "18%", minWidth: 180 }, children: [
1705
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
1706
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: redir, children: /* @__PURE__ */ jsxRuntime.jsx(
1707
- "a",
1708
- {
1709
- href: redir,
1710
- target: "_blank",
1711
- rel: "noreferrer",
1712
- style: {
1713
- cursor: "pointer",
1714
- textDecoration: "none"
1715
- },
1716
- children: /* @__PURE__ */ jsxRuntime.jsx(
1717
- material.Typography,
1718
- {
1719
- variant: "subtitle2",
1720
- color: "primary.dark",
1721
- sx: {
1722
- mt: 0.8,
1723
- lineHeight: "15.4px",
1724
- overflow: "hidden",
1725
- textOverflow: "ellipsis",
1726
- whiteSpace: "nowrap"
1727
- },
1728
- children: redir
1729
- }
1730
- )
1731
- }
1732
- ) })
1733
- ] }),
1734
- /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
1735
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
1736
- /* @__PURE__ */ jsxRuntime.jsx(
1737
- material.Typography,
2110
+ children: [
2111
+ /* @__PURE__ */ jsxRuntime.jsxs(
2112
+ material.CardContent,
2113
+ {
2114
+ sx: {
2115
+ display: "flex",
2116
+ justifyContent: "space-between",
2117
+ alignItems: "center",
2118
+ flexWrap: { xs: "wrap", md: "nowrap" },
2119
+ gap: 2
2120
+ },
2121
+ children: [
2122
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "20%", minWidth: 220 }, children: [
2123
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h6", fontWeight: 600, noWrap: true, children: info.activity_name }) }),
2124
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsxRuntime.jsx(
2125
+ material.Typography,
2126
+ {
2127
+ variant: "body2",
2128
+ color: "text.secondary",
2129
+ noWrap: true,
2130
+ sx: { mt: 0.5 },
2131
+ children: info.description_data
2132
+ }
2133
+ ) })
2134
+ ] }),
2135
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "18%", minWidth: 180 }, children: [
2136
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
2137
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: redir, children: /* @__PURE__ */ jsxRuntime.jsx(
2138
+ "a",
2139
+ {
2140
+ href: redir,
2141
+ target: "_blank",
2142
+ rel: "noreferrer",
2143
+ style: {
2144
+ cursor: "pointer",
2145
+ textDecoration: "none"
2146
+ },
2147
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2148
+ material.Typography,
2149
+ {
2150
+ variant: "subtitle2",
2151
+ color: "primary.dark",
2152
+ sx: {
2153
+ mt: 0.8,
2154
+ lineHeight: "15.4px",
2155
+ overflow: "hidden",
2156
+ textOverflow: "ellipsis",
2157
+ whiteSpace: "nowrap"
2158
+ },
2159
+ children: redir
2160
+ }
2161
+ )
2162
+ }
2163
+ ) })
2164
+ ] }),
2165
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
2166
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
2167
+ /* @__PURE__ */ jsxRuntime.jsx(
2168
+ material.Typography,
2169
+ {
2170
+ variant: "body2",
2171
+ noWrap: true,
2172
+ sx: {
2173
+ mt: 0.8,
2174
+ color: ((_h2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h2.length) ? "primary.dark" : "text.disabled"
2175
+ },
2176
+ children: ((_i2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _i2.length) ? `${info.attachment_links.length} file(s)` : "N/A"
2177
+ }
2178
+ )
2179
+ ] }),
2180
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
2181
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
2182
+ /* @__PURE__ */ jsxRuntime.jsx(
2183
+ material.Typography,
2184
+ {
2185
+ variant: "body2",
2186
+ sx: {
2187
+ mt: 0.8,
2188
+ fontWeight: 500,
2189
+ color: "text.primary"
2190
+ },
2191
+ 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"
2192
+ }
2193
+ )
2194
+ ] }),
2195
+ /* @__PURE__ */ jsxRuntime.jsxs(
2196
+ system.Box,
1738
2197
  {
1739
- variant: "body2",
1740
- noWrap: true,
1741
2198
  sx: {
1742
- mt: 0.8,
1743
- color: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? "primary.dark" : "text.disabled"
2199
+ flexBasis: "8%",
2200
+ minWidth: 80,
2201
+ textAlign: "center"
1744
2202
  },
1745
- children: ((_i = info == null ? void 0 : info.attachment_links) == null ? void 0 : _i.length) ? `${info.attachment_links.length} file(s)` : "N/A"
2203
+ children: [
2204
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
2205
+ /* @__PURE__ */ jsxRuntime.jsx(material.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(
2206
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
2207
+ )) != null ? _k2 : -1) + 1 || "") })
2208
+ ]
1746
2209
  }
1747
- )
1748
- ] }),
1749
- /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
1750
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
1751
- /* @__PURE__ */ jsxRuntime.jsx(
1752
- material.Typography,
2210
+ ),
2211
+ /* @__PURE__ */ jsxRuntime.jsxs(
2212
+ system.Box,
1753
2213
  {
1754
- variant: "body2",
1755
2214
  sx: {
1756
- mt: 0.8,
1757
- fontWeight: 500,
1758
- color: "text.primary"
2215
+ flexBasis: "18%",
2216
+ minWidth: 200,
2217
+ display: "flex",
2218
+ alignItems: "center",
2219
+ justifyContent: "flex-end",
2220
+ gap: 1.5
1759
2221
  },
1760
- 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"
1761
- }
1762
- )
1763
- ] }),
1764
- /* @__PURE__ */ jsxRuntime.jsxs(
1765
- system.Box,
1766
- {
1767
- sx: {
1768
- flexBasis: "8%",
1769
- minWidth: 80,
1770
- textAlign: "center"
1771
- },
1772
- children: [
1773
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1774
- /* @__PURE__ */ jsxRuntime.jsx(material.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(
1775
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1776
- )) != null ? _k : -1) + 1 || "") })
1777
- ]
1778
- }
1779
- ),
1780
- /* @__PURE__ */ jsxRuntime.jsxs(
1781
- system.Box,
1782
- {
1783
- sx: {
1784
- flexBasis: "18%",
1785
- minWidth: 200,
1786
- display: "flex",
1787
- alignItems: "center",
1788
- justifyContent: "flex-end",
1789
- gap: 1.5
1790
- },
1791
- children: [
1792
- (info == null ? void 0 : info.current_status) !== "completed" ? /* @__PURE__ */ jsxRuntime.jsx(
1793
- Statusselector_default,
1794
- {
1795
- onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
1796
- onApprove: () => {
1797
- var _a3;
1798
- return handleApprove(
1799
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
1800
- );
1801
- },
1802
- onReject: () => {
1803
- var _a3;
1804
- return handleReject(
1805
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
1806
- );
1807
- },
1808
- onHold: () => {
1809
- var _a3;
1810
- return handleOnHold(
1811
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1812
- );
1813
- },
1814
- statusList
1815
- }
1816
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1817
- material.Chip,
1818
- {
1819
- variant: "filled",
1820
- sx: {
1821
- backgroundColor: statusData.color,
1822
- color: statusData.labelColor,
1823
- height: "40px",
1824
- px: 2,
1825
- borderRadius: "100px !important",
1826
- "& .MuiChip-label": {
1827
- fontSize: "14px",
1828
- lineHeight: "15.4px",
1829
- fontWeight: "500",
1830
- textTransform: "capitalize"
2222
+ children: [
2223
+ (info == null ? void 0 : info.current_status) !== "completed" ? /* @__PURE__ */ jsxRuntime.jsx(
2224
+ Statusselector_default,
2225
+ {
2226
+ onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
2227
+ onApprove: () => {
2228
+ var _a3;
2229
+ return handleApprove(
2230
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
2231
+ );
2232
+ },
2233
+ onReject: () => {
2234
+ var _a3;
2235
+ return handleReject(
2236
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
2237
+ );
2238
+ },
2239
+ onHold: () => {
2240
+ var _a3;
2241
+ return handleOnHold(
2242
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
2243
+ );
2244
+ },
2245
+ level: info == null ? void 0 : info.isLevelZero,
2246
+ statusList: filterRejectForLevelZero(
2247
+ statusList,
2248
+ info
2249
+ )
2250
+ }
2251
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2252
+ material.Chip,
2253
+ {
2254
+ variant: "filled",
2255
+ sx: {
2256
+ backgroundColor: statusData.color,
2257
+ color: statusData.labelColor,
2258
+ height: "40px",
2259
+ px: 2,
2260
+ borderRadius: "100px !important",
2261
+ "& .MuiChip-label": {
2262
+ fontSize: "14px",
2263
+ lineHeight: "15.4px",
2264
+ fontWeight: "500",
2265
+ textTransform: "capitalize"
2266
+ }
2267
+ },
2268
+ label: statusData.title
2269
+ }
2270
+ ),
2271
+ /* @__PURE__ */ jsxRuntime.jsx(
2272
+ material.Divider,
2273
+ {
2274
+ orientation: "vertical",
2275
+ flexItem: true,
2276
+ sx: {
2277
+ borderColor: "#E0E0E0",
2278
+ height: "40px"
1831
2279
  }
1832
- },
1833
- label: statusData.title
1834
- }
1835
- ),
1836
- /* @__PURE__ */ jsxRuntime.jsx(
1837
- material.Divider,
1838
- {
1839
- orientation: "vertical",
1840
- flexItem: true,
1841
- sx: {
1842
- borderColor: "#E0E0E0",
1843
- height: "40px"
1844
2280
  }
1845
- }
1846
- ),
1847
- /* @__PURE__ */ jsxRuntime.jsx(
1848
- material.IconButton,
1849
- {
1850
- color: "primary",
1851
- sx: {
1852
- background: "rgba(25,118,210,0.08)",
1853
- boxShadow: "2px 2px 10px 0px #4C4E6426",
1854
- "& span": { color: "primary.dark" }
1855
- },
1856
- onClick: () => handleExpandClick(info._id),
1857
- children: expandedId === info._id ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-right-3" })
1858
- }
1859
- )
1860
- ]
1861
- }
1862
- )
1863
- ]
1864
- }
1865
- )
2281
+ ),
2282
+ /* @__PURE__ */ jsxRuntime.jsx(
2283
+ material.IconButton,
2284
+ {
2285
+ color: "primary",
2286
+ sx: {
2287
+ background: "rgba(25,118,210,0.08)",
2288
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
2289
+ "& span": { color: "primary.dark" }
2290
+ },
2291
+ onClick: () => handleExpandClick(info._id),
2292
+ children: expandedId === info._id ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-right-3" })
2293
+ }
2294
+ )
2295
+ ]
2296
+ }
2297
+ )
2298
+ ]
2299
+ }
2300
+ ),
2301
+ expandedId === info._id && /* @__PURE__ */ jsxRuntime.jsx(system.Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsxRuntime.jsx(
2302
+ system.Box,
2303
+ {
2304
+ sx: {
2305
+ height: 150,
2306
+ display: "flex",
2307
+ justifyContent: "center",
2308
+ alignItems: "center"
2309
+ },
2310
+ children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
2311
+ }
2312
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
2313
+ CustomTimelineWithStatus,
2314
+ {
2315
+ events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
2316
+ var _a3, _b3, _c3, _d3;
2317
+ return {
2318
+ date: moment__default.default(item == null ? void 0 : item.created_at).format(
2319
+ "DD-MM-YYYY"
2320
+ ),
2321
+ time: moment__default.default(item == null ? void 0 : item.created_at).format("HH:mm"),
2322
+ 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",
2323
+ subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
2324
+ attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
2325
+ count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
2326
+ cardType: "card",
2327
+ 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
2328
+ };
2329
+ })
2330
+ }
2331
+ ) })
2332
+ ]
1866
2333
  },
1867
2334
  index
1868
2335
  );
@@ -1887,8 +2354,8 @@ function ApprovalWorkflow({
1887
2354
  openModal: !!approveTarget,
1888
2355
  closeModal: () => setApproveTarget(null),
1889
2356
  header: "Approve",
1890
- workflowLogId: (_a = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _a[0],
1891
- statusId: (_b = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _b[1]
2357
+ workflowLogId: (_m = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _m[0],
2358
+ statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1]
1892
2359
  }
1893
2360
  ),
1894
2361
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1897,9 +2364,9 @@ function ApprovalWorkflow({
1897
2364
  openModal: !!rejectTarget,
1898
2365
  closeModal: () => setRejectTarget(null),
1899
2366
  header: "Reject",
1900
- workflowLogId: (_c = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _c[0],
1901
- statusId: (_d = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _d[1],
1902
- rejection_reason_master: (_e = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _e[2]
2367
+ workflowLogId: (_o = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _o[0],
2368
+ statusId: (_p = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _p[1],
2369
+ rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2]
1903
2370
  }
1904
2371
  ),
1905
2372
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1908,8 +2375,8 @@ function ApprovalWorkflow({
1908
2375
  openModal: !!onHoldTarget,
1909
2376
  closeModal: () => setOnHoldTarget(null),
1910
2377
  header: "On Hold",
1911
- workflowLogId: (_f = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _f[0],
1912
- statusId: (_g = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _g[1]
2378
+ workflowLogId: (_r = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _r[0],
2379
+ statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1]
1913
2380
  }
1914
2381
  )
1915
2382
  ] });