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