amp-workflow-ui 0.1.14 → 0.1.16

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,562 @@ 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
+ children: /* @__PURE__ */ jsxs(
451
+ Typography,
452
+ {
453
+ className: "assignee-text",
454
+ sx: { cursor: "pointer" },
455
+ children: [
456
+ /* @__PURE__ */ jsx("span", { className: "assignee-label", children: "Current Assignee:" }),
457
+ " ",
458
+ allAssignees.length > 0 ? `${allAssignees[0]} +${allAssignees.length - 1}` : allAssignees[0]
459
+ ]
460
+ }
461
+ )
462
+ }
463
+ ) : /* @__PURE__ */ jsxs(
464
+ Typography,
465
+ {
466
+ className: "assignee-text",
467
+ sx: { cursor: "pointer" },
468
+ children: [
469
+ /* @__PURE__ */ jsx("span", { className: "assignee-label", children: "Current Assignee:" }),
470
+ " ",
471
+ allAssignees[0]
472
+ ]
473
+ }
474
+ ) }) : extraCurrentlyAssignedUserCount > 0 || tatExpired && extraCurrentlyEscalatedUserCount > 0 ? /* @__PURE__ */ jsx(
475
+ Tooltip,
476
+ {
477
+ title: /* @__PURE__ */ jsx(
478
+ Box,
479
+ {
480
+ sx: {
481
+ backgroundColor: "#fff",
482
+ padding: "10px",
483
+ borderRadius: "5px"
484
+ },
485
+ children: (tatExpired ? currentlyEscaltedUserArray : currentlyAssignedUserArray).map((user, index2) => /* @__PURE__ */ jsx(
486
+ Typography,
487
+ {
488
+ className: "assignee-text",
489
+ variant: "body2",
490
+ children: user
491
+ },
492
+ index2
493
+ ))
494
+ }
495
+ ),
496
+ arrow: true,
497
+ placement: "top",
498
+ children: /* @__PURE__ */ jsxs(Typography, { className: "assignee-text", sx: { cursor: "pointer" }, children: [
499
+ /* @__PURE__ */ jsx("span", { className: "assignee-label", children: tatExpired ? "Escalated To:" : "Current Assignee:" }),
500
+ " ",
501
+ (tatExpired ? extraCurrentlyEscalatedUserCount : extraCurrentlyAssignedUserCount) > 0 ? `${tatExpired ? currentlyEscalatedUser : currentlyAssignedUser} +${tatExpired ? extraCurrentlyEscalatedUserCount : extraCurrentlyAssignedUserCount}` : tatExpired ? currentlyEscalatedUser : currentlyAssignedUser
502
+ ] })
503
+ }
504
+ ) : /* @__PURE__ */ jsxs(Typography, { className: "assignee-text", sx: { cursor: "pointer" }, children: [
505
+ /* @__PURE__ */ jsx("span", { className: "assignee-label", children: tatExpired ? "Escalated To:" : "Current Assignee:" }),
506
+ " ",
507
+ tatExpired ? currentlyEscalatedUser : currentlyAssignedUser
508
+ ] })
509
+ ] }),
510
+ (requestDetails == null ? void 0 : requestDetails.current_status) !== "completed" ? /* @__PURE__ */ jsxs(Box, { className: "action-buttons", children: [
511
+ filterRejectForLevelZero(statusList, requestDetails).find(
512
+ (list) => list.status == 3
513
+ ) && /* @__PURE__ */ jsx(
514
+ Button,
515
+ {
516
+ variant: "outlined",
517
+ className: "btn-reject",
518
+ onClick: () => {
519
+ var _a2;
520
+ return handleReject(
521
+ `${requestDetails == null ? void 0 : requestDetails._id}|${(_a2 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a2.id}|${requestDetails == null ? void 0 : requestDetails.reasons}`
522
+ );
523
+ },
524
+ children: "Reject"
525
+ }
526
+ ),
527
+ !(requestDetails == null ? void 0 : requestDetails.isLevelZero) && /* @__PURE__ */ jsx(
528
+ Button,
529
+ {
530
+ variant: "outlined",
531
+ className: "btn-send-back",
532
+ onClick: () => handleSendBack(requestDetails._id),
533
+ children: "Send Back"
534
+ }
535
+ ),
536
+ filterRejectForLevelZero(statusList, requestDetails).find(
537
+ (list) => list.status == 1
538
+ ) && /* @__PURE__ */ jsx(
539
+ Button,
540
+ {
541
+ variant: "contained",
542
+ className: "btn-approve",
543
+ onClick: () => {
544
+ var _a2;
545
+ return handleApprove(
546
+ `${requestDetails == null ? void 0 : requestDetails._id}|${(_a2 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a2.id}`
547
+ );
548
+ },
549
+ children: "Approve"
550
+ }
551
+ )
552
+ ] }) : /* @__PURE__ */ jsx(
553
+ WorkflowButton_default,
554
+ {
555
+ variant: currentStatus === "approved" ? "approved" : currentStatus === "rejected" ? "rejected" : "pending",
556
+ className: "dialog-close-btn",
557
+ children: currentStatus.toLocaleLowerCase()
558
+ }
559
+ )
560
+ ] }),
561
+ expandedId === requestDetails._id && /* @__PURE__ */ jsxs(Fragment, { children: [
562
+ /* @__PURE__ */ jsx("div", { className: "horizontal-divider" }),
563
+ /* @__PURE__ */ jsx(
564
+ WorkFlowTimeline,
565
+ {
566
+ events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
567
+ var _a2, _b2, _c2, _d2;
568
+ return {
569
+ date: moment(item == null ? void 0 : item.created_at).format("DD-MM-YYYY"),
570
+ time: moment(item == null ? void 0 : item.created_at).format("HH:mm"),
571
+ 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",
572
+ subTitle: ((_c2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c2.comment) || "No Comments",
573
+ attachment: ((_d2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d2.file) || null,
574
+ count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
575
+ 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",
576
+ type: item == null ? void 0 : item.type
577
+ };
578
+ })
579
+ }
580
+ )
581
+ ] })
582
+ ]
583
+ },
584
+ index
585
+ );
586
+ }
82
587
  function SendBackDialog({
83
588
  openModal,
84
589
  closeModal,
@@ -194,7 +699,7 @@ function SendBackDialog({
194
699
  };
195
700
  return /* @__PURE__ */ jsxs(Fragment, { children: [
196
701
  /* @__PURE__ */ jsxs(
197
- Dialog,
702
+ Dialog$1,
198
703
  {
199
704
  open: openModal,
200
705
  onClose: closeModal,
@@ -202,7 +707,7 @@ function SendBackDialog({
202
707
  sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
203
708
  children: [
204
709
  /* @__PURE__ */ jsxs(
205
- Box$1,
710
+ Box,
206
711
  {
207
712
  sx: {
208
713
  display: "flex",
@@ -215,7 +720,7 @@ function SendBackDialog({
215
720
  ]
216
721
  }
217
722
  ),
218
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
723
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
219
724
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
220
725
  TextField,
221
726
  {
@@ -265,7 +770,7 @@ function SendBackDialog({
265
770
  ] })
266
771
  ] }) }) }),
267
772
  /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
268
- Box$1,
773
+ Box,
269
774
  {
270
775
  sx: {
271
776
  display: "flex",
@@ -390,7 +895,7 @@ function ApproveDialog({
390
895
  };
391
896
  return /* @__PURE__ */ jsxs(Fragment, { children: [
392
897
  /* @__PURE__ */ jsxs(
393
- Dialog,
898
+ Dialog$1,
394
899
  {
395
900
  open: openModal,
396
901
  onClose: closeModal,
@@ -398,7 +903,7 @@ function ApproveDialog({
398
903
  sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
399
904
  children: [
400
905
  /* @__PURE__ */ jsxs(
401
- Box$1,
906
+ Box,
402
907
  {
403
908
  sx: {
404
909
  display: "flex",
@@ -411,7 +916,7 @@ function ApproveDialog({
411
916
  ]
412
917
  }
413
918
  ),
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(
919
+ /* @__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
920
  TextField,
416
921
  {
417
922
  fullWidth: true,
@@ -425,7 +930,7 @@ function ApproveDialog({
425
930
  }
426
931
  ) }) }) }) }),
427
932
  /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
428
- Box$1,
933
+ Box,
429
934
  {
430
935
  sx: {
431
936
  display: "flex",
@@ -591,7 +1096,7 @@ function RejectDialog({
591
1096
  };
592
1097
  return /* @__PURE__ */ jsxs(Fragment, { children: [
593
1098
  /* @__PURE__ */ jsxs(
594
- Dialog,
1099
+ Dialog$1,
595
1100
  {
596
1101
  open: openModal,
597
1102
  onClose: closeModal,
@@ -599,7 +1104,7 @@ function RejectDialog({
599
1104
  sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
600
1105
  children: [
601
1106
  /* @__PURE__ */ jsxs(
602
- Box$1,
1107
+ Box,
603
1108
  {
604
1109
  sx: {
605
1110
  display: "flex",
@@ -612,7 +1117,7 @@ function RejectDialog({
612
1117
  ]
613
1118
  }
614
1119
  ),
615
- /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
1120
+ /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
616
1121
  /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, required: true, error: !!error.reason, children: [
617
1122
  /* @__PURE__ */ jsx(InputLabel, { required: true, id: "reject-reason-label", children: "Reject Reasons" }),
618
1123
  /* @__PURE__ */ jsx(
@@ -644,7 +1149,7 @@ function RejectDialog({
644
1149
  ) })
645
1150
  ] }) }) }),
646
1151
  /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
647
- Box$1,
1152
+ Box,
648
1153
  {
649
1154
  sx: {
650
1155
  display: "flex",
@@ -769,7 +1274,7 @@ function OnHoldDialog({
769
1274
  };
770
1275
  return /* @__PURE__ */ jsxs(Fragment, { children: [
771
1276
  /* @__PURE__ */ jsxs(
772
- Dialog,
1277
+ Dialog$1,
773
1278
  {
774
1279
  open: openModal,
775
1280
  onClose: closeModal,
@@ -777,7 +1282,7 @@ function OnHoldDialog({
777
1282
  sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
778
1283
  children: [
779
1284
  /* @__PURE__ */ jsxs(
780
- Box$1,
1285
+ Box,
781
1286
  {
782
1287
  sx: {
783
1288
  display: "flex",
@@ -790,7 +1295,7 @@ function OnHoldDialog({
790
1295
  ]
791
1296
  }
792
1297
  ),
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(
1298
+ /* @__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
1299
  TextField,
795
1300
  {
796
1301
  fullWidth: true,
@@ -804,7 +1309,7 @@ function OnHoldDialog({
804
1309
  }
805
1310
  ) }) }) }) }),
806
1311
  /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(
807
- Box$1,
1312
+ Box,
808
1313
  {
809
1314
  sx: {
810
1315
  display: "flex",
@@ -868,239 +1373,302 @@ function OnHoldDialog({
868
1373
  ] });
869
1374
  }
870
1375
  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
- }
1376
+ var useDebounce = (value, delay) => {
1377
+ const [debouncedValue, setDebouncedValue] = useState(value);
1378
+ useEffect(() => {
1379
+ const timeoutId = setTimeout(() => {
1380
+ setDebouncedValue(value);
1381
+ }, delay);
1382
+ return () => clearTimeout(timeoutId);
1383
+ }, [value, delay]);
1384
+ return debouncedValue;
883
1385
  };
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,
1386
+ var useDebounce_default = useDebounce;
1387
+ var SearchBox = ({
1388
+ placeHolderTitle,
1389
+ searchText,
1390
+ handleClearSearch,
1391
+ handleInputChange
1392
+ }) => {
1393
+ return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx(
1394
+ TextField,
903
1395
  {
904
- 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
916
- },
917
- children: count
1396
+ size: "small",
1397
+ variant: "outlined",
1398
+ value: searchText,
1399
+ onChange: handleInputChange,
1400
+ placeholder: placeHolderTitle,
1401
+ autoComplete: "off",
1402
+ className: "custom-search",
1403
+ InputProps: {
1404
+ startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx("span", { className: "icon-search-normal-1" }) }),
1405
+ endAdornment: searchText ? /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(
1406
+ IconButton,
1407
+ {
1408
+ disableFocusRipple: true,
1409
+ disableRipple: true,
1410
+ disableTouchRipple: true,
1411
+ onClick: handleClearSearch,
1412
+ children: /* @__PURE__ */ jsx("span", { className: "icon-close-circle" })
1413
+ }
1414
+ ) }) : null
1415
+ }
918
1416
  }
919
- );
1417
+ ) });
920
1418
  };
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;
1419
+ var SearchBox_default = SearchBox;
1420
+ var StyledDialog = styled(Dialog)(({ theme }) => ({
1421
+ "& .MuiDialog-paper": {
1422
+ borderRadius: "16px",
1423
+ boxShadow: "0px 2px 16px 0px rgba(0,0,0,0.16)",
1424
+ padding: "24px",
1425
+ maxWidth: "640px",
1426
+ width: "100%"
1427
+ }
1428
+ }));
1429
+ var FilterSection = styled(Box)({
1430
+ border: "1px solid rgba(146,144,144,0.3)",
1431
+ borderRadius: "12px",
1432
+ padding: "18px",
1433
+ display: "flex",
1434
+ flexDirection: "column",
1435
+ gap: "22px"
1436
+ });
1437
+ var StyledTextField = styled(TextField)({
1438
+ "& .MuiOutlinedInput-root": {
1439
+ borderRadius: "4px",
1440
+ "& fieldset": {
1441
+ borderColor: "#a3a3a3"
1442
+ }
1443
+ },
1444
+ "& .MuiInputLabel-root": {
1445
+ fontSize: "12px",
1446
+ color: "#666",
1447
+ fontFamily: '"Graphik Web:Regular", sans-serif'
1448
+ },
1449
+ "& .MuiSelect-select": {
1450
+ fontSize: "16px",
1451
+ color: "#666",
1452
+ fontFamily: '"Graphik Web:Regular", sans-serif',
1453
+ textTransform: "capitalize"
1454
+ },
1455
+ "& .MuiSelect-icon": {
1456
+ color: "#666"
1457
+ }
1458
+ });
1459
+ function FilterModal({
1460
+ open,
1461
+ onClose,
1462
+ initialFilters,
1463
+ onApply
1464
+ }) {
1465
+ const { api } = useWorkflowContext();
1466
+ const [approvalType, setApprovalType] = useState(
1467
+ (initialFilters == null ? void 0 : initialFilters.approvalType) || ""
1468
+ );
1469
+ const [approvalStatus, setApprovalStatus] = useState(
1470
+ (initialFilters == null ? void 0 : initialFilters.approvalStatus) || ""
1471
+ );
1472
+ const [sortBy, setSortBy] = useState((initialFilters == null ? void 0 : initialFilters.sortBy) || "");
1473
+ const [approvalTypeOptions, setApprovalTypeOptions] = useState([]);
1474
+ useEffect(() => {
1475
+ api.get({ url: "/workflow/activities?page=1&size=1000", serviceURL: "api" }).then((res) => {
1476
+ var _a;
1477
+ console.log("\u{1F680} ~ FilterModal ~ res:", res);
1478
+ setApprovalTypeOptions(((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || []);
1479
+ }).catch((err) => {
1480
+ console.error("Failed to fetch approval types:", err);
1481
+ });
1482
+ }, [api]);
1483
+ useEffect(() => {
1484
+ if (open) {
1485
+ setApprovalType((initialFilters == null ? void 0 : initialFilters.approvalType) || "");
1486
+ setApprovalStatus((initialFilters == null ? void 0 : initialFilters.approvalStatus) || "");
1487
+ setSortBy((initialFilters == null ? void 0 : initialFilters.sortBy) || "");
1488
+ }
1489
+ }, [open, initialFilters]);
1490
+ const handleClear = () => {
1491
+ setApprovalType("");
1492
+ setApprovalStatus("");
1493
+ setSortBy("");
929
1494
  };
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;
1495
+ const handleApply = () => {
1496
+ if (onApply) {
1497
+ onApply({ approvalType, approvalStatus, sortBy });
1498
+ }
1499
+ onClose();
934
1500
  };
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
- }
1501
+ return /* @__PURE__ */ jsx(StyledDialog, { open, onClose, children: /* @__PURE__ */ jsxs(Box, { children: [
1502
+ /* @__PURE__ */ jsxs(
1503
+ Box,
1504
+ {
1505
+ sx: {
1506
+ display: "flex",
1507
+ justifyContent: "space-between",
1508
+ alignItems: "center",
1509
+ mb: 3
1510
+ },
1511
+ children: [
1512
+ /* @__PURE__ */ jsx(
1513
+ Typography,
1514
+ {
1515
+ sx: {
1516
+ fontSize: "20px",
1517
+ color: "#666",
1518
+ fontFamily: '"Graphik Web:Medium", sans-serif',
1519
+ textTransform: "capitalize"
1520
+ },
1521
+ children: "Filter"
1522
+ }
1523
+ ),
1524
+ /* @__PURE__ */ jsx(Box, { sx: { display: "flex", gap: "12px" }, children: /* @__PURE__ */ jsx(
1525
+ Button,
1526
+ {
1527
+ onClick: handleClear,
1528
+ sx: {
1529
+ color: "#666",
1530
+ textTransform: "capitalize",
1531
+ fontSize: "14px",
1532
+ fontFamily: '"Graphik Web:Medium", sans-serif',
1533
+ borderRadius: "100px",
1534
+ height: "40px",
1535
+ "&:hover": {
1536
+ backgroundColor: "rgba(0,0,0,0.04)"
986
1537
  }
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
- ]
1538
+ },
1539
+ children: "Clear Filter"
1540
+ }
1541
+ ) })
1542
+ ]
1543
+ }
1544
+ ),
1545
+ /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: "24px" }, children: [
1546
+ /* @__PURE__ */ jsx(FilterSection, { children: /* @__PURE__ */ jsx(
1547
+ StyledTextField,
1548
+ {
1549
+ select: true,
1550
+ label: "Approval Type",
1551
+ value: approvalType,
1552
+ onChange: (e) => setApprovalType(e.target.value),
1553
+ fullWidth: true,
1554
+ SelectProps: {
1555
+ IconComponent: KeyboardArrowDownIcon
1054
1556
  },
1055
- index
1056
- );
1057
- })
1058
- }
1059
- ) });
1557
+ children: approvalTypeOptions.length && (approvalTypeOptions == null ? void 0 : approvalTypeOptions.map((option) => /* @__PURE__ */ jsx(MenuItem, { value: option.id, children: option.activity_name }, option.id)))
1558
+ }
1559
+ ) }),
1560
+ /* @__PURE__ */ jsx(FilterSection, { children: /* @__PURE__ */ jsxs(
1561
+ StyledTextField,
1562
+ {
1563
+ select: true,
1564
+ label: "Sort By",
1565
+ value: sortBy,
1566
+ onChange: (e) => setSortBy(e.target.value),
1567
+ fullWidth: true,
1568
+ SelectProps: {
1569
+ IconComponent: KeyboardArrowDownIcon
1570
+ },
1571
+ children: [
1572
+ /* @__PURE__ */ jsx(MenuItem, { value: "asc", children: "Ascending" }),
1573
+ /* @__PURE__ */ jsx(MenuItem, { value: "desc", children: "Descending" })
1574
+ ]
1575
+ }
1576
+ ) })
1577
+ ] }),
1578
+ /* @__PURE__ */ jsxs(
1579
+ Box,
1580
+ {
1581
+ sx: {
1582
+ display: "flex",
1583
+ justifyContent: "flex-end",
1584
+ gap: "10px",
1585
+ mt: 3,
1586
+ pt: "10px"
1587
+ },
1588
+ children: [
1589
+ /* @__PURE__ */ jsx(
1590
+ Button,
1591
+ {
1592
+ onClick: onClose,
1593
+ variant: "outlined",
1594
+ sx: {
1595
+ color: "#666",
1596
+ borderColor: "#666",
1597
+ textTransform: "capitalize",
1598
+ fontSize: "14px",
1599
+ fontFamily: '"Graphik Web:Medium", sans-serif',
1600
+ borderRadius: "100px",
1601
+ height: "40px",
1602
+ px: "24px",
1603
+ "&:hover": {
1604
+ borderColor: "#666",
1605
+ backgroundColor: "rgba(0,0,0,0.04)"
1606
+ }
1607
+ },
1608
+ children: "Cancel"
1609
+ }
1610
+ ),
1611
+ /* @__PURE__ */ jsx(
1612
+ Button,
1613
+ {
1614
+ onClick: handleApply,
1615
+ variant: "contained",
1616
+ sx: {
1617
+ backgroundColor: "#3f41d1",
1618
+ color: "white",
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
+ backgroundColor: "#2f31b1"
1627
+ }
1628
+ },
1629
+ children: "Apply"
1630
+ }
1631
+ )
1632
+ ]
1633
+ }
1634
+ )
1635
+ ] }) });
1060
1636
  }
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,
1637
+ function FilterButton({ onClick }) {
1638
+ return /* @__PURE__ */ jsx(
1639
+ Button,
1080
1640
  {
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
- }
1641
+ onClick,
1642
+ variant: "contained",
1643
+ startIcon: /* @__PURE__ */ jsx(FilterAlt, { sx: { fontSize: "18px" } }),
1644
+ sx: {
1645
+ backgroundColor: "#f4f0ef",
1646
+ color: "#666",
1647
+ fontFamily: "Poppins, sans-serif",
1648
+ fontWeight: 500,
1649
+ fontSize: "14px",
1650
+ letterSpacing: "0.1px",
1651
+ textTransform: "none",
1652
+ borderRadius: "100px",
1653
+ height: "40px",
1654
+ paddingLeft: "16px",
1655
+ paddingRight: "24px",
1656
+ paddingTop: "10px",
1657
+ paddingBottom: "10px",
1658
+ gap: "8px",
1659
+ boxShadow: "none",
1660
+ "&:hover": {
1661
+ backgroundColor: "#ebe7e6",
1662
+ boxShadow: "none"
1663
+ },
1664
+ "&:active": {
1665
+ boxShadow: "none"
1666
+ }
1667
+ },
1668
+ children: "Filter"
1100
1669
  }
1101
- ) });
1102
- };
1103
- var SearchBox_default = SearchBox;
1670
+ );
1671
+ }
1104
1672
  var StyledChipProps = styled$1(Chip)(({ theme }) => {
1105
1673
  var _a, _b, _c;
1106
1674
  return {
@@ -1134,11 +1702,11 @@ function ApprovalWorkflow({
1134
1702
  selectedWorkflowsList = [],
1135
1703
  userInfo
1136
1704
  }) {
1137
- var _a, _b, _c, _d, _e, _f, _g;
1705
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
1138
1706
  useTheme$1();
1139
1707
  const { api, urlBuilder, loadingComponent, ENV_VARIABLES } = useWorkflowContext();
1140
- const [selectedApprovalOtions, setSelectedApprovalOtions] = useState(
1141
- selectedWorkflowsList.length ? "selected" : "Action Required"
1708
+ const [selectedOption, setSelectedOption] = useState(
1709
+ selectedWorkflowsList.length ? "selected" : "Assign To Me"
1142
1710
  );
1143
1711
  const [expandedId, setExpandedId] = useState(null);
1144
1712
  const [sendDialog, setSendDialog] = React7.useState(null);
@@ -1147,80 +1715,114 @@ function ApprovalWorkflow({
1147
1715
  const [onHoldTarget, setOnHoldTarget] = React7.useState(null);
1148
1716
  const [expandedDetails, setExpandedDetails] = useState([]);
1149
1717
  console.log("\u{1F680} ~ ApprovalWorkflow ~ expandedDetails:", expandedDetails);
1718
+ const [descriptionView, setDescriptionView] = useState(null);
1150
1719
  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);
1720
+ const [viewMoreDetails, setViewMoreDetails] = useState(null);
1721
+ const [isViewMoreOpen, setIsViewMoreOpen] = useState(false);
1722
+ const [isFilterOpen, setIsFilterOpen] = useState(false);
1723
+ const handleOpenViewMore = (details) => {
1724
+ setViewMoreDetails(details);
1725
+ setIsViewMoreOpen(true);
1726
+ };
1727
+ const handleCloseViewMore = () => {
1728
+ setIsViewMoreOpen(false);
1729
+ setViewMoreDetails(null);
1730
+ };
1731
+ const [tabs, setTabs] = useState({
1732
+ "Assign To Me": {
1733
+ data: [],
1734
+ page: 1,
1735
+ search: "",
1736
+ hasMore: true,
1737
+ loading: false,
1738
+ initialized: false,
1739
+ filters: null
1740
+ },
1741
+ "All Requests": {
1742
+ data: [],
1743
+ page: 1,
1744
+ search: "",
1745
+ hasMore: true,
1746
+ loading: false,
1747
+ initialized: false,
1748
+ filters: null
1749
+ },
1750
+ Completed: {
1751
+ data: [],
1752
+ page: 1,
1753
+ search: "",
1754
+ hasMore: true,
1755
+ loading: false,
1756
+ initialized: false,
1757
+ filters: null
1758
+ },
1759
+ selected: {
1760
+ data: [],
1761
+ page: 1,
1762
+ search: "",
1763
+ hasMore: true,
1764
+ loading: false,
1765
+ initialized: false,
1766
+ filters: null
1767
+ }
1768
+ });
1769
+ console.log("\u{1F680} ~ ApprovalWorkflow ~ tabs:", tabs);
1158
1770
  const [searchText, setSearchText] = useState("");
1771
+ const debouncedSearchTerm = useDebounce_default(searchText, 500);
1772
+ useEffect(() => {
1773
+ var _a2;
1774
+ setSearchText(((_a2 = tabs[selectedOption]) == null ? void 0 : _a2.search) || "");
1775
+ }, [selectedOption]);
1776
+ useEffect(() => {
1777
+ var _a2, _b2;
1778
+ if (debouncedSearchTerm !== tabs[selectedOption].search) {
1779
+ setTabs((prev) => ({
1780
+ ...prev,
1781
+ [selectedOption]: {
1782
+ ...prev[selectedOption],
1783
+ search: debouncedSearchTerm,
1784
+ page: 1,
1785
+ hasMore: true,
1786
+ data: []
1787
+ // Clear data on new search
1788
+ }
1789
+ }));
1790
+ if ((_a2 = tabs[selectedOption]) == null ? void 0 : _a2.initialized) {
1791
+ fetchData(
1792
+ selectedOption,
1793
+ 1,
1794
+ debouncedSearchTerm,
1795
+ (_b2 = tabs[selectedOption]) == null ? void 0 : _b2.filters
1796
+ );
1797
+ }
1798
+ }
1799
+ }, [debouncedSearchTerm, selectedOption]);
1159
1800
  const handleClearSearch = useCallback(() => {
1160
1801
  setSearchText("");
1161
1802
  }, []);
1162
1803
  const handleSearchChange = useCallback((value) => {
1163
1804
  setSearchText(value);
1164
1805
  }, []);
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.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.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.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
1806
  const observer = React7.useRef(null);
1194
1807
  const lastCardRef = useCallback(
1195
1808
  (node) => {
1196
- if (isLoading) return;
1809
+ const currentTab = tabs[selectedOption];
1810
+ if ((currentTab == null ? void 0 : currentTab.loading) || !(currentTab == null ? void 0 : currentTab.hasMore)) return;
1197
1811
  if (observer.current) observer.current.disconnect();
1198
1812
  observer.current = new IntersectionObserver((entries) => {
1199
1813
  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
- }
1814
+ setTabs((prev) => ({
1815
+ ...prev,
1816
+ [selectedOption]: {
1817
+ ...prev[selectedOption],
1818
+ page: prev[selectedOption].page + 1
1819
+ }
1820
+ }));
1207
1821
  }
1208
1822
  });
1209
1823
  if (node) observer.current.observe(node);
1210
1824
  },
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
1825
+ [tabs, selectedOption]
1224
1826
  );
1225
1827
  const handleSendBack = (workflowLogId) => {
1226
1828
  setSendDialog(workflowLogId);
@@ -1234,11 +1836,108 @@ function ApprovalWorkflow({
1234
1836
  const handleOnHold = (workflowLogId) => {
1235
1837
  setOnHoldTarget(workflowLogId);
1236
1838
  };
1839
+ const handleApplyFilter = (filters) => {
1840
+ setTabs((prev) => ({
1841
+ ...prev,
1842
+ [selectedOption]: {
1843
+ ...prev[selectedOption],
1844
+ filters,
1845
+ page: 1,
1846
+ hasMore: true,
1847
+ data: []
1848
+ }
1849
+ }));
1850
+ setIsFilterOpen(false);
1851
+ fetchData(selectedOption, 1, tabs[selectedOption].search, filters);
1852
+ };
1853
+ const fetchData = useCallback(
1854
+ (tab, page, search, filtersOverride) => {
1855
+ var _a2, _b2;
1856
+ if (!((_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id)) return;
1857
+ const currentFilters = filtersOverride || ((_b2 = tabs[tab]) == null ? void 0 : _b2.filters);
1858
+ console.log("\u{1F680} ~ ApprovalWorkflow ~ currentFilters:", currentFilters);
1859
+ let filterQuery = "";
1860
+ if (currentFilters) {
1861
+ if (currentFilters.approvalType)
1862
+ filterQuery += `&activityId=${encodeURIComponent(
1863
+ currentFilters.approvalType
1864
+ )}`;
1865
+ if (currentFilters.approvalStatus)
1866
+ filterQuery += `&approval_status=${encodeURIComponent(
1867
+ currentFilters.approvalStatus
1868
+ )}`;
1869
+ if (currentFilters.sortBy)
1870
+ filterQuery += `&tat=${encodeURIComponent(currentFilters.sortBy)}`;
1871
+ }
1872
+ let url = "";
1873
+ const query = `paginate=${true}&page=${page}&size=10&search=${encodeURIComponent(
1874
+ search
1875
+ )}${filterQuery}`;
1876
+ if (tab === "Assign To Me") {
1877
+ url = `/workflow/activity-workflow/${userInfo.userInfo.id}?${query}&type=pending`;
1878
+ } else if (tab === "All Requests") {
1879
+ url = `/workflow/activity-workflow/${userInfo.userInfo.id}?${query}`;
1880
+ } else if (tab === "Completed") {
1881
+ url = `/workflow/activity-workflow/${userInfo.userInfo.id}?${query}&type=completed`;
1882
+ } else if (tab === "selected") {
1883
+ if (selectedWorkflowsList.length && !tabs["selected"].initialized) {
1884
+ api.post({
1885
+ url: `/workflow/bulk-details`,
1886
+ serviceURL: "api",
1887
+ data: { workflowIds: selectedWorkflowsList }
1888
+ }).then((res) => {
1889
+ setTabs((prev) => ({
1890
+ ...prev,
1891
+ selected: {
1892
+ ...prev.selected,
1893
+ data: (res == null ? void 0 : res.data) || [],
1894
+ loading: false,
1895
+ initialized: true,
1896
+ hasMore: false
1897
+ // No pagination for selected for now
1898
+ }
1899
+ }));
1900
+ });
1901
+ }
1902
+ return;
1903
+ }
1904
+ if (!url) return;
1905
+ setTabs((prev) => ({
1906
+ ...prev,
1907
+ [tab]: { ...prev[tab], loading: true }
1908
+ }));
1909
+ api.get({ url, serviceURL: "api" }).then((res) => {
1910
+ var _a3;
1911
+ const newItems = ((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.activities) || [];
1912
+ setTabs((prev) => {
1913
+ var _a4;
1914
+ return {
1915
+ ...prev,
1916
+ [tab]: {
1917
+ ...prev[tab],
1918
+ data: page === 1 ? newItems : [...prev[tab].data, ...newItems],
1919
+ count: (_a4 = res == null ? void 0 : res.data) == null ? void 0 : _a4.totalCount,
1920
+ loading: false,
1921
+ hasMore: newItems.length === 10,
1922
+ initialized: true
1923
+ }
1924
+ };
1925
+ });
1926
+ }).catch(() => {
1927
+ setTabs((prev) => ({
1928
+ ...prev,
1929
+ [tab]: { ...prev[tab], loading: false }
1930
+ }));
1931
+ });
1932
+ },
1933
+ [api, userInfo, selectedWorkflowsList, tabs]
1934
+ );
1237
1935
  const handleProfileToggle = (option) => {
1238
- setSelectedApprovalOtions(option);
1239
- if (option === "Action Required") fetchPendingActivities();
1240
- if (option === "All Requests") fetchAllActivites();
1241
- if (option === "selected") fetchSelectedActivites();
1936
+ var _a2, _b2;
1937
+ setSelectedOption(option);
1938
+ if (!((_a2 = tabs[option]) == null ? void 0 : _a2.initialized)) {
1939
+ fetchData(option, 1, ((_b2 = tabs[option]) == null ? void 0 : _b2.search) || "");
1940
+ }
1242
1941
  };
1243
1942
  const handleExpandClick = (id) => {
1244
1943
  setExpandedId((prevId) => prevId === id ? null : id);
@@ -1286,14 +1985,19 @@ function ApprovalWorkflow({
1286
1985
  };
1287
1986
  const approvalChipLabel = [
1288
1987
  {
1289
- label: "Action Required",
1988
+ label: "Assign To Me",
1290
1989
  icon: /* @__PURE__ */ jsx("span", { className: "icon-document-forward" }),
1291
- count: pendingRequestArray ? pendingRequestArray.length : 0
1990
+ count: ((_a = tabs["Assign To Me"]) == null ? void 0 : _a.count) || 0
1292
1991
  },
1293
1992
  {
1294
1993
  label: "All Requests",
1295
1994
  icon: /* @__PURE__ */ jsx("span", { className: "icon-document-copy" }),
1296
- count: allRequestArray ? allRequestArray.length : 0
1995
+ count: ((_b = tabs["All Requests"]) == null ? void 0 : _b.count) || 0
1996
+ },
1997
+ {
1998
+ label: "Completed",
1999
+ icon: /* @__PURE__ */ jsx("span", { className: "icon-tick-circle" }),
2000
+ count: ((_c = tabs["Completed"]) == null ? void 0 : _c.count) || 0
1297
2001
  }
1298
2002
  ];
1299
2003
  const fetchExpandedActivityLogs = (workflowLogId) => {
@@ -1303,62 +2007,28 @@ function ApprovalWorkflow({
1303
2007
  serviceURL: "api"
1304
2008
  }).then((res) => setExpandedDetails(res == null ? void 0 : res.data));
1305
2009
  };
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
2010
  useEffect(() => {
1337
- if (!sendDialog && !approveTarget && !onHoldTarget && !rejectTarget) {
1338
- fetchAllActivites();
1339
- fetchPendingActivities();
1340
- setExpandedDetails([]);
1341
- setExpandedId(null);
2011
+ var _a2;
2012
+ if ((_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id) {
2013
+ const tabsToFetch = ["Assign To Me", "All Requests", "Completed"];
2014
+ tabsToFetch.forEach((tab) => {
2015
+ var _a3;
2016
+ if (!((_a3 = tabs[tab]) == null ? void 0 : _a3.initialized)) {
2017
+ fetchData(tab, 1, "");
2018
+ }
2019
+ });
1342
2020
  }
1343
- }, [sendDialog, approveTarget, onHoldTarget, rejectTarget, userInfo]);
2021
+ }, [userInfo]);
1344
2022
  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();
2023
+ const tabState = tabs[selectedOption];
2024
+ if ((tabState == null ? void 0 : tabState.page) > 1) {
2025
+ fetchData(selectedOption, tabState.page, tabState.search);
1357
2026
  }
1358
- }, [selectedWorkflowsList]);
2027
+ }, [(_d = tabs[selectedOption]) == null ? void 0 : _d.page]);
1359
2028
  useEffect(() => {
1360
- if (Object.keys(urlConfig).length > 0 && userInfo) {
1361
- fetchPendingActivities();
2029
+ var _a2;
2030
+ if (Object.keys(urlConfig).length > 0 && userInfo && !tabs["Assign To Me"].initialized) {
2031
+ fetchData("Assign To Me", 1, ((_a2 = tabs["Assign To Me"]) == null ? void 0 : _a2.search) || "");
1362
2032
  }
1363
2033
  }, [urlConfig, userInfo]);
1364
2034
  const buildRedirectionUrl = (info) => {
@@ -1385,60 +2055,50 @@ function ApprovalWorkflow({
1385
2055
  }
1386
2056
  return "#";
1387
2057
  };
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 });
2058
+ function timeLeftDHm(targetISO) {
2059
+ const diff = new Date(targetISO).getTime() - Date.now();
2060
+ if (diff <= 0) return "0d: 0h: 0m";
2061
+ const totalMinutes = Math.floor(diff / 6e4);
2062
+ const d = Math.floor(totalMinutes / 1440);
2063
+ const h = Math.floor(totalMinutes % 1440 / 60);
2064
+ const m = totalMinutes % 60;
2065
+ return `${d}d: ${h}h: ${m}m`;
2066
+ }
2067
+ if (((_e = tabs[selectedOption]) == null ? void 0 : _e.loading) && ((_f = tabs[selectedOption]) == null ? void 0 : _f.page) === 1 && loadingComponent)
2068
+ return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
1410
2069
  console.info("LIBRARY RUNNING...");
1411
2070
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1412
2071
  /* @__PURE__ */ jsx(
1413
- Box,
2072
+ Box$1,
1414
2073
  {
1415
2074
  sx: {
1416
2075
  display: "flex",
1417
2076
  justifyContent: "center",
1418
2077
  flexWrap: "nowrap",
2078
+ // width:"1100px",height:"90%",
1419
2079
  overflow: "hidden !important"
1420
2080
  },
1421
2081
  children: /* @__PURE__ */ jsxs(
1422
- Box,
2082
+ Box$1,
1423
2083
  {
1424
2084
  sx: { width: "100%", height: "100%", overflow: "hidden !important" },
1425
2085
  children: [
1426
2086
  /* @__PURE__ */ jsxs(
1427
- Box,
2087
+ Box$1,
1428
2088
  {
1429
2089
  sx: {
1430
2090
  display: "flex",
1431
2091
  justifyContent: "space-between",
1432
- alignItems: "center"
2092
+ alignItems: "flex-start"
1433
2093
  },
1434
2094
  children: [
1435
- /* @__PURE__ */ jsxs(Box, { sx: { mt: 2, mb: 2 }, children: [
2095
+ /* @__PURE__ */ jsxs(Box$1, { children: [
1436
2096
  (selectedWorkflowsList == null ? void 0 : selectedWorkflowsList.length) ? /* @__PURE__ */ jsx(Tooltip, { title: "Selected Workflows", children: /* @__PURE__ */ jsx(
1437
2097
  StyledChipProps,
1438
2098
  {
1439
2099
  label: "Selected",
1440
2100
  icon: /* @__PURE__ */ jsx("span", { className: "icon-eye" }),
1441
- color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes("selected")) ? "primary" : "default",
2101
+ color: (selectedOption == null ? void 0 : selectedOption.includes("selected")) ? "primary" : "default",
1442
2102
  variant: "filled",
1443
2103
  sx: {
1444
2104
  mr: 4,
@@ -1453,7 +2113,7 @@ function ApprovalWorkflow({
1453
2113
  {
1454
2114
  label: `${count} ${label}`,
1455
2115
  icon,
1456
- color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes(label)) ? "primary" : "default",
2116
+ color: (selectedOption == null ? void 0 : selectedOption.includes(label)) ? "primary" : "default",
1457
2117
  variant: "filled",
1458
2118
  sx: {
1459
2119
  mr: 4,
@@ -1464,344 +2124,34 @@ function ApprovalWorkflow({
1464
2124
  }
1465
2125
  ) }, index))
1466
2126
  ] }),
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.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,
2127
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex" }, children: [
2128
+ /* @__PURE__ */ jsx(
2129
+ Box$1,
2130
+ {
2131
+ sx: {
2132
+ flexGrow: 1,
2133
+ maxWidth: 295,
2134
+ ml: "auto",
2135
+ mr: "10px"
2136
+ },
2137
+ children: /* @__PURE__ */ jsx(
2138
+ SearchBox_default,
1736
2139
  {
1737
- sx: {
1738
- height: 150,
1739
- display: "flex",
1740
- justifyContent: "center",
1741
- alignItems: "center"
1742
- },
1743
- children: /* @__PURE__ */ jsx(CircularProgress, { size: 36, color: "primary" })
2140
+ placeHolderTitle: "Search",
2141
+ searchText,
2142
+ handleClearSearch,
2143
+ handleInputChange: (e) => handleSearchChange(e.target.value)
1744
2144
  }
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
- )
2145
+ )
2146
+ }
2147
+ ),
2148
+ /* @__PURE__ */ jsx(FilterButton, { onClick: () => setIsFilterOpen((prev) => !prev) })
2149
+ ] })
2150
+ ]
1801
2151
  }
1802
2152
  ),
1803
- selectedApprovalOtions === "All Requests" && /* @__PURE__ */ jsx(
1804
- Box,
2153
+ /* @__PURE__ */ jsxs(
2154
+ Box$1,
1805
2155
  {
1806
2156
  className: "fixedModal hide-scrollbar",
1807
2157
  sx: {
@@ -1810,627 +2160,60 @@ function ApprovalWorkflow({
1810
2160
  px: 2,
1811
2161
  pb: 3
1812
2162
  },
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.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,
2163
+ children: [
2164
+ ((_g = tabs[selectedOption]) == null ? void 0 : _g.loading) && ((_h = tabs[selectedOption]) == null ? void 0 : _h.page) === 1 ? /* @__PURE__ */ jsx(
2165
+ Box$1,
1842
2166
  {
1843
- ref: index === visibleAllRequests.length - 1 ? lastCardRef : null,
1844
2167
  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"
2168
+ display: "flex",
2169
+ justifyContent: "center",
2170
+ alignItems: "center",
2171
+ height: "100%",
2172
+ p: 4,
2173
+ width: "1100px"
1851
2174
  },
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
- ]
2175
+ children: /* @__PURE__ */ jsx(CircularProgress, {})
2176
+ }
2177
+ ) : ((_j = (_i = tabs[selectedOption]) == null ? void 0 : _i.data) == null ? void 0 : _j.length) > 0 ? tabs[selectedOption].data.map((info, index) => /* @__PURE__ */ jsx(
2178
+ WorkflowRequestCard,
2179
+ {
2180
+ requestDetails: info,
2181
+ index,
2182
+ isLast: index === tabs[selectedOption].data.length - 1,
2183
+ lastCardRef,
2184
+ expandedId,
2185
+ handleExpandClick,
2186
+ handleOpenViewMore,
2187
+ handleApprove,
2188
+ handleReject,
2189
+ handleSendBack,
2190
+ handleOnHold,
2191
+ expandedDetails,
2192
+ userInfo,
2193
+ helpers: {
2194
+ timeLeftDHm,
2195
+ getStatus,
2196
+ buildRedirectionUrl
2197
+ }
2117
2198
  },
2118
2199
  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.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,
2200
+ )) : /* @__PURE__ */ jsx(
2201
+ "div",
2166
2202
  {
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"
2203
+ style: {
2204
+ height: "100%",
2205
+ width: "1100px",
2206
+ color: "gray",
2207
+ fontSize: "20px",
2208
+ display: "flex",
2209
+ justifyContent: "center",
2210
+ alignItems: "center"
2175
2211
  },
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
- )
2212
+ children: "NO RECORD FOUND"
2213
+ }
2214
+ ),
2215
+ ((_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 }) })
2216
+ ]
2434
2217
  }
2435
2218
  )
2436
2219
  ]
@@ -2453,8 +2236,8 @@ function ApprovalWorkflow({
2453
2236
  openModal: !!approveTarget,
2454
2237
  closeModal: () => setApproveTarget(null),
2455
2238
  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]
2239
+ workflowLogId: (_m = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _m[0],
2240
+ statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1]
2458
2241
  }
2459
2242
  ),
2460
2243
  /* @__PURE__ */ jsx(
@@ -2463,9 +2246,9 @@ function ApprovalWorkflow({
2463
2246
  openModal: !!rejectTarget,
2464
2247
  closeModal: () => setRejectTarget(null),
2465
2248
  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]
2249
+ workflowLogId: (_o = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _o[0],
2250
+ statusId: (_p = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _p[1],
2251
+ rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2]
2469
2252
  }
2470
2253
  ),
2471
2254
  /* @__PURE__ */ jsx(
@@ -2474,8 +2257,79 @@ function ApprovalWorkflow({
2474
2257
  openModal: !!onHoldTarget,
2475
2258
  closeModal: () => setOnHoldTarget(null),
2476
2259
  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]
2260
+ workflowLogId: (_r = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _r[0],
2261
+ statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1]
2262
+ }
2263
+ ),
2264
+ /* @__PURE__ */ jsxs(
2265
+ Dialog,
2266
+ {
2267
+ open: isViewMoreOpen,
2268
+ onClose: handleCloseViewMore,
2269
+ maxWidth: "sm",
2270
+ fullWidth: true,
2271
+ PaperProps: {
2272
+ sx: {
2273
+ borderRadius: "16px",
2274
+ padding: "10px",
2275
+ position: "relative"
2276
+ // For absolute close button
2277
+ }
2278
+ },
2279
+ children: [
2280
+ /* @__PURE__ */ jsxs(
2281
+ DialogTitle,
2282
+ {
2283
+ sx: {
2284
+ display: "flex",
2285
+ justifyContent: "space-between",
2286
+ alignItems: "center",
2287
+ paddingBottom: "10px"
2288
+ },
2289
+ children: [
2290
+ /* @__PURE__ */ jsx(Typography, { variant: "h6", sx: { fontWeight: 600 }, children: "Description Details" }),
2291
+ /* @__PURE__ */ jsx(
2292
+ IconButton,
2293
+ {
2294
+ onClick: handleCloseViewMore,
2295
+ sx: {
2296
+ position: "absolute",
2297
+ right: 8,
2298
+ top: 8,
2299
+ color: (theme2) => theme2.palette.grey[500]
2300
+ },
2301
+ children: /* @__PURE__ */ jsx(CloseIcon, {})
2302
+ }
2303
+ )
2304
+ ]
2305
+ }
2306
+ ),
2307
+ /* @__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(
2308
+ Typography,
2309
+ {
2310
+ className: "detail-item",
2311
+ sx: { fontSize: "14px" },
2312
+ children: [
2313
+ /* @__PURE__ */ jsxs("span", { style: { fontWeight: "bold", color: "#666" }, children: [
2314
+ data[0].replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()),
2315
+ ":"
2316
+ ] }),
2317
+ " ",
2318
+ /* @__PURE__ */ jsx("span", { style: { color: "#000" }, children: data[1] })
2319
+ ]
2320
+ },
2321
+ idx
2322
+ )) }) })
2323
+ ]
2324
+ }
2325
+ ),
2326
+ /* @__PURE__ */ jsx(
2327
+ FilterModal,
2328
+ {
2329
+ open: isFilterOpen,
2330
+ onClose: () => setIsFilterOpen(false),
2331
+ initialFilters: (_t = tabs[selectedOption]) == null ? void 0 : _t.filters,
2332
+ onApply: handleApplyFilter
2479
2333
  }
2480
2334
  )
2481
2335
  ] });
@@ -2503,15 +2357,31 @@ function DialogOpener({
2503
2357
  return () => window.removeEventListener("resize", updateScreenWidth);
2504
2358
  }, []);
2505
2359
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
2506
- Dialog,
2360
+ Dialog$1,
2507
2361
  {
2508
- fullScreen: true,
2362
+ fullScreen: false,
2509
2363
  open: openDialog,
2510
2364
  onClose: () => handleClose && handleClose(),
2511
2365
  "aria-labelledby": "responsive-dialog-title",
2512
- sx: { zIndex: 1234 },
2366
+ maxWidth: "lg",
2367
+ sx: {
2368
+ "& .MuiDialog-container": {
2369
+ justifyContent: "flex-end",
2370
+ alignItems: "flex-start"
2371
+ },
2372
+ "& .MuiDialog-paper": {
2373
+ position: "fixed",
2374
+ right: 0,
2375
+ top: 0,
2376
+ height: "100vh",
2377
+ maxHeight: "100vh",
2378
+ margin: 0,
2379
+ borderRadius: 0
2380
+ }
2381
+ },
2513
2382
  children: [
2514
- /* @__PURE__ */ jsxs(DialogContent, { children: [
2383
+ /* @__PURE__ */ jsxs(DialogTitle, { children: [
2384
+ "Workflow",
2515
2385
  /* @__PURE__ */ jsx(
2516
2386
  IconButton,
2517
2387
  {
@@ -2521,26 +2391,32 @@ function DialogOpener({
2521
2391
  sx: { float: "right" },
2522
2392
  children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } })
2523
2393
  }
2524
- ),
2525
- /* @__PURE__ */ jsx(
2526
- ApprovalWorkflow,
2527
- {
2528
- userInfo: userInfoData,
2529
- selectedWorkflowsList
2530
- }
2531
2394
  )
2532
2395
  ] }),
2533
- /* @__PURE__ */ jsx(DialogActions5, { children: /* @__PURE__ */ jsx(
2534
- Button7,
2396
+ /* @__PURE__ */ jsx(
2397
+ DialogContent,
2535
2398
  {
2536
- variant: "contained",
2537
- color: "primary",
2538
2399
  sx: {
2539
- display: "flex",
2540
- justifyContent: "flex-end",
2541
- alignItems: "center"
2400
+ overflow: "hidden",
2401
+ width: "100%",
2402
+ height: "100%",
2403
+ padding: "0 20px"
2542
2404
  },
2405
+ children: /* @__PURE__ */ jsx(
2406
+ ApprovalWorkflow,
2407
+ {
2408
+ userInfo: userInfoData,
2409
+ selectedWorkflowsList
2410
+ }
2411
+ )
2412
+ }
2413
+ ),
2414
+ /* @__PURE__ */ jsx(DialogActions6, { children: /* @__PURE__ */ jsx(
2415
+ WorkflowButton_default,
2416
+ {
2417
+ variant: "approve",
2543
2418
  onClick: handleClose,
2419
+ className: "dialog-close-btn",
2544
2420
  children: "Close"
2545
2421
  }
2546
2422
  ) })