amp-workflow-ui 0.1.2 → 0.1.4

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
@@ -84,7 +84,12 @@ var ActionMenu = ({
84
84
  ] });
85
85
  };
86
86
  var Statusselector_default = ActionMenu;
87
- function SendBackDialog({ openModal, closeModal, header, workflowLogId }) {
87
+ function SendBackDialog({
88
+ openModal,
89
+ closeModal,
90
+ header,
91
+ workflowLogId
92
+ }) {
88
93
  const { userInfo, api } = useWorkflowContext();
89
94
  const [comment, setComment] = React7.useState("");
90
95
  const [selectedFile, setSelectedFile] = React7.useState(null);
@@ -102,7 +107,9 @@ function SendBackDialog({ openModal, closeModal, header, workflowLogId }) {
102
107
  const formData = new FormData();
103
108
  formData.append("file", file);
104
109
  try {
105
- const response = await api.post("/workflow/upload-document", formData, {
110
+ const response = await api.post({
111
+ url: "/workflow/upload-document",
112
+ data: formData,
106
113
  headers: { "Content-Type": "multipart/form-data" }
107
114
  });
108
115
  setFileName(response.data.file);
@@ -138,10 +145,14 @@ function SendBackDialog({ openModal, closeModal, header, workflowLogId }) {
138
145
  if (!validateFields()) return;
139
146
  setLoading(true);
140
147
  try {
141
- const res = await api.post(`/workflow/send-back/${workflowLogId}`, {
142
- comment,
143
- file: selectedFile,
144
- created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
148
+ const res = await api.post({
149
+ url: `/workflow/send-back/${workflowLogId}`,
150
+ data: {
151
+ comment,
152
+ file: selectedFile,
153
+ created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
154
+ },
155
+ serviceURL: "api"
145
156
  });
146
157
  if ((res == null ? void 0 : res.status) === 200) toast__default.default.success("Successfully sent back!");
147
158
  if ((_b = res == null ? void 0 : res.error) == null ? void 0 : _b.message) {
@@ -154,50 +165,107 @@ function SendBackDialog({ openModal, closeModal, header, workflowLogId }) {
154
165
  setLoading(false);
155
166
  }
156
167
  };
157
- return /* @__PURE__ */ jsxRuntime.jsxs(Dialog__default.default, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
158
- /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
159
- /* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
160
- /* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
161
- ] }),
162
- /* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { container: true, spacing: 5, children: [
163
- /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
164
- material.TextField,
165
- {
166
- fullWidth: true,
167
- label: "Comment",
168
- value: comment,
169
- placeholder: "Comment Here",
170
- onChange: (e) => setComment(e.target.value),
171
- required: true,
172
- error: !!error.comment,
173
- helperText: error.comment
174
- }
175
- ) }),
176
- /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { item: true, xs: 12, children: [
177
- /* @__PURE__ */ jsxRuntime.jsx(
178
- material.TextField,
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,
179
178
  {
180
- type: "text",
181
- fullWidth: true,
182
- label: "Attachment",
183
- placeholder: "Attachment",
184
- InputProps: {
185
- endAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-export-1" }) })
179
+ sx: {
180
+ display: "flex",
181
+ justifyContent: "space-between",
182
+ alignItems: "center"
186
183
  },
187
- onClick: handleAttachment,
188
- value: fileName,
189
- error: !!error.file,
190
- helperText: error.file
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
+ ]
191
188
  }
192
189
  ),
193
- /* @__PURE__ */ jsxRuntime.jsx("input", { type: "file", ref: fileInputRef, style: { display: "none" }, onChange: handleFileChange })
194
- ] })
195
- ] }) }) }),
196
- /* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
197
- /* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
198
- /* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading || fileLoading, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
199
- ] }) })
200
- ] });
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,
193
+ {
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
202
+ }
203
+ ) }),
204
+ /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { item: true, xs: 12, children: [
205
+ /* @__PURE__ */ jsxRuntime.jsx(
206
+ material.TextField,
207
+ {
208
+ type: "text",
209
+ 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
228
+ }
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: [
241
+ /* @__PURE__ */ jsxRuntime.jsx(
242
+ material.Button,
243
+ {
244
+ onClick: closeModal,
245
+ size: "large",
246
+ variant: "outlined",
247
+ color: "primary",
248
+ sx: { mr: 2 },
249
+ children: "Close"
250
+ }
251
+ ),
252
+ /* @__PURE__ */ jsxRuntime.jsx(
253
+ material.Button,
254
+ {
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"
261
+ }
262
+ )
263
+ ]
264
+ }
265
+ ) })
266
+ ]
267
+ }
268
+ );
201
269
  }
202
270
  var SendBackDialog_default = SendBackDialog;
203
271
  function ApproveDialog({ openModal, closeModal, header, workflowLogId, statusId }) {
@@ -368,31 +436,6 @@ function OnHoldDialog({ openModal, closeModal, header, workflowLogId, statusId }
368
436
  ] });
369
437
  }
370
438
  var OnHoldDialog_default = OnHoldDialog;
