amp-workflow-ui 0.1.1 → 0.1.2

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