amp-workflow-ui 0.1.1 → 0.1.3

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