371
- var Bull = ({
372
- count,
373
- isDisabled
374
- }) => {
375
- const theme = material.useTheme();
376
- const color = isDisabled ? theme.palette.success.main : theme.palette.primary.main;
377
- return /* @__PURE__ */ jsxRuntime.jsx(
378
- material.Box,
379
- {
380
- sx: {
381
- display: "flex",
382
- justifyContent: "center",
383
- alignItems: "center",
384
- width: 32,
385
- height: 32,
386
- borderRadius: "50%",
387
- border: `2px solid ${color}`,
388
- color,
389
- fontWeight: 600,
390
- fontSize: 14
391
- },
392
- children: count
393
- }
394
- );
395
- };
396
439
  var getStatus = (status, theme) => {
397
440
  const s = status == null ? void 0 : status.toLowerCase();
398
441
  const colors = {
@@ -410,7 +453,7 @@ var getStatus = (status, theme) => {
410
453
  };
411
454
  return colors[s] || colors.pending;
412
455
  };
413
- function CustomTimelineWithStatus({ events }) {
456
+ function ConnectedTimeline({ events }) {
414
457
  const { api } = useWorkflowContext();
415
458
  const theme = material.useTheme();
416
459
  const [isMobile, setIsMobile] = React7.useState(false);
@@ -426,126 +469,210 @@ function CustomTimelineWithStatus({ events }) {
426
469
  serviceURL: "api"
427
470
  }).then((res) => window.open(res.data, "_blank"));
428
471
  };
472
+ const columns = 4;
429
473
  const rows = [];
430
- for (let i = 0; i < (events == null ? void 0 : events.length); i += 4) rows.push(events.slice(i, i + 4));
431
- return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { p: 2 }, children: rows.map((row, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx(
432
- material.Box,
433
- {
434
- sx: {
435
- display: "flex",
436
- flexDirection: isMobile ? "column" : rowIndex % 2 === 0 ? "row" : "row-reverse",
437
- gap: isMobile ? 3 : 6,
438
- alignItems: "center",
439
- mb: 6
440
- },
441
- children: row.map((event, index) => {
442
- var _a;
443
- const status = getStatus((_a = event.status) == null ? void 0 : _a.title, theme);
444
- const isDisabled = event.cardType === "disableCard";
445
- return /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: isMobile ? 12 : 3, children: /* @__PURE__ */ jsxRuntime.jsx(
446
- material.Card,
447
- {
448
- variant: "outlined",
449
- sx: {
450
- width: "100%",
451
- borderRadius: 3,
452
- p: 2,
453
- borderColor: isDisabled ? theme.palette.success.main : theme.palette.divider,
454
- backgroundColor: isDisabled ? theme.palette.action.hover : theme.palette.background.paper,
455
- textAlign: "center",
456
- boxShadow: 2,
457
- "&:hover": { boxShadow: 5 }
458
- },
459
- children: /* @__PURE__ */ jsxRuntime.jsxs(material.CardContent, { children: [
460
- /* @__PURE__ */ jsxRuntime.jsxs(
461
- material.Box,
462
- {
463
- sx: {
464
- display: "flex",
465
- justifyContent: "space-between",
466
- alignItems: "center",
467
- mb: 1
468
- },
469
- children: [
470
- /* @__PURE__ */ jsxRuntime.jsx(
471
- material.Typography,
472
- {
473
- variant: "body2",
474
- color: theme.palette.text.secondary,
475
- children: event.date
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,
480
+ {
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(
497
+ material.Box,
498
+ {
499
+ sx: {
500
+ position: "relative",
501
+ display: "flex",
502
+ justifyContent: "center",
503
+ alignItems: "center"
504
+ },
505
+ 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,
522
+ {
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
+ }
532
+ }
533
+ ),
534
+ /* @__PURE__ */ jsxRuntime.jsx(
535
+ material.Card,
536
+ {
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)"
476
549
  }
477
- ),
478
- event.status && /* @__PURE__ */ jsxRuntime.jsx(
479
- material.Chip,
480
- {
481
- label: event.status.title,
482
- sx: {
483
- backgroundColor: status.bg,
484
- color: status.text,
485
- fontSize: 12,
486
- height: 26,
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",
487
611
  fontWeight: 600,
488
- borderRadius: "16px"
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
489
620
  }
490
- }
491
- )
492
- ]
493
- }
494
- ),
495
- /* @__PURE__ */ jsxRuntime.jsx(Bull, { count: event.count, isDisabled }),
496
- /* @__PURE__ */ jsxRuntime.jsx(
497
- material.Typography,
498
- {
499
- variant: "subtitle1",
500
- fontWeight: 600,
501
- color: isDisabled ? theme.palette.text.secondary : theme.palette.text.primary,
502
- sx: { mt: 2, mb: 0.5 },
503
- children: event.title
504
- }
505
- ),
506
- /* @__PURE__ */ jsxRuntime.jsx(
507
- material.Typography,
508
- {
509
- variant: "body2",
510
- color: theme.palette.text.secondary,
511
- sx: { mb: 1 },
512
- children: event.subTitle
513
- }
514
- ),
515
- event.attachment && /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "View attachment", children: /* @__PURE__ */ jsxRuntime.jsx(
516
- material.Typography,
517
- {
518
- variant: "body2",
519
- sx: {
520
- color: theme.palette.primary.main,
521
- cursor: "pointer",
522
- fontWeight: 500,
523
- textDecoration: "underline",
524
- "&:hover": {
525
- color: theme.palette.primary.dark
526
- }
527
- },
528
- onClick: () => handleAttachmentClick(event.attachment),
529
- children: "Attachment"
530
- }
531
- ) }),
532
- /* @__PURE__ */ jsxRuntime.jsx(
533
- material.Typography,
534
- {
535
- variant: "caption",
536
- display: "block",
537
- color: theme.palette.text.disabled,
538
- sx: { mt: 2 },
539
- children: event.time
540
- }
541
- )
542
- ] })
543
- }
544
- ) }, index);
545
- })
546
- },
547
- rowIndex
548
- )) });
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,
639
+ {
640
+ variant: "body2",
641
+ 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
662
+ }
663
+ )
664
+ ] })
665
+ }
666
+ )
667
+ ]
668
+ },
669
+ index
670
+ );
671
+ })
672
+ },
673
+ rowIndex
674
+ );
675
+ }) });
549
676
  }
