amp-workflow-ui 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1290 -1387
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1310 -1408
- package/dist/index.mjs.map +1 -1
- package/package.json +46 -44
- package/dist/index.css +0 -10
- package/dist/index.css.map +0 -1
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
|
|
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
|
|
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
|
|
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,578 @@ function useWorkflowContext() {
|
|
|
39
42
|
}
|
|
40
43
|
return ctx;
|
|
41
44
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
70
|
-
|
|
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
|
-
|
|
77
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
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
|
+
componentsProps: {
|
|
465
|
+
tooltip: {
|
|
466
|
+
sx: {
|
|
467
|
+
backgroundColor: "#fff",
|
|
468
|
+
color: "#000",
|
|
469
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
|
|
470
|
+
borderRadius: "6px",
|
|
471
|
+
p: 1
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
arrow: {
|
|
475
|
+
sx: {
|
|
476
|
+
color: "#fff"
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
481
|
+
material.Typography,
|
|
482
|
+
{
|
|
483
|
+
className: "assignee-text",
|
|
484
|
+
sx: { cursor: "pointer" },
|
|
485
|
+
children: [
|
|
486
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "assignee-label", children: "Current Assignee:" }),
|
|
487
|
+
" ",
|
|
488
|
+
allAssignees.length > 0 ? `${allAssignees[0]} +${allAssignees.length - 1}` : allAssignees[0]
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
)
|
|
492
|
+
}
|
|
493
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
494
|
+
material.Typography,
|
|
495
|
+
{
|
|
496
|
+
className: "assignee-text",
|
|
497
|
+
sx: { cursor: "pointer" },
|
|
498
|
+
children: [
|
|
499
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "assignee-label", children: "Current Assignee:" }),
|
|
500
|
+
" ",
|
|
501
|
+
allAssignees[0]
|
|
502
|
+
]
|
|
503
|
+
}
|
|
504
|
+
) }) : extraCurrentlyAssignedUserCount > 0 || tatExpired && extraCurrentlyEscalatedUserCount > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
505
|
+
material.Tooltip,
|
|
506
|
+
{
|
|
507
|
+
title: /* @__PURE__ */ jsxRuntime.jsx(
|
|
508
|
+
material.Box,
|
|
509
|
+
{
|
|
510
|
+
sx: {
|
|
511
|
+
backgroundColor: "#fff",
|
|
512
|
+
padding: "10px",
|
|
513
|
+
borderRadius: "5px"
|
|
514
|
+
},
|
|
515
|
+
children: (tatExpired ? currentlyEscaltedUserArray : currentlyAssignedUserArray).map((user, index2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
516
|
+
material.Typography,
|
|
517
|
+
{
|
|
518
|
+
className: "assignee-text",
|
|
519
|
+
variant: "body2",
|
|
520
|
+
children: user
|
|
521
|
+
},
|
|
522
|
+
index2
|
|
523
|
+
))
|
|
524
|
+
}
|
|
525
|
+
),
|
|
526
|
+
arrow: true,
|
|
527
|
+
placement: "top",
|
|
528
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { className: "assignee-text", sx: { cursor: "pointer" }, children: [
|
|
529
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "assignee-label", children: tatExpired ? "Escalated To:" : "Current Assignee:" }),
|
|
530
|
+
" ",
|
|
531
|
+
(tatExpired ? extraCurrentlyEscalatedUserCount : extraCurrentlyAssignedUserCount) > 0 ? `${tatExpired ? currentlyEscalatedUser : currentlyAssignedUser} +${tatExpired ? extraCurrentlyEscalatedUserCount : extraCurrentlyAssignedUserCount}` : tatExpired ? currentlyEscalatedUser : currentlyAssignedUser
|
|
532
|
+
] })
|
|
533
|
+
}
|
|
534
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(material.Typography, { className: "assignee-text", sx: { cursor: "pointer" }, children: [
|
|
535
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "assignee-label", children: tatExpired ? "Escalated To:" : "Current Assignee:" }),
|
|
536
|
+
" ",
|
|
537
|
+
tatExpired ? currentlyEscalatedUser : currentlyAssignedUser
|
|
538
|
+
] })
|
|
539
|
+
] }),
|
|
540
|
+
(requestDetails == null ? void 0 : requestDetails.current_status) !== "completed" ? /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { className: "action-buttons", children: [
|
|
541
|
+
filterRejectForLevelZero(statusList, requestDetails).find(
|
|
542
|
+
(list) => list.status == 3
|
|
543
|
+
) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
544
|
+
material.Button,
|
|
545
|
+
{
|
|
546
|
+
variant: "outlined",
|
|
547
|
+
className: "btn-reject",
|
|
548
|
+
onClick: () => {
|
|
549
|
+
var _a2;
|
|
550
|
+
return handleReject(
|
|
551
|
+
`${requestDetails == null ? void 0 : requestDetails._id}|${(_a2 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a2.id}|${requestDetails == null ? void 0 : requestDetails.reasons}`
|
|
552
|
+
);
|
|
553
|
+
},
|
|
554
|
+
children: "Reject"
|
|
555
|
+
}
|
|
556
|
+
),
|
|
557
|
+
!(requestDetails == null ? void 0 : requestDetails.isLevelZero) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
558
|
+
material.Button,
|
|
559
|
+
{
|
|
560
|
+
variant: "outlined",
|
|
561
|
+
className: "btn-send-back",
|
|
562
|
+
onClick: () => handleSendBack(requestDetails._id),
|
|
563
|
+
children: "Send Back"
|
|
564
|
+
}
|
|
565
|
+
),
|
|
566
|
+
filterRejectForLevelZero(statusList, requestDetails).find(
|
|
567
|
+
(list) => list.status == 1
|
|
568
|
+
) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
569
|
+
material.Button,
|
|
570
|
+
{
|
|
571
|
+
variant: "contained",
|
|
572
|
+
className: "btn-approve",
|
|
573
|
+
onClick: () => {
|
|
574
|
+
var _a2;
|
|
575
|
+
return handleApprove(
|
|
576
|
+
`${requestDetails == null ? void 0 : requestDetails._id}|${(_a2 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a2.id}`
|
|
577
|
+
);
|
|
578
|
+
},
|
|
579
|
+
children: "Approve"
|
|
580
|
+
}
|
|
581
|
+
)
|
|
582
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
583
|
+
WorkflowButton_default,
|
|
584
|
+
{
|
|
585
|
+
variant: currentStatus === "approved" ? "approved" : currentStatus === "rejected" ? "rejected" : "pending",
|
|
586
|
+
className: "dialog-close-btn",
|
|
587
|
+
children: currentStatus.toLocaleLowerCase()
|
|
588
|
+
}
|
|
589
|
+
)
|
|
590
|
+
] }),
|
|
591
|
+
expandedId === requestDetails._id && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
592
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "horizontal-divider" }),
|
|
593
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
594
|
+
WorkFlowTimeline,
|
|
595
|
+
{
|
|
596
|
+
events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
|
|
597
|
+
var _a2, _b2, _c2, _d2;
|
|
598
|
+
return {
|
|
599
|
+
date: moment__default.default(item == null ? void 0 : item.created_at).format("DD-MM-YYYY"),
|
|
600
|
+
time: moment__default.default(item == null ? void 0 : item.created_at).format("HH:mm"),
|
|
601
|
+
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",
|
|
602
|
+
subTitle: ((_c2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c2.comment) || "No Comments",
|
|
603
|
+
attachment: ((_d2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d2.file) || null,
|
|
604
|
+
count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
|
|
605
|
+
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",
|
|
606
|
+
type: item == null ? void 0 : item.type
|
|
607
|
+
};
|
|
608
|
+
})
|
|
609
|
+
}
|
|
610
|
+
)
|
|
611
|
+
] })
|
|
612
|
+
]
|
|
613
|
+
},
|
|
614
|
+
index
|
|
615
|
+
);
|
|
616
|
+
}
|
|
95
617
|
function SendBackDialog({
|
|
96
618
|
openModal,
|
|
97
619
|
closeModal,
|
|
@@ -881,239 +1403,308 @@ function OnHoldDialog({
|
|
|
881
1403
|
] });
|
|
882
1404
|
}
|
|
883
1405
|
var OnHoldDialog_default = OnHoldDialog;
|
|
884
|
-
var
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
height: 60,
|
|
894
|
-
color: "#2C35FF"
|
|
895
|
-
}
|
|
1406
|
+
var useDebounce = (value, delay) => {
|
|
1407
|
+
const [debouncedValue, setDebouncedValue] = React7.useState(value);
|
|
1408
|
+
React7.useEffect(() => {
|
|
1409
|
+
const timeoutId = setTimeout(() => {
|
|
1410
|
+
setDebouncedValue(value);
|
|
1411
|
+
}, delay);
|
|
1412
|
+
return () => clearTimeout(timeoutId);
|
|
1413
|
+
}, [value, delay]);
|
|
1414
|
+
return debouncedValue;
|
|
896
1415
|
};
|
|
897
|
-
var
|
|
898
|
-
var
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
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,
|
|
1416
|
+
var useDebounce_default = useDebounce;
|
|
1417
|
+
var SearchBox = ({
|
|
1418
|
+
placeHolderTitle,
|
|
1419
|
+
searchText,
|
|
1420
|
+
handleClearSearch,
|
|
1421
|
+
handleInputChange
|
|
1422
|
+
}) => {
|
|
1423
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1424
|
+
material.TextField,
|
|
916
1425
|
{
|
|
1426
|
+
size: "small",
|
|
1427
|
+
variant: "outlined",
|
|
1428
|
+
value: searchText,
|
|
1429
|
+
onChange: handleInputChange,
|
|
1430
|
+
placeholder: placeHolderTitle,
|
|
1431
|
+
autoComplete: "off",
|
|
1432
|
+
className: "custom-search",
|
|
917
1433
|
sx: {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
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
|
|
1434
|
+
"& .MuiOutlinedInput-root": {
|
|
1435
|
+
height: "38px",
|
|
1436
|
+
borderRadius: "20px"
|
|
1437
|
+
}
|
|
929
1438
|
},
|
|
930
|
-
|
|
1439
|
+
InputProps: {
|
|
1440
|
+
startAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "start", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-search-normal-1" }) }),
|
|
1441
|
+
endAdornment: searchText ? /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1442
|
+
material.IconButton,
|
|
1443
|
+
{
|
|
1444
|
+
disableFocusRipple: true,
|
|
1445
|
+
disableRipple: true,
|
|
1446
|
+
disableTouchRipple: true,
|
|
1447
|
+
onClick: handleClearSearch,
|
|
1448
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-close-circle" })
|
|
1449
|
+
}
|
|
1450
|
+
) }) : null
|
|
1451
|
+
}
|
|
931
1452
|
}
|
|
932
|
-
);
|
|
1453
|
+
) });
|
|
933
1454
|
};
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
1455
|
+
var SearchBox_default = SearchBox;
|
|
1456
|
+
var StyledDialog = styles.styled(material.Dialog)(({ theme }) => ({
|
|
1457
|
+
"& .MuiDialog-paper": {
|
|
1458
|
+
borderRadius: "16px",
|
|
1459
|
+
boxShadow: "0px 2px 16px 0px rgba(0,0,0,0.16)",
|
|
1460
|
+
padding: "24px",
|
|
1461
|
+
maxWidth: "640px",
|
|
1462
|
+
width: "100%"
|
|
1463
|
+
}
|
|
1464
|
+
}));
|
|
1465
|
+
var FilterSection = styles.styled(material.Box)({
|
|
1466
|
+
border: "1px solid rgba(146,144,144,0.3)",
|
|
1467
|
+
borderRadius: "12px",
|
|
1468
|
+
padding: "18px",
|
|
1469
|
+
display: "flex",
|
|
1470
|
+
flexDirection: "column",
|
|
1471
|
+
gap: "22px"
|
|
1472
|
+
});
|
|
1473
|
+
var StyledTextField = styles.styled(material.TextField)({
|
|
1474
|
+
"& .MuiOutlinedInput-root": {
|
|
1475
|
+
borderRadius: "4px",
|
|
1476
|
+
"& fieldset": {
|
|
1477
|
+
borderColor: "#a3a3a3"
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
"& .MuiInputLabel-root": {
|
|
1481
|
+
fontSize: "12px",
|
|
1482
|
+
color: "#666",
|
|
1483
|
+
fontFamily: '"Graphik Web:Regular", sans-serif'
|
|
1484
|
+
},
|
|
1485
|
+
"& .MuiSelect-select": {
|
|
1486
|
+
fontSize: "16px",
|
|
1487
|
+
color: "#666",
|
|
1488
|
+
fontFamily: '"Graphik Web:Regular", sans-serif',
|
|
1489
|
+
textTransform: "capitalize"
|
|
1490
|
+
},
|
|
1491
|
+
"& .MuiSelect-icon": {
|
|
1492
|
+
color: "#666"
|
|
1493
|
+
}
|
|
1494
|
+
});
|
|
1495
|
+
function FilterModal({
|
|
1496
|
+
open,
|
|
1497
|
+
onClose,
|
|
1498
|
+
initialFilters,
|
|
1499
|
+
onApply
|
|
1500
|
+
}) {
|
|
1501
|
+
const { api } = useWorkflowContext();
|
|
1502
|
+
const [approvalType, setApprovalType] = React7.useState(
|
|
1503
|
+
(initialFilters == null ? void 0 : initialFilters.approvalType) || ""
|
|
1504
|
+
);
|
|
1505
|
+
const [approvalStatus, setApprovalStatus] = React7.useState(
|
|
1506
|
+
(initialFilters == null ? void 0 : initialFilters.approvalStatus) || ""
|
|
1507
|
+
);
|
|
1508
|
+
const [sortBy, setSortBy] = React7.useState((initialFilters == null ? void 0 : initialFilters.sortBy) || "");
|
|
1509
|
+
const [approvalTypeOptions, setApprovalTypeOptions] = React7.useState([]);
|
|
1510
|
+
React7.useEffect(() => {
|
|
1511
|
+
api.get({ url: "/workflow/activities?page=1&size=1000", serviceURL: "api" }).then((res) => {
|
|
1512
|
+
var _a;
|
|
1513
|
+
console.log("\u{1F680} ~ FilterModal ~ res:", res);
|
|
1514
|
+
setApprovalTypeOptions(((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || []);
|
|
1515
|
+
}).catch((err) => {
|
|
1516
|
+
console.error("Failed to fetch approval types:", err);
|
|
1517
|
+
});
|
|
1518
|
+
}, [api]);
|
|
1519
|
+
React7.useEffect(() => {
|
|
1520
|
+
if (open) {
|
|
1521
|
+
setApprovalType((initialFilters == null ? void 0 : initialFilters.approvalType) || "");
|
|
1522
|
+
setApprovalStatus((initialFilters == null ? void 0 : initialFilters.approvalStatus) || "");
|
|
1523
|
+
setSortBy((initialFilters == null ? void 0 : initialFilters.sortBy) || "");
|
|
1524
|
+
}
|
|
1525
|
+
}, [open, initialFilters]);
|
|
1526
|
+
const handleClear = () => {
|
|
1527
|
+
setApprovalType("");
|
|
1528
|
+
setApprovalStatus("");
|
|
1529
|
+
setSortBy("");
|
|
942
1530
|
};
|
|
943
|
-
const
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1531
|
+
const handleApply = () => {
|
|
1532
|
+
if (onApply) {
|
|
1533
|
+
onApply({ approvalType, approvalStatus, sortBy });
|
|
1534
|
+
}
|
|
1535
|
+
onClose();
|
|
947
1536
|
};
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
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
|
-
}
|
|
1537
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyledDialog, { open, onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { children: [
|
|
1538
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1539
|
+
material.Box,
|
|
1540
|
+
{
|
|
1541
|
+
sx: {
|
|
1542
|
+
display: "flex",
|
|
1543
|
+
justifyContent: "space-between",
|
|
1544
|
+
alignItems: "center",
|
|
1545
|
+
mb: 3
|
|
1546
|
+
},
|
|
1547
|
+
children: [
|
|
1548
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1549
|
+
material.Typography,
|
|
1550
|
+
{
|
|
1551
|
+
sx: {
|
|
1552
|
+
fontSize: "20px",
|
|
1553
|
+
color: "#666",
|
|
1554
|
+
fontFamily: '"Graphik Web:Medium", sans-serif',
|
|
1555
|
+
textTransform: "capitalize"
|
|
1556
|
+
},
|
|
1557
|
+
children: "Filter"
|
|
1558
|
+
}
|
|
1559
|
+
),
|
|
1560
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { display: "flex", gap: "12px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1561
|
+
material.Button,
|
|
1562
|
+
{
|
|
1563
|
+
onClick: handleClear,
|
|
1564
|
+
sx: {
|
|
1565
|
+
color: "#666",
|
|
1566
|
+
textTransform: "capitalize",
|
|
1567
|
+
fontSize: "14px",
|
|
1568
|
+
fontFamily: '"Graphik Web:Medium", sans-serif',
|
|
1569
|
+
borderRadius: "100px",
|
|
1570
|
+
height: "40px",
|
|
1571
|
+
"&:hover": {
|
|
1572
|
+
backgroundColor: "rgba(0,0,0,0.04)"
|
|
999
1573
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
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
|
-
]
|
|
1574
|
+
},
|
|
1575
|
+
children: "Clear Filter"
|
|
1576
|
+
}
|
|
1577
|
+
) })
|
|
1578
|
+
]
|
|
1579
|
+
}
|
|
1580
|
+
),
|
|
1581
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", flexDirection: "column", gap: "24px" }, children: [
|
|
1582
|
+
/* @__PURE__ */ jsxRuntime.jsx(FilterSection, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1583
|
+
StyledTextField,
|
|
1584
|
+
{
|
|
1585
|
+
select: true,
|
|
1586
|
+
label: "Approval Type",
|
|
1587
|
+
value: approvalType,
|
|
1588
|
+
onChange: (e) => setApprovalType(e.target.value),
|
|
1589
|
+
fullWidth: true,
|
|
1590
|
+
SelectProps: {
|
|
1591
|
+
IconComponent: KeyboardArrowDownIcon__default.default
|
|
1067
1592
|
},
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
})
|
|
1071
|
-
|
|
1072
|
-
|
|
1593
|
+
children: approvalTypeOptions.length && (approvalTypeOptions == null ? void 0 : approvalTypeOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { value: option.id, children: option.activity_name }, option.id)))
|
|
1594
|
+
}
|
|
1595
|
+
) }),
|
|
1596
|
+
/* @__PURE__ */ jsxRuntime.jsx(FilterSection, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1597
|
+
StyledTextField,
|
|
1598
|
+
{
|
|
1599
|
+
select: true,
|
|
1600
|
+
label: "Sort By",
|
|
1601
|
+
value: sortBy,
|
|
1602
|
+
onChange: (e) => setSortBy(e.target.value),
|
|
1603
|
+
fullWidth: true,
|
|
1604
|
+
SelectProps: {
|
|
1605
|
+
IconComponent: KeyboardArrowDownIcon__default.default
|
|
1606
|
+
},
|
|
1607
|
+
children: [
|
|
1608
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { value: "asc", children: "Ascending" }),
|
|
1609
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { value: "desc", children: "Descending" })
|
|
1610
|
+
]
|
|
1611
|
+
}
|
|
1612
|
+
) })
|
|
1613
|
+
] }),
|
|
1614
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1615
|
+
material.Box,
|
|
1616
|
+
{
|
|
1617
|
+
sx: {
|
|
1618
|
+
display: "flex",
|
|
1619
|
+
justifyContent: "flex-end",
|
|
1620
|
+
gap: "10px",
|
|
1621
|
+
mt: 3,
|
|
1622
|
+
pt: "10px"
|
|
1623
|
+
},
|
|
1624
|
+
children: [
|
|
1625
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1626
|
+
material.Button,
|
|
1627
|
+
{
|
|
1628
|
+
onClick: onClose,
|
|
1629
|
+
variant: "outlined",
|
|
1630
|
+
sx: {
|
|
1631
|
+
color: "#666",
|
|
1632
|
+
borderColor: "#666",
|
|
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
|
+
borderColor: "#666",
|
|
1641
|
+
backgroundColor: "rgba(0,0,0,0.04)"
|
|
1642
|
+
}
|
|
1643
|
+
},
|
|
1644
|
+
children: "Cancel"
|
|
1645
|
+
}
|
|
1646
|
+
),
|
|
1647
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1648
|
+
material.Button,
|
|
1649
|
+
{
|
|
1650
|
+
onClick: handleApply,
|
|
1651
|
+
variant: "contained",
|
|
1652
|
+
sx: {
|
|
1653
|
+
backgroundColor: "#3f41d1",
|
|
1654
|
+
color: "white",
|
|
1655
|
+
textTransform: "capitalize",
|
|
1656
|
+
fontSize: "14px",
|
|
1657
|
+
fontFamily: '"Graphik Web:Medium", sans-serif',
|
|
1658
|
+
borderRadius: "100px",
|
|
1659
|
+
height: "40px",
|
|
1660
|
+
px: "24px",
|
|
1661
|
+
"&:hover": {
|
|
1662
|
+
backgroundColor: "#2f31b1"
|
|
1663
|
+
}
|
|
1664
|
+
},
|
|
1665
|
+
children: "Apply"
|
|
1666
|
+
}
|
|
1667
|
+
)
|
|
1668
|
+
]
|
|
1669
|
+
}
|
|
1670
|
+
)
|
|
1671
|
+
] }) });
|
|
1073
1672
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
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,
|
|
1673
|
+
function FilterButton({ onClick }) {
|
|
1674
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1675
|
+
material.Button,
|
|
1093
1676
|
{
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1677
|
+
onClick,
|
|
1678
|
+
variant: "contained",
|
|
1679
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.FilterAlt, { sx: { fontSize: "18px" } }),
|
|
1680
|
+
sx: {
|
|
1681
|
+
backgroundColor: "#f4f0ef !important",
|
|
1682
|
+
color: "#666 !important",
|
|
1683
|
+
fontFamily: "Poppins, sans-serif",
|
|
1684
|
+
fontWeight: 500,
|
|
1685
|
+
fontSize: "14px",
|
|
1686
|
+
letterSpacing: "0.1px",
|
|
1687
|
+
textTransform: "none",
|
|
1688
|
+
borderRadius: "100px",
|
|
1689
|
+
height: "40px",
|
|
1690
|
+
paddingLeft: "16px",
|
|
1691
|
+
paddingRight: "24px",
|
|
1692
|
+
paddingTop: "10px",
|
|
1693
|
+
paddingBottom: "10px",
|
|
1694
|
+
gap: "8px",
|
|
1695
|
+
boxShadow: "none",
|
|
1696
|
+
"&:hover": {
|
|
1697
|
+
backgroundColor: "#ebe7e6 !important",
|
|
1698
|
+
boxShadow: "none"
|
|
1699
|
+
},
|
|
1700
|
+
"&:active": {
|
|
1701
|
+
boxShadow: "none"
|
|
1702
|
+
}
|
|
1703
|
+
},
|
|
1704
|
+
children: "Filter"
|
|
1113
1705
|
}
|
|
1114
|
-
)
|
|
1115
|
-
}
|
|
1116
|
-
var SearchBox_default = SearchBox;
|
|
1706
|
+
);
|
|
1707
|
+
}
|
|
1117
1708
|
var StyledChipProps = material.styled(material.Chip)(({ theme }) => {
|
|
1118
1709
|
var _a, _b, _c;
|
|
1119
1710
|
return {
|
|
@@ -1147,11 +1738,11 @@ function ApprovalWorkflow({
|
|
|
1147
1738
|
selectedWorkflowsList = [],
|
|
1148
1739
|
userInfo
|
|
1149
1740
|
}) {
|
|
1150
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1741
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
1151
1742
|
material.useTheme();
|
|
1152
1743
|
const { api, urlBuilder, loadingComponent, ENV_VARIABLES } = useWorkflowContext();
|
|
1153
|
-
const [
|
|
1154
|
-
selectedWorkflowsList.length ? "selected" : "
|
|
1744
|
+
const [selectedOption, setSelectedOption] = React7.useState(
|
|
1745
|
+
selectedWorkflowsList.length ? "selected" : "Assign To Me"
|
|
1155
1746
|
);
|
|
1156
1747
|
const [expandedId, setExpandedId] = React7.useState(null);
|
|
1157
1748
|
const [sendDialog, setSendDialog] = React7__default.default.useState(null);
|
|
@@ -1160,80 +1751,112 @@ function ApprovalWorkflow({
|
|
|
1160
1751
|
const [onHoldTarget, setOnHoldTarget] = React7__default.default.useState(null);
|
|
1161
1752
|
const [expandedDetails, setExpandedDetails] = React7.useState([]);
|
|
1162
1753
|
console.log("\u{1F680} ~ ApprovalWorkflow ~ expandedDetails:", expandedDetails);
|
|
1754
|
+
const [descriptionView, setDescriptionView] = React7.useState(null);
|
|
1163
1755
|
const [urlConfig, setUrlConfig] = React7.useState({});
|
|
1164
|
-
const [
|
|
1165
|
-
const [
|
|
1166
|
-
const [
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1756
|
+
const [viewMoreDetails, setViewMoreDetails] = React7.useState(null);
|
|
1757
|
+
const [isViewMoreOpen, setIsViewMoreOpen] = React7.useState(false);
|
|
1758
|
+
const [isFilterOpen, setIsFilterOpen] = React7.useState(false);
|
|
1759
|
+
const handleOpenViewMore = (details) => {
|
|
1760
|
+
setViewMoreDetails(details);
|
|
1761
|
+
setIsViewMoreOpen(true);
|
|
1762
|
+
};
|
|
1763
|
+
const handleCloseViewMore = () => {
|
|
1764
|
+
setIsViewMoreOpen(false);
|
|
1765
|
+
setViewMoreDetails(null);
|
|
1766
|
+
};
|
|
1767
|
+
const [tabs, setTabs] = React7.useState({
|
|
1768
|
+
"Assign To Me": {
|
|
1769
|
+
data: [],
|
|
1770
|
+
page: 1,
|
|
1771
|
+
search: "",
|
|
1772
|
+
hasMore: true,
|
|
1773
|
+
loading: false,
|
|
1774
|
+
initialized: false,
|
|
1775
|
+
filters: null
|
|
1776
|
+
},
|
|
1777
|
+
"All Requests": {
|
|
1778
|
+
data: [],
|
|
1779
|
+
page: 1,
|
|
1780
|
+
search: "",
|
|
1781
|
+
hasMore: true,
|
|
1782
|
+
loading: false,
|
|
1783
|
+
initialized: false,
|
|
1784
|
+
filters: null
|
|
1785
|
+
},
|
|
1786
|
+
Completed: {
|
|
1787
|
+
data: [],
|
|
1788
|
+
page: 1,
|
|
1789
|
+
search: "",
|
|
1790
|
+
hasMore: true,
|
|
1791
|
+
loading: false,
|
|
1792
|
+
initialized: false,
|
|
1793
|
+
filters: null
|
|
1794
|
+
},
|
|
1795
|
+
selected: {
|
|
1796
|
+
data: [],
|
|
1797
|
+
page: 1,
|
|
1798
|
+
search: "",
|
|
1799
|
+
hasMore: true,
|
|
1800
|
+
loading: false,
|
|
1801
|
+
initialized: false,
|
|
1802
|
+
filters: null
|
|
1803
|
+
}
|
|
1804
|
+
});
|
|
1805
|
+
console.log("\u{1F680} ~ ApprovalWorkflow ~ tabs:", tabs);
|
|
1171
1806
|
const [searchText, setSearchText] = React7.useState("");
|
|
1807
|
+
const debouncedSearchTerm = useDebounce_default(searchText, 500);
|
|
1808
|
+
React7.useEffect(() => {
|
|
1809
|
+
var _a2;
|
|
1810
|
+
setSearchText(((_a2 = tabs[selectedOption]) == null ? void 0 : _a2.search) || "");
|
|
1811
|
+
}, [selectedOption]);
|
|
1812
|
+
React7.useEffect(() => {
|
|
1813
|
+
var _a2, _b2;
|
|
1814
|
+
if (debouncedSearchTerm !== tabs[selectedOption].search && ((_a2 = tabs[selectedOption]) == null ? void 0 : _a2.initialized)) {
|
|
1815
|
+
setTabs((prev) => ({
|
|
1816
|
+
...prev,
|
|
1817
|
+
[selectedOption]: {
|
|
1818
|
+
...prev[selectedOption],
|
|
1819
|
+
search: debouncedSearchTerm,
|
|
1820
|
+
page: 1,
|
|
1821
|
+
hasMore: true,
|
|
1822
|
+
data: []
|
|
1823
|
+
// Clear data on new search
|
|
1824
|
+
}
|
|
1825
|
+
}));
|
|
1826
|
+
fetchData(
|
|
1827
|
+
selectedOption,
|
|
1828
|
+
1,
|
|
1829
|
+
debouncedSearchTerm,
|
|
1830
|
+
(_b2 = tabs[selectedOption]) == null ? void 0 : _b2.filters
|
|
1831
|
+
);
|
|
1832
|
+
}
|
|
1833
|
+
}, [debouncedSearchTerm]);
|
|
1172
1834
|
const handleClearSearch = React7.useCallback(() => {
|
|
1173
1835
|
setSearchText("");
|
|
1174
1836
|
}, []);
|
|
1175
1837
|
const handleSearchChange = React7.useCallback((value) => {
|
|
1176
1838
|
setSearchText(value);
|
|
1177
1839
|
}, []);
|
|
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
1840
|
const observer = React7__default.default.useRef(null);
|
|
1207
1841
|
const lastCardRef = React7.useCallback(
|
|
1208
1842
|
(node) => {
|
|
1209
|
-
|
|
1843
|
+
const currentTab = tabs[selectedOption];
|
|
1844
|
+
if ((currentTab == null ? void 0 : currentTab.loading) || !(currentTab == null ? void 0 : currentTab.hasMore)) return;
|
|
1210
1845
|
if (observer.current) observer.current.disconnect();
|
|
1211
1846
|
observer.current = new IntersectionObserver((entries) => {
|
|
1212
1847
|
if (entries[0].isIntersecting) {
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
}
|
|
1848
|
+
setTabs((prev) => ({
|
|
1849
|
+
...prev,
|
|
1850
|
+
[selectedOption]: {
|
|
1851
|
+
...prev[selectedOption],
|
|
1852
|
+
page: prev[selectedOption].page + 1
|
|
1853
|
+
}
|
|
1854
|
+
}));
|
|
1220
1855
|
}
|
|
1221
1856
|
});
|
|
1222
1857
|
if (node) observer.current.observe(node);
|
|
1223
1858
|
},
|
|
1224
|
-
[
|
|
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
|
|
1859
|
+
[tabs, selectedOption]
|
|
1237
1860
|
);
|
|
1238
1861
|
const handleSendBack = (workflowLogId) => {
|
|
1239
1862
|
setSendDialog(workflowLogId);
|
|
@@ -1247,11 +1870,108 @@ function ApprovalWorkflow({
|
|
|
1247
1870
|
const handleOnHold = (workflowLogId) => {
|
|
1248
1871
|
setOnHoldTarget(workflowLogId);
|
|
1249
1872
|
};
|
|
1873
|
+
const handleApplyFilter = (filters) => {
|
|
1874
|
+
setTabs((prev) => ({
|
|
1875
|
+
...prev,
|
|
1876
|
+
[selectedOption]: {
|
|
1877
|
+
...prev[selectedOption],
|
|
1878
|
+
filters,
|
|
1879
|
+
page: 1,
|
|
1880
|
+
hasMore: true,
|
|
1881
|
+
data: []
|
|
1882
|
+
}
|
|
1883
|
+
}));
|
|
1884
|
+
setIsFilterOpen(false);
|
|
1885
|
+
fetchData(selectedOption, 1, tabs[selectedOption].search, filters);
|
|
1886
|
+
};
|
|
1887
|
+
const fetchData = React7.useCallback(
|
|
1888
|
+
(tab, page, search, filtersOverride) => {
|
|
1889
|
+
var _a2, _b2;
|
|
1890
|
+
if (!((_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id)) return;
|
|
1891
|
+
const currentFilters = filtersOverride || ((_b2 = tabs[tab]) == null ? void 0 : _b2.filters);
|
|
1892
|
+
console.log("\u{1F680} ~ ApprovalWorkflow ~ currentFilters:", currentFilters);
|
|
1893
|
+
let filterQuery = "";
|
|
1894
|
+
if (currentFilters) {
|
|
1895
|
+
if (currentFilters.approvalType)
|
|
1896
|
+
filterQuery += `&activityId=${encodeURIComponent(
|
|
1897
|
+
currentFilters.approvalType
|
|
1898
|
+
)}`;
|
|
1899
|
+
if (currentFilters.approvalStatus)
|
|
1900
|
+
filterQuery += `&approval_status=${encodeURIComponent(
|
|
1901
|
+
currentFilters.approvalStatus
|
|
1902
|
+
)}`;
|
|
1903
|
+
if (currentFilters.sortBy)
|
|
1904
|
+
filterQuery += `&tat=${encodeURIComponent(currentFilters.sortBy)}`;
|
|
1905
|
+
}
|
|
1906
|
+
let url = "";
|
|
1907
|
+
const query = `paginate=${true}&page=${page}&size=10&search=${encodeURIComponent(
|
|
1908
|
+
search
|
|
1909
|
+
)}${filterQuery}`;
|
|
1910
|
+
if (tab === "Assign To Me") {
|
|
1911
|
+
url = `/workflow/activity-workflow/${userInfo.userInfo.id}?${query}&type=pending`;
|
|
1912
|
+
} else if (tab === "All Requests") {
|
|
1913
|
+
url = `/workflow/activity-workflow/${userInfo.userInfo.id}?${query}`;
|
|
1914
|
+
} else if (tab === "Completed") {
|
|
1915
|
+
url = `/workflow/activity-workflow/${userInfo.userInfo.id}?${query}&type=completed`;
|
|
1916
|
+
} else if (tab === "selected") {
|
|
1917
|
+
if (selectedWorkflowsList.length && !tabs["selected"].initialized) {
|
|
1918
|
+
api.post({
|
|
1919
|
+
url: `/workflow/bulk-details`,
|
|
1920
|
+
serviceURL: "api",
|
|
1921
|
+
data: { workflowIds: selectedWorkflowsList }
|
|
1922
|
+
}).then((res) => {
|
|
1923
|
+
setTabs((prev) => ({
|
|
1924
|
+
...prev,
|
|
1925
|
+
selected: {
|
|
1926
|
+
...prev.selected,
|
|
1927
|
+
data: (res == null ? void 0 : res.data) || [],
|
|
1928
|
+
loading: false,
|
|
1929
|
+
initialized: true,
|
|
1930
|
+
hasMore: false
|
|
1931
|
+
// No pagination for selected for now
|
|
1932
|
+
}
|
|
1933
|
+
}));
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
return;
|
|
1937
|
+
}
|
|
1938
|
+
if (!url) return;
|
|
1939
|
+
setTabs((prev) => ({
|
|
1940
|
+
...prev,
|
|
1941
|
+
[tab]: { ...prev[tab], loading: true }
|
|
1942
|
+
}));
|
|
1943
|
+
api.get({ url, serviceURL: "api" }).then((res) => {
|
|
1944
|
+
var _a3;
|
|
1945
|
+
const newItems = ((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.activities) || [];
|
|
1946
|
+
setTabs((prev) => {
|
|
1947
|
+
var _a4;
|
|
1948
|
+
return {
|
|
1949
|
+
...prev,
|
|
1950
|
+
[tab]: {
|
|
1951
|
+
...prev[tab],
|
|
1952
|
+
data: page === 1 ? newItems : [...prev[tab].data, ...newItems],
|
|
1953
|
+
count: (_a4 = res == null ? void 0 : res.data) == null ? void 0 : _a4.totalCount,
|
|
1954
|
+
loading: false,
|
|
1955
|
+
hasMore: newItems.length === 10,
|
|
1956
|
+
initialized: true
|
|
1957
|
+
}
|
|
1958
|
+
};
|
|
1959
|
+
});
|
|
1960
|
+
}).catch(() => {
|
|
1961
|
+
setTabs((prev) => ({
|
|
1962
|
+
...prev,
|
|
1963
|
+
[tab]: { ...prev[tab], loading: false }
|
|
1964
|
+
}));
|
|
1965
|
+
});
|
|
1966
|
+
},
|
|
1967
|
+
[api, userInfo, selectedWorkflowsList, tabs]
|
|
1968
|
+
);
|
|
1250
1969
|
const handleProfileToggle = (option) => {
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
if (option
|
|
1254
|
-
|
|
1970
|
+
var _a2, _b2;
|
|
1971
|
+
setSelectedOption(option);
|
|
1972
|
+
if (!((_a2 = tabs[option]) == null ? void 0 : _a2.initialized)) {
|
|
1973
|
+
fetchData(option, 1, ((_b2 = tabs[option]) == null ? void 0 : _b2.search) || "");
|
|
1974
|
+
}
|
|
1255
1975
|
};
|
|
1256
1976
|
const handleExpandClick = (id) => {
|
|
1257
1977
|
setExpandedId((prevId) => prevId === id ? null : id);
|
|
@@ -1299,14 +2019,19 @@ function ApprovalWorkflow({
|
|
|
1299
2019
|
};
|
|
1300
2020
|
const approvalChipLabel = [
|
|
1301
2021
|
{
|
|
1302
|
-
label: "
|
|
2022
|
+
label: "Assign To Me",
|
|
1303
2023
|
icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-document-forward" }),
|
|
1304
|
-
count:
|
|
2024
|
+
count: ((_a = tabs["Assign To Me"]) == null ? void 0 : _a.count) || 0
|
|
1305
2025
|
},
|
|
1306
2026
|
{
|
|
1307
2027
|
label: "All Requests",
|
|
1308
2028
|
icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-document-copy" }),
|
|
1309
|
-
count:
|
|
2029
|
+
count: ((_b = tabs["All Requests"]) == null ? void 0 : _b.count) || 0
|
|
2030
|
+
},
|
|
2031
|
+
{
|
|
2032
|
+
label: "Completed",
|
|
2033
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-tick-circle" }),
|
|
2034
|
+
count: ((_c = tabs["Completed"]) == null ? void 0 : _c.count) || 0
|
|
1310
2035
|
}
|
|
1311
2036
|
];
|
|
1312
2037
|
const fetchExpandedActivityLogs = (workflowLogId) => {
|
|
@@ -1316,62 +2041,28 @@ function ApprovalWorkflow({
|
|
|
1316
2041
|
serviceURL: "api"
|
|
1317
2042
|
}).then((res) => setExpandedDetails(res == null ? void 0 : res.data));
|
|
1318
2043
|
};
|
|
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
2044
|
React7.useEffect(() => {
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
2045
|
+
var _a2;
|
|
2046
|
+
if ((_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id) {
|
|
2047
|
+
const tabsToFetch = ["Assign To Me", "All Requests", "Completed"];
|
|
2048
|
+
tabsToFetch.forEach((tab) => {
|
|
2049
|
+
var _a3;
|
|
2050
|
+
if (!((_a3 = tabs[tab]) == null ? void 0 : _a3.initialized)) {
|
|
2051
|
+
fetchData(tab, 1, "");
|
|
2052
|
+
}
|
|
2053
|
+
});
|
|
1355
2054
|
}
|
|
1356
|
-
}, [
|
|
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
|
-
}, []);
|
|
2055
|
+
}, [userInfo]);
|
|
1367
2056
|
React7.useEffect(() => {
|
|
1368
|
-
|
|
1369
|
-
|
|
2057
|
+
const tabState = tabs[selectedOption];
|
|
2058
|
+
if ((tabState == null ? void 0 : tabState.page) > 1) {
|
|
2059
|
+
fetchData(selectedOption, tabState.page, tabState.search);
|
|
1370
2060
|
}
|
|
1371
|
-
}, [
|
|
2061
|
+
}, [(_d = tabs[selectedOption]) == null ? void 0 : _d.page]);
|
|
1372
2062
|
React7.useEffect(() => {
|
|
1373
|
-
|
|
1374
|
-
|
|
2063
|
+
var _a2;
|
|
2064
|
+
if (Object.keys(urlConfig).length > 0 && userInfo && !tabs["Assign To Me"].initialized) {
|
|
2065
|
+
fetchData("Assign To Me", 1, ((_a2 = tabs["Assign To Me"]) == null ? void 0 : _a2.search) || "");
|
|
1375
2066
|
}
|
|
1376
2067
|
}, [urlConfig, userInfo]);
|
|
1377
2068
|
const buildRedirectionUrl = (info) => {
|
|
@@ -1398,28 +2089,17 @@ function ApprovalWorkflow({
|
|
|
1398
2089
|
}
|
|
1399
2090
|
return "#";
|
|
1400
2091
|
};
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
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 });
|
|
2092
|
+
function timeLeftDHm(targetISO) {
|
|
2093
|
+
const diff = new Date(targetISO).getTime() - Date.now();
|
|
2094
|
+
if (diff <= 0) return "0d: 0h: 0m";
|
|
2095
|
+
const totalMinutes = Math.floor(diff / 6e4);
|
|
2096
|
+
const d = Math.floor(totalMinutes / 1440);
|
|
2097
|
+
const h = Math.floor(totalMinutes % 1440 / 60);
|
|
2098
|
+
const m = totalMinutes % 60;
|
|
2099
|
+
return `${d}d: ${h}h: ${m}m`;
|
|
2100
|
+
}
|
|
2101
|
+
if (((_e = tabs[selectedOption]) == null ? void 0 : _e.loading) && ((_f = tabs[selectedOption]) == null ? void 0 : _f.page) === 1 && loadingComponent)
|
|
2102
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingComponent });
|
|
1423
2103
|
console.info("LIBRARY RUNNING...");
|
|
1424
2104
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1425
2105
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1429,12 +2109,19 @@ function ApprovalWorkflow({
|
|
|
1429
2109
|
display: "flex",
|
|
1430
2110
|
justifyContent: "center",
|
|
1431
2111
|
flexWrap: "nowrap",
|
|
2112
|
+
// width:"1100px",height:"90%",
|
|
1432
2113
|
overflow: "hidden !important"
|
|
1433
2114
|
},
|
|
1434
2115
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1435
2116
|
system.Box,
|
|
1436
2117
|
{
|
|
1437
|
-
sx: {
|
|
2118
|
+
sx: {
|
|
2119
|
+
width: "1141px",
|
|
2120
|
+
maxWidth: "1141px",
|
|
2121
|
+
minWidth: "1141px",
|
|
2122
|
+
height: "100%",
|
|
2123
|
+
overflow: "hidden !important"
|
|
2124
|
+
},
|
|
1438
2125
|
children: [
|
|
1439
2126
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1440
2127
|
system.Box,
|
|
@@ -1442,16 +2129,16 @@ function ApprovalWorkflow({
|
|
|
1442
2129
|
sx: {
|
|
1443
2130
|
display: "flex",
|
|
1444
2131
|
justifyContent: "space-between",
|
|
1445
|
-
alignItems: "
|
|
2132
|
+
alignItems: "flex-start"
|
|
1446
2133
|
},
|
|
1447
2134
|
children: [
|
|
1448
|
-
/* @__PURE__ */ jsxRuntime.jsxs(system.Box, {
|
|
2135
|
+
/* @__PURE__ */ jsxRuntime.jsxs(system.Box, { children: [
|
|
1449
2136
|
(selectedWorkflowsList == null ? void 0 : selectedWorkflowsList.length) ? /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "Selected Workflows", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1450
2137
|
StyledChipProps,
|
|
1451
2138
|
{
|
|
1452
2139
|
label: "Selected",
|
|
1453
2140
|
icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-eye" }),
|
|
1454
|
-
color: (
|
|
2141
|
+
color: (selectedOption == null ? void 0 : selectedOption.includes("selected")) ? "primary" : "default",
|
|
1455
2142
|
variant: "filled",
|
|
1456
2143
|
sx: {
|
|
1457
2144
|
mr: 4,
|
|
@@ -1466,7 +2153,7 @@ function ApprovalWorkflow({
|
|
|
1466
2153
|
{
|
|
1467
2154
|
label: `${count} ${label}`,
|
|
1468
2155
|
icon,
|
|
1469
|
-
color: (
|
|
2156
|
+
color: (selectedOption == null ? void 0 : selectedOption.includes(label)) ? "primary" : "default",
|
|
1470
2157
|
variant: "filled",
|
|
1471
2158
|
sx: {
|
|
1472
2159
|
mr: 4,
|
|
@@ -1477,343 +2164,33 @@ function ApprovalWorkflow({
|
|
|
1477
2164
|
}
|
|
1478
2165
|
) }, index))
|
|
1479
2166
|
] }),
|
|
1480
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
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,
|
|
2167
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex" }, children: [
|
|
2168
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2169
|
+
system.Box,
|
|
2170
|
+
{
|
|
2171
|
+
sx: {
|
|
2172
|
+
flexGrow: 1,
|
|
2173
|
+
maxWidth: 295,
|
|
2174
|
+
ml: "auto",
|
|
2175
|
+
mr: "10px"
|
|
2176
|
+
},
|
|
2177
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2178
|
+
SearchBox_default,
|
|
1749
2179
|
{
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
alignItems: "center"
|
|
1755
|
-
},
|
|
1756
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
|
|
2180
|
+
placeHolderTitle: "Search",
|
|
2181
|
+
searchText,
|
|
2182
|
+
handleClearSearch,
|
|
2183
|
+
handleInputChange: (e) => handleSearchChange(e.target.value)
|
|
1757
2184
|
}
|
|
1758
|
-
)
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
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
|
-
)
|
|
2185
|
+
)
|
|
2186
|
+
}
|
|
2187
|
+
),
|
|
2188
|
+
/* @__PURE__ */ jsxRuntime.jsx(FilterButton, { onClick: () => setIsFilterOpen((prev) => !prev) })
|
|
2189
|
+
] })
|
|
2190
|
+
]
|
|
1814
2191
|
}
|
|
1815
2192
|
),
|
|
1816
|
-
|
|
2193
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1817
2194
|
system.Box,
|
|
1818
2195
|
{
|
|
1819
2196
|
className: "fixedModal hide-scrollbar",
|
|
@@ -1823,627 +2200,60 @@ function ApprovalWorkflow({
|
|
|
1823
2200
|
px: 2,
|
|
1824
2201
|
pb: 3
|
|
1825
2202
|
},
|
|
1826
|
-
children:
|
|
1827
|
-
|
|
1828
|
-
|
|
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,
|
|
2203
|
+
children: [
|
|
2204
|
+
((_g = tabs[selectedOption]) == null ? void 0 : _g.loading) && ((_h = tabs[selectedOption]) == null ? void 0 : _h.page) === 1 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2205
|
+
system.Box,
|
|
1855
2206
|
{
|
|
1856
|
-
ref: index === visibleAllRequests.length - 1 ? lastCardRef : null,
|
|
1857
2207
|
sx: {
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
2208
|
+
display: "flex",
|
|
2209
|
+
justifyContent: "center",
|
|
2210
|
+
alignItems: "center",
|
|
2211
|
+
height: "100%",
|
|
2212
|
+
p: 4,
|
|
2213
|
+
width: "1100px"
|
|
1864
2214
|
},
|
|
1865
|
-
children:
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
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
|
-
]
|
|
2215
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, {})
|
|
2216
|
+
}
|
|
2217
|
+
) : ((_j = (_i = tabs[selectedOption]) == null ? void 0 : _i.data) == null ? void 0 : _j.length) > 0 ? tabs[selectedOption].data.map((info, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2218
|
+
WorkflowRequestCard,
|
|
2219
|
+
{
|
|
2220
|
+
requestDetails: info,
|
|
2221
|
+
index,
|
|
2222
|
+
isLast: index === tabs[selectedOption].data.length - 1,
|
|
2223
|
+
lastCardRef,
|
|
2224
|
+
expandedId,
|
|
2225
|
+
handleExpandClick,
|
|
2226
|
+
handleOpenViewMore,
|
|
2227
|
+
handleApprove,
|
|
2228
|
+
handleReject,
|
|
2229
|
+
handleSendBack,
|
|
2230
|
+
handleOnHold,
|
|
2231
|
+
expandedDetails,
|
|
2232
|
+
userInfo,
|
|
2233
|
+
helpers: {
|
|
2234
|
+
timeLeftDHm,
|
|
2235
|
+
getStatus,
|
|
2236
|
+
buildRedirectionUrl
|
|
2237
|
+
}
|
|
2130
2238
|
},
|
|
2131
2239
|
index
|
|
2132
|
-
)
|
|
2133
|
-
|
|
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,
|
|
2240
|
+
)) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2241
|
+
"div",
|
|
2179
2242
|
{
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2243
|
+
style: {
|
|
2244
|
+
height: "100%",
|
|
2245
|
+
width: "1100px",
|
|
2246
|
+
color: "gray",
|
|
2247
|
+
fontSize: "20px",
|
|
2248
|
+
display: "flex",
|
|
2249
|
+
justifyContent: "center",
|
|
2250
|
+
alignItems: "center"
|
|
2188
2251
|
},
|
|
2189
|
-
children:
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
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
|
-
)
|
|
2252
|
+
children: "NO RECORD FOUND"
|
|
2253
|
+
}
|
|
2254
|
+
),
|
|
2255
|
+
((_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 }) })
|
|
2256
|
+
]
|
|
2447
2257
|
}
|
|
2448
2258
|
)
|
|
2449
2259
|
]
|
|
@@ -2466,8 +2276,8 @@ function ApprovalWorkflow({
|
|
|
2466
2276
|
openModal: !!approveTarget,
|
|
2467
2277
|
closeModal: () => setApproveTarget(null),
|
|
2468
2278
|
header: "Approve",
|
|
2469
|
-
workflowLogId: (
|
|
2470
|
-
statusId: (
|
|
2279
|
+
workflowLogId: (_m = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _m[0],
|
|
2280
|
+
statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1]
|
|
2471
2281
|
}
|
|
2472
2282
|
),
|
|
2473
2283
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2476,9 +2286,9 @@ function ApprovalWorkflow({
|
|
|
2476
2286
|
openModal: !!rejectTarget,
|
|
2477
2287
|
closeModal: () => setRejectTarget(null),
|
|
2478
2288
|
header: "Reject",
|
|
2479
|
-
workflowLogId: (
|
|
2480
|
-
statusId: (
|
|
2481
|
-
rejection_reason_master: (
|
|
2289
|
+
workflowLogId: (_o = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _o[0],
|
|
2290
|
+
statusId: (_p = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _p[1],
|
|
2291
|
+
rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2]
|
|
2482
2292
|
}
|
|
2483
2293
|
),
|
|
2484
2294
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2487,8 +2297,79 @@ function ApprovalWorkflow({
|
|
|
2487
2297
|
openModal: !!onHoldTarget,
|
|
2488
2298
|
closeModal: () => setOnHoldTarget(null),
|
|
2489
2299
|
header: "On Hold",
|
|
2490
|
-
workflowLogId: (
|
|
2491
|
-
statusId: (
|
|
2300
|
+
workflowLogId: (_r = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _r[0],
|
|
2301
|
+
statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1]
|
|
2302
|
+
}
|
|
2303
|
+
),
|
|
2304
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2305
|
+
material.Dialog,
|
|
2306
|
+
{
|
|
2307
|
+
open: isViewMoreOpen,
|
|
2308
|
+
onClose: handleCloseViewMore,
|
|
2309
|
+
maxWidth: "sm",
|
|
2310
|
+
fullWidth: true,
|
|
2311
|
+
PaperProps: {
|
|
2312
|
+
sx: {
|
|
2313
|
+
borderRadius: "16px",
|
|
2314
|
+
padding: "10px",
|
|
2315
|
+
position: "relative"
|
|
2316
|
+
// For absolute close button
|
|
2317
|
+
}
|
|
2318
|
+
},
|
|
2319
|
+
children: [
|
|
2320
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2321
|
+
material.DialogTitle,
|
|
2322
|
+
{
|
|
2323
|
+
sx: {
|
|
2324
|
+
display: "flex",
|
|
2325
|
+
justifyContent: "space-between",
|
|
2326
|
+
alignItems: "center",
|
|
2327
|
+
paddingBottom: "10px"
|
|
2328
|
+
},
|
|
2329
|
+
children: [
|
|
2330
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h6", sx: { fontWeight: 600 }, children: "Description Details" }),
|
|
2331
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2332
|
+
material.IconButton,
|
|
2333
|
+
{
|
|
2334
|
+
onClick: handleCloseViewMore,
|
|
2335
|
+
sx: {
|
|
2336
|
+
position: "absolute",
|
|
2337
|
+
right: 8,
|
|
2338
|
+
top: 8,
|
|
2339
|
+
color: (theme2) => theme2.palette.grey[500]
|
|
2340
|
+
},
|
|
2341
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon__default.default, {})
|
|
2342
|
+
}
|
|
2343
|
+
)
|
|
2344
|
+
]
|
|
2345
|
+
}
|
|
2346
|
+
),
|
|
2347
|
+
/* @__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(
|
|
2348
|
+
material.Typography,
|
|
2349
|
+
{
|
|
2350
|
+
className: "detail-item",
|
|
2351
|
+
sx: { fontSize: "14px" },
|
|
2352
|
+
children: [
|
|
2353
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontWeight: "bold", color: "#666" }, children: [
|
|
2354
|
+
data[0].replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()),
|
|
2355
|
+
":"
|
|
2356
|
+
] }),
|
|
2357
|
+
" ",
|
|
2358
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#000" }, children: data[1] })
|
|
2359
|
+
]
|
|
2360
|
+
},
|
|
2361
|
+
idx
|
|
2362
|
+
)) }) })
|
|
2363
|
+
]
|
|
2364
|
+
}
|
|
2365
|
+
),
|
|
2366
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2367
|
+
FilterModal,
|
|
2368
|
+
{
|
|
2369
|
+
open: isFilterOpen,
|
|
2370
|
+
onClose: () => setIsFilterOpen(false),
|
|
2371
|
+
initialFilters: (_t = tabs[selectedOption]) == null ? void 0 : _t.filters,
|
|
2372
|
+
onApply: handleApplyFilter
|
|
2492
2373
|
}
|
|
2493
2374
|
)
|
|
2494
2375
|
] });
|
|
@@ -2518,13 +2399,29 @@ function DialogOpener({
|
|
|
2518
2399
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2519
2400
|
Dialog__default.default,
|
|
2520
2401
|
{
|
|
2521
|
-
fullScreen:
|
|
2402
|
+
fullScreen: false,
|
|
2522
2403
|
open: openDialog,
|
|
2523
2404
|
onClose: () => handleClose && handleClose(),
|
|
2524
2405
|
"aria-labelledby": "responsive-dialog-title",
|
|
2525
|
-
|
|
2406
|
+
maxWidth: "lg",
|
|
2407
|
+
sx: {
|
|
2408
|
+
"& .MuiDialog-container": {
|
|
2409
|
+
justifyContent: "flex-end",
|
|
2410
|
+
alignItems: "flex-start"
|
|
2411
|
+
},
|
|
2412
|
+
"& .MuiDialog-paper": {
|
|
2413
|
+
position: "fixed",
|
|
2414
|
+
right: 0,
|
|
2415
|
+
top: 0,
|
|
2416
|
+
height: "100vh",
|
|
2417
|
+
maxHeight: "100vh",
|
|
2418
|
+
margin: 0,
|
|
2419
|
+
borderRadius: 0
|
|
2420
|
+
}
|
|
2421
|
+
},
|
|
2526
2422
|
children: [
|
|
2527
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2423
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.DialogTitle, { children: [
|
|
2424
|
+
"Workflow",
|
|
2528
2425
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2529
2426
|
material.IconButton,
|
|
2530
2427
|
{
|
|
@@ -2534,26 +2431,32 @@ function DialogOpener({
|
|
|
2534
2431
|
sx: { float: "right" },
|
|
2535
2432
|
children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } })
|
|
2536
2433
|
}
|
|
2537
|
-
),
|
|
2538
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2539
|
-
ApprovalWorkflow,
|
|
2540
|
-
{
|
|
2541
|
-
userInfo: userInfoData,
|
|
2542
|
-
selectedWorkflowsList
|
|
2543
|
-
}
|
|
2544
2434
|
)
|
|
2545
2435
|
] }),
|
|
2546
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2547
|
-
|
|
2436
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2437
|
+
DialogContent__default.default,
|
|
2548
2438
|
{
|
|
2549
|
-
variant: "contained",
|
|
2550
|
-
color: "primary",
|
|
2551
2439
|
sx: {
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2440
|
+
overflow: "hidden",
|
|
2441
|
+
width: "100%",
|
|
2442
|
+
height: "100%",
|
|
2443
|
+
padding: "0 20px"
|
|
2555
2444
|
},
|
|
2445
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2446
|
+
ApprovalWorkflow,
|
|
2447
|
+
{
|
|
2448
|
+
userInfo: userInfoData,
|
|
2449
|
+
selectedWorkflowsList
|
|
2450
|
+
}
|
|
2451
|
+
)
|
|
2452
|
+
}
|
|
2453
|
+
),
|
|
2454
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogActions6__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2455
|
+
WorkflowButton_default,
|
|
2456
|
+
{
|
|
2457
|
+
variant: "approve",
|
|
2556
2458
|
onClick: handleClose,
|
|
2459
|
+
className: "dialog-close-btn",
|
|
2557
2460
|
children: "Close"
|
|
2558
2461
|
}
|
|
2559
2462
|
) })
|