amp-workflow-ui 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,15 +1,17 @@
1
1
  import React7, { createContext, useState, useEffect, useCallback, useContext, useRef } from 'react';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
- import Button7 from '@mui/material/Button';
4
- import Dialog from '@mui/material/Dialog';
3
+ import Dialog$1 from '@mui/material/Dialog';
5
4
  import { styled, useTheme } from '@mui/material/styles';
6
5
  import useMediaQuery from '@mui/material/useMediaQuery';
7
- import DialogActions5 from '@mui/material/DialogActions';
6
+ import DialogActions6 from '@mui/material/DialogActions';
8
7
  import DialogContent from '@mui/material/DialogContent';
9
- import { Card, styled as styled$1, Chip, IconButton, useTheme as useTheme$1, Tooltip, CardContent, Typography, Divider, CircularProgress, Box as Box$1, TextField, InputAdornment, Button, Menu, MenuItem, DialogTitle, Grid, DialogActions, Snackbar, Alert, FormControl, InputLabel, Select } from '@mui/material';
8
+ import { Dialog, Box, TextField, styled as styled$1, Chip, DialogTitle, IconButton, useTheme as useTheme$1, Tooltip, CircularProgress, Typography, DialogContent as DialogContent$1, InputAdornment, Button, Grid, DialogActions, Snackbar, Alert, FormControl, InputLabel, Select, MenuItem } from '@mui/material';
10
9
  import HighlightOffIcon from '@mui/icons-material/HighlightOff';
11
- import { Box } from '@mui/system';
10
+ import { FilterAlt, CheckCircleOutlineOutlined } from '@mui/icons-material';
12
11
  import moment from 'moment';
12
+ import { Box as Box$1 } from '@mui/system';
13
+ import CloseIcon from '@mui/icons-material/Close';
14
+ import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
13
15
 
14
16
  // src/context.tsx
15
17
  var WorkflowContext = createContext(null);
@@ -26,59 +28,578 @@ function useWorkflowContext() {
26
28
  }
27
29
  return ctx;
28
30
  }
29
- var ActionMenu = ({
30
- onSendBack,
31
- onApprove,
32
- onReject,
33
- onHold,
34
- level,
35
- statusList
31
+
32
+ // #style-inject:#style-inject
33
+ function styleInject(css, { insertAt } = {}) {
34
+ if (!css || typeof document === "undefined") return;
35
+ const head = document.head || document.getElementsByTagName("head")[0];
36
+ const style = document.createElement("style");
37
+ style.type = "text/css";
38
+ if (insertAt === "top") {
39
+ if (head.firstChild) {
40
+ head.insertBefore(style, head.firstChild);
41
+ } else {
42
+ head.appendChild(style);
43
+ }
44
+ } else {
45
+ head.appendChild(style);
46
+ }
47
+ if (style.styleSheet) {
48
+ style.styleSheet.cssText = css;
49
+ } else {
50
+ style.appendChild(document.createTextNode(css));
51
+ }
52
+ }
53
+
54
+ // src/ui/style.css
55
+ styleInject('.hide-scrollbar {\n overflow: auto !important;\n -ms-overflow-style: none !important;\n scrollbar-width: none !important;\n}\n.hide-scrollbar::-webkit-scrollbar {\n display: none !important;\n}\n.approval-card {\n position: relative;\n background-color: #f5f5f5;\n border-radius: 8px;\n width: 1069px;\n min-height: 250px;\n height: auto;\n padding: 24px;\n font-family:\n "Graphik Web",\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n sans-serif;\n margin-bottom: 10px;\n display: flex;\n flex-direction: column;\n}\n.card-title {\n color: #3f41d1;\n font-size: 18px;\n font-weight: 600;\n text-decoration: underline;\n text-transform: capitalize;\n margin-top: -7px;\n margin-bottom: 24px;\n}\n.vertical-divider {\n position: absolute;\n left: 884px;\n top: 24px;\n width: 1px;\n height: 128px;\n background-color: #d9d9d9;\n}\n.timer-container {\n position: absolute;\n left: 916px;\n top: 24px;\n width: 121px;\n height: 121px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.timer-svg {\n position: absolute;\n width: 121px;\n height: 121px;\n}\n.timer-content {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n z-index: 1;\n}\n.timer-time {\n color: #3a9f4b;\n font-size: 14px;\n font-weight: 600;\n line-height: 16px;\n letter-spacing: 0.5px;\n}\n.timer-time-expired {\n color: #e6393e;\n}\n.timer-label {\n color: #666;\n font-size: 12px;\n line-height: 16px;\n}\n.details-section {\n display: flex;\n flex-direction: column;\n gap: 8px;\n padding-right: 185px;\n margin-bottom: 32px;\n min-height: 80px;\n}\n.details-row {\n display: flex;\n gap: 64px;\n}\n.details-column {\n display: flex;\n flex-direction: column;\n}\n.detail-item {\n color: #666;\n font-size: 14px;\n line-height: 21px;\n text-transform: capitalize;\n margin: 0;\n}\n.detail-label {\n font-weight: 500;\n}\n.view-more-container {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-top: 8px;\n}\n.view-more-button {\n background-color: #f5f5f5;\n border: 1px solid #e697ab;\n border-radius: 8px;\n padding: 4px 12px;\n color: #3e3e3e;\n font-size: 14px;\n font-weight: 500;\n text-transform: capitalize;\n cursor: pointer;\n line-height: 21px;\n}\n.expand-icon {\n color: #666;\n font-size: 18px;\n transform: rotate(270deg);\n}\n.actions-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n margin-bottom: 18px;\n}\n.progress-bar {\n background-color: white;\n border: 1px solid #3f41d1;\n border-radius: 12px;\n padding: 4px 14px 4px 5px;\n display: flex;\n align-items: center;\n gap: 14px;\n height: 40px;\n}\n.bus-icon {\n width: 35px;\n height: 29px;\n}\n.progress-steps {\n display: flex;\n align-items: center;\n gap: 2px;\n}\n.step-icon {\n width: 17px;\n height: 17px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.step-completed {\n background-color: #eaebfa;\n}\n.step-approved {\n background-color: #3a9f4b;\n}\n.step-inactive {\n background-color: #f6f6f6;\n border: 1px solid #a3a3a3;\n}\n.step-line {\n width: 33px;\n height: 1px;\n}\n.step-line-completed {\n background-color: #3a9f4b;\n}\n.step-line-inactive {\n background-color: #e3e3e3;\n}\n.step-chip-current {\n background-color: #bef2bf !important;\n color: #3e3e3e !important;\n font-size: 14px !important;\n font-weight: 500 !important;\n height: 29px !important;\n border-radius: 14.5px !important;\n text-transform: capitalize;\n}\n.step-chip-next {\n background-color: #eff4f2 !important;\n color: #3e3e3e !important;\n font-size: 14px !important;\n font-weight: 500 !important;\n height: 29px !important;\n border-radius: 14.5px !important;\n text-transform: capitalize;\n}\n.vertical-separator {\n width: 1px;\n height: 29px;\n background-color: #e3e3e3;\n}\n.assignee-text {\n color: #666;\n font-size: 14px;\n line-height: 21px;\n text-transform: capitalize;\n}\n.assignee-label {\n font-weight: 500;\n}\n.action-buttons {\n display: flex;\n gap: 14px;\n}\n.btn-reject,\n.btn-send-back {\n border-color: #666 !important;\n color: #666 !important;\n border-radius: 100px !important;\n text-transform: capitalize !important;\n font-weight: 500 !important;\n font-size: 14px !important;\n height: 40px;\n min-width: 106px;\n}\n.btn-approve {\n background-color: #3f41d1 !important;\n color: white !important;\n border-radius: 100px !important;\n text-transform: capitalize !important;\n font-weight: 500 !important;\n font-size: 14px !important;\n height: 40px;\n}\n.btn-approve:hover {\n background-color: #3436b0 !important;\n}\n.horizontal-divider {\n width: 100%;\n height: 1px;\n background-color: #d9d9d9;\n margin-bottom: 18px;\n}\n.timeline-container {\n display: block;\n}\n.timeline-item {\n width: 215px;\n height: 157px;\n position: relative;\n}\n.timeline-card {\n position: absolute;\n top: 16px;\n width: 215px;\n height: 141px;\n background-color: white;\n border-radius: 16px;\n padding: 16px;\n position: relative;\n}\n.timeline-card.active {\n border: 1px solid #3f41d1;\n}\n.timeline-badge {\n position: absolute !important;\n top: -16px;\n left: 8px;\n width: 32px !important;\n height: 32px !important;\n border-radius: 50% !important;\n font-size: 14px !important;\n font-weight: 500 !important;\n text-transform: capitalize !important;\n border: 3px solid #f6f6f6;\n}\n.badge-l0 {\n background-color: #eaebfa !important;\n color: #3f41d1 !important;\n}\n.badge-l1-bg {\n background-color: #fbcecf !important;\n color: #3e3e3e !important;\n}\n.badge-l1-approved {\n background-color: #3a9f4b !important;\n color: white !important;\n}\n.badge-l1-rejected {\n background-color: #e6393e !important;\n color: white !important;\n}\n.badge-l1-sendback {\n background-color: #dcecf9 !important;\n color: #237ecd !important;\n}\n.badge-l2-active {\n background-color: #f4f0ef !important;\n color: #3e3e3e !important;\n border: 1px solid #3f41d1 !important;\n}\n.timeline-badge-wrapper {\n position: absolute;\n top: -16px;\n left: 8px;\n width: 32px;\n height: 32px;\n}\n.timeline-badge-wrapper .timeline-badge {\n position: absolute !important;\n top: 0;\n left: 0;\n}\n.timeline-badge-wrapper-active {\n position: absolute;\n top: -20px;\n left: 4px;\n width: 38px;\n height: 38px;\n}\n.timeline-badge-wrapper-active .timeline-badge {\n position: absolute !important;\n top: 3px;\n left: 3px;\n}\n.timeline-type {\n color: #666;\n font-size: 12px;\n line-height: 13px;\n text-transform: capitalize;\n margin-top: 12px;\n margin-bottom: 8px;\n}\n.timeline-type.approved {\n color: #3a9f4b;\n font-weight: 600;\n}\n.timeline-type.rejected {\n color: #e6393e;\n font-weight: 600;\n}\n.timeline-type.sendback {\n color: #237ecd;\n font-weight: 600;\n}\n.timeline-name {\n color: #3e3e3e;\n font-size: 14px;\n font-weight: 500;\n line-height: 21px;\n margin-bottom: 8px;\n text-transform: capitalize;\n}\n.timeline-message {\n color: #666;\n font-size: 12px;\n line-height: 13px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin-bottom: 24px;\n}\n.attachments {\n color: #0612fb;\n font-size: 12px;\n line-height: 13px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n margin-bottom: 24px;\n cursor: pointer;\n}\n.timeline-date {\n position: absolute;\n bottom: 16px;\n right: 16px;\n color: #666;\n font-size: 12px;\n line-height: 14px;\n text-align: right;\n text-transform: capitalize;\n}\n.timeline-connector {\n width: 45px;\n height: 157px;\n flex-shrink: 0;\n}\n.timeline-connector svg {\n width: 100%;\n height: 100%;\n}\n@media (max-width: 1200px) {\n .approval-card {\n width: 100%;\n height: auto;\n min-height: 437px;\n }\n}\n.flag {\n position: absolute;\n top: 0;\n right: 0;\n padding: 3px 4px;\n border: 2px solid #b28900;\n border-radius: 5px;\n color: #b28900;\n font-size: 12px;\n}\n');
56
+
57
+ // src/common-component/index.css
58
+ styleInject('.workflow-btn {\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding: 10px 24px;\n gap: 8px;\n height: 40px;\n border-radius: 100px;\n border: none;\n cursor: pointer;\n font-family: "Graphik Web", sans-serif;\n font-style: normal;\n font-weight: 500;\n font-size: 14px;\n line-height: 14px;\n text-align: center;\n text-transform: capitalize;\n background: transparent;\n outline: none;\n}\n.workflow-btn.variant-reject,\n.workflow-btn.variant-send-back {\n background: #FFFFFF;\n border: 1px solid #666666;\n color: #666666;\n}\n.workflow-btn.variant-approve {\n background: #3F41D1;\n color: #FFFFFF;\n}\n.workflow-btn.variant-status-approved {\n background: #3A9F4B;\n color: #CDF3E2;\n}\n.workflow-btn.variant-status-sent-back {\n background: #237ECD;\n color: #DCECF9;\n}\n.workflow-btn.variant-status-rejected {\n background: #FAD7D8;\n color: #E6393E;\n}\n');
59
+ var variantClassMap = {
60
+ reject: "variant-reject",
61
+ "send-back": "variant-send-back",
62
+ approve: "variant-approve",
63
+ approved: "variant-status-approved",
64
+ "status-sent-back": "variant-status-sent-back",
65
+ pending: "variant-status-sent-back",
66
+ rejected: "variant-status-rejected"
67
+ };
68
+ var WorkflowButton = ({
69
+ variant,
70
+ label,
71
+ className = "",
72
+ children,
73
+ ...props
36
74
  }) => {
37
- const [anchorEl, setAnchorEl] = useState(null);
38
- const open = Boolean(anchorEl);
39
- const handleActionClick = (event) => {
40
- setAnchorEl(event.currentTarget);
75
+ const variantClass = variantClassMap[variant];
76
+ return /* @__PURE__ */ jsx("button", { className: `workflow-btn ${variantClass} ${className}`, ...props, children: label || children });
77
+ };
78
+ var WorkflowButton_default = WorkflowButton;
79
+ var CONNECTOR = {
80
+ horizontal: {
81
+ lengthExtra: 0},
82
+ vertical: {
83
+ thickness: 3}
84
+ };
85
+ var CARD_WIDTH = 215;
86
+ var CARD_HEIGHT = 157;
87
+ var GAP = 45;
88
+ var ROW_GAP = 45;
89
+ function WorkFlowTimeline({ events }) {
90
+ const { api } = useWorkflowContext();
91
+ const computeColumn = (index) => {
92
+ const row = Math.floor(index / 4);
93
+ const pos = index % 4;
94
+ return row % 2 === 0 ? pos : 3 - pos;
41
95
  };
42
- const handleClose = () => setAnchorEl(null);
43
- return /* @__PURE__ */ jsxs(Fragment, { children: [
44
- /* @__PURE__ */ jsx(Button, { variant: "contained", color: "primary", onClick: handleActionClick, children: "Apply Action" }),
45
- /* @__PURE__ */ jsxs(
46
- Menu,
47
- {
48
- anchorEl,
49
- open,
50
- onClose: handleClose,
51
- MenuListProps: { "aria-labelledby": "basic-button" },
52
- children: [
53
- !level && /* @__PURE__ */ jsx(
54
- MenuItem,
96
+ const hasNextCard = (i) => i + 1 < events.length;
97
+ const getHorizontalY = (rowIndex) => {
98
+ const centerY = 86.5;
99
+ return centerY;
100
+ };
101
+ const isVerticalNeeded = (index) => (index + 1) % 4 === 0 && hasNextCard(index);
102
+ const handleAttachmentClick = (attachment) => {
103
+ api.get({
104
+ url: `/workflow/uploaded-document-url/${attachment.split("/").reverse()[0]}`,
105
+ serviceURL: "api"
106
+ }).then((res) => {
107
+ window.open(res.data, "_blank");
108
+ });
109
+ };
110
+ return /* @__PURE__ */ jsx(Box, { sx: { width: "100%", overflowX: "auto", p: 1 }, children: /* @__PURE__ */ jsx(
111
+ Box,
112
+ {
113
+ sx: {
114
+ position: "relative",
115
+ display: "grid",
116
+ gridTemplateColumns: `repeat(4, ${CARD_WIDTH}px)`,
117
+ columnGap: `${GAP}px`,
118
+ rowGap: `${ROW_GAP}px`,
119
+ width: "max-content"
120
+ },
121
+ children: events == null ? void 0 : events.map((item, index) => {
122
+ const row = Math.floor(index / 4);
123
+ const col = computeColumn(index);
124
+ const isLastInRow = index % 4 === 3;
125
+ return /* @__PURE__ */ jsxs(
126
+ Box,
127
+ {
128
+ sx: {
129
+ gridColumn: col + 1,
130
+ gridRow: row + 1,
131
+ position: "relative",
132
+ width: `${CARD_WIDTH}px`,
133
+ height: `${CARD_HEIGHT}px`
134
+ },
135
+ children: [
136
+ !isLastInRow && hasNextCard(index) && /* @__PURE__ */ jsx(
137
+ Box,
138
+ {
139
+ sx: {
140
+ position: "absolute",
141
+ top: getHorizontalY(),
142
+ // If row is Even (LTR), connector goes to RIGHT.
143
+ // If row is Odd (RTL), connector goes to LEFT.
144
+ left: row % 2 === 0 ? "100%" : "auto",
145
+ right: row % 2 !== 0 ? "100%" : "auto",
146
+ width: GAP + CONNECTOR.horizontal.lengthExtra,
147
+ zIndex: 0,
148
+ display: "flex",
149
+ alignItems: "center",
150
+ justifyContent: "center",
151
+ transform: row % 2 !== 0 ? "scaleX(-1)" : "none"
152
+ // Flip for RTL if needed, though line is symmetric
153
+ },
154
+ children: /* @__PURE__ */ jsx(
155
+ "svg",
156
+ {
157
+ width: "65",
158
+ height: "3",
159
+ viewBox: "0 0 65 3",
160
+ fill: "none",
161
+ style: { width: "100%" },
162
+ children: /* @__PURE__ */ jsx(
163
+ "line",
164
+ {
165
+ x1: "0",
166
+ y1: "1.5",
167
+ x2: "65",
168
+ y2: "1.5",
169
+ stroke: "#3F41D1",
170
+ strokeWidth: "1",
171
+ strokeDasharray: "6 6",
172
+ strokeLinecap: "round"
173
+ }
174
+ )
175
+ }
176
+ )
177
+ }
178
+ ),
179
+ isVerticalNeeded(index) && /* @__PURE__ */ jsx(
180
+ Box,
181
+ {
182
+ sx: {
183
+ position: "absolute",
184
+ top: "100%",
185
+ // Start at bottom of item
186
+ left: "50%",
187
+ transform: "translateX(-50%)",
188
+ width: CONNECTOR.vertical.thickness,
189
+ height: ROW_GAP,
190
+ // Span the row gap
191
+ zIndex: 0,
192
+ display: "flex",
193
+ justifyContent: "center"
194
+ },
195
+ children: /* @__PURE__ */ jsx("svg", { width: "3", height: 70, viewBox: `0 0 3 70`, fill: "none", children: /* @__PURE__ */ jsx(
196
+ "line",
197
+ {
198
+ x1: "1.5",
199
+ y1: "0",
200
+ x2: "1.5",
201
+ y2: 70,
202
+ stroke: "#3F41D1",
203
+ strokeWidth: "1",
204
+ strokeDasharray: "6 6",
205
+ strokeLinecap: "round"
206
+ }
207
+ ) })
208
+ }
209
+ ),
210
+ /* @__PURE__ */ jsx(
211
+ Box,
212
+ {
213
+ className: "timeline-item",
214
+ sx: { width: "100%", height: "100%" },
215
+ children: /* @__PURE__ */ jsxs(
216
+ Box,
217
+ {
218
+ className: `timeline-card ${events.length - 1 === index ? "active" : ""}`,
219
+ children: [
220
+ /* @__PURE__ */ jsx(Chip, { label: "", className: "timeline-badge badge-l0" }),
221
+ /* @__PURE__ */ jsx(
222
+ Chip,
223
+ {
224
+ label: item == null ? void 0 : item.count,
225
+ className: `timeline-badge badge-l1-${(item == null ? void 0 : item.type) == "approve" ? "approved" : (item == null ? void 0 : item.type) == "reject" ? "rejected" : (item == null ? void 0 : item.type) == "send_back" ? "sendback" : ""}`,
226
+ sx: {
227
+ "& .MuiChip-label": {
228
+ padding: "0px"
229
+ }
230
+ }
231
+ }
232
+ ),
233
+ /* @__PURE__ */ jsx(
234
+ Typography,
235
+ {
236
+ className: `timeline-type ${(item == null ? void 0 : item.type) == "approve" ? "approved" : (item == null ? void 0 : item.type) == "reject" ? "rejected" : (item == null ? void 0 : item.type) == "send_back" ? "sendback" : ""}`,
237
+ children: item == null ? void 0 : item.status
238
+ }
239
+ ),
240
+ /* @__PURE__ */ jsx(Typography, { className: "timeline-name", children: item == null ? void 0 : item.name }),
241
+ /* @__PURE__ */ jsx(Typography, { className: "timeline-message", children: item == null ? void 0 : item.subTitle }),
242
+ (item == null ? void 0 : item.attachment) && /* @__PURE__ */ jsx(
243
+ Typography,
244
+ {
245
+ className: "attachments",
246
+ onClick: () => handleAttachmentClick(item == null ? void 0 : item.attachment),
247
+ children: "Attachments"
248
+ }
249
+ ),
250
+ /* @__PURE__ */ jsxs(Typography, { className: "timeline-date", children: [
251
+ item == null ? void 0 : item.date,
252
+ " ",
253
+ item == null ? void 0 : item.time
254
+ ] })
255
+ ]
256
+ }
257
+ )
258
+ }
259
+ )
260
+ ]
261
+ },
262
+ index
263
+ );
264
+ })
265
+ }
266
+ ) });
267
+ }
268
+ function WorkflowRequestCard({
269
+ requestDetails,
270
+ index,
271
+ isLast,
272
+ lastCardRef,
273
+ expandedId,
274
+ handleExpandClick,
275
+ handleOpenViewMore,
276
+ handleApprove,
277
+ handleReject,
278
+ handleSendBack,
279
+ handleOnHold,
280
+ expandedDetails,
281
+ userInfo,
282
+ helpers
283
+ }) {
284
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
285
+ const { timeLeftDHm, getStatus, buildRedirectionUrl } = helpers;
286
+ const allCurrentAssignees = (_a = requestDetails == null ? void 0 : requestDetails.levels) == null ? void 0 : _a.map(
287
+ (level) => {
288
+ var _a2;
289
+ return (_a2 = level == null ? void 0 : level.assign_to_name) == null ? void 0 : _a2[0];
290
+ }
291
+ );
292
+ const allCurrentEscalatedAssignees = (_b = requestDetails == null ? void 0 : requestDetails.levels) == null ? void 0 : _b.map(
293
+ (level) => {
294
+ var _a2;
295
+ return timeLeftDHm(level == null ? void 0 : level.tat_expiry) === "0d: 0h: 0m" ? (_a2 = level == null ? void 0 : level.escalate_assign_to_name) == null ? void 0 : _a2[0] : "";
296
+ }
297
+ );
298
+ const allAssignees = [
299
+ .../* @__PURE__ */ new Set([...allCurrentAssignees, ...allCurrentEscalatedAssignees])
300
+ ].filter((item) => item);
301
+ console.log("\u{1F680} ~ WorkflowRequestCard ~ allAssignees:", allAssignees);
302
+ const currentLevel = (_c = requestDetails == null ? void 0 : requestDetails.levels) == null ? void 0 : _c.find(
303
+ (level_) => level_.id === (requestDetails == null ? void 0 : requestDetails.current_level)
304
+ );
305
+ const currentlyAssignedUserArray = (currentLevel == null ? void 0 : currentLevel.assign_to_name) || [];
306
+ const currentlyEscaltedUserArray = (currentLevel == null ? void 0 : currentLevel.escalate_assign_to_name) || [];
307
+ const currentlyAssignedUser = (currentLevel == null ? void 0 : currentLevel.assign_to_name) ? currentLevel == null ? void 0 : currentLevel.assign_to_name[0] : "NA";
308
+ const currentlyEscalatedUser = (currentLevel == null ? void 0 : currentLevel.escalate_assign_to_name) ? currentLevel == null ? void 0 : currentLevel.escalate_assign_to_name[0] : "NA";
309
+ console.log(
310
+ "\u{1F680} ~ WorkflowRequestCard ~ currentlyEscalatedUser:",
311
+ currentLevel == null ? void 0 : currentLevel.escalate_assign_to_name
312
+ );
313
+ const extraCurrentlyAssignedUserCount = currentlyAssignedUserArray.length - 1;
314
+ const extraCurrentlyEscalatedUserCount = currentlyEscaltedUserArray.length - 1;
315
+ const statusList = currentLevel ? currentLevel.status_list : [];
316
+ const filterRejectForLevelZero = (statusList2, info) => {
317
+ if (!(info == null ? void 0 : info.isLevelZero)) return statusList2;
318
+ return statusList2 == null ? void 0 : statusList2.filter((item) => item.status !== 3);
319
+ };
320
+ const redirectionUrl = buildRedirectionUrl(requestDetails);
321
+ const currentStatus = ((_f = (_e = (_d = requestDetails == null ? void 0 : requestDetails.levels) == null ? void 0 : _d.find(
322
+ (lvl) => lvl.id === (requestDetails == null ? void 0 : requestDetails.current_level)
323
+ )) == null ? void 0 : _e.selected_status) == null ? void 0 : _f.status_id) === 1 ? "approved" : ((_i = (_h = (_g = requestDetails == null ? void 0 : requestDetails.levels) == null ? void 0 : _g.find(
324
+ (lvl) => lvl.id === (requestDetails == null ? void 0 : requestDetails.current_level)
325
+ )) == null ? void 0 : _h.selected_status) == null ? void 0 : _i.status_id) === 3 ? "rejected" : "pending";
326
+ getStatus(currentStatus);
327
+ const descriptionDetails = (_j = requestDetails == null ? void 0 : requestDetails.template_variables) == null ? void 0 : _j.description_variables;
328
+ const formatKey = (key) => key.replace(/_/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
329
+ const displayEntries = descriptionDetails ? Object.entries(descriptionDetails).filter(
330
+ ([, value]) => typeof value === "string" || typeof value === "number"
331
+ ) : [];
332
+ const userLevel = (requestDetails == null ? void 0 : requestDetails.isLevelZero) ? "L0" : "L" + (((_l = (_k = requestDetails == null ? void 0 : requestDetails.levels) == null ? void 0 : _k.findIndex(
333
+ (lvl) => lvl.id === (requestDetails == null ? void 0 : requestDetails.current_level)
334
+ )) != null ? _l : -1) + 1 || "");
335
+ const tatExpired = timeLeftDHm(currentLevel == null ? void 0 : currentLevel.tat_expiry) === "0d: 0h: 0m";
336
+ return /* @__PURE__ */ jsxs(
337
+ Box,
338
+ {
339
+ className: "approval-card",
340
+ ref: isLast ? lastCardRef : null,
341
+ children: [
342
+ (requestDetails == null ? void 0 : requestDetails.is_parallel) && /* @__PURE__ */ jsx("span", { className: "flag", children: "Parallel Workflow" }),
343
+ /* @__PURE__ */ jsx(Typography, { className: "card-title", children: /* @__PURE__ */ jsx("a", { href: redirectionUrl, target: "_blank", rel: "noreferrer", children: requestDetails.activity_name }) }),
344
+ /* @__PURE__ */ jsx("div", { className: "vertical-divider" }),
345
+ /* @__PURE__ */ jsx(Box, { className: "timer-container", children: /* @__PURE__ */ jsxs(Box, { className: "timer-content", children: [
346
+ /* @__PURE__ */ jsx(
347
+ Typography,
55
348
  {
56
- onClick: () => {
57
- onSendBack();
58
- handleClose();
59
- },
60
- children: "Send Back"
349
+ className: `${timeLeftDHm(currentLevel == null ? void 0 : currentLevel.tat_expiry) === "0d: 0h: 0m" ? "timer-time-expired" : "timer-time"}`,
350
+ children: (currentLevel == null ? void 0 : currentLevel.tat_expiry) ? timeLeftDHm(currentLevel.tat_expiry) : "N/A"
61
351
  }
62
352
  ),
63
- statusList.map((list) => /* @__PURE__ */ jsx(
64
- MenuItem,
353
+ /* @__PURE__ */ jsx(Typography, { className: "timer-label", children: "Time Left" })
354
+ ] }) }),
355
+ /* @__PURE__ */ jsxs(Box, { className: "details-section", children: [
356
+ /* @__PURE__ */ jsxs(Box, { className: "details-row", children: [
357
+ /* @__PURE__ */ jsx(Box, { className: "details-column", children: displayEntries.slice(0, 3).map((entry, i) => /* @__PURE__ */ jsxs(Typography, { className: "detail-item", children: [
358
+ /* @__PURE__ */ jsxs("span", { style: { fontWeight: "bold" }, className: "detail-label", children: [
359
+ formatKey(entry[0]),
360
+ ":"
361
+ ] }),
362
+ " ",
363
+ entry[1]
364
+ ] }, i)) }),
365
+ /* @__PURE__ */ jsx(Box, { className: "details-column", children: displayEntries.slice(3, 6).map((entry, i) => /* @__PURE__ */ jsxs(Typography, { className: "detail-item", children: [
366
+ /* @__PURE__ */ jsxs("span", { style: { fontWeight: "bold" }, className: "detail-label", children: [
367
+ formatKey(entry[0]),
368
+ ":"
369
+ ] }),
370
+ " ",
371
+ entry[1]
372
+ ] }, i)) })
373
+ ] }),
374
+ /* @__PURE__ */ jsx(Box, { className: "view-more-container", children: displayEntries.length > 0 && /* @__PURE__ */ jsx(
375
+ "button",
65
376
  {
66
- onClick: () => {
67
- if (list.status === 1) onApprove();
68
- else if (list.status === 2) onHold();
69
- else if (list.status === 3) onReject();
70
- handleClose();
71
- },
72
- children: list.name
73
- },
74
- list.id
75
- ))
76
- ]
77
- }
78
- )
79
- ] });
80
- };
81
- var Statusselector_default = ActionMenu;
377
+ className: "view-more-button",
378
+ onClick: () => handleOpenViewMore(displayEntries),
379
+ children: "View More"
380
+ }
381
+ ) })
382
+ ] }),
383
+ /* @__PURE__ */ jsxs(Box, { className: "actions-container", children: [
384
+ /* @__PURE__ */ jsxs(Box, { className: "progress-bar", children: [
385
+ /* @__PURE__ */ jsx(
386
+ IconButton,
387
+ {
388
+ color: "primary",
389
+ onClick: () => handleExpandClick(requestDetails._id),
390
+ children: expandedId === requestDetails._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
391
+ }
392
+ ),
393
+ /* @__PURE__ */ jsxs(Box, { className: "progress-steps", children: [
394
+ userLevel == "L0" ? /* @__PURE__ */ jsxs(Fragment, { children: [
395
+ /* @__PURE__ */ jsx(Chip, { label: "L0", className: "step-chip-current" }),
396
+ /* @__PURE__ */ jsx("div", { className: "step-line step-line-inactive" })
397
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
398
+ /* @__PURE__ */ jsx(Box, { className: "step-icon step-completed", children: /* @__PURE__ */ jsx(
399
+ CheckCircleOutlineOutlined,
400
+ {
401
+ sx: { fontSize: 14, color: "#3F41D1" }
402
+ }
403
+ ) }),
404
+ /* @__PURE__ */ jsx("div", { className: "step-line step-line-inactive" })
405
+ ] }),
406
+ (_m = requestDetails == null ? void 0 : requestDetails.levels) == null ? void 0 : _m.map((_, idx) => {
407
+ const level = idx + 1;
408
+ return /* @__PURE__ */ jsx(React7.Fragment, { children: userLevel == "L" + level ? /* @__PURE__ */ jsxs(Fragment, { children: [
409
+ /* @__PURE__ */ jsx(Chip, { label: "L" + level, className: "step-chip-current" }),
410
+ (requestDetails == null ? void 0 : requestDetails.levels.length) !== level && /* @__PURE__ */ jsx("div", { className: "step-line step-line-inactive" })
411
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
412
+ level > +userLevel.split("")[1] ? (
413
+ // <Box className="step-icon step-inactive"></Box>
414
+ /* @__PURE__ */ jsx(Chip, { label: "L" + level, className: "step-chip-next" })
415
+ ) : /* @__PURE__ */ jsx(Box, { className: "step-icon step-completed", children: /* @__PURE__ */ jsx(
416
+ CheckCircleOutlineOutlined,
417
+ {
418
+ sx: { fontSize: 14, color: "#3F41D1" }
419
+ }
420
+ ) }),
421
+ (requestDetails == null ? void 0 : requestDetails.levels.length) !== level && /* @__PURE__ */ jsx("div", { className: "step-line step-line-inactive" })
422
+ ] }) }, idx);
423
+ })
424
+ ] }),
425
+ /* @__PURE__ */ jsx("div", { className: "vertical-separator" }),
426
+ (requestDetails == null ? void 0 : requestDetails.is_parallel) ? /* @__PURE__ */ jsx(Fragment, { children: allAssignees.length > 1 ? /* @__PURE__ */ jsx(
427
+ Tooltip,
428
+ {
429
+ title: /* @__PURE__ */ jsx(
430
+ Box,
431
+ {
432
+ sx: {
433
+ backgroundColor: "#fff",
434
+ padding: "10px",
435
+ borderRadius: "5px"
436
+ },
437
+ children: allAssignees.map((user, index2) => /* @__PURE__ */ jsx(
438
+ Typography,
439
+ {
440
+ className: "assignee-text",
441
+ variant: "body2",
442
+ children: user
443
+ },
444
+ index2
445
+ ))
446
+ }
447
+ ),
448
+ arrow: true,
449
+ placement: "top",
450
+ componentsProps: {
451
+ tooltip: {
452
+ sx: {
453
+ backgroundColor: "#fff",
454
+ color: "#000",
455
+ boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
456
+ borderRadius: "6px",
457
+ p: 1
458
+ }
459
+ },
460
+ arrow: {
461
+ sx: {
462
+ color: "#fff"
463
+ }
464
+ }
465
+ },
466
+ children: /* @__PURE__ */ jsxs(
467
+ Typography,
468
+ {
469
+ className: "assignee-text",
470
+ sx: { cursor: "pointer" },
471
+ children: [
472
+ /* @__PURE__ */ jsx("span", { className: "assignee-label", children: "Current Assignee:" }),
473
+ " ",
474
+ allAssignees.length > 0 ? `${allAssignees[0]} +${allAssignees.length - 1}` : allAssignees[0]
475
+ ]
476
+ }
477
+ )
478
+ }
479
+ ) : /* @__PURE__ */ jsxs(
480
+ Typography,
481
+ {
482
+ className: "assignee-text",
483
+ sx: { cursor: "pointer" },
484
+ children: [
485
+ /* @__PURE__ */ jsx("span", { className: "assignee-label", children: "Current Assignee:" }),
486
+ " ",
487
+ allAssignees[0]
488
+ ]
489
+ }
490
+ ) }) : extraCurrentlyAssignedUserCount > 0 || tatExpired && extraCurrentlyEscalatedUserCount > 0 ? /* @__PURE__ */ jsx(
491
+ Tooltip,
492
+ {
493
+ title: /* @__PURE__ */ jsx(
494
+ Box,
495
+ {
496
+ sx: {
497
+ backgroundColor: "#fff",
498
+ padding: "10px",
499
+ borderRadius: "5px"
500
+ },
501
+ children: (tatExpired ? currentlyEscaltedUserArray : currentlyAssignedUserArray).map((user, index2) => /* @__PURE__ */ jsx(
502
+ Typography,
503
+ {
504
+ className: "assignee-text",
505
+ variant: "body2",
506
+ children: user
507
+ },
508
+ index2
509
+ ))
510
+ }
511
+ ),
512
+ arrow: true,
513
+ placement: "top",
514
+ children: /* @__PURE__ */ jsxs(Typography, { className: "assignee-text", sx: { cursor: "pointer" }, children: [
515
+ /* @__PURE__ */ jsx("span", { className: "assignee-label", children: tatExpired ? "Escalated To:" : "Current Assignee:" }),
516
+ " ",
517
+ (tatExpired ? extraCurrentlyEscalatedUserCount : extraCurrentlyAssignedUserCount) > 0 ? `${tatExpired ? currentlyEscalatedUser : currentlyAssignedUser} +${tatExpired ? extraCurrentlyEscalatedUserCount : extraCurrentlyAssignedUserCount}` : tatExpired ? currentlyEscalatedUser : currentlyAssignedUser
518
+ ] })
519
+ }
520
+ ) : /* @__PURE__ */ jsxs(Typography, { className: "assignee-text", sx: { cursor: "pointer" }, children: [
521
+ /* @__PURE__ */ jsx("span", { className: "assignee-label", children: tatExpired ? "Escalated To:" : "Current Assignee:" }),
522
+ " ",
523
+ tatExpired ? currentlyEscalatedUser : currentlyAssignedUser
524
+ ] })
525
+ ] }),
526
+ (requestDetails == null ? void 0 : requestDetails.current_status) !== "completed" ? /* @__PURE__ */ jsxs(Box, { className: "action-buttons", children: [
527
+ filterRejectForLevelZero(statusList, requestDetails).find(
528
+ (list) => list.status == 3
529
+ ) && /* @__PURE__ */ jsx(
530
+ Button,
531
+ {
532
+ variant: "outlined",
533
+ className: "btn-reject",
534
+ onClick: () => {
535
+ var _a2;
536
+ return handleReject(
537
+ `${requestDetails == null ? void 0 : requestDetails._id}|${(_a2 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a2.id}|${requestDetails == null ? void 0 : requestDetails.reasons}`
538
+ );
539
+ },
540
+ children: "Reject"
541
+ }
542
+ ),
543
+ !(requestDetails == null ? void 0 : requestDetails.isLevelZero) && /* @__PURE__ */ jsx(
544
+ Button,
545
+ {
546
+ variant: "outlined",
547
+ className: "btn-send-back",
548
+ onClick: () => handleSendBack(requestDetails._id),
549
+ children: "Send Back"
550
+ }
551
+ ),
552
+ filterRejectForLevelZero(statusList, requestDetails).find(
553
+ (list) => list.status == 1
554
+ ) && /* @__PURE__ */ jsx(
555
+ Button,
556
+ {
557
+ variant: "contained",
558
+ className: "btn-approve",
559
+ onClick: () => {
560
+ var _a2;
561
+ return handleApprove(
562
+ `${requestDetails == null ? void 0 : requestDetails._id}|${(_a2 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a2.id}`
563
+ );
564
+ },
565
+ children: "Approve"
566
+ }
567
+ )
568
+ ] }) : /* @__PURE__ */ jsx(
569
+ WorkflowButton_default,
570
+ {
571
+ variant: currentStatus === "approved" ? "approved" : currentStatus === "rejected" ? "rejected" : "pending",
572
+ className: "dialog-close-btn",
573
+ children: currentStatus.toLocaleLowerCase()
574
+ }
575
+ )
576
+ ] }),
577
+ expandedId === requestDetails._id && /* @__PURE__ */ jsxs(Fragment, { children: [
578
+ /* @__PURE__ */ jsx("div", { className: "horizontal-divider" }),
579
+ /* @__PURE__ */ jsx(
580
+ WorkFlowTimeline,
581
+ {
582
+ events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
583
+ var _a2, _b2, _c2, _d2;
584
+ return {
585
+ date: moment(item == null ? void 0 : item.created_at).format("DD-MM-YYYY"),
586
+ time: moment(item == null ? void 0 : item.created_at).format("HH:mm"),
587
+ name: (item == null ? void 0 : item.type) === "create" ? (_a2 = item == null ? void 0 : item.created_by_user) == null ? void 0 : _a2.full_name : ((_b2 = item == null ? void 0 : item.created_by_user) == null ? void 0 : _b2.full_name) || "N/A",
588
+ subTitle: ((_c2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c2.comment) || "No Comments",
589
+ attachment: ((_d2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d2.file) || null,
590
+ count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
591
+ status: (item == null ? void 0 : item.type) === "approve" ? "Approved by" : (item == null ? void 0 : item.type) === "reject" ? "Rejected by" : (item == null ? void 0 : item.type) === "send_back" ? "Send Back" : (item == null ? void 0 : item.type) === "onhold" ? "On Hold" : "Created by",
592
+ type: item == null ? void 0 : item.type
593
+ };
594
+ })
595
+ }
596
+ )
597
+ ] })
598
+ ]
599
+ },
600
+ index
601
+ );
602
+ }
82
603
  function SendBackDialog({
83
604
  openModal,
84
605
  closeModal,
@@ -194,7 +715,7 @@ function SendBackDialog({
194
715
  };
195
716
  return /* @__PURE__ */ jsxs(Fragment, { children: [
196
717
  /* @__PURE__ */ jsxs(
197
- Dialog,
718
+ Dialog$1,
198
719
  {
199
720
  open: openModal,
200
721
  onClose: closeModal,
@@ -202,7 +723,7 @@ function SendBackDialog({
202
723
  sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
203
724
  children: [
204
725
  /* @__PURE__ */ jsxs(
205
- Box$1,
726
+ Box,
206
727
  {
207
728
  sx: {
208
729
  display: "flex",
@@ -215,7 +736,7 @@ function SendBackDialog({
215
736
  ]
216
737
  }
217
738
  ),
218
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
739
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
219
740
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
220
741
  TextField,
221
742
  {
@@ -265,7 +786,7 @@ function SendBackDialog({
265
786
  ] })
266
787
  ] }) }) }),
267
788
  /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
268
- Box$1,
789
+ Box,
269
790
  {
270
791
  sx: {
271
792
  display: "flex",
@@ -390,7 +911,7 @@ function ApproveDialog({
390
911
  };
391
912
  return /* @__PURE__ */ jsxs(Fragment, { children: [
392
913
  /* @__PURE__ */ jsxs(
393
- Dialog,
914
+ Dialog$1,
394
915
  {
395
916
  open: openModal,
396
917
  onClose: closeModal,
@@ -398,7 +919,7 @@ function ApproveDialog({
398
919
  sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
399
920
  children: [
400
921
  /* @__PURE__ */ jsxs(
401
- Box$1,
922
+ Box,
402
923
  {
403
924
  sx: {
404
925
  display: "flex",
@@ -411,7 +932,7 @@ function ApproveDialog({
411
932
  ]
412
933
  }
413
934
  ),
414
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
935
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
415
936
  TextField,
416
937
  {
417
938
  fullWidth: true,
@@ -425,7 +946,7 @@ function ApproveDialog({
425
946
  }
426
947
  ) }) }) }) }),
427
948
  /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
428
- Box$1,
949
+ Box,
429
950
  {
430
951
  sx: {
431
952
  display: "flex",
@@ -591,7 +1112,7 @@ function RejectDialog({
591
1112
  };
592
1113
  return /* @__PURE__ */ jsxs(Fragment, { children: [
593
1114
  /* @__PURE__ */ jsxs(
594
- Dialog,
1115
+ Dialog$1,
595
1116
  {
596
1117
  open: openModal,
597
1118
  onClose: closeModal,
@@ -599,7 +1120,7 @@ function RejectDialog({
599
1120
  sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
600
1121
  children: [
601
1122
  /* @__PURE__ */ jsxs(
602
- Box$1,
1123
+ Box,
603
1124
  {
604
1125
  sx: {
605
1126
  display: "flex",
@@ -612,7 +1133,7 @@ function RejectDialog({
612
1133
  ]
613
1134
  }
614
1135
  ),
615
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
1136
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
616
1137
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, required: true, error: !!error.reason, children: [
617
1138
  /* @__PURE__ */ jsx(InputLabel, { required: true, id: "reject-reason-label", children: "Reject Reasons" }),
618
1139
  /* @__PURE__ */ jsx(
@@ -644,7 +1165,7 @@ function RejectDialog({
644
1165
  ) })
645
1166
  ] }) }) }),
646
1167
  /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
647
- Box$1,
1168
+ Box,
648
1169
  {
649
1170
  sx: {
650
1171
  display: "flex",
@@ -769,7 +1290,7 @@ function OnHoldDialog({
769
1290
  };
770
1291
  return /* @__PURE__ */ jsxs(Fragment, { children: [
771
1292
  /* @__PURE__ */ jsxs(
772
- Dialog,
1293
+ Dialog$1,
773
1294
  {
774
1295
  open: openModal,
775
1296
  onClose: closeModal,
@@ -777,7 +1298,7 @@ function OnHoldDialog({
777
1298
  sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
778
1299
  children: [
779
1300
  /* @__PURE__ */ jsxs(
780
- Box$1,
1301
+ Box,
781
1302
  {
782
1303
  sx: {
783
1304
  display: "flex",
@@ -790,7 +1311,7 @@ function OnHoldDialog({
790
1311
  ]
791
1312
  }
792
1313
  ),
793
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
1314
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
794
1315
  TextField,
795
1316
  {
796
1317
  fullWidth: true,
@@ -804,7 +1325,7 @@ function OnHoldDialog({
804
1325
  }
805
1326
  ) }) }) }) }),
806
1327
  /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
807
- Box$1,
1328
+ Box,
808
1329
  {
809
1330
  sx: {
810
1331
  display: "flex",
@@ -868,239 +1389,308 @@ function OnHoldDialog({
868
1389
  ] });
869
1390
  }
870
1391
  var OnHoldDialog_default = OnHoldDialog;
871
- var CONNECTOR = {
872
- horizontal: {
873
- thickness: 3,
874
- lengthExtra: 0,
875
- offsetReverseExtra: 30,
876
- color: "#2C35FF"
877
- },
878
- vertical: {
879
- thickness: 3,
880
- height: 60,
881
- color: "#2C35FF"
882
- }
1392
+ var useDebounce = (value, delay) => {
1393
+ const [debouncedValue, setDebouncedValue] = useState(value);
1394
+ useEffect(() => {
1395
+ const timeoutId = setTimeout(() => {
1396
+ setDebouncedValue(value);
1397
+ }, delay);
1398
+ return () => clearTimeout(timeoutId);
1399
+ }, [value, delay]);
1400
+ return debouncedValue;
883
1401
  };
884
- var CARD_WIDTH = 200;
885
- var CARD_HEIGHT = 220;
886
- var GAP = 65;
887
- var ROW_GAP = 60;
888
- var CustomCard = styled(Card)(
889
- ({ theme, cardType }) => ({
890
- width: CARD_WIDTH,
891
- height: CARD_HEIGHT,
892
- borderRadius: 16,
893
- backgroundColor: cardType === "subCard" ? "#FFF2D8 !important" : cardType === "disableCard" ? "#ECECEC !important" : "#F1F1FF !important",
894
- border: cardType === "disableCard" ? "none" : `1px solid ${theme.palette.primary.dark}`,
895
- overflow: "hidden",
896
- position: "relative"
897
- })
898
- );
899
- var Bull = ({ count, cardType }) => {
900
- const theme = useTheme();
901
- return /* @__PURE__ */ jsx(
902
- Box$1,
1402
+ var useDebounce_default = useDebounce;
1403
+ var SearchBox = ({
1404
+ placeHolderTitle,
1405
+ searchText,
1406
+ handleClearSearch,
1407
+ handleInputChange
1408
+ }) => {
1409
+ return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx(
1410
+ TextField,
903
1411
  {
1412
+ size: "small",
1413
+ variant: "outlined",
1414
+ value: searchText,
1415
+ onChange: handleInputChange,
1416
+ placeholder: placeHolderTitle,
1417
+ autoComplete: "off",
1418
+ className: "custom-search",
904
1419
  sx: {
905
- width: 40,
906
- height: 40,
907
- display: "flex",
908
- justifyContent: "center",
909
- alignItems: "center",
910
- borderRadius: "50%",
911
- background: "#fff",
912
- border: cardType === "disableCard" ? `2px solid ${theme.palette.grey[400]}` : `2px solid ${theme.palette.primary.dark}`,
913
- color: cardType === "disableCard" ? theme.palette.grey[700] : theme.palette.primary.dark,
914
- fontWeight: 600,
915
- fontSize: 16
1420
+ "& .MuiOutlinedInput-root": {
1421
+ height: "38px",
1422
+ borderRadius: "20px"
1423
+ }
916
1424
  },
917
- children: count
1425
+ InputProps: {
1426
+ startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx("span", { className: "icon-search-normal-1" }) }),
1427
+ endAdornment: searchText ? /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(
1428
+ IconButton,
1429
+ {
1430
+ disableFocusRipple: true,
1431
+ disableRipple: true,
1432
+ disableTouchRipple: true,
1433
+ onClick: handleClearSearch,
1434
+ children: /* @__PURE__ */ jsx("span", { className: "icon-close-circle" })
1435
+ }
1436
+ ) }) : null
1437
+ }
918
1438
  }
919
- );
1439
+ ) });
920
1440
  };
921
- function CustomTimelineWithStatus({ events }) {
922
- useTheme();
923
- const rows = [];
924
- for (let i = 0; i < events.length; i += 4) rows.push(events.slice(i, i + 4));
925
- const computeColumn = (index) => {
926
- const row = Math.floor(index / 4);
927
- const pos = index % 4;
928
- return row % 2 === 0 ? pos : 3 - pos;
1441
+ var SearchBox_default = SearchBox;
1442
+ var StyledDialog = styled(Dialog)(({ theme }) => ({
1443
+ "& .MuiDialog-paper": {
1444
+ borderRadius: "16px",
1445
+ boxShadow: "0px 2px 16px 0px rgba(0,0,0,0.16)",
1446
+ padding: "24px",
1447
+ maxWidth: "640px",
1448
+ width: "100%"
1449
+ }
1450
+ }));
1451
+ var FilterSection = styled(Box)({
1452
+ border: "1px solid rgba(146,144,144,0.3)",
1453
+ borderRadius: "12px",
1454
+ padding: "18px",
1455
+ display: "flex",
1456
+ flexDirection: "column",
1457
+ gap: "22px"
1458
+ });
1459
+ var StyledTextField = styled(TextField)({
1460
+ "& .MuiOutlinedInput-root": {
1461
+ borderRadius: "4px",
1462
+ "& fieldset": {
1463
+ borderColor: "#a3a3a3"
1464
+ }
1465
+ },
1466
+ "& .MuiInputLabel-root": {
1467
+ fontSize: "12px",
1468
+ color: "#666",
1469
+ fontFamily: '"Graphik Web:Regular", sans-serif'
1470
+ },
1471
+ "& .MuiSelect-select": {
1472
+ fontSize: "16px",
1473
+ color: "#666",
1474
+ fontFamily: '"Graphik Web:Regular", sans-serif',
1475
+ textTransform: "capitalize"
1476
+ },
1477
+ "& .MuiSelect-icon": {
1478
+ color: "#666"
1479
+ }
1480
+ });
1481
+ function FilterModal({
1482
+ open,
1483
+ onClose,
1484
+ initialFilters,
1485
+ onApply
1486
+ }) {
1487
+ const { api } = useWorkflowContext();
1488
+ const [approvalType, setApprovalType] = useState(
1489
+ (initialFilters == null ? void 0 : initialFilters.approvalType) || ""
1490
+ );
1491
+ const [approvalStatus, setApprovalStatus] = useState(
1492
+ (initialFilters == null ? void 0 : initialFilters.approvalStatus) || ""
1493
+ );
1494
+ const [sortBy, setSortBy] = useState((initialFilters == null ? void 0 : initialFilters.sortBy) || "");
1495
+ const [approvalTypeOptions, setApprovalTypeOptions] = useState([]);
1496
+ useEffect(() => {
1497
+ api.get({ url: "/workflow/activities?page=1&size=1000", serviceURL: "api" }).then((res) => {
1498
+ var _a;
1499
+ console.log("\u{1F680} ~ FilterModal ~ res:", res);
1500
+ setApprovalTypeOptions(((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || []);
1501
+ }).catch((err) => {
1502
+ console.error("Failed to fetch approval types:", err);
1503
+ });
1504
+ }, [api]);
1505
+ useEffect(() => {
1506
+ if (open) {
1507
+ setApprovalType((initialFilters == null ? void 0 : initialFilters.approvalType) || "");
1508
+ setApprovalStatus((initialFilters == null ? void 0 : initialFilters.approvalStatus) || "");
1509
+ setSortBy((initialFilters == null ? void 0 : initialFilters.sortBy) || "");
1510
+ }
1511
+ }, [open, initialFilters]);
1512
+ const handleClear = () => {
1513
+ setApprovalType("");
1514
+ setApprovalStatus("");
1515
+ setSortBy("");
929
1516
  };
930
- const hasNextCard = (i) => i + 1 < events.length;
931
- const getHorizontalY = (rowIndex) => {
932
- const centerY = CARD_HEIGHT / 2 - CONNECTOR.horizontal.thickness / 2;
933
- return rowIndex % 2 === 0 ? centerY : centerY + CONNECTOR.horizontal.offsetReverseExtra;
1517
+ const handleApply = () => {
1518
+ if (onApply) {
1519
+ onApply({ approvalType, approvalStatus, sortBy });
1520
+ }
1521
+ onClose();
934
1522
  };
935
- const isVerticalNeeded = (index) => (index + 1) % 4 === 0 && hasNextCard(index);
936
- return /* @__PURE__ */ jsx(Box$1, { sx: { width: "100%", overflowX: "auto", p: 1 }, children: /* @__PURE__ */ jsx(
937
- Box$1,
938
- {
939
- sx: {
940
- position: "relative",
941
- display: "grid",
942
- gridTemplateColumns: `repeat(4, ${CARD_WIDTH}px)`,
943
- columnGap: `${GAP}px`,
944
- rowGap: `${ROW_GAP}px`,
945
- width: "max-content"
946
- },
947
- children: events.map((event, index) => {
948
- const row = Math.floor(index / 4);
949
- const col = computeColumn(index);
950
- const isLast = index % 4 === 3;
951
- return /* @__PURE__ */ jsxs(
952
- Box$1,
953
- {
954
- sx: {
955
- gridColumn: col + 1,
956
- gridRow: row + 1,
957
- position: "relative"
958
- },
959
- children: [
960
- !isLast && hasNextCard(index) && /* @__PURE__ */ jsx(
961
- Box$1,
962
- {
963
- sx: {
964
- position: "absolute",
965
- top: getHorizontalY(row),
966
- left: row % 2 === 0 ? CARD_WIDTH : "auto",
967
- right: row % 2 !== 0 ? CARD_WIDTH : "auto",
968
- width: GAP + CONNECTOR.horizontal.lengthExtra,
969
- borderTop: `${CONNECTOR.horizontal.thickness}px dashed ${CONNECTOR.horizontal.color}`,
970
- zIndex: 10
971
- }
972
- }
973
- ),
974
- isVerticalNeeded(index) && /* @__PURE__ */ jsx(
975
- Box$1,
976
- {
977
- sx: {
978
- position: "absolute",
979
- top: CARD_HEIGHT,
980
- left: CARD_WIDTH / 2 - CONNECTOR.vertical.thickness / 2,
981
- width: CONNECTOR.vertical.thickness,
982
- height: CONNECTOR.vertical.height,
983
- borderLeft: `${CONNECTOR.vertical.thickness}px dashed ${CONNECTOR.vertical.color}`,
984
- zIndex: 10
985
- }
1523
+ return /* @__PURE__ */ jsx(StyledDialog, { open, onClose, children: /* @__PURE__ */ jsxs(Box, { children: [
1524
+ /* @__PURE__ */ jsxs(
1525
+ Box,
1526
+ {
1527
+ sx: {
1528
+ display: "flex",
1529
+ justifyContent: "space-between",
1530
+ alignItems: "center",
1531
+ mb: 3
1532
+ },
1533
+ children: [
1534
+ /* @__PURE__ */ jsx(
1535
+ Typography,
1536
+ {
1537
+ sx: {
1538
+ fontSize: "20px",
1539
+ color: "#666",
1540
+ fontFamily: '"Graphik Web:Medium", sans-serif',
1541
+ textTransform: "capitalize"
1542
+ },
1543
+ children: "Filter"
1544
+ }
1545
+ ),
1546
+ /* @__PURE__ */ jsx(Box, { sx: { display: "flex", gap: "12px" }, children: /* @__PURE__ */ jsx(
1547
+ Button,
1548
+ {
1549
+ onClick: handleClear,
1550
+ sx: {
1551
+ color: "#666",
1552
+ textTransform: "capitalize",
1553
+ fontSize: "14px",
1554
+ fontFamily: '"Graphik Web:Medium", sans-serif',
1555
+ borderRadius: "100px",
1556
+ height: "40px",
1557
+ "&:hover": {
1558
+ backgroundColor: "rgba(0,0,0,0.04)"
986
1559
  }
987
- ),
988
- /* @__PURE__ */ jsx(CustomCard, { cardType: event.cardType, children: /* @__PURE__ */ jsxs(CardContent, { sx: { px: 2, pt: 2, pb: 1 }, children: [
989
- /* @__PURE__ */ jsxs(
990
- Box$1,
991
- {
992
- sx: {
993
- mb: 1,
994
- display: "flex",
995
- justifyContent: "space-between",
996
- alignItems: "center",
997
- height: 28
998
- },
999
- children: [
1000
- /* @__PURE__ */ jsx(Typography, { variant: "body2", children: event.date }),
1001
- event.status && /* @__PURE__ */ jsx(
1002
- Chip,
1003
- {
1004
- label: event.status.title,
1005
- sx: {
1006
- backgroundColor: `${event.status.color} !important`,
1007
- color: `${event.status.labelColor} !important`,
1008
- borderRadius: "40px",
1009
- height: 28,
1010
- fontWeight: 600,
1011
- px: 1
1012
- }
1013
- }
1014
- )
1015
- ]
1016
- }
1017
- ),
1018
- /* @__PURE__ */ jsx(Bull, { count: event.count, cardType: event.cardType }),
1019
- /* @__PURE__ */ jsx(
1020
- Typography,
1021
- {
1022
- variant: "subtitle2",
1023
- sx: { mt: 2, fontWeight: 600 },
1024
- children: event.title
1025
- }
1026
- ),
1027
- /* @__PURE__ */ jsx(Typography, { sx: { mb: 1 }, variant: "body2", children: event.subTitle }),
1028
- event.attachment && /* @__PURE__ */ jsx(
1029
- Typography,
1030
- {
1031
- sx: {
1032
- cursor: "pointer",
1033
- color: "#0B56CA",
1034
- fontWeight: 600
1035
- },
1036
- children: "Attachment"
1037
- }
1038
- ),
1039
- /* @__PURE__ */ jsx(
1040
- Typography,
1041
- {
1042
- variant: "body2",
1043
- sx: {
1044
- position: "absolute",
1045
- bottom: 12,
1046
- left: 14,
1047
- color: "#777"
1048
- },
1049
- children: event.time
1050
- }
1051
- )
1052
- ] }) })
1053
- ]
1560
+ },
1561
+ children: "Clear Filter"
1562
+ }
1563
+ ) })
1564
+ ]
1565
+ }
1566
+ ),
1567
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: "24px" }, children: [
1568
+ /* @__PURE__ */ jsx(FilterSection, { children: /* @__PURE__ */ jsx(
1569
+ StyledTextField,
1570
+ {
1571
+ select: true,
1572
+ label: "Approval Type",
1573
+ value: approvalType,
1574
+ onChange: (e) => setApprovalType(e.target.value),
1575
+ fullWidth: true,
1576
+ SelectProps: {
1577
+ IconComponent: KeyboardArrowDownIcon
1054
1578
  },
1055
- index
1056
- );
1057
- })
1058
- }
1059
- ) });
1579
+ children: approvalTypeOptions.length && (approvalTypeOptions == null ? void 0 : approvalTypeOptions.map((option) => /* @__PURE__ */ jsx(MenuItem, { value: option.id, children: option.activity_name }, option.id)))
1580
+ }
1581
+ ) }),
1582
+ /* @__PURE__ */ jsx(FilterSection, { children: /* @__PURE__ */ jsxs(
1583
+ StyledTextField,
1584
+ {
1585
+ select: true,
1586
+ label: "Sort By",
1587
+ value: sortBy,
1588
+ onChange: (e) => setSortBy(e.target.value),
1589
+ fullWidth: true,
1590
+ SelectProps: {
1591
+ IconComponent: KeyboardArrowDownIcon
1592
+ },
1593
+ children: [
1594
+ /* @__PURE__ */ jsx(MenuItem, { value: "asc", children: "Ascending" }),
1595
+ /* @__PURE__ */ jsx(MenuItem, { value: "desc", children: "Descending" })
1596
+ ]
1597
+ }
1598
+ ) })
1599
+ ] }),
1600
+ /* @__PURE__ */ jsxs(
1601
+ Box,
1602
+ {
1603
+ sx: {
1604
+ display: "flex",
1605
+ justifyContent: "flex-end",
1606
+ gap: "10px",
1607
+ mt: 3,
1608
+ pt: "10px"
1609
+ },
1610
+ children: [
1611
+ /* @__PURE__ */ jsx(
1612
+ Button,
1613
+ {
1614
+ onClick: onClose,
1615
+ variant: "outlined",
1616
+ sx: {
1617
+ color: "#666",
1618
+ borderColor: "#666",
1619
+ textTransform: "capitalize",
1620
+ fontSize: "14px",
1621
+ fontFamily: '"Graphik Web:Medium", sans-serif',
1622
+ borderRadius: "100px",
1623
+ height: "40px",
1624
+ px: "24px",
1625
+ "&:hover": {
1626
+ borderColor: "#666",
1627
+ backgroundColor: "rgba(0,0,0,0.04)"
1628
+ }
1629
+ },
1630
+ children: "Cancel"
1631
+ }
1632
+ ),
1633
+ /* @__PURE__ */ jsx(
1634
+ Button,
1635
+ {
1636
+ onClick: handleApply,
1637
+ variant: "contained",
1638
+ sx: {
1639
+ backgroundColor: "#3f41d1",
1640
+ color: "white",
1641
+ textTransform: "capitalize",
1642
+ fontSize: "14px",
1643
+ fontFamily: '"Graphik Web:Medium", sans-serif',
1644
+ borderRadius: "100px",
1645
+ height: "40px",
1646
+ px: "24px",
1647
+ "&:hover": {
1648
+ backgroundColor: "#2f31b1"
1649
+ }
1650
+ },
1651
+ children: "Apply"
1652
+ }
1653
+ )
1654
+ ]
1655
+ }
1656
+ )
1657
+ ] }) });
1060
1658
  }
1061
- var useDebounce = (value, delay) => {
1062
- const [debouncedValue, setDebouncedValue] = useState(value);
1063
- useEffect(() => {
1064
- const timeoutId = setTimeout(() => {
1065
- setDebouncedValue(value);
1066
- }, delay);
1067
- return () => clearTimeout(timeoutId);
1068
- }, [value, delay]);
1069
- return debouncedValue;
1070
- };
1071
- var useDebounce_default = useDebounce;
1072
- var SearchBox = ({
1073
- placeHolderTitle,
1074
- searchText,
1075
- handleClearSearch,
1076
- handleInputChange
1077
- }) => {
1078
- return /* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx(
1079
- TextField,
1659
+ function FilterButton({ onClick }) {
1660
+ return /* @__PURE__ */ jsx(
1661
+ Button,
1080
1662
  {
1081
- variant: "outlined",
1082
- value: searchText,
1083
- onChange: handleInputChange,
1084
- placeholder: placeHolderTitle,
1085
- autoComplete: "off",
1086
- className: "custom-search",
1087
- InputProps: {
1088
- startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx("span", { className: "icon-search-normal-1" }) }),
1089
- endAdornment: searchText ? /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(
1090
- IconButton,
1091
- {
1092
- disableFocusRipple: true,
1093
- disableRipple: true,
1094
- disableTouchRipple: true,
1095
- onClick: handleClearSearch,
1096
- children: /* @__PURE__ */ jsx("span", { className: "icon-close-circle" })
1097
- }
1098
- ) }) : null
1099
- }
1663
+ onClick,
1664
+ variant: "contained",
1665
+ startIcon: /* @__PURE__ */ jsx(FilterAlt, { sx: { fontSize: "18px" } }),
1666
+ sx: {
1667
+ backgroundColor: "#f4f0ef !important",
1668
+ color: "#666 !important",
1669
+ fontFamily: "Poppins, sans-serif",
1670
+ fontWeight: 500,
1671
+ fontSize: "14px",
1672
+ letterSpacing: "0.1px",
1673
+ textTransform: "none",
1674
+ borderRadius: "100px",
1675
+ height: "40px",
1676
+ paddingLeft: "16px",
1677
+ paddingRight: "24px",
1678
+ paddingTop: "10px",
1679
+ paddingBottom: "10px",
1680
+ gap: "8px",
1681
+ boxShadow: "none",
1682
+ "&:hover": {
1683
+ backgroundColor: "#ebe7e6 !important",
1684
+ boxShadow: "none"
1685
+ },
1686
+ "&:active": {
1687
+ boxShadow: "none"
1688
+ }
1689
+ },
1690
+ children: "Filter"
1100
1691
  }
1101
- ) });
1102
- };
1103
- var SearchBox_default = SearchBox;
1692
+ );
1693
+ }
1104
1694
  var StyledChipProps = styled$1(Chip)(({ theme }) => {
1105
1695
  var _a, _b, _c;
1106
1696
  return {
@@ -1134,11 +1724,11 @@ function ApprovalWorkflow({
1134
1724
  selectedWorkflowsList = [],
1135
1725
  userInfo
1136
1726
  }) {
1137
- var _a, _b, _c, _d, _e, _f, _g;
1727
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
1138
1728
  useTheme$1();
1139
1729
  const { api, urlBuilder, loadingComponent, ENV_VARIABLES } = useWorkflowContext();
1140
- const [selectedApprovalOtions, setSelectedApprovalOtions] = useState(
1141
- selectedWorkflowsList.length ? "selected" : "Action Required"
1730
+ const [selectedOption, setSelectedOption] = useState(
1731
+ selectedWorkflowsList.length ? "selected" : "Assign To Me"
1142
1732
  );
1143
1733
  const [expandedId, setExpandedId] = useState(null);
1144
1734
  const [sendDialog, setSendDialog] = React7.useState(null);
@@ -1147,80 +1737,112 @@ function ApprovalWorkflow({
1147
1737
  const [onHoldTarget, setOnHoldTarget] = React7.useState(null);
1148
1738
  const [expandedDetails, setExpandedDetails] = useState([]);
1149
1739
  console.log("\u{1F680} ~ ApprovalWorkflow ~ expandedDetails:", expandedDetails);
1740
+ const [descriptionView, setDescriptionView] = useState(null);
1150
1741
  const [urlConfig, setUrlConfig] = useState({});
1151
- const [allRequestArray, setAllRequestArray] = useState([]);
1152
- const [pendingRequestArray, setPendingRequestArray] = useState([]);
1153
- const [selectedRequestArray, setSelectedRequestArray] = useState([]);
1154
- const [isLoading, setIsLoading] = useState(false);
1155
- const [visibleAll, setVisibleAll] = useState(10);
1156
- const [visiblePending, setVisiblePending] = useState(10);
1157
- const [visibleSelected, setVisibleSelected] = useState(10);
1742
+ const [viewMoreDetails, setViewMoreDetails] = useState(null);
1743
+ const [isViewMoreOpen, setIsViewMoreOpen] = useState(false);
1744
+ const [isFilterOpen, setIsFilterOpen] = useState(false);
1745
+ const handleOpenViewMore = (details) => {
1746
+ setViewMoreDetails(details);
1747
+ setIsViewMoreOpen(true);
1748
+ };
1749
+ const handleCloseViewMore = () => {
1750
+ setIsViewMoreOpen(false);
1751
+ setViewMoreDetails(null);
1752
+ };
1753
+ const [tabs, setTabs] = useState({
1754
+ "Assign To Me": {
1755
+ data: [],
1756
+ page: 1,
1757
+ search: "",
1758
+ hasMore: true,
1759
+ loading: false,
1760
+ initialized: false,
1761
+ filters: null
1762
+ },
1763
+ "All Requests": {
1764
+ data: [],
1765
+ page: 1,
1766
+ search: "",
1767
+ hasMore: true,
1768
+ loading: false,
1769
+ initialized: false,
1770
+ filters: null
1771
+ },
1772
+ Completed: {
1773
+ data: [],
1774
+ page: 1,
1775
+ search: "",
1776
+ hasMore: true,
1777
+ loading: false,
1778
+ initialized: false,
1779
+ filters: null
1780
+ },
1781
+ selected: {
1782
+ data: [],
1783
+ page: 1,
1784
+ search: "",
1785
+ hasMore: true,
1786
+ loading: false,
1787
+ initialized: false,
1788
+ filters: null
1789
+ }
1790
+ });
1791
+ console.log("\u{1F680} ~ ApprovalWorkflow ~ tabs:", tabs);
1158
1792
  const [searchText, setSearchText] = useState("");
1793
+ const debouncedSearchTerm = useDebounce_default(searchText, 500);
1794
+ useEffect(() => {
1795
+ var _a2;
1796
+ setSearchText(((_a2 = tabs[selectedOption]) == null ? void 0 : _a2.search) || "");
1797
+ }, [selectedOption]);
1798
+ useEffect(() => {
1799
+ var _a2, _b2;
1800
+ if (debouncedSearchTerm !== tabs[selectedOption].search && ((_a2 = tabs[selectedOption]) == null ? void 0 : _a2.initialized)) {
1801
+ setTabs((prev) => ({
1802
+ ...prev,
1803
+ [selectedOption]: {
1804
+ ...prev[selectedOption],
1805
+ search: debouncedSearchTerm,
1806
+ page: 1,
1807
+ hasMore: true,
1808
+ data: []
1809
+ // Clear data on new search
1810
+ }
1811
+ }));
1812
+ fetchData(
1813
+ selectedOption,
1814
+ 1,
1815
+ debouncedSearchTerm,
1816
+ (_b2 = tabs[selectedOption]) == null ? void 0 : _b2.filters
1817
+ );
1818
+ }
1819
+ }, [debouncedSearchTerm]);
1159
1820
  const handleClearSearch = useCallback(() => {
1160
1821
  setSearchText("");
1161
1822
  }, []);
1162
1823
  const handleSearchChange = useCallback((value) => {
1163
1824
  setSearchText(value);
1164
1825
  }, []);
1165
- const debouncedSearchTerm = useDebounce_default(searchText, 500);
1166
- const filteredSelectedRequestArray = React7.useMemo(() => {
1167
- if (!debouncedSearchTerm) return selectedRequestArray;
1168
- const q = debouncedSearchTerm.toLowerCase();
1169
- return selectedRequestArray == null ? void 0 : selectedRequestArray.filter((item) => {
1170
- const name = ((item == null ? void 0 : item.activity_name) || "").toString().toLowerCase();
1171
- const desc = ((item == null ? void 0 : item.description_data) || "").toString().toLowerCase();
1172
- return name.includes(q) || desc.includes(q);
1173
- });
1174
- }, [selectedRequestArray, debouncedSearchTerm]);
1175
- const filteredAllRequestArray = React7.useMemo(() => {
1176
- if (!debouncedSearchTerm) return allRequestArray;
1177
- const q = debouncedSearchTerm.toLowerCase();
1178
- return allRequestArray == null ? void 0 : allRequestArray.filter((item) => {
1179
- const name = ((item == null ? void 0 : item.activity_name) || "").toString().toLowerCase();
1180
- const desc = ((item == null ? void 0 : item.description_data) || "").toString().toLowerCase();
1181
- return name.includes(q) || desc.includes(q);
1182
- });
1183
- }, [allRequestArray, debouncedSearchTerm]);
1184
- const filteredPendingRequestArray = React7.useMemo(() => {
1185
- if (!debouncedSearchTerm) return pendingRequestArray;
1186
- const q = debouncedSearchTerm.toLowerCase();
1187
- return pendingRequestArray == null ? void 0 : pendingRequestArray.filter((item) => {
1188
- const name = ((item == null ? void 0 : item.activity_name) || "").toString().toLowerCase();
1189
- const desc = ((item == null ? void 0 : item.description_data) || "").toString().toLowerCase();
1190
- return name.includes(q) || desc.includes(q);
1191
- });
1192
- }, [pendingRequestArray, debouncedSearchTerm]);
1193
1826
  const observer = React7.useRef(null);
1194
1827
  const lastCardRef = useCallback(
1195
1828
  (node) => {
1196
- if (isLoading) return;
1829
+ const currentTab = tabs[selectedOption];
1830
+ if ((currentTab == null ? void 0 : currentTab.loading) || !(currentTab == null ? void 0 : currentTab.hasMore)) return;
1197
1831
  if (observer.current) observer.current.disconnect();
1198
1832
  observer.current = new IntersectionObserver((entries) => {
1199
1833
  if (entries[0].isIntersecting) {
1200
- if (selectedApprovalOtions === "All Requests") {
1201
- setVisibleAll((prev) => prev + 10);
1202
- } else if (selectedApprovalOtions === "Action Required") {
1203
- setVisiblePending((prev) => prev + 10);
1204
- } else if (selectedApprovalOtions === "selected") {
1205
- setVisibleSelected((prev) => prev + 10);
1206
- }
1834
+ setTabs((prev) => ({
1835
+ ...prev,
1836
+ [selectedOption]: {
1837
+ ...prev[selectedOption],
1838
+ page: prev[selectedOption].page + 1
1839
+ }
1840
+ }));
1207
1841
  }
1208
1842
  });
1209
1843
  if (node) observer.current.observe(node);
1210
1844
  },
1211
- [isLoading, selectedApprovalOtions]
1212
- );
1213
- const visibleAllRequests = (filteredAllRequestArray || []).slice(
1214
- 0,
1215
- visibleAll
1216
- );
1217
- const visiblePendingRequests = (filteredPendingRequestArray || []).slice(
1218
- 0,
1219
- visiblePending
1220
- );
1221
- const visibleSelectedRequests = (filteredSelectedRequestArray || []).slice(
1222
- 0,
1223
- visibleSelected
1845
+ [tabs, selectedOption]
1224
1846
  );
1225
1847
  const handleSendBack = (workflowLogId) => {
1226
1848
  setSendDialog(workflowLogId);
@@ -1234,11 +1856,108 @@ function ApprovalWorkflow({
1234
1856
  const handleOnHold = (workflowLogId) => {
1235
1857
  setOnHoldTarget(workflowLogId);
1236
1858
  };
1859
+ const handleApplyFilter = (filters) => {
1860
+ setTabs((prev) => ({
1861
+ ...prev,
1862
+ [selectedOption]: {
1863
+ ...prev[selectedOption],
1864
+ filters,
1865
+ page: 1,
1866
+ hasMore: true,
1867
+ data: []
1868
+ }
1869
+ }));
1870
+ setIsFilterOpen(false);
1871
+ fetchData(selectedOption, 1, tabs[selectedOption].search, filters);
1872
+ };
1873
+ const fetchData = useCallback(
1874
+ (tab, page, search, filtersOverride) => {
1875
+ var _a2, _b2;
1876
+ if (!((_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id)) return;
1877
+ const currentFilters = filtersOverride || ((_b2 = tabs[tab]) == null ? void 0 : _b2.filters);
1878
+ console.log("\u{1F680} ~ ApprovalWorkflow ~ currentFilters:", currentFilters);
1879
+ let filterQuery = "";
1880
+ if (currentFilters) {
1881
+ if (currentFilters.approvalType)
1882
+ filterQuery += `&activityId=${encodeURIComponent(
1883
+ currentFilters.approvalType
1884
+ )}`;
1885
+ if (currentFilters.approvalStatus)
1886
+ filterQuery += `&approval_status=${encodeURIComponent(
1887
+ currentFilters.approvalStatus
1888
+ )}`;
1889
+ if (currentFilters.sortBy)
1890
+ filterQuery += `&tat=${encodeURIComponent(currentFilters.sortBy)}`;
1891
+ }
1892
+ let url = "";
1893
+ const query = `paginate=${true}&page=${page}&size=10&search=${encodeURIComponent(
1894
+ search
1895
+ )}${filterQuery}`;
1896
+ if (tab === "Assign To Me") {
1897
+ url = `/workflow/activity-workflow/${userInfo.userInfo.id}?${query}&type=pending`;
1898
+ } else if (tab === "All Requests") {
1899
+ url = `/workflow/activity-workflow/${userInfo.userInfo.id}?${query}`;
1900
+ } else if (tab === "Completed") {
1901
+ url = `/workflow/activity-workflow/${userInfo.userInfo.id}?${query}&type=completed`;
1902
+ } else if (tab === "selected") {
1903
+ if (selectedWorkflowsList.length && !tabs["selected"].initialized) {
1904
+ api.post({
1905
+ url: `/workflow/bulk-details`,
1906
+ serviceURL: "api",
1907
+ data: { workflowIds: selectedWorkflowsList }
1908
+ }).then((res) => {
1909
+ setTabs((prev) => ({
1910
+ ...prev,
1911
+ selected: {
1912
+ ...prev.selected,
1913
+ data: (res == null ? void 0 : res.data) || [],
1914
+ loading: false,
1915
+ initialized: true,
1916
+ hasMore: false
1917
+ // No pagination for selected for now
1918
+ }
1919
+ }));
1920
+ });
1921
+ }
1922
+ return;
1923
+ }
1924
+ if (!url) return;
1925
+ setTabs((prev) => ({
1926
+ ...prev,
1927
+ [tab]: { ...prev[tab], loading: true }
1928
+ }));
1929
+ api.get({ url, serviceURL: "api" }).then((res) => {
1930
+ var _a3;
1931
+ const newItems = ((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.activities) || [];
1932
+ setTabs((prev) => {
1933
+ var _a4;
1934
+ return {
1935
+ ...prev,
1936
+ [tab]: {
1937
+ ...prev[tab],
1938
+ data: page === 1 ? newItems : [...prev[tab].data, ...newItems],
1939
+ count: (_a4 = res == null ? void 0 : res.data) == null ? void 0 : _a4.totalCount,
1940
+ loading: false,
1941
+ hasMore: newItems.length === 10,
1942
+ initialized: true
1943
+ }
1944
+ };
1945
+ });
1946
+ }).catch(() => {
1947
+ setTabs((prev) => ({
1948
+ ...prev,
1949
+ [tab]: { ...prev[tab], loading: false }
1950
+ }));
1951
+ });
1952
+ },
1953
+ [api, userInfo, selectedWorkflowsList, tabs]
1954
+ );
1237
1955
  const handleProfileToggle = (option) => {
1238
- setSelectedApprovalOtions(option);
1239
- if (option === "Action Required") fetchPendingActivities();
1240
- if (option === "All Requests") fetchAllActivites();
1241
- if (option === "selected") fetchSelectedActivites();
1956
+ var _a2, _b2;
1957
+ setSelectedOption(option);
1958
+ if (!((_a2 = tabs[option]) == null ? void 0 : _a2.initialized)) {
1959
+ fetchData(option, 1, ((_b2 = tabs[option]) == null ? void 0 : _b2.search) || "");
1960
+ }
1242
1961
  };
1243
1962
  const handleExpandClick = (id) => {
1244
1963
  setExpandedId((prevId) => prevId === id ? null : id);
@@ -1286,14 +2005,19 @@ function ApprovalWorkflow({
1286
2005
  };
1287
2006
  const approvalChipLabel = [
1288
2007
  {
1289
- label: "Action Required",
2008
+ label: "Assign To Me",
1290
2009
  icon: /* @__PURE__ */ jsx("span", { className: "icon-document-forward" }),
1291
- count: pendingRequestArray ? pendingRequestArray.length : 0
2010
+ count: ((_a = tabs["Assign To Me"]) == null ? void 0 : _a.count) || 0
1292
2011
  },
1293
2012
  {
1294
2013
  label: "All Requests",
1295
2014
  icon: /* @__PURE__ */ jsx("span", { className: "icon-document-copy" }),
1296
- count: allRequestArray ? allRequestArray.length : 0
2015
+ count: ((_b = tabs["All Requests"]) == null ? void 0 : _b.count) || 0
2016
+ },
2017
+ {
2018
+ label: "Completed",
2019
+ icon: /* @__PURE__ */ jsx("span", { className: "icon-tick-circle" }),
2020
+ count: ((_c = tabs["Completed"]) == null ? void 0 : _c.count) || 0
1297
2021
  }
1298
2022
  ];
1299
2023
  const fetchExpandedActivityLogs = (workflowLogId) => {
@@ -1303,62 +2027,28 @@ function ApprovalWorkflow({
1303
2027
  serviceURL: "api"
1304
2028
  }).then((res) => setExpandedDetails(res == null ? void 0 : res.data));
1305
2029
  };
1306
- const fetchPendingActivities = () => {
1307
- var _a2;
1308
- setIsLoading(true);
1309
- api.get({
1310
- url: `/workflow/activity-workflow/${(_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id}?paginate=false&type=pending`,
1311
- serviceURL: "api"
1312
- }).then((res) => {
1313
- var _a3;
1314
- return setPendingRequestArray((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.activities);
1315
- }).finally(() => setIsLoading(false));
1316
- };
1317
- const fetchAllActivites = () => {
1318
- var _a2;
1319
- setIsLoading(true);
1320
- api.get({
1321
- url: `/workflow/activity-workflow/${(_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id}?paginate=false`,
1322
- serviceURL: "api"
1323
- }).then((res) => {
1324
- var _a3;
1325
- return setAllRequestArray((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.activities);
1326
- }).finally(() => setIsLoading(false));
1327
- };
1328
- const fetchSelectedActivites = () => {
1329
- setIsLoading(true);
1330
- api.post({
1331
- url: `/workflow/bulk-details`,
1332
- serviceURL: "api",
1333
- data: { workflowIds: selectedWorkflowsList }
1334
- }).then((res) => setSelectedRequestArray(res == null ? void 0 : res.data)).finally(() => setIsLoading(false));
1335
- };
1336
2030
  useEffect(() => {
1337
- if (!sendDialog && !approveTarget && !onHoldTarget && !rejectTarget) {
1338
- fetchAllActivites();
1339
- fetchPendingActivities();
1340
- setExpandedDetails([]);
1341
- setExpandedId(null);
2031
+ var _a2;
2032
+ if ((_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id) {
2033
+ const tabsToFetch = ["Assign To Me", "All Requests", "Completed"];
2034
+ tabsToFetch.forEach((tab) => {
2035
+ var _a3;
2036
+ if (!((_a3 = tabs[tab]) == null ? void 0 : _a3.initialized)) {
2037
+ fetchData(tab, 1, "");
2038
+ }
2039
+ });
1342
2040
  }
1343
- }, [sendDialog, approveTarget, onHoldTarget, rejectTarget, userInfo]);
2041
+ }, [userInfo]);
1344
2042
  useEffect(() => {
1345
- api.get({ url: `/workflow/url-config`, serviceURL: "api" }).then((res) => {
1346
- const data = (res == null ? void 0 : res.data) || [];
1347
- const map = data.reduce((acc, { module_name, ...details }) => {
1348
- acc[module_name] = details;
1349
- return acc;
1350
- }, {});
1351
- setUrlConfig(map);
1352
- });
1353
- }, []);
1354
- useEffect(() => {
1355
- if (selectedWorkflowsList.length && !selectedRequestArray.length) {
1356
- fetchSelectedActivites();
2043
+ const tabState = tabs[selectedOption];
2044
+ if ((tabState == null ? void 0 : tabState.page) > 1) {
2045
+ fetchData(selectedOption, tabState.page, tabState.search);
1357
2046
  }
1358
- }, [selectedWorkflowsList]);
2047
+ }, [(_d = tabs[selectedOption]) == null ? void 0 : _d.page]);
1359
2048
  useEffect(() => {
1360
- if (Object.keys(urlConfig).length > 0 && userInfo) {
1361
- fetchPendingActivities();
2049
+ var _a2;
2050
+ if (Object.keys(urlConfig).length > 0 && userInfo && !tabs["Assign To Me"].initialized) {
2051
+ fetchData("Assign To Me", 1, ((_a2 = tabs["Assign To Me"]) == null ? void 0 : _a2.search) || "");
1362
2052
  }
1363
2053
  }, [urlConfig, userInfo]);
1364
2054
  const buildRedirectionUrl = (info) => {
@@ -1385,60 +2075,56 @@ function ApprovalWorkflow({
1385
2075
  }
1386
2076
  return "#";
1387
2077
  };
1388
- const StatusObj = {
1389
- approved: {
1390
- title: "Approved",
1391
- color: "#e6f7e9",
1392
- labelColor: "#389e49"
1393
- },
1394
- rejected: {
1395
- title: "Rejected",
1396
- color: "#fff1f0",
1397
- labelColor: "#f5222d"
1398
- },
1399
- onhold: {
1400
- title: "On Hold",
1401
- color: "#fff7e6",
1402
- labelColor: "#faad14"
1403
- },
1404
- sendback: {
1405
- title: "Send Back",
1406
- color: "#e6f7ff",
1407
- labelColor: "#1890ff"
1408
- }};
1409
- if (isLoading && loadingComponent) return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
2078
+ function timeLeftDHm(targetISO) {
2079
+ const diff = new Date(targetISO).getTime() - Date.now();
2080
+ if (diff <= 0) return "0d: 0h: 0m";
2081
+ const totalMinutes = Math.floor(diff / 6e4);
2082
+ const d = Math.floor(totalMinutes / 1440);
2083
+ const h = Math.floor(totalMinutes % 1440 / 60);
2084
+ const m = totalMinutes % 60;
2085
+ return `${d}d: ${h}h: ${m}m`;
2086
+ }
2087
+ if (((_e = tabs[selectedOption]) == null ? void 0 : _e.loading) && ((_f = tabs[selectedOption]) == null ? void 0 : _f.page) === 1 && loadingComponent)
2088
+ return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
1410
2089
  console.info("LIBRARY RUNNING...");
1411
2090
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1412
2091
  /* @__PURE__ */ jsx(
1413
- Box,
2092
+ Box$1,
1414
2093
  {
1415
2094
  sx: {
1416
2095
  display: "flex",
1417
2096
  justifyContent: "center",
1418
2097
  flexWrap: "nowrap",
2098
+ // width:"1100px",height:"90%",
1419
2099
  overflow: "hidden !important"
1420
2100
  },
1421
2101
  children: /* @__PURE__ */ jsxs(
1422
- Box,
2102
+ Box$1,
1423
2103
  {
1424
- sx: { width: "100%", height: "100%", overflow: "hidden !important" },
2104
+ sx: {
2105
+ width: "1141px",
2106
+ maxWidth: "1141px",
2107
+ minWidth: "1141px",
2108
+ height: "100%",
2109
+ overflow: "hidden !important"
2110
+ },
1425
2111
  children: [
1426
2112
  /* @__PURE__ */ jsxs(
1427
- Box,
2113
+ Box$1,
1428
2114
  {
1429
2115
  sx: {
1430
2116
  display: "flex",
1431
2117
  justifyContent: "space-between",
1432
- alignItems: "center"
2118
+ alignItems: "flex-start"
1433
2119
  },
1434
2120
  children: [
1435
- /* @__PURE__ */ jsxs(Box, { sx: { mt: 2, mb: 2 }, children: [
2121
+ /* @__PURE__ */ jsxs(Box$1, { children: [
1436
2122
  (selectedWorkflowsList == null ? void 0 : selectedWorkflowsList.length) ? /* @__PURE__ */ jsx(Tooltip, { title: "Selected Workflows", children: /* @__PURE__ */ jsx(
1437
2123
  StyledChipProps,
1438
2124
  {
1439
2125
  label: "Selected",
1440
2126
  icon: /* @__PURE__ */ jsx("span", { className: "icon-eye" }),
1441
- color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes("selected")) ? "primary" : "default",
2127
+ color: (selectedOption == null ? void 0 : selectedOption.includes("selected")) ? "primary" : "default",
1442
2128
  variant: "filled",
1443
2129
  sx: {
1444
2130
  mr: 4,
@@ -1453,7 +2139,7 @@ function ApprovalWorkflow({
1453
2139
  {
1454
2140
  label: `${count} ${label}`,
1455
2141
  icon,
1456
- color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes(label)) ? "primary" : "default",
2142
+ color: (selectedOption == null ? void 0 : selectedOption.includes(label)) ? "primary" : "default",
1457
2143
  variant: "filled",
1458
2144
  sx: {
1459
2145
  mr: 4,
@@ -1464,344 +2150,34 @@ function ApprovalWorkflow({
1464
2150
  }
1465
2151
  ) }, index))
1466
2152
  ] }),
1467
- /* @__PURE__ */ jsx(Box, { sx: { flexGrow: 1, maxWidth: 250, ml: "auto" }, children: /* @__PURE__ */ jsx(
1468
- SearchBox_default,
1469
- {
1470
- placeHolderTitle: "Search",
1471
- searchText,
1472
- handleClearSearch,
1473
- handleInputChange: (e) => handleSearchChange(e.target.value)
1474
- }
1475
- ) })
1476
- ]
1477
- }
1478
- ),
1479
- selectedApprovalOtions === "selected" && /* @__PURE__ */ jsx(
1480
- Box,
1481
- {
1482
- className: "fixedModal hide-scrollbar",
1483
- sx: {
1484
- overflowY: "auto",
1485
- height: "calc(100vh - 180px)",
1486
- px: 2,
1487
- pb: 3
1488
- },
1489
- children: visibleSelectedRequests.length > 0 ? visibleSelectedRequests == null ? void 0 : visibleSelectedRequests.map((info, index) => {
1490
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
1491
- const currentLevel = info == null ? void 0 : info.levels.find(
1492
- (level_) => level_.id === (info == null ? void 0 : info.current_level)
1493
- );
1494
- const statusList = currentLevel ? currentLevel.status_list : [];
1495
- (statusList || []).reduce(
1496
- (acc, s) => {
1497
- if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
1498
- return acc;
1499
- },
1500
- {}
1501
- );
1502
- const filterRejectForLevelZero = (statusList2, info2) => {
1503
- if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
1504
- return statusList2 == null ? void 0 : statusList2.filter((item) => item.status !== 3);
1505
- };
1506
- const redir = buildRedirectionUrl(info);
1507
- const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
1508
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1509
- )) == 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(
1510
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1511
- )) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
1512
- const statusData = getStatus(currentStatus);
1513
- return /* @__PURE__ */ jsxs(
1514
- Card,
1515
- {
1516
- ref: index === visibleSelectedRequests.length - 1 ? lastCardRef : null,
1517
- sx: {
1518
- mb: 3,
1519
- borderRadius: "14px",
1520
- boxShadow: "0px 2px 10px rgba(76, 78, 100, 0.1)",
1521
- px: 3,
1522
- py: 2,
1523
- background: "white !important"
1524
- },
1525
- children: [
1526
- /* @__PURE__ */ jsxs(
1527
- CardContent,
1528
- {
1529
- sx: {
1530
- display: "flex",
1531
- justifyContent: "space-between",
1532
- alignItems: "center",
1533
- flexWrap: { xs: "wrap", md: "nowrap" },
1534
- gap: 2
1535
- },
1536
- children: [
1537
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "22%", minWidth: 220 }, children: [
1538
- /* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(
1539
- Typography,
1540
- {
1541
- variant: "h6",
1542
- fontWeight: 600,
1543
- noWrap: true,
1544
- color: "text.primary",
1545
- children: info.activity_name
1546
- }
1547
- ) }),
1548
- /* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
1549
- Typography,
1550
- {
1551
- variant: "body2",
1552
- color: "text.secondary",
1553
- noWrap: true,
1554
- sx: { mt: 0.5 },
1555
- children: info.description_data
1556
- }
1557
- ) })
1558
- ] }),
1559
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "20%", minWidth: 180 }, children: [
1560
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
1561
- /* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx(
1562
- "a",
1563
- {
1564
- href: redir,
1565
- target: "_blank",
1566
- rel: "noreferrer",
1567
- style: {
1568
- cursor: "pointer",
1569
- textDecoration: "none"
1570
- },
1571
- children: /* @__PURE__ */ jsx(
1572
- Typography,
1573
- {
1574
- variant: "subtitle2",
1575
- color: "primary.dark",
1576
- sx: {
1577
- mt: 0.8,
1578
- lineHeight: "15.4px",
1579
- overflow: "hidden",
1580
- textOverflow: "ellipsis",
1581
- whiteSpace: "nowrap"
1582
- },
1583
- children: redir
1584
- }
1585
- )
1586
- }
1587
- ) })
1588
- ] }),
1589
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
1590
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
1591
- /* @__PURE__ */ jsx(
1592
- Typography,
1593
- {
1594
- variant: "body2",
1595
- noWrap: true,
1596
- sx: {
1597
- mt: 0.8,
1598
- color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1599
- },
1600
- children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1601
- }
1602
- )
1603
- ] }),
1604
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
1605
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
1606
- /* @__PURE__ */ jsx(
1607
- Typography,
1608
- {
1609
- variant: "body2",
1610
- sx: {
1611
- mt: 0.8,
1612
- fontWeight: 500,
1613
- color: "text.primary"
1614
- },
1615
- children: (currentLevel == null ? void 0 : currentLevel.tat_expiry) ? moment(currentLevel.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY hh:mm A") : "N/A"
1616
- }
1617
- )
1618
- ] }),
1619
- /* @__PURE__ */ jsxs(
1620
- Box,
1621
- {
1622
- sx: {
1623
- flexBasis: "8%",
1624
- minWidth: 80,
1625
- textAlign: "center"
1626
- },
1627
- children: [
1628
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1629
- /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.findIndex(
1630
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1631
- )) != null ? _j : -1) + 1 || "") })
1632
- ]
1633
- }
1634
- ),
1635
- /* @__PURE__ */ jsxs(
1636
- Box,
1637
- {
1638
- sx: {
1639
- flexBasis: "18%",
1640
- minWidth: 200,
1641
- display: "flex",
1642
- alignItems: "center",
1643
- justifyContent: "flex-end",
1644
- gap: 1.5
1645
- },
1646
- children: [
1647
- (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1648
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1649
- )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1650
- (lvl) => {
1651
- var _a3;
1652
- return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1653
- }
1654
- )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsx(
1655
- Statusselector_default,
1656
- {
1657
- onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
1658
- onApprove: () => {
1659
- var _a3;
1660
- return handleApprove(
1661
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
1662
- );
1663
- },
1664
- onReject: () => {
1665
- var _a3;
1666
- return handleReject(
1667
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
1668
- );
1669
- },
1670
- onHold: () => {
1671
- var _a3;
1672
- return handleOnHold(
1673
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
1674
- );
1675
- },
1676
- level: info == null ? void 0 : info.isLevelZero,
1677
- statusList: filterRejectForLevelZero(
1678
- statusList,
1679
- info
1680
- )
1681
- }
1682
- ) : /* @__PURE__ */ jsx(
1683
- Chip,
1684
- {
1685
- variant: "filled",
1686
- sx: {
1687
- backgroundColor: `${getStatus(currentStatus).color} !important`,
1688
- color: `${getStatus(currentStatus).labelColor} !important`,
1689
- height: "40px",
1690
- px: 2,
1691
- borderRadius: "100px !important",
1692
- "& .MuiChip-label": {
1693
- fontSize: "14px",
1694
- lineHeight: "15.4px",
1695
- fontWeight: "500",
1696
- textTransform: "capitalize"
1697
- }
1698
- },
1699
- label: statusData.title
1700
- }
1701
- ),
1702
- /* @__PURE__ */ jsx(
1703
- Divider,
1704
- {
1705
- orientation: "vertical",
1706
- flexItem: true,
1707
- sx: {
1708
- borderColor: "#E0E0E0",
1709
- height: "40px"
1710
- }
1711
- }
1712
- ),
1713
- /* @__PURE__ */ jsx(
1714
- IconButton,
1715
- {
1716
- disableFocusRipple: true,
1717
- disableRipple: true,
1718
- color: "primary",
1719
- sx: {
1720
- background: "rgba(25,118,210,0.08)",
1721
- boxShadow: "2px 2px 10px 0px #4C4E6426",
1722
- "& span": { color: "primary.dark" }
1723
- },
1724
- onClick: () => handleExpandClick(info._id),
1725
- children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
1726
- }
1727
- )
1728
- ]
1729
- }
1730
- )
1731
- ]
1732
- }
1733
- ),
1734
- expandedId === info._id && /* @__PURE__ */ jsx(Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(
1735
- Box,
2153
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex" }, children: [
2154
+ /* @__PURE__ */ jsx(
2155
+ Box$1,
2156
+ {
2157
+ sx: {
2158
+ flexGrow: 1,
2159
+ maxWidth: 295,
2160
+ ml: "auto",
2161
+ mr: "10px"
2162
+ },
2163
+ children: /* @__PURE__ */ jsx(
2164
+ SearchBox_default,
1736
2165
  {
1737
- sx: {
1738
- height: 150,
1739
- display: "flex",
1740
- justifyContent: "center",
1741
- alignItems: "center"
1742
- },
1743
- children: /* @__PURE__ */ jsx(CircularProgress, { size: 36, color: "primary" })
2166
+ placeHolderTitle: "Search",
2167
+ searchText,
2168
+ handleClearSearch,
2169
+ handleInputChange: (e) => handleSearchChange(e.target.value)
1744
2170
  }
1745
- ) : /* @__PURE__ */ jsxs("div", { children: [
1746
- /* @__PURE__ */ jsx(
1747
- CustomTimelineWithStatus,
1748
- {
1749
- events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
1750
- var _a3, _b3, _c3, _d3;
1751
- return {
1752
- date: moment(item == null ? void 0 : item.created_at).format(
1753
- "DD-MM-YYYY"
1754
- ),
1755
- time: moment(item == null ? void 0 : item.created_at).format(
1756
- "HH:mm"
1757
- ),
1758
- 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",
1759
- subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
1760
- attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
1761
- count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
1762
- cardType: "card",
1763
- status: (item == null ? void 0 : item.type) === "approve" ? StatusObj.approved : (item == null ? void 0 : item.type) === "reject" ? StatusObj.rejected : (item == null ? void 0 : item.type) === "send_back" ? StatusObj.sendback : (item == null ? void 0 : item.type) === "onhold" ? StatusObj.onhold : null
1764
- };
1765
- })
1766
- }
1767
- ),
1768
- /* @__PURE__ */ jsxs("div", { children: [
1769
- /* @__PURE__ */ jsx(Typography, { variant: "caption", children: /* @__PURE__ */ jsxs("span", { style: { fontWeight: "bold" }, children: [
1770
- "Currently Assigned to:",
1771
- " "
1772
- ] }) }),
1773
- /* @__PURE__ */ jsx(
1774
- Tooltip,
1775
- {
1776
- title: (info == null ? void 0 : info.isLevelZero) ? (_p = (_o = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _o.created_by_user) == null ? void 0 : _p.official_email_id : (_r = (_q = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _q.assigned_user) == null ? void 0 : _r.official_email_id,
1777
- children: /* @__PURE__ */ jsx(Typography, { variant: "caption", children: (info == null ? void 0 : info.isLevelZero) ? `${expandedDetails == null ? void 0 : expandedDetails[0].created_by_user.full_name} (${((_t = (_s = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _s.created_by_user) == null ? void 0 : _t.group_employee_code) || "N/A"})` : `${(_v = (_u = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _u.assigned_user) == null ? void 0 : _v.full_name} (${((_x = (_w = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _w.assigned_user) == null ? void 0 : _x.group_employee_code) || "N/A"})` })
1778
- }
1779
- )
1780
- ] })
1781
- ] }) })
1782
- ]
1783
- },
1784
- index
1785
- );
1786
- }) : /* @__PURE__ */ jsx(
1787
- "div",
1788
- {
1789
- style: {
1790
- height: "100%",
1791
- width: "100%",
1792
- color: "gray",
1793
- fontSize: "20px",
1794
- display: "flex",
1795
- justifyContent: "center",
1796
- alignItems: "center"
1797
- },
1798
- children: "NO RECORD FOUND"
1799
- }
1800
- )
2171
+ )
2172
+ }
2173
+ ),
2174
+ /* @__PURE__ */ jsx(FilterButton, { onClick: () => setIsFilterOpen((prev) => !prev) })
2175
+ ] })
2176
+ ]
1801
2177
  }
1802
2178
  ),
1803
- selectedApprovalOtions === "All Requests" && /* @__PURE__ */ jsx(
1804
- Box,
2179
+ /* @__PURE__ */ jsxs(
2180
+ Box$1,
1805
2181
  {
1806
2182
  className: "fixedModal hide-scrollbar",
1807
2183
  sx: {
@@ -1810,627 +2186,60 @@ function ApprovalWorkflow({
1810
2186
  px: 2,
1811
2187
  pb: 3
1812
2188
  },
1813
- children: visibleAllRequests.length > 0 ? visibleAllRequests == null ? void 0 : visibleAllRequests.map((info, index) => {
1814
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
1815
- if (!(info == null ? void 0 : info.isLevelZero)) {
1816
- console.log("\u{1F680} ~ ApprovalWorkflow ~ Zero:", info);
1817
- }
1818
- const currentLevel = info == null ? void 0 : info.levels.find(
1819
- (level_) => level_.id === (info == null ? void 0 : info.current_level)
1820
- );
1821
- const statusList = currentLevel ? currentLevel.status_list : [];
1822
- (statusList || []).reduce(
1823
- (acc, s) => {
1824
- if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
1825
- return acc;
1826
- },
1827
- {}
1828
- );
1829
- const filterRejectForLevelZero = (statusList2, info2) => {
1830
- if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
1831
- return statusList2 == null ? void 0 : statusList2.filter((item) => item.status !== 3);
1832
- };
1833
- const redir = buildRedirectionUrl(info);
1834
- const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
1835
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1836
- )) == 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(
1837
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1838
- )) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
1839
- const statusData = getStatus(currentStatus);
1840
- return /* @__PURE__ */ jsxs(
1841
- Card,
2189
+ children: [
2190
+ ((_g = tabs[selectedOption]) == null ? void 0 : _g.loading) && ((_h = tabs[selectedOption]) == null ? void 0 : _h.page) === 1 ? /* @__PURE__ */ jsx(
2191
+ Box$1,
1842
2192
  {
1843
- ref: index === visibleAllRequests.length - 1 ? lastCardRef : null,
1844
2193
  sx: {
1845
- mb: 3,
1846
- borderRadius: "14px",
1847
- boxShadow: "0px 2px 10px rgba(76, 78, 100, 0.1)",
1848
- px: 3,
1849
- py: 2,
1850
- background: "white !important"
2194
+ display: "flex",
2195
+ justifyContent: "center",
2196
+ alignItems: "center",
2197
+ height: "100%",
2198
+ p: 4,
2199
+ width: "1100px"
1851
2200
  },
1852
- children: [
1853
- /* @__PURE__ */ jsxs(
1854
- CardContent,
1855
- {
1856
- sx: {
1857
- display: "flex",
1858
- justifyContent: "space-between",
1859
- alignItems: "center",
1860
- flexWrap: { xs: "wrap", md: "nowrap" },
1861
- gap: 2
1862
- },
1863
- children: [
1864
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "20%", minWidth: 220 }, children: [
1865
- /* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(
1866
- Typography,
1867
- {
1868
- variant: "h6",
1869
- fontWeight: 600,
1870
- noWrap: true,
1871
- color: "text.primary",
1872
- children: info.activity_name
1873
- }
1874
- ) }),
1875
- /* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
1876
- Typography,
1877
- {
1878
- variant: "body2",
1879
- noWrap: true,
1880
- sx: { mt: 0.5, color: "text.secondary" },
1881
- children: info.description_data
1882
- }
1883
- ) })
1884
- ] }),
1885
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "18%", minWidth: 180 }, children: [
1886
- /* @__PURE__ */ jsx(
1887
- Typography,
1888
- {
1889
- variant: "caption",
1890
- color: "text.secondary",
1891
- sx: { display: "block" },
1892
- children: "Links"
1893
- }
1894
- ),
1895
- /* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx(
1896
- "a",
1897
- {
1898
- href: redir,
1899
- target: "_blank",
1900
- rel: "noreferrer",
1901
- style: {
1902
- cursor: "pointer",
1903
- textDecoration: "none"
1904
- },
1905
- children: /* @__PURE__ */ jsx(
1906
- Typography,
1907
- {
1908
- variant: "subtitle2",
1909
- color: "primary.dark",
1910
- sx: {
1911
- mt: 0.8,
1912
- lineHeight: "15.4px",
1913
- overflow: "hidden",
1914
- textOverflow: "ellipsis",
1915
- whiteSpace: "nowrap"
1916
- },
1917
- children: redir
1918
- }
1919
- )
1920
- }
1921
- ) })
1922
- ] }),
1923
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
1924
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
1925
- /* @__PURE__ */ jsx(
1926
- Typography,
1927
- {
1928
- variant: "body2",
1929
- noWrap: true,
1930
- sx: {
1931
- mt: 0.8,
1932
- color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
1933
- },
1934
- children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
1935
- }
1936
- )
1937
- ] }),
1938
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
1939
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
1940
- /* @__PURE__ */ jsx(
1941
- Typography,
1942
- {
1943
- variant: "body2",
1944
- sx: {
1945
- mt: 0.8,
1946
- fontWeight: 500,
1947
- color: "text.primary"
1948
- },
1949
- children: (currentLevel == null ? void 0 : currentLevel.tat_expiry) ? moment(currentLevel.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY hh:mm A") : "N/A"
1950
- }
1951
- )
1952
- ] }),
1953
- /* @__PURE__ */ jsxs(
1954
- Box,
1955
- {
1956
- sx: {
1957
- flexBasis: "8%",
1958
- minWidth: 80,
1959
- textAlign: "center"
1960
- },
1961
- children: [
1962
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
1963
- /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.findIndex(
1964
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1965
- )) != null ? _j : -1) + 1 || "") })
1966
- ]
1967
- }
1968
- ),
1969
- /* @__PURE__ */ jsxs(
1970
- Box,
1971
- {
1972
- sx: {
1973
- flexBasis: "18%",
1974
- minWidth: 200,
1975
- display: "flex",
1976
- alignItems: "center",
1977
- justifyContent: "flex-end",
1978
- gap: 1.5
1979
- },
1980
- children: [
1981
- (info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
1982
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
1983
- )) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
1984
- (lvl) => {
1985
- var _a3;
1986
- return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
1987
- }
1988
- )) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsx(
1989
- Statusselector_default,
1990
- {
1991
- onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
1992
- onApprove: () => {
1993
- var _a3;
1994
- return handleApprove(
1995
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
1996
- );
1997
- },
1998
- onReject: () => {
1999
- var _a3;
2000
- return handleReject(
2001
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
2002
- );
2003
- },
2004
- onHold: () => {
2005
- var _a3;
2006
- return handleOnHold(
2007
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
2008
- );
2009
- },
2010
- level: info == null ? void 0 : info.isLevelZero,
2011
- statusList: filterRejectForLevelZero(
2012
- statusList,
2013
- info
2014
- )
2015
- }
2016
- ) : /* @__PURE__ */ jsx(
2017
- Chip,
2018
- {
2019
- variant: "filled",
2020
- sx: {
2021
- backgroundColor: `${getStatus(currentStatus).color} !important`,
2022
- color: `${getStatus(currentStatus).labelColor} !important`,
2023
- height: "40px",
2024
- px: 2,
2025
- borderRadius: "100px !important",
2026
- "& .MuiChip-label": {
2027
- fontSize: "14px",
2028
- lineHeight: "15.4px",
2029
- fontWeight: "500",
2030
- textTransform: "capitalize"
2031
- }
2032
- },
2033
- label: statusData.title
2034
- }
2035
- ),
2036
- /* @__PURE__ */ jsx(
2037
- Divider,
2038
- {
2039
- orientation: "vertical",
2040
- flexItem: true,
2041
- sx: {
2042
- borderColor: "#E0E0E0",
2043
- height: "40px"
2044
- }
2045
- }
2046
- ),
2047
- /* @__PURE__ */ jsx(
2048
- IconButton,
2049
- {
2050
- disableFocusRipple: true,
2051
- disableRipple: true,
2052
- color: "primary",
2053
- sx: {
2054
- background: "rgba(25,118,210,0.08)",
2055
- boxShadow: "2px 2px 10px 0px #4C4E6426",
2056
- "& span": { color: "primary.dark" }
2057
- },
2058
- onClick: () => handleExpandClick(info._id),
2059
- children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
2060
- }
2061
- )
2062
- ]
2063
- }
2064
- )
2065
- ]
2066
- }
2067
- ),
2068
- expandedId === info._id && /* @__PURE__ */ jsx(Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(
2069
- Box,
2070
- {
2071
- sx: {
2072
- height: 150,
2073
- display: "flex",
2074
- justifyContent: "center",
2075
- alignItems: "center"
2076
- },
2077
- children: /* @__PURE__ */ jsx(CircularProgress, { size: 36, color: "primary" })
2078
- }
2079
- ) : /* @__PURE__ */ jsxs("div", { children: [
2080
- /* @__PURE__ */ jsx(
2081
- CustomTimelineWithStatus,
2082
- {
2083
- events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
2084
- var _a3, _b3, _c3, _d3;
2085
- return {
2086
- date: moment(item == null ? void 0 : item.created_at).format(
2087
- "DD-MM-YYYY"
2088
- ),
2089
- time: moment(item == null ? void 0 : item.created_at).format(
2090
- "HH:mm"
2091
- ),
2092
- 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",
2093
- subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
2094
- attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
2095
- count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
2096
- cardType: "card",
2097
- status: (item == null ? void 0 : item.type) === "approve" ? StatusObj.approved : (item == null ? void 0 : item.type) === "reject" ? StatusObj.rejected : (item == null ? void 0 : item.type) === "send_back" ? StatusObj.sendback : (item == null ? void 0 : item.type) === "onhold" ? StatusObj.onhold : null
2098
- };
2099
- })
2100
- }
2101
- ),
2102
- /* @__PURE__ */ jsxs("div", { children: [
2103
- /* @__PURE__ */ jsx(Typography, { variant: "caption", children: /* @__PURE__ */ jsxs("span", { style: { fontWeight: "bold" }, children: [
2104
- "Currently Assigned to:",
2105
- " "
2106
- ] }) }),
2107
- /* @__PURE__ */ jsx(
2108
- Tooltip,
2109
- {
2110
- title: (info == null ? void 0 : info.isLevelZero) ? (_p = (_o = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _o.created_by_user) == null ? void 0 : _p.official_email_id : (_r = (_q = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _q.assigned_user) == null ? void 0 : _r.official_email_id,
2111
- children: /* @__PURE__ */ jsx(Typography, { variant: "caption", children: (info == null ? void 0 : info.isLevelZero) ? `${expandedDetails == null ? void 0 : expandedDetails[0].created_by_user.full_name} (${((_t = (_s = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _s.created_by_user) == null ? void 0 : _t.group_employee_code) || "N/A"})` : `${(_v = (_u = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _u.assigned_user) == null ? void 0 : _v.full_name} (${((_x = (_w = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _w.assigned_user) == null ? void 0 : _x.group_employee_code) || "N/A"})` })
2112
- }
2113
- )
2114
- ] })
2115
- ] }) })
2116
- ]
2201
+ children: /* @__PURE__ */ jsx(CircularProgress, {})
2202
+ }
2203
+ ) : ((_j = (_i = tabs[selectedOption]) == null ? void 0 : _i.data) == null ? void 0 : _j.length) > 0 ? tabs[selectedOption].data.map((info, index) => /* @__PURE__ */ jsx(
2204
+ WorkflowRequestCard,
2205
+ {
2206
+ requestDetails: info,
2207
+ index,
2208
+ isLast: index === tabs[selectedOption].data.length - 1,
2209
+ lastCardRef,
2210
+ expandedId,
2211
+ handleExpandClick,
2212
+ handleOpenViewMore,
2213
+ handleApprove,
2214
+ handleReject,
2215
+ handleSendBack,
2216
+ handleOnHold,
2217
+ expandedDetails,
2218
+ userInfo,
2219
+ helpers: {
2220
+ timeLeftDHm,
2221
+ getStatus,
2222
+ buildRedirectionUrl
2223
+ }
2117
2224
  },
2118
2225
  index
2119
- );
2120
- }) : /* @__PURE__ */ jsx(
2121
- "div",
2122
- {
2123
- style: {
2124
- height: "100%",
2125
- width: "100%",
2126
- color: "gray",
2127
- fontSize: "20px",
2128
- display: "flex",
2129
- justifyContent: "center",
2130
- alignItems: "center"
2131
- },
2132
- children: "NO RECORD FOUND"
2133
- }
2134
- )
2135
- }
2136
- ),
2137
- selectedApprovalOtions === "Action Required" && /* @__PURE__ */ jsx(
2138
- Box,
2139
- {
2140
- className: "fixedModal hide-scrollbar",
2141
- sx: {
2142
- overflowY: "auto",
2143
- height: "calc(100vh - 180px)",
2144
- px: 2,
2145
- pb: 3
2146
- },
2147
- children: visiblePendingRequests.length > 0 ? visiblePendingRequests == null ? void 0 : visiblePendingRequests.map((info, index) => {
2148
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
2149
- const currentLevel = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
2150
- (level_) => level_.id === (info == null ? void 0 : info.current_level)
2151
- );
2152
- const statusList = currentLevel ? currentLevel.status_list : [];
2153
- const filterRejectForLevelZero = (statusList2, info2) => {
2154
- if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
2155
- return statusList2 == null ? void 0 : statusList2.filter((item) => item.status !== 3);
2156
- };
2157
- const redir = buildRedirectionUrl(info);
2158
- const currentStatus = ((_d2 = (_c2 = (_b2 = info == null ? void 0 : info.levels) == null ? void 0 : _b2.find(
2159
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
2160
- )) == 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(
2161
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
2162
- )) == null ? void 0 : _f2.selected_status) == null ? void 0 : _g2.status_id) === 3 ? "rejected" : "pending";
2163
- const statusData = getStatus(currentStatus);
2164
- return /* @__PURE__ */ jsxs(
2165
- Card,
2226
+ )) : /* @__PURE__ */ jsx(
2227
+ "div",
2166
2228
  {
2167
- ref: index === visiblePendingRequests.length - 1 ? lastCardRef : null,
2168
- sx: {
2169
- mb: 3,
2170
- borderRadius: "14px",
2171
- boxShadow: "0px 2px 10px rgba(76, 78, 100, 0.1)",
2172
- px: 3,
2173
- py: 2,
2174
- background: "white !important"
2229
+ style: {
2230
+ height: "100%",
2231
+ width: "1100px",
2232
+ color: "gray",
2233
+ fontSize: "20px",
2234
+ display: "flex",
2235
+ justifyContent: "center",
2236
+ alignItems: "center"
2175
2237
  },
2176
- children: [
2177
- /* @__PURE__ */ jsxs(
2178
- CardContent,
2179
- {
2180
- sx: {
2181
- display: "flex",
2182
- justifyContent: "space-between",
2183
- alignItems: "center",
2184
- flexWrap: { xs: "wrap", md: "nowrap" },
2185
- gap: 2
2186
- },
2187
- children: [
2188
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "20%", minWidth: 220 }, children: [
2189
- /* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(Typography, { variant: "h6", fontWeight: 600, noWrap: true, children: info.activity_name }) }),
2190
- /* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
2191
- Typography,
2192
- {
2193
- variant: "body2",
2194
- color: "text.secondary",
2195
- noWrap: true,
2196
- sx: { mt: 0.5 },
2197
- children: info.description_data
2198
- }
2199
- ) })
2200
- ] }),
2201
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "18%", minWidth: 180 }, children: [
2202
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
2203
- /* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx(
2204
- "a",
2205
- {
2206
- href: redir,
2207
- target: "_blank",
2208
- rel: "noreferrer",
2209
- style: {
2210
- cursor: "pointer",
2211
- textDecoration: "none"
2212
- },
2213
- children: /* @__PURE__ */ jsx(
2214
- Typography,
2215
- {
2216
- variant: "subtitle2",
2217
- color: "primary.dark",
2218
- sx: {
2219
- mt: 0.8,
2220
- lineHeight: "15.4px",
2221
- overflow: "hidden",
2222
- textOverflow: "ellipsis",
2223
- whiteSpace: "nowrap"
2224
- },
2225
- children: redir
2226
- }
2227
- )
2228
- }
2229
- ) })
2230
- ] }),
2231
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
2232
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
2233
- /* @__PURE__ */ jsx(
2234
- Typography,
2235
- {
2236
- variant: "body2",
2237
- noWrap: true,
2238
- sx: {
2239
- mt: 0.8,
2240
- color: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? "primary.dark" : "text.disabled"
2241
- },
2242
- children: ((_i = info == null ? void 0 : info.attachment_links) == null ? void 0 : _i.length) ? `${info.attachment_links.length} file(s)` : "N/A"
2243
- }
2244
- )
2245
- ] }),
2246
- /* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
2247
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
2248
- /* @__PURE__ */ jsx(
2249
- Typography,
2250
- {
2251
- variant: "body2",
2252
- sx: {
2253
- mt: 0.8,
2254
- fontWeight: 500,
2255
- color: "text.primary"
2256
- },
2257
- children: (currentLevel == null ? void 0 : currentLevel.tat_expiry) ? moment(currentLevel.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY hh:mm A") : "N/A"
2258
- }
2259
- )
2260
- ] }),
2261
- /* @__PURE__ */ jsxs(
2262
- Box,
2263
- {
2264
- sx: {
2265
- flexBasis: "8%",
2266
- minWidth: 80,
2267
- textAlign: "center"
2268
- },
2269
- children: [
2270
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
2271
- /* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_k = (_j = info == null ? void 0 : info.levels) == null ? void 0 : _j.findIndex(
2272
- (lvl) => lvl.id === (info == null ? void 0 : info.current_level)
2273
- )) != null ? _k : -1) + 1 || "") })
2274
- ]
2275
- }
2276
- ),
2277
- /* @__PURE__ */ jsxs(
2278
- Box,
2279
- {
2280
- sx: {
2281
- flexBasis: "18%",
2282
- minWidth: 200,
2283
- display: "flex",
2284
- alignItems: "center",
2285
- justifyContent: "flex-end",
2286
- gap: 1.5
2287
- },
2288
- children: [
2289
- (info == null ? void 0 : info.current_status) !== "completed" ? /* @__PURE__ */ jsx(
2290
- Statusselector_default,
2291
- {
2292
- onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
2293
- onApprove: () => {
2294
- var _a3;
2295
- return handleApprove(
2296
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
2297
- );
2298
- },
2299
- onReject: () => {
2300
- var _a3;
2301
- return handleReject(
2302
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
2303
- );
2304
- },
2305
- onHold: () => {
2306
- var _a3;
2307
- return handleOnHold(
2308
- `${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
2309
- );
2310
- },
2311
- level: info == null ? void 0 : info.isLevelZero,
2312
- statusList: filterRejectForLevelZero(
2313
- statusList,
2314
- info
2315
- )
2316
- }
2317
- ) : /* @__PURE__ */ jsx(
2318
- Chip,
2319
- {
2320
- variant: "filled",
2321
- sx: {
2322
- backgroundColor: statusData.color,
2323
- color: statusData.labelColor,
2324
- height: "40px",
2325
- px: 2,
2326
- borderRadius: "100px !important",
2327
- "& .MuiChip-label": {
2328
- fontSize: "14px",
2329
- lineHeight: "15.4px",
2330
- fontWeight: "500",
2331
- textTransform: "capitalize"
2332
- }
2333
- },
2334
- label: statusData.title
2335
- }
2336
- ),
2337
- /* @__PURE__ */ jsx(
2338
- Divider,
2339
- {
2340
- orientation: "vertical",
2341
- flexItem: true,
2342
- sx: {
2343
- borderColor: "#E0E0E0",
2344
- height: "40px"
2345
- }
2346
- }
2347
- ),
2348
- /* @__PURE__ */ jsx(
2349
- IconButton,
2350
- {
2351
- color: "primary",
2352
- sx: {
2353
- background: "rgba(25,118,210,0.08)",
2354
- boxShadow: "2px 2px 10px 0px #4C4E6426",
2355
- "& span": { color: "primary.dark" }
2356
- },
2357
- onClick: () => handleExpandClick(info._id),
2358
- children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
2359
- }
2360
- )
2361
- ]
2362
- }
2363
- )
2364
- ]
2365
- }
2366
- ),
2367
- expandedId === info._id && /* @__PURE__ */ jsx(Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(
2368
- Box,
2369
- {
2370
- sx: {
2371
- height: 150,
2372
- display: "flex",
2373
- justifyContent: "center",
2374
- alignItems: "center"
2375
- },
2376
- children: /* @__PURE__ */ jsx(CircularProgress, { size: 36, color: "primary" })
2377
- }
2378
- ) : /* @__PURE__ */ jsxs("div", { children: [
2379
- /* @__PURE__ */ jsx(
2380
- CustomTimelineWithStatus,
2381
- {
2382
- events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
2383
- var _a3, _b3, _c3, _d3;
2384
- return {
2385
- date: moment(item == null ? void 0 : item.created_at).format(
2386
- "DD-MM-YYYY"
2387
- ),
2388
- time: moment(item == null ? void 0 : item.created_at).format(
2389
- "HH:mm"
2390
- ),
2391
- 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",
2392
- subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
2393
- attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
2394
- count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
2395
- cardType: "card",
2396
- status: (item == null ? void 0 : item.type) === "approve" ? StatusObj.approved : (item == null ? void 0 : item.type) === "reject" ? StatusObj.rejected : (item == null ? void 0 : item.type) === "send_back" ? StatusObj.sendback : (item == null ? void 0 : item.type) === "onhold" ? StatusObj.onhold : null
2397
- };
2398
- })
2399
- }
2400
- ),
2401
- /* @__PURE__ */ jsxs("div", { children: [
2402
- /* @__PURE__ */ jsx(Typography, { variant: "caption", children: /* @__PURE__ */ jsxs("span", { style: { fontWeight: "bold" }, children: [
2403
- "Currently Assigned to:",
2404
- " "
2405
- ] }) }),
2406
- /* @__PURE__ */ jsx(
2407
- Tooltip,
2408
- {
2409
- title: (info == null ? void 0 : info.isLevelZero) ? (_m = (_l = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _l.created_by_user) == null ? void 0 : _m.official_email_id : (_o = (_n = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _n.assigned_user) == null ? void 0 : _o.official_email_id,
2410
- children: /* @__PURE__ */ jsx(Typography, { variant: "caption", children: (info == null ? void 0 : info.isLevelZero) ? `${expandedDetails == null ? void 0 : expandedDetails[0].created_by_user.full_name} (${((_q = (_p = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _p.created_by_user) == null ? void 0 : _q.group_employee_code) || "N/A"})` : `${(_s = (_r = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _r.assigned_user) == null ? void 0 : _s.full_name} (${((_u = (_t = expandedDetails == null ? void 0 : expandedDetails[0]) == null ? void 0 : _t.assigned_user) == null ? void 0 : _u.group_employee_code) || "N/A"})` })
2411
- }
2412
- )
2413
- ] })
2414
- ] }) })
2415
- ]
2416
- },
2417
- index
2418
- );
2419
- }) : /* @__PURE__ */ jsx(
2420
- "div",
2421
- {
2422
- style: {
2423
- height: "100%",
2424
- width: "100%",
2425
- color: "gray",
2426
- fontSize: "20px",
2427
- display: "flex",
2428
- justifyContent: "center",
2429
- alignItems: "center"
2430
- },
2431
- children: "NO RECORD FOUND"
2432
- }
2433
- )
2238
+ children: "NO RECORD FOUND"
2239
+ }
2240
+ ),
2241
+ ((_k = tabs[selectedOption]) == null ? void 0 : _k.loading) && ((_l = tabs[selectedOption]) == null ? void 0 : _l.page) > 1 && /* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", justifyContent: "center", p: 2 }, children: /* @__PURE__ */ jsx(CircularProgress, { size: 24 }) })
2242
+ ]
2434
2243
  }
2435
2244
  )
2436
2245
  ]
@@ -2453,8 +2262,8 @@ function ApprovalWorkflow({
2453
2262
  openModal: !!approveTarget,
2454
2263
  closeModal: () => setApproveTarget(null),
2455
2264
  header: "Approve",
2456
- workflowLogId: (_a = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _a[0],
2457
- statusId: (_b = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _b[1]
2265
+ workflowLogId: (_m = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _m[0],
2266
+ statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1]
2458
2267
  }
2459
2268
  ),
2460
2269
  /* @__PURE__ */ jsx(
@@ -2463,9 +2272,9 @@ function ApprovalWorkflow({
2463
2272
  openModal: !!rejectTarget,
2464
2273
  closeModal: () => setRejectTarget(null),
2465
2274
  header: "Reject",
2466
- workflowLogId: (_c = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _c[0],
2467
- statusId: (_d = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _d[1],
2468
- rejection_reason_master: (_e = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _e[2]
2275
+ workflowLogId: (_o = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _o[0],
2276
+ statusId: (_p = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _p[1],
2277
+ rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2]
2469
2278
  }
2470
2279
  ),
2471
2280
  /* @__PURE__ */ jsx(
@@ -2474,8 +2283,79 @@ function ApprovalWorkflow({
2474
2283
  openModal: !!onHoldTarget,
2475
2284
  closeModal: () => setOnHoldTarget(null),
2476
2285
  header: "On Hold",
2477
- workflowLogId: (_f = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _f[0],
2478
- statusId: (_g = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _g[1]
2286
+ workflowLogId: (_r = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _r[0],
2287
+ statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1]
2288
+ }
2289
+ ),
2290
+ /* @__PURE__ */ jsxs(
2291
+ Dialog,
2292
+ {
2293
+ open: isViewMoreOpen,
2294
+ onClose: handleCloseViewMore,
2295
+ maxWidth: "sm",
2296
+ fullWidth: true,
2297
+ PaperProps: {
2298
+ sx: {
2299
+ borderRadius: "16px",
2300
+ padding: "10px",
2301
+ position: "relative"
2302
+ // For absolute close button
2303
+ }
2304
+ },
2305
+ children: [
2306
+ /* @__PURE__ */ jsxs(
2307
+ DialogTitle,
2308
+ {
2309
+ sx: {
2310
+ display: "flex",
2311
+ justifyContent: "space-between",
2312
+ alignItems: "center",
2313
+ paddingBottom: "10px"
2314
+ },
2315
+ children: [
2316
+ /* @__PURE__ */ jsx(Typography, { variant: "h6", sx: { fontWeight: 600 }, children: "Description Details" }),
2317
+ /* @__PURE__ */ jsx(
2318
+ IconButton,
2319
+ {
2320
+ onClick: handleCloseViewMore,
2321
+ sx: {
2322
+ position: "absolute",
2323
+ right: 8,
2324
+ top: 8,
2325
+ color: (theme2) => theme2.palette.grey[500]
2326
+ },
2327
+ children: /* @__PURE__ */ jsx(CloseIcon, {})
2328
+ }
2329
+ )
2330
+ ]
2331
+ }
2332
+ ),
2333
+ /* @__PURE__ */ jsx(DialogContent$1, { dividers: true, sx: { borderTop: "none" }, children: /* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: viewMoreDetails == null ? void 0 : viewMoreDetails.map((data, idx) => /* @__PURE__ */ jsxs(
2334
+ Typography,
2335
+ {
2336
+ className: "detail-item",
2337
+ sx: { fontSize: "14px" },
2338
+ children: [
2339
+ /* @__PURE__ */ jsxs("span", { style: { fontWeight: "bold", color: "#666" }, children: [
2340
+ data[0].replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()),
2341
+ ":"
2342
+ ] }),
2343
+ " ",
2344
+ /* @__PURE__ */ jsx("span", { style: { color: "#000" }, children: data[1] })
2345
+ ]
2346
+ },
2347
+ idx
2348
+ )) }) })
2349
+ ]
2350
+ }
2351
+ ),
2352
+ /* @__PURE__ */ jsx(
2353
+ FilterModal,
2354
+ {
2355
+ open: isFilterOpen,
2356
+ onClose: () => setIsFilterOpen(false),
2357
+ initialFilters: (_t = tabs[selectedOption]) == null ? void 0 : _t.filters,
2358
+ onApply: handleApplyFilter
2479
2359
  }
2480
2360
  )
2481
2361
  ] });
@@ -2503,15 +2383,31 @@ function DialogOpener({
2503
2383
  return () => window.removeEventListener("resize", updateScreenWidth);
2504
2384
  }, []);
2505
2385
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
2506
- Dialog,
2386
+ Dialog$1,
2507
2387
  {
2508
- fullScreen: true,
2388
+ fullScreen: false,
2509
2389
  open: openDialog,
2510
2390
  onClose: () => handleClose && handleClose(),
2511
2391
  "aria-labelledby": "responsive-dialog-title",
2512
- sx: { zIndex: 1234 },
2392
+ maxWidth: "lg",
2393
+ sx: {
2394
+ "& .MuiDialog-container": {
2395
+ justifyContent: "flex-end",
2396
+ alignItems: "flex-start"
2397
+ },
2398
+ "& .MuiDialog-paper": {
2399
+ position: "fixed",
2400
+ right: 0,
2401
+ top: 0,
2402
+ height: "100vh",
2403
+ maxHeight: "100vh",
2404
+ margin: 0,
2405
+ borderRadius: 0
2406
+ }
2407
+ },
2513
2408
  children: [
2514
- /* @__PURE__ */ jsxs(DialogContent, { children: [
2409
+ /* @__PURE__ */ jsxs(DialogTitle, { children: [
2410
+ "Workflow",
2515
2411
  /* @__PURE__ */ jsx(
2516
2412
  IconButton,
2517
2413
  {
@@ -2521,26 +2417,32 @@ function DialogOpener({
2521
2417
  sx: { float: "right" },
2522
2418
  children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } })
2523
2419
  }
2524
- ),
2525
- /* @__PURE__ */ jsx(
2526
- ApprovalWorkflow,
2527
- {
2528
- userInfo: userInfoData,
2529
- selectedWorkflowsList
2530
- }
2531
2420
  )
2532
2421
  ] }),
2533
- /* @__PURE__ */ jsx(DialogActions5, { children: /* @__PURE__ */ jsx(
2534
- Button7,
2422
+ /* @__PURE__ */ jsx(
2423
+ DialogContent,
2535
2424
  {
2536
- variant: "contained",
2537
- color: "primary",
2538
2425
  sx: {
2539
- display: "flex",
2540
- justifyContent: "flex-end",
2541
- alignItems: "center"
2426
+ overflow: "hidden",
2427
+ width: "100%",
2428
+ height: "100%",
2429
+ padding: "0 20px"
2542
2430
  },
2431
+ children: /* @__PURE__ */ jsx(
2432
+ ApprovalWorkflow,
2433
+ {
2434
+ userInfo: userInfoData,
2435
+ selectedWorkflowsList
2436
+ }
2437
+ )
2438
+ }
2439
+ ),
2440
+ /* @__PURE__ */ jsx(DialogActions6, { children: /* @__PURE__ */ jsx(
2441
+ WorkflowButton_default,
2442
+ {
2443
+ variant: "approve",
2543
2444
  onClick: handleClose,
2445
+ className: "dialog-close-btn",
2544
2446
  children: "Close"
2545
2447
  }
2546
2448
  ) })