550
677
  var useDebounce = (value, delay) => {
551
678
  const [debouncedValue, setDebouncedValue] = React7.useState(value);
@@ -591,15 +718,15 @@ var SearchBox = ({
591
718
  };
592
719
  var SearchBox_default = SearchBox;
593
720
  var StyledChipProps = material.styled(material.Chip)(({ theme }) => {
594
- var _a, _b, _c, _d, _e, _f, _g;
721
+ var _a, _b, _c;
595
722
  return {
596
723
  "&.MuiChip-colorPrimary": {
597
724
  border: `1px solid ${theme.palette.primary.dark}`,
598
725
  borderRadius: "8px",
599
726
  height: "36px",
600
727
  padding: "6px 4px",
601
- background: `${(_b = (_a = theme.palette.customColors) == null ? void 0 : _a.customChipBackgroundColor) != null ? _b : "rgba(25,118,210,0.1)"}`,
602
- color: `${(_d = (_c = theme.palette.customColors) == null ? void 0 : _c.customChipColor) != null ? _d : theme.palette.primary.dark}`,
728
+ background: `${"rgba(25,118,210,0.1)"}`,
729
+ color: `${theme.palette.primary.dark}`,
603
730
  width: "170px",
604
731
  overflow: "hidden",
605
732
  whiteSpace: "nowrap",
@@ -611,7 +738,7 @@ var StyledChipProps = material.styled(material.Chip)(({ theme }) => {
611
738
  height: "36px",
612
739
  padding: "6px 4px",
613
740
  background: "none !important",
614
- color: `${(_g = (_f = (_e = theme.palette) == null ? void 0 : _e.customColors) == null ? void 0 : _f.mainText) != null ? _g : theme.palette.text.primary} `,
741
+ color: `${(_c = (_b = (_a = theme.palette) == null ? void 0 : _a.customColors) == null ? void 0 : _b.mainText) != null ? _c : theme.palette.text.primary} `,
615
742
  width: "170px",
616
743
  overflow: "hidden",
617
744
  whiteSpace: "nowrap",
@@ -619,22 +746,13 @@ var StyledChipProps = material.styled(material.Chip)(({ theme }) => {
619
746
  }
620
747
  };
621
748
  });
622
- material.styled(material.Typography)(({ theme }) => ({
623
- overflow: "hidden",
624
- textOverflow: "ellipsis",
625
- whiteSpace: "nowrap",
626
- width: "200px",
627
- [theme.breakpoints.down("sm")]: {
628
- width: "80px"
629
- }
630
- }));
631
749
  function ApprovalWorkflow({
632
750
  selectedWorkflowsList = [],
633
751
  userInfo
634
752
  }) {
635
753
  var _a, _b, _c, _d, _e, _f, _g;
636
754
  const theme = material.useTheme();
637
- const { api, urlBuilder, loadingComponent } = useWorkflowContext();
755
+ const { api, urlBuilder, loadingComponent, ENV_VARIABLES } = useWorkflowContext();
638
756
  const [selectedApprovalOtions, setSelectedApprovalOtions] = React7.useState(
639
757
  selectedWorkflowsList.length ? "selected" : "Action Required"
640
758
  );
@@ -644,12 +762,14 @@ function ApprovalWorkflow({
644
762
  const [rejectTarget, setRejectTarget] = React7__default.default.useState(null);
645
763
  const [onHoldTarget, setOnHoldTarget] = React7__default.default.useState(null);
646
764
  const [expandedDetails, setExpandedDetails] = React7.useState([]);
647
- const [statusCount, setStatusCount] = React7.useState({});
648
765
  const [urlConfig, setUrlConfig] = React7.useState({});
649
766
  const [allRequestArray, setAllRequestArray] = React7.useState([]);
650
767
  const [pendingRequestArray, setPendingRequestArray] = React7.useState([]);
651
768
  const [selectedRequestArray, setSelectedRequestArray] = React7.useState([]);
652
769
  const [isLoading, setIsLoading] = React7.useState(false);
770
+ const [visibleAll, setVisibleAll] = React7.useState(10);
771
+ const [visiblePending, setVisiblePending] = React7.useState(10);
772
+ const [visibleSelected, setVisibleSelected] = React7.useState(10);
653
773
  const [searchText, setSearchText] = React7.useState("");
654
774
  const handleClearSearch = React7.useCallback(() => {
655
775
  setSearchText("");
@@ -685,6 +805,35 @@ function ApprovalWorkflow({
685
805
  return name.includes(q) || desc.includes(q);
686
806
  });
687
807
  }, [pendingRequestArray, debouncedSearchTerm]);
808
+ const observer = React7__default.default.useRef(null);
809
+ const lastCardRef = React7.useCallback(
810
+ (node) => {
811
+ if (isLoading) return;
812
+ if (observer.current) observer.current.disconnect();
813
+ observer.current = new IntersectionObserver((entries) => {
814
+ if (entries[0].isIntersecting) {
815
+ if (selectedApprovalOtions === "All Requests") {
816
+ setVisibleAll((prev) => prev + 10);
817
+ } else if (selectedApprovalOtions === "Action Required") {
818
+ setVisiblePending((prev) => prev + 10);
819
+ } else if (selectedApprovalOtions === "selected") {
820
+ setVisibleSelected((prev) => prev + 10);
821
+ }
822
+ }
823
+ });
824
+ if (node) observer.current.observe(node);
825
+ },
826
+ [isLoading, selectedApprovalOtions]
827
+ );
828
+ const visibleAllRequests = filteredAllRequestArray.slice(0, visibleAll);
829
+ const visiblePendingRequests = filteredPendingRequestArray.slice(
830
+ 0,
831
+ visiblePending
832
+ );
833
+ const visibleSelectedRequests = filteredSelectedRequestArray.slice(
834
+ 0,
835
+ visibleSelected
836
+ );
688
837
  const handleSendBack = (workflowLogId) => {
689
838
  setSendDialog(workflowLogId);
690
839
  };
@@ -758,12 +907,12 @@ function ApprovalWorkflow({
758
907
  {
759
908
  label: "Action Required",
760
909
  icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-document-forward" }),
761
- count: (statusCount == null ? void 0 : statusCount.pending_activities_count) || ""
910
+ count: pendingRequestArray.length || ""
762
911
  },
763
912
  {
764
913
  label: "All Requests",
765
914
  icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-document-copy" }),
766
- count: (statusCount == null ? void 0 : statusCount.total_activities_count) || ""
915
+ count: allRequestArray.length || ""
767
916
  }
768
917
  ];
769
918
  const fetchExpandedActivityLogs = (workflowLogId) => {
@@ -803,20 +952,9 @@ function ApprovalWorkflow({
803
952
  data: { workflowIds: selectedWorkflowsList }
804
953
  }).then((res) => setSelectedRequestArray(res == null ? void 0 : res.data)).finally(() => setIsLoading(false));
805
954
  };
806
- const fetchStatusCount = () => {
807
- var _a2;
808
- api.get({
809
- url: `/workflow/status-count/${(_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id}`,
810
- serviceURL: "api"
811
- }).then((res) => {
812
- var _a3;
813
- setStatusCount((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3[0]);
814
- });
815
- };
816
955
  React7.useEffect(() => {
817
956
  if (!sendDialog && !approveTarget && !onHoldTarget && !rejectTarget) {
818
957
  fetchAllActivites();
819
- fetchStatusCount();
820
958
  fetchPendingActivities();
821
959
  setExpandedDetails([]);
822
960
  setExpandedId(null);
@@ -837,48 +975,35 @@ function ApprovalWorkflow({
837
975
  fetchSelectedActivites();
838
976
  }
839
977
  }, [selectedWorkflowsList]);
978
+ React7.useEffect(() => {
979
+ if (Object.keys(urlConfig).length > 0 && userInfo) {
980
+ fetchPendingActivities();
981
+ }
982
+ }, [urlConfig, userInfo]);
840
983
  const buildRedirectionUrl = (info) => {
841
- if (info == null ? void 0 : info.redirection_link) return info.redirection_link;
842
- if (urlBuilder)
843
- return urlBuilder(
844
- info == null ? void 0 : info.module_name,
845
- info == null ? void 0 : info.module_id,
846
- urlConfig,
847
- info == null ? void 0 : info.reference_id
848
- );
849
- const ref = urlConfig == null ? void 0 : urlConfig[info == null ? void 0 : info.module_name];
984
+ const { module_name, module_id, reference_id, redirection_link } = info;
985
+ if (redirection_link) return redirection_link;
986
+ if (module_name === "route_approval") {
987
+ return `${ENV_VARIABLES == null ? void 0 : ENV_VARIABLES.TRANSPORT_URL}route-listing/view/${reference_id}`;
988
+ } else if (module_name === "update_bus_details_approval") {
989
+ return `${ENV_VARIABLES == null ? void 0 : ENV_VARIABLES.TRANSPORT_URL}bus-listing/view/${reference_id}`;
990
+ } else if (module_name === "kit_handover_approve") {
991
+ return `${ENV_VARIABLES == null ? void 0 : ENV_VARIABLES.FINANCE_URL}fee-collection/?reference_id=${reference_id}&module_name=${module_name}&module_id=${module_id}`;
992
+ }
993
+ if (urlBuilder) {
994
+ return urlBuilder(module_name, module_id, urlConfig, reference_id);
995
+ }
996
+ const ref = urlConfig == null ? void 0 : urlConfig[module_name];
850
997
  if ((ref == null ? void 0 : ref.base_url) && (ref == null ? void 0 : ref.sub_url)) {
851
998
  const qs = new URLSearchParams();
852
- if (info == null ? void 0 : info.reference_id)
853
- qs.set("reference_id", String(info == null ? void 0 : info.reference_id));
854
- if (info == null ? void 0 : info.module_name) qs.set("module_name", String(info == null ? void 0 : info.module_name));
855
- return `${ref.base_url}${ref.sub_url}${qs.toString() ? `?${qs.toString()}` : ""}`;
999
+ if (reference_id) qs.set("reference_id", String(reference_id));
1000
+ if (module_name) qs.set("module_name", String(module_name));
1001
+ if (module_id) qs.set("module_id", String(module_id));
1002
+ return `${ref.base_url}${ref.sub_url}?${qs.toString()}`;
856
1003
  }
857
1004
  return "#";
858
1005
  };
859
1006
  if (isLoading && loadingComponent) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingComponent });
860
- ({
861
- approved: {
862
- color: theme.palette.success.light,
863
- labelColor: theme.palette.success.main
864
- },
865
- rejected: {
866
- color: theme.palette.success.light,
867
- labelColor: theme.palette.success.main
868
- },
869
- onhold: {
870
- color: theme.palette.success.light,
871
- labelColor: theme.palette.success.main
872
- },
873
- sendback: {
874
- color: theme.palette.success.light,
875
- labelColor: theme.palette.success.main
876
- },
877
- pending: {
878
- color: theme.palette.success.light,
879
- labelColor: theme.palette.success.main
880
- }
881
- });
882
1007
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
883
1008
  /* @__PURE__ */ jsxRuntime.jsx(
884
1009
  system.Box,
@@ -948,7 +1073,7 @@ function ApprovalWorkflow({
948
1073
  px: 2,
949
1074
  pb: 3
950
1075
  },
951
- children: filteredSelectedRequestArray == null ? void 0 : filteredSelectedRequestArray.map((info, index) => {
1076
+ children: visibleSelectedRequests == null ? void 0 : visibleSelectedRequests.map((info, index) => {
952
1077
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o;
953
1078
  const currentLevel = info == null ? void 0 : info.levels.find(
954
1079
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
@@ -971,6 +1096,7 @@ function ApprovalWorkflow({
971
1096
  return /* @__PURE__ */ jsxRuntime.jsxs(
972
1097
  material.Card,
973
1098
  {
1099
+ ref: index === visibleSelectedRequests.length - 1 ? lastCardRef : null,
974
1100
  sx: {
975
1101
  mb: 3,
976
1102
  borderRadius: "14px",
@@ -1015,23 +1141,30 @@ function ApprovalWorkflow({
1015
1141
  /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "20%", minWidth: 180 }, children: [
1016
1142
  /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
1017
1143
  /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: redir, children: /* @__PURE__ */ jsxRuntime.jsx(
1018
- material.Typography,
1144
+ "a",
1019
1145
  {
1020
- component: "a",
1021
1146
  href: redir,
1022
1147
  target: "_blank",
1023
1148
  rel: "noreferrer",
1024
- sx: {
1025
- display: "block",
1026
- color: "primary.dark",
1027
- fontWeight: 500,
1028
- textDecoration: "none",
1029
- overflow: "hidden",
1030
- textOverflow: "ellipsis",
1031
- whiteSpace: "nowrap",
1032
- mt: 0.8
1149
+ style: {
1150
+ cursor: "pointer",
1151
+ textDecoration: "none"
1033
1152
  },
1034
- children: redir
1153
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1154
+ material.Typography,
1155
+ {
1156
+ variant: "subtitle2",
1157
+ color: "primary.dark",
1158
+ sx: {
1159
+ mt: 0.8,
1160
+ lineHeight: "15.4px",
1161
+ overflow: "hidden",
1162
+ textOverflow: "ellipsis",
1163
+ whiteSpace: "nowrap"
1164
+ },
1165
+ children: redir
1166
+ }
1167
+ )
1035
1168
  }
1036
1169
  ) })
1037
1170
  ] }),
@@ -1190,7 +1323,7 @@ function ApprovalWorkflow({
1190
1323
  children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
1191
1324
  }
1192
1325
  ) : /* @__PURE__ */ jsxRuntime.jsx(
1193
- CustomTimelineWithStatus,
1326
+ ConnectedTimeline,
1194
1327
  {
1195
1328
  events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
1196
1329
  var _a3, _b3, _c3, _d3;
@@ -1225,7 +1358,7 @@ function ApprovalWorkflow({
1225
1358
  px: 2,
1226
1359
  pb: 3
1227
1360
  },
1228
- children: filteredAllRequestArray == null ? void 0 : filteredAllRequestArray.map((info, index) => {
1361
+ children: visibleAllRequests == null ? void 0 : visibleAllRequests.map((info, index) => {
1229
1362
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o;
1230
1363
  const currentLevel = info == null ? void 0 : info.levels.find(
1231
1364
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
@@ -1248,6 +1381,7 @@ function ApprovalWorkflow({
1248
1381
  return /* @__PURE__ */ jsxRuntime.jsxs(
1249
1382
  material.Card,
1250
1383
  {
1384
+ ref: index === visibleAllRequests.length - 1 ? lastCardRef : null,
1251
1385
  sx: {
1252
1386
  mb: 3,
1253
1387
  borderRadius: "14px",
@@ -1299,23 +1433,30 @@ function ApprovalWorkflow({
1299
1433
  }
1300
1434
  ),
1301
1435
  /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: redir, children: /* @__PURE__ */ jsxRuntime.jsx(
1302
- material.Typography,
1436
+ "a",
1303
1437
  {
1304
- component: "a",
1305
1438
  href: redir,
1306
1439
  target: "_blank",
1307
1440
  rel: "noreferrer",
1308
- sx: {
1309
- display: "block",
1310
- color: "primary.dark",
1311
- fontWeight: 500,
1312
- textDecoration: "none",
1313
- overflow: "hidden",
1314
- textOverflow: "ellipsis",
1315
- whiteSpace: "nowrap",
1316
- mt: 0.8
1441
+ style: {
1442
+ cursor: "pointer",
1443
+ textDecoration: "none"
1317
1444
  },
1318
- children: redir
1445
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1446
+ material.Typography,
1447
+ {
1448
+ variant: "subtitle2",
1449
+ color: "primary.dark",
1450
+ sx: {
1451
+ mt: 0.8,
1452
+ lineHeight: "15.4px",
1453
+ overflow: "hidden",
1454
+ textOverflow: "ellipsis",
1455
+ whiteSpace: "nowrap"
1456
+ },
1457
+ children: redir
1458
+ }
1459
+ )
1319
1460
  }
1320
1461
  ) })
1321
1462
  ] }),
@@ -1474,7 +1615,7 @@ function ApprovalWorkflow({
1474
1615
  children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
1475
1616
  }
1476
1617
  ) : /* @__PURE__ */ jsxRuntime.jsx(
1477
- CustomTimelineWithStatus,
1618
+ ConnectedTimeline,
1478
1619
  {
1479
1620
  events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
1480
1621
  var _a3, _b3, _c3, _d3;
@@ -1509,19 +1650,12 @@ function ApprovalWorkflow({
1509
1650
  px: 2,
1510
1651
  pb: 3
1511
1652
  },
1512
- children: filteredPendingRequestArray == null ? void 0 : filteredPendingRequestArray.map((info, index) => {
1513
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l;
1653
+ children: visiblePendingRequests == null ? void 0 : visiblePendingRequests.map((info, index) => {
1654
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k;
1514
1655
  const currentLevel = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
1515
1656
  (level_) => level_.id === (info == null ? void 0 : info.current_level)
1516
1657
  );
1517
1658
  const statusList = currentLevel ? currentLevel.status_list : [];
1518
- (statusList || []).reduce(
1519
- (acc, s) => {
1520
- if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
1521
- return acc;
1522
- },
1523
- {}
1524
- );
1525
1659
  const redir = buildRedirectionUrl(info);
1526
1660
  const currentStatus = ((_d2 = (_c2 = (_b2 = info == null ? void 0 : info.levels) == null ? void 0 : _b2.find(
1527
1661
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
@@ -1529,9 +1663,10 @@ function ApprovalWorkflow({
1529
1663
  (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1530
1664
  )) == null ? void 0 : _f2.selected_status) == null ? void 0 : _g2.status_id) === 3 ? "rejected" : "pending";
1531
1665
  const statusData = getStatus2(currentStatus);
1532
- return /* @__PURE__ */ jsxRuntime.jsxs(
1666
+ return /* @__PURE__ */ jsxRuntime.jsx(
1533
1667
  material.Card,
1534
1668
  {
1669
+ ref: index === visiblePendingRequests.length - 1 ? lastCardRef : null,
1535
1670
  sx: {
1536
1671
  mb: 3,
1537
1672
  borderRadius: "14px",
@@ -1539,191 +1674,192 @@ function ApprovalWorkflow({
1539
1674
  px: 3,
1540
1675
  py: 2
1541
1676
  },
1542
- children: [
1543
- /* @__PURE__ */ jsxRuntime.jsxs(
1544
- material.CardContent,
1545
- {
1546
- sx: {
1547
- display: "flex",
1548
- justifyContent: "space-between",
1549
- alignItems: "center",
1550
- flexWrap: { xs: "wrap", md: "nowrap" },
1551
- gap: 2
1552
- },
1553
- children: [
1554
- /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "22%", minWidth: 220 }, children: [
1555
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsxRuntime.jsx(
1556
- material.Typography,
1557
- {
1558
- variant: "h6",
1559
- fontWeight: 600,
1560
- noWrap: true,
1561
- color: "text.primary",
1562
- children: info.activity_name
1563
- }
1564
- ) }),
1565
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsxRuntime.jsx(
1566
- material.Typography,
1567
- {
1568
- variant: "body2",
1569
- color: "text.secondary",
1570
- noWrap: true,
1571
- sx: { mt: 0.5 },
1572
- children: info.description_data
1573
- }
1574
- ) })
1575
- ] }),
1576
- /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "20%", minWidth: 180 }, children: [
1577
- /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
1578
- /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: redir, children: /* @__PURE__ */ jsxRuntime.jsx(
1579
- material.Typography,
1580
- {
1581
- component: "a",
1582
- href: redir,
1583
- target: "_blank",
1584
- rel: "noreferrer",
1585
- sx: {
1586
- display: "block",
1677
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
1678
+ material.CardContent,
1679
+ {
1680
+ sx: {
1681
+ display: "flex",
1682
+ justifyContent: "space-between",
1683
+ alignItems: "center",
1684
+ flexWrap: { xs: "wrap", md: "nowrap" },
1685
+ gap: 2
1686
+ },
1687
+ children: [
1688
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "20%", minWidth: 220 }, children: [
1689
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h6", fontWeight: 600, noWrap: true, children: info.activity_name }) }),
1690
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsxRuntime.jsx(
1691
+ material.Typography,
1692
+ {
1693
+ variant: "body2",
1694
+ color: "text.secondary",
1695
+ noWrap: true,
1696
+ sx: { mt: 0.5 },
1697
+ children: info.description_data
1698
+ }
1699
+ ) })
1700
+ ] }),
1701
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "18%", minWidth: 180 }, children: [
1702
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
1703
+ /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: redir, children: /* @__PURE__ */ jsxRuntime.jsx(
1704
+ "a",
1705
+ {
1706
+ href: redir,
1707
+ target: "_blank",
1708
+ rel: "noreferrer",
1709
+ style: {
1710
+ cursor: "pointer",
1711
+ textDecoration: "none"
1712
+ },
1713
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1714
+ material.Typography,
1715
+ {
1716
+ variant: "subtitle2",
1587
1717
  color: "primary.dark",
1588
- fontWeight: 500,
1589
- textDecoration: "none",
1590
- overflow: "hidden",
1591
- textOverflow: "ellipsis",
1592
- whiteSpace: "nowrap",
1593
- mt: 0.8
1594
- },
1595
- children: redir
1596
- }
1597
- ) })
1598
- ] }),
1599
- /* @__PURE__ */ jsxRuntime.jsxs(
1600
- system.Box,
1718
+ sx: {
1719
+ mt: 0.8,
1720
+ lineHeight: "15.4px",
1721
+ overflow: "hidden",
1722
+ textOverflow: "ellipsis",
1723
+ whiteSpace: "nowrap"
1724
+ },
1725
+ children: redir
1726
+ }
1727
+ )
1728
+ }
1729
+ ) })
1730
+ ] }),
1731
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
1732
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
1733
+ /* @__PURE__ */ jsxRuntime.jsx(
1734
+ material.Typography,
1601
1735
  {
1736
+ variant: "body2",
1737
+ noWrap: true,
1602
1738
  sx: {
1603
- flexBasis: "18%",
1604
- minWidth: 200,
1605
- display: "flex",
1606
- alignItems: "center",
1607
- justifyContent: "flex-end",
1608
- gap: 1.5
1739
+ mt: 0.8,
1740
+ color: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? "primary.dark" : "text.disabled"
1609
1741
  },
1610
- children: [
1611
- (info == null ? void 0 : info.current_status) !== "completed" && ((_i = (_h = info == null ? void 0 : info.levels) == null ? void 0 : _h.find(
1612
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1613
- )) == null ? void 0 : _i.order) <= ((_k = (_j = info == null ? void 0 : info.levels) == null ? void 0 : _j.find(
1614
- (lvl) => {
1742
+ children: ((_i = info == null ? void 0 : info.attachment_links) == null ? void 0 : _i.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1743
+ }
1744
+ )
1745
+ ] }),
1746
+ /* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
1747
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
1748
+ /* @__PURE__ */ jsxRuntime.jsx(
1749
+ material.Typography,
1750
+ {
1751
+ variant: "body2",
1752
+ sx: {
1753
+ mt: 0.8,
1754
+ fontWeight: 500,
1755
+ color: "text.primary"
1756
+ },
1757
+ 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"
1758
+ }
1759
+ )
1760
+ ] }),
1761
+ /* @__PURE__ */ jsxRuntime.jsxs(
1762
+ system.Box,
1763
+ {
1764
+ sx: {
1765
+ flexBasis: "8%",
1766
+ minWidth: 80,
1767
+ textAlign: "center"
1768
+ },
1769
+ children: [
1770
+ /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1771
+ /* @__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(
1772
+ (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1773
+ )) != null ? _k : -1) + 1 || "") })
1774
+ ]
1775
+ }
1776
+ ),
1777
+ /* @__PURE__ */ jsxRuntime.jsxs(
1778
+ system.Box,
1779
+ {
1780
+ sx: {
1781
+ flexBasis: "18%",
1782
+ minWidth: 200,
1783
+ display: "flex",
1784
+ alignItems: "center",
1785
+ justifyContent: "flex-end",
1786
+ gap: 1.5
1787
+ },
1788
+ children: [
1789
+ (info == null ? void 0 : info.current_status) !== "completed" ? /* @__PURE__ */ jsxRuntime.jsx(
1790
+ Statusselector_default,
1791
+ {
1792
+ onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
1793
+ onApprove: () => {
1615
1794
  var _a3;
1616
- return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1617
- }
1618
- )) == null ? void 0 : _k.order) ? /* @__PURE__ */ jsxRuntime.jsx(
1619
- Statusselector_default,
1620
- {
1621
- onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
1622
- onApprove: () => {
1623
- var _a3;
1624
- return handleApprove(
1625
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
1626
- );
1627
- },
1628
- onReject: () => {
1629
- var _a3;
1630
- return handleReject(
1631
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
1632
- );
1633
- },
1634
- onHold: () => {
1635
- var _a3;
1636
- return handleOnHold(
1637
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1638
- );
1639
- },
1640
- statusList: (info == null ? void 0 : info.isLevelZero) && (info == null ? void 0 : info.created_by) === ((_l = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _l.id) ? statusList == null ? void 0 : statusList.filter(
1641
- (app) => app.status == 1
1642
- ) : statusList
1643
- }
1644
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1645
- material.Chip,
1646
- {
1647
- variant: "filled",
1648
- sx: {
1649
- backgroundColor: getStatus2(currentStatus).color,
1650
- color: getStatus2(currentStatus).labelColor,
1651
- height: "40px",
1652
- px: 2,
1653
- borderRadius: "100px !important",
1654
- "& .MuiChip-label": {
1655
- fontSize: "14px",
1656
- lineHeight: "15.4px",
1657
- fontWeight: "500",
1658
- textTransform: "capitalize"
1659
- }
1660
- },
1661
- label: statusData.title
1662
- }
1663
- ),
1664
- /* @__PURE__ */ jsxRuntime.jsx(
1665
- material.Divider,
1666
- {
1667
- orientation: "vertical",
1668
- flexItem: true,
1669
- sx: {
1670
- borderColor: "#E0E0E0",
1671
- height: "40px"
1795
+ return handleApprove(
1796
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
1797
+ );
1798
+ },
1799
+ onReject: () => {
1800
+ var _a3;
1801
+ return handleReject(
1802
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
1803
+ );
1804
+ },
1805
+ onHold: () => {
1806
+ var _a3;
1807
+ return handleOnHold(
1808
+ `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1809
+ );
1810
+ },
1811
+ statusList
1812
+ }
1813
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
1814
+ material.Chip,
1815
+ {
1816
+ variant: "filled",
1817
+ sx: {
1818
+ backgroundColor: statusData.color,
1819
+ color: statusData.labelColor,
1820
+ height: "40px",
1821
+ px: 2,
1822
+ borderRadius: "100px !important",
1823
+ "& .MuiChip-label": {
1824
+ fontSize: "14px",
1825
+ lineHeight: "15.4px",
1826
+ fontWeight: "500",
1827
+ textTransform: "capitalize"
1672
1828
  }
1829
+ },
1830
+ label: statusData.title
1831
+ }
1832
+ ),
1833
+ /* @__PURE__ */ jsxRuntime.jsx(
1834
+ material.Divider,
1835
+ {
1836
+ orientation: "vertical",
1837
+ flexItem: true,
1838
+ sx: {
1839
+ borderColor: "#E0E0E0",
1840
+ height: "40px"
1673
1841
  }
1674
- ),
1675
- /* @__PURE__ */ jsxRuntime.jsx(
1676
- material.IconButton,
1677
- {
1678
- disableFocusRipple: true,
1679
- disableRipple: true,
1680
- color: "primary",
1681
- sx: {
1682
- background: "rgba(25,118,210,0.08)",
1683
- boxShadow: "2px 2px 10px 0px #4C4E6426",
1684
- "& span": { color: "primary.dark" }
1685
- },
1686
- onClick: () => handleExpandClick(info._id),
1687
- children: expandedId === info._id ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-right-3" })
1688
- }
1689
- )
1690
- ]
1691
- }
1692
- )
1693
- ]
1694
- }
1695
- ),
1696
- expandedId === info._id && /* @__PURE__ */ jsxRuntime.jsx(system.Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsxRuntime.jsx(
1697
- system.Box,
1698
- {
1699
- sx: {
1700
- height: 150,
1701
- display: "flex",
1702
- justifyContent: "center",
1703
- alignItems: "center"
1704
- },
1705
- children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
1706
- }
1707
- ) : /* @__PURE__ */ jsxRuntime.jsx(
1708
- CustomTimelineWithStatus,
1709
- {
1710
- events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
1711
- var _a3, _b3, _c3, _d3;
1712
- return {
1713
- date: moment__default.default(item == null ? void 0 : item.created_at).format(
1714
- "DD-MM-YYYY"
1715
- ),
1716
- time: moment__default.default(item == null ? void 0 : item.created_at).format("HH:mm"),
1717
- title: (item == null ? void 0 : item.type) === "create" ? `Raised by - ${(_a3 = item == null ? void 0 : item.created_by_user) == null ? void 0 : _a3.full_name}` : ((_b3 = item == null ? void 0 : item.created_by_user) == null ? void 0 : _b3.full_name) || "N/A",
1718
- subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
1719
- attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
1720
- count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
1721
- cardType: "card"
1722
- };
1723
- })
1724
- }
1725
- ) })
1726
- ]
1842
+ }
1843
+ ),
1844
+ /* @__PURE__ */ jsxRuntime.jsx(
1845
+ material.IconButton,
1846
+ {
1847
+ color: "primary",
1848
+ sx: {
1849
+ background: "rgba(25,118,210,0.08)",
1850
+ boxShadow: "2px 2px 10px 0px #4C4E6426",
1851
+ "& span": { color: "primary.dark" }
1852
+ },
1853
+ onClick: () => handleExpandClick(info._id),
1854
+ children: expandedId === info._id ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-right-3" })
1855
+ }
1856
+ )
1857
+ ]
1858
+ }
1859
+ )
1860
+ ]
1861
+ }
1862
+ )
1727
1863
  },
1728
1864
  index
1729
1865
  );
@@ -1817,12 +1953,44 @@ function DialogOpener({
1817
1953
  ) });
1818
1954
  }
1819
1955
  function DialogOpener2(props) {
1820
- const { api, urlBuilder, loadingComponent, userInfoData, ...rest } = props;
1821
- return /* @__PURE__ */ jsxRuntime.jsx(WorkflowProvider, { value: { api, urlBuilder, userInfo: userInfoData, loadingComponent }, children: /* @__PURE__ */ jsxRuntime.jsx(DialogOpener, { ...rest, userInfoData }) });
1956
+ const {
1957
+ api,
1958
+ urlBuilder,
1959
+ loadingComponent,
1960
+ userInfoData,
1961
+ ENV_VARIABLES,
1962
+ ...rest
1963
+ } = props;
1964
+ return /* @__PURE__ */ jsxRuntime.jsx(
1965
+ WorkflowProvider,
1966
+ {
1967
+ value: {
1968
+ api,
1969
+ urlBuilder,
1970
+ userInfo: userInfoData,
1971
+ loadingComponent,
1972
+ ENV_VARIABLES
1973
+ },
1974
+ children: /* @__PURE__ */ jsxRuntime.jsx(DialogOpener, { ...rest, userInfoData })
1975
+ }
1976
+ );
1822
1977
  }
1823
1978
  function ApprovalWorkflow2(props) {
1824
- const { api, urlBuilder, loadingComponent, userInfo, ...rest } = props;
1825
- return /* @__PURE__ */ jsxRuntime.jsx(WorkflowProvider, { value: { api, urlBuilder, userInfo, loadingComponent }, children: /* @__PURE__ */ jsxRuntime.jsx(ApprovalWorkflow, { userInfo, ...rest }) });
1979
+ const {
1980
+ api,
1981
+ urlBuilder,
1982
+ loadingComponent,
1983
+ userInfo,
1984
+ ENV_VARIABLES,
1985
+ ...rest
1986
+ } = props;
1987
+ return /* @__PURE__ */ jsxRuntime.jsx(
1988
+ WorkflowProvider,
1989
+ {
1990
+ value: { api, urlBuilder, userInfo, loadingComponent, ENV_VARIABLES },
1991
+ children: /* @__PURE__ */ jsxRuntime.jsx(ApprovalWorkflow, { userInfo, ...rest })
1992
+ }
1993
+ );
1826
1994
  }
1827
1995
 
1828
1996
  exports.ApprovalWorkflow = ApprovalWorkflow2;