amp-workflow-ui 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -14
- package/dist/index.js +1611 -475
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1592 -457
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React7, { createContext, useState, useEffect, useCallback, useContext, useRef } from 'react';
|
|
2
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import
|
|
3
|
+
import Button7 from '@mui/material/Button';
|
|
4
4
|
import Dialog from '@mui/material/Dialog';
|
|
5
5
|
import { useTheme } from '@mui/material/styles';
|
|
6
6
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
7
|
-
import
|
|
7
|
+
import DialogActions5 from '@mui/material/DialogActions';
|
|
8
8
|
import DialogContent from '@mui/material/DialogContent';
|
|
9
|
-
import { styled, Chip, Typography, IconButton, useTheme as useTheme$1, Tooltip, Card, CardContent, Divider, Grid,
|
|
9
|
+
import { styled, Chip, Typography, IconButton, useTheme as useTheme$1, Tooltip, Card, CardContent, Divider, CircularProgress, Box as Box$1, TextField, InputAdornment, Button, Menu, MenuItem, Grid, DialogTitle, DialogActions, FormControl, InputLabel, Select } from '@mui/material';
|
|
10
10
|
import HighlightOffIcon from '@mui/icons-material/HighlightOff';
|
|
11
11
|
import { Box } from '@mui/system';
|
|
12
12
|
import moment from 'moment';
|
|
13
|
+
import toast from 'react-hot-toast';
|
|
13
14
|
|
|
14
15
|
// src/context.tsx
|
|
15
16
|
var WorkflowContext = createContext(null);
|
|
@@ -26,6 +27,555 @@ function useWorkflowContext() {
|
|
|
26
27
|
}
|
|
27
28
|
return ctx;
|
|
28
29
|
}
|
|
30
|
+
var ActionMenu = ({
|
|
31
|
+
onSendBack,
|
|
32
|
+
onApprove,
|
|
33
|
+
onReject,
|
|
34
|
+
onHold,
|
|
35
|
+
statusList
|
|
36
|
+
}) => {
|
|
37
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
38
|
+
const open = Boolean(anchorEl);
|
|
39
|
+
const handleActionClick = (event) => {
|
|
40
|
+
setAnchorEl(event.currentTarget);
|
|
41
|
+
};
|
|
42
|
+
const handleClose = () => setAnchorEl(null);
|
|
43
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44
|
+
/* @__PURE__ */ jsx(Button, { variant: "contained", color: "primary", onClick: handleActionClick, children: "Apply Action" }),
|
|
45
|
+
/* @__PURE__ */ jsxs(Menu, { anchorEl, open, onClose: handleClose, MenuListProps: { "aria-labelledby": "basic-button" }, children: [
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
MenuItem,
|
|
48
|
+
{
|
|
49
|
+
onClick: () => {
|
|
50
|
+
onSendBack();
|
|
51
|
+
handleClose();
|
|
52
|
+
},
|
|
53
|
+
children: "Send Back"
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
statusList.map((list) => /* @__PURE__ */ jsx(
|
|
57
|
+
MenuItem,
|
|
58
|
+
{
|
|
59
|
+
onClick: () => {
|
|
60
|
+
if (list.status === 1) onApprove();
|
|
61
|
+
else if (list.status === 2) onHold();
|
|
62
|
+
else if (list.status === 3) onReject();
|
|
63
|
+
handleClose();
|
|
64
|
+
},
|
|
65
|
+
children: list.name
|
|
66
|
+
},
|
|
67
|
+
list.id
|
|
68
|
+
))
|
|
69
|
+
] })
|
|
70
|
+
] });
|
|
71
|
+
};
|
|
72
|
+
var Statusselector_default = ActionMenu;
|
|
73
|
+
function SendBackDialog({ openModal, closeModal, header, workflowLogId }) {
|
|
74
|
+
const { userInfo, api } = useWorkflowContext();
|
|
75
|
+
const [comment, setComment] = useState("");
|
|
76
|
+
const [selectedFile, setSelectedFile] = useState(null);
|
|
77
|
+
const [fileName, setFileName] = useState("");
|
|
78
|
+
const [error, setError] = useState({});
|
|
79
|
+
const [loading, setLoading] = useState(false);
|
|
80
|
+
const [fileLoading, setFileLoading] = useState(false);
|
|
81
|
+
const fileInputRef = useRef(null);
|
|
82
|
+
const handleAttachment = () => {
|
|
83
|
+
var _a;
|
|
84
|
+
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
85
|
+
};
|
|
86
|
+
const handleUpload = async (file) => {
|
|
87
|
+
setFileLoading(true);
|
|
88
|
+
const formData = new FormData();
|
|
89
|
+
formData.append("file", file);
|
|
90
|
+
try {
|
|
91
|
+
const response = await api.post("/workflow/upload-document", formData, {
|
|
92
|
+
headers: { "Content-Type": "multipart/form-data" }
|
|
93
|
+
});
|
|
94
|
+
setFileName(response.data.file);
|
|
95
|
+
setSelectedFile(response.data.file);
|
|
96
|
+
} catch (error2) {
|
|
97
|
+
toast.error("File upload failed");
|
|
98
|
+
} finally {
|
|
99
|
+
setFileLoading(false);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const handleFileChange = async (event) => {
|
|
103
|
+
if (event.target.files && event.target.files.length > 0) {
|
|
104
|
+
const file = event.target.files[0];
|
|
105
|
+
await handleUpload(file);
|
|
106
|
+
setError((prev) => ({ ...prev, file: "" }));
|
|
107
|
+
} else {
|
|
108
|
+
setSelectedFile(null);
|
|
109
|
+
setFileName("");
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const validateFields = () => {
|
|
113
|
+
let isValid = true;
|
|
114
|
+
const errors = { comment: "", file: "" };
|
|
115
|
+
if (!comment) {
|
|
116
|
+
errors.comment = "Please enter a comment";
|
|
117
|
+
isValid = false;
|
|
118
|
+
}
|
|
119
|
+
setError(errors);
|
|
120
|
+
return isValid;
|
|
121
|
+
};
|
|
122
|
+
const onSubmit = async () => {
|
|
123
|
+
var _a, _b, _c;
|
|
124
|
+
if (!validateFields()) return;
|
|
125
|
+
setLoading(true);
|
|
126
|
+
try {
|
|
127
|
+
const res = await api.post(`/workflow/send-back/${workflowLogId}`, {
|
|
128
|
+
comment,
|
|
129
|
+
file: selectedFile,
|
|
130
|
+
created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
|
|
131
|
+
});
|
|
132
|
+
if ((res == null ? void 0 : res.status) === 200) toast.success("Successfully sent back!");
|
|
133
|
+
if ((_b = res == null ? void 0 : res.error) == null ? void 0 : _b.message) {
|
|
134
|
+
toast.error((_c = res == null ? void 0 : res.error) == null ? void 0 : _c.message, { duration: 2e3 });
|
|
135
|
+
}
|
|
136
|
+
closeModal && closeModal();
|
|
137
|
+
} catch {
|
|
138
|
+
toast.error("Opps! something went wrong.");
|
|
139
|
+
} finally {
|
|
140
|
+
setLoading(false);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
return /* @__PURE__ */ jsxs(Dialog, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
|
|
144
|
+
/* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
145
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
|
|
146
|
+
/* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
|
|
147
|
+
] }),
|
|
148
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
|
|
149
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
|
|
150
|
+
TextField,
|
|
151
|
+
{
|
|
152
|
+
fullWidth: true,
|
|
153
|
+
label: "Comment",
|
|
154
|
+
value: comment,
|
|
155
|
+
placeholder: "Comment Here",
|
|
156
|
+
onChange: (e) => setComment(e.target.value),
|
|
157
|
+
required: true,
|
|
158
|
+
error: !!error.comment,
|
|
159
|
+
helperText: error.comment
|
|
160
|
+
}
|
|
161
|
+
) }),
|
|
162
|
+
/* @__PURE__ */ jsxs(Grid, { item: true, xs: 12, children: [
|
|
163
|
+
/* @__PURE__ */ jsx(
|
|
164
|
+
TextField,
|
|
165
|
+
{
|
|
166
|
+
type: "text",
|
|
167
|
+
fullWidth: true,
|
|
168
|
+
label: "Attachment",
|
|
169
|
+
placeholder: "Attachment",
|
|
170
|
+
InputProps: {
|
|
171
|
+
endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx("span", { className: "icon-export-1" }) })
|
|
172
|
+
},
|
|
173
|
+
onClick: handleAttachment,
|
|
174
|
+
value: fileName,
|
|
175
|
+
error: !!error.file,
|
|
176
|
+
helperText: error.file
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
/* @__PURE__ */ jsx("input", { type: "file", ref: fileInputRef, style: { display: "none" }, onChange: handleFileChange })
|
|
180
|
+
] })
|
|
181
|
+
] }) }) }),
|
|
182
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
|
|
183
|
+
/* @__PURE__ */ jsx(Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
|
|
184
|
+
/* @__PURE__ */ jsx(Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading || fileLoading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
|
|
185
|
+
] }) })
|
|
186
|
+
] });
|
|
187
|
+
}
|
|
188
|
+
var SendBackDialog_default = SendBackDialog;
|
|
189
|
+
function ApproveDialog({ openModal, closeModal, header, workflowLogId, statusId }) {
|
|
190
|
+
const { userInfo, api } = useWorkflowContext();
|
|
191
|
+
const theme = useTheme();
|
|
192
|
+
useMediaQuery(theme.breakpoints.down("lg"));
|
|
193
|
+
const [comment, setComment] = useState("");
|
|
194
|
+
const [error, setError] = useState({});
|
|
195
|
+
const [loading, setLoading] = useState(false);
|
|
196
|
+
const validateFields = () => {
|
|
197
|
+
let isValid = true;
|
|
198
|
+
const newError = {};
|
|
199
|
+
if (!comment) {
|
|
200
|
+
newError.comment = "Please provide a comment";
|
|
201
|
+
isValid = false;
|
|
202
|
+
}
|
|
203
|
+
setError(newError);
|
|
204
|
+
return isValid;
|
|
205
|
+
};
|
|
206
|
+
const onSubmit = async () => {
|
|
207
|
+
var _a;
|
|
208
|
+
if (!validateFields()) return;
|
|
209
|
+
setLoading(true);
|
|
210
|
+
try {
|
|
211
|
+
await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
|
|
212
|
+
comment,
|
|
213
|
+
created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
|
|
214
|
+
});
|
|
215
|
+
toast.success("approved successfully!!!");
|
|
216
|
+
closeModal && closeModal();
|
|
217
|
+
} catch {
|
|
218
|
+
toast.error("something unexpected occured!!!");
|
|
219
|
+
} finally {
|
|
220
|
+
setLoading(false);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
return /* @__PURE__ */ jsxs(Dialog, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
|
|
224
|
+
/* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
225
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
|
|
226
|
+
/* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
|
|
227
|
+
] }),
|
|
228
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(TextField, { fullWidth: true, label: "Comment", value: comment, placeholder: "Comment Here", onChange: (e) => setComment(e.target.value), required: true, error: !!error.comment, helperText: error.comment }) }) }) }) }),
|
|
229
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
|
|
230
|
+
/* @__PURE__ */ jsx(Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
|
|
231
|
+
/* @__PURE__ */ jsx(Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
|
|
232
|
+
] }) })
|
|
233
|
+
] });
|
|
234
|
+
}
|
|
235
|
+
var ApproveDialog_default = ApproveDialog;
|
|
236
|
+
function RejectDialog({ openModal, closeModal, header, workflowLogId, statusId, rejection_reason_master }) {
|
|
237
|
+
const { userInfo, api } = useWorkflowContext();
|
|
238
|
+
const theme = useTheme();
|
|
239
|
+
useMediaQuery(theme.breakpoints.down("lg"));
|
|
240
|
+
const DownArrow = () => {
|
|
241
|
+
var _a;
|
|
242
|
+
return /* @__PURE__ */ jsx("span", { style: { color: ((_a = theme.palette.customColors) == null ? void 0 : _a.mainText) || "#333" }, className: "icon-arrow-down-1" });
|
|
243
|
+
};
|
|
244
|
+
const [rejectReasons, setRejectReasons] = useState("");
|
|
245
|
+
const [comment, setComment] = useState("");
|
|
246
|
+
const [error, setError] = useState({ reason: "", comment: "" });
|
|
247
|
+
const [statusApplicableList, setStatusApplicableList] = useState([]);
|
|
248
|
+
const [loading, setLoading] = useState(false);
|
|
249
|
+
useEffect(() => {
|
|
250
|
+
(async () => {
|
|
251
|
+
var _a;
|
|
252
|
+
try {
|
|
253
|
+
if (!statusApplicableList.length) {
|
|
254
|
+
const res = await api.get(`/workflow/applicableStatuses?type=${rejection_reason_master}`);
|
|
255
|
+
setStatusApplicableList(((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || []);
|
|
256
|
+
}
|
|
257
|
+
} catch (e) {
|
|
258
|
+
}
|
|
259
|
+
})();
|
|
260
|
+
}, []);
|
|
261
|
+
const validateFields = () => {
|
|
262
|
+
let isValid = true;
|
|
263
|
+
const errors = { reason: "", comment: "" };
|
|
264
|
+
if (!rejectReasons) {
|
|
265
|
+
errors.reason = "Please select a reject reason";
|
|
266
|
+
isValid = false;
|
|
267
|
+
}
|
|
268
|
+
if (!comment) {
|
|
269
|
+
errors.comment = "Please enter a comment";
|
|
270
|
+
isValid = false;
|
|
271
|
+
}
|
|
272
|
+
setError(errors);
|
|
273
|
+
return isValid;
|
|
274
|
+
};
|
|
275
|
+
const onSubmit = async () => {
|
|
276
|
+
var _a;
|
|
277
|
+
if (!validateFields()) return;
|
|
278
|
+
setLoading(true);
|
|
279
|
+
try {
|
|
280
|
+
await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
|
|
281
|
+
reason: rejectReasons,
|
|
282
|
+
comment,
|
|
283
|
+
created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
|
|
284
|
+
});
|
|
285
|
+
closeModal && closeModal();
|
|
286
|
+
} catch (e) {
|
|
287
|
+
} finally {
|
|
288
|
+
setLoading(false);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
return /* @__PURE__ */ jsxs(Dialog, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
|
|
292
|
+
/* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
293
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
|
|
294
|
+
/* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
|
|
295
|
+
] }),
|
|
296
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxs(Grid, { container: true, spacing: 5, children: [
|
|
297
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxs(FormControl, { fullWidth: true, required: true, error: !!error.reason, children: [
|
|
298
|
+
/* @__PURE__ */ jsx(InputLabel, { required: true, id: "reject-reason-label", children: "Reject Reasons" }),
|
|
299
|
+
/* @__PURE__ */ jsx(Select, { IconComponent: DownArrow, label: "Reject Reasons", value: rejectReasons, id: "reject-reason", labelId: "reject-reason-label", onChange: (e) => setRejectReasons(e.target.value), children: statusApplicableList == null ? void 0 : statusApplicableList.map((reason_) => /* @__PURE__ */ jsx(MenuItem, { value: reason_ == null ? void 0 : reason_.id, children: reason_ == null ? void 0 : reason_.name }, reason_ == null ? void 0 : reason_.id)) }),
|
|
300
|
+
error.reason && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "error", children: error.reason })
|
|
301
|
+
] }) }),
|
|
302
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(TextField, { fullWidth: true, label: "Comment", value: comment, placeholder: "Comment Here", onChange: (e) => setComment(e.target.value), required: true, error: !!error.comment, helperText: error.comment }) })
|
|
303
|
+
] }) }) }),
|
|
304
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
|
|
305
|
+
/* @__PURE__ */ jsx(Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
|
|
306
|
+
/* @__PURE__ */ jsx(Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
|
|
307
|
+
] }) })
|
|
308
|
+
] });
|
|
309
|
+
}
|
|
310
|
+
var RejectDialog_default = RejectDialog;
|
|
311
|
+
function OnHoldDialog({ openModal, closeModal, header, workflowLogId, statusId }) {
|
|
312
|
+
const { userInfo, api } = useWorkflowContext();
|
|
313
|
+
const theme = useTheme();
|
|
314
|
+
useMediaQuery(theme.breakpoints.down("lg"));
|
|
315
|
+
const [comment, setComment] = useState("");
|
|
316
|
+
const [error, setError] = useState({ comment: "" });
|
|
317
|
+
const [loading, setLoading] = useState(false);
|
|
318
|
+
const validateFields = () => {
|
|
319
|
+
let isValid = true;
|
|
320
|
+
const errors = { comment: "" };
|
|
321
|
+
if (!comment) {
|
|
322
|
+
errors.comment = "Please enter a comment";
|
|
323
|
+
isValid = false;
|
|
324
|
+
}
|
|
325
|
+
setError(errors);
|
|
326
|
+
return isValid;
|
|
327
|
+
};
|
|
328
|
+
const onSubmit = async () => {
|
|
329
|
+
var _a;
|
|
330
|
+
if (!validateFields()) return;
|
|
331
|
+
setLoading(true);
|
|
332
|
+
try {
|
|
333
|
+
await api.post(`/workflow/update-status/${workflowLogId}/${statusId}`, {
|
|
334
|
+
comment,
|
|
335
|
+
created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
|
|
336
|
+
});
|
|
337
|
+
closeModal && closeModal();
|
|
338
|
+
} catch {
|
|
339
|
+
toast.error("Failed to submit the form");
|
|
340
|
+
} finally {
|
|
341
|
+
setLoading(false);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
return /* @__PURE__ */ jsxs(Dialog, { open: openModal, onClose: closeModal, "aria-labelledby": "responsive-dialog-title", sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } }, children: [
|
|
345
|
+
/* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
346
|
+
/* @__PURE__ */ jsx(DialogTitle, { id: "responsive-dialog-title", children: header }),
|
|
347
|
+
/* @__PURE__ */ jsx(IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) })
|
|
348
|
+
] }),
|
|
349
|
+
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(Box$1, { sx: { mb: 5 }, children: /* @__PURE__ */ jsx(Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(TextField, { fullWidth: true, label: "Comment", value: comment, placeholder: "Comment Here", onChange: (e) => setComment(e.target.value), required: true, error: !!error.comment, helperText: error.comment }) }) }) }) }),
|
|
350
|
+
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
|
|
351
|
+
/* @__PURE__ */ jsx(Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
|
|
352
|
+
/* @__PURE__ */ jsx(Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
|
|
353
|
+
] }) })
|
|
354
|
+
] });
|
|
355
|
+
}
|
|
356
|
+
var OnHoldDialog_default = OnHoldDialog;
|
|
357
|
+
var Bull = ({
|
|
358
|
+
count,
|
|
359
|
+
isDisabled
|
|
360
|
+
}) => {
|
|
361
|
+
const theme = useTheme$1();
|
|
362
|
+
const color = isDisabled ? theme.palette.success.main : theme.palette.primary.main;
|
|
363
|
+
return /* @__PURE__ */ jsx(
|
|
364
|
+
Box$1,
|
|
365
|
+
{
|
|
366
|
+
sx: {
|
|
367
|
+
display: "flex",
|
|
368
|
+
justifyContent: "center",
|
|
369
|
+
alignItems: "center",
|
|
370
|
+
width: 32,
|
|
371
|
+
height: 32,
|
|
372
|
+
borderRadius: "50%",
|
|
373
|
+
border: `2px solid ${color}`,
|
|
374
|
+
color,
|
|
375
|
+
fontWeight: 600,
|
|
376
|
+
fontSize: 14
|
|
377
|
+
},
|
|
378
|
+
children: count
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
};
|
|
382
|
+
var getStatus = (status, theme) => {
|
|
383
|
+
const s = status == null ? void 0 : status.toLowerCase();
|
|
384
|
+
const colors = {
|
|
385
|
+
approved: {
|
|
386
|
+
bg: theme.palette.success.light,
|
|
387
|
+
text: theme.palette.success.main
|
|
388
|
+
},
|
|
389
|
+
rejected: { bg: theme.palette.error.light, text: theme.palette.error.main },
|
|
390
|
+
onhold: {
|
|
391
|
+
bg: theme.palette.warning.light,
|
|
392
|
+
text: theme.palette.warning.main
|
|
393
|
+
},
|
|
394
|
+
inprogress: { bg: theme.palette.info.light, text: theme.palette.info.main },
|
|
395
|
+
pending: { bg: theme.palette.grey[200], text: theme.palette.text.primary }
|
|
396
|
+
};
|
|
397
|
+
return colors[s] || colors.pending;
|
|
398
|
+
};
|
|
399
|
+
function CustomTimelineWithStatus({ events }) {
|
|
400
|
+
const { api } = useWorkflowContext();
|
|
401
|
+
const theme = useTheme$1();
|
|
402
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
403
|
+
useEffect(() => {
|
|
404
|
+
const checkScreen = () => setIsMobile(window.innerWidth < 768);
|
|
405
|
+
checkScreen();
|
|
406
|
+
window.addEventListener("resize", checkScreen);
|
|
407
|
+
return () => window.removeEventListener("resize", checkScreen);
|
|
408
|
+
}, []);
|
|
409
|
+
const handleAttachmentClick = (attachment) => {
|
|
410
|
+
api.get({
|
|
411
|
+
url: `/workflow/uploaded-document-url/${attachment.split("/").reverse()[0]}`,
|
|
412
|
+
serviceURL: "api"
|
|
413
|
+
}).then((res) => window.open(res.data, "_blank"));
|
|
414
|
+
};
|
|
415
|
+
const rows = [];
|
|
416
|
+
for (let i = 0; i < (events == null ? void 0 : events.length); i += 4) rows.push(events.slice(i, i + 4));
|
|
417
|
+
return /* @__PURE__ */ jsx(Box$1, { sx: { p: 2 }, children: rows.map((row, rowIndex) => /* @__PURE__ */ jsx(
|
|
418
|
+
Box$1,
|
|
419
|
+
{
|
|
420
|
+
sx: {
|
|
421
|
+
display: "flex",
|
|
422
|
+
flexDirection: isMobile ? "column" : rowIndex % 2 === 0 ? "row" : "row-reverse",
|
|
423
|
+
gap: isMobile ? 3 : 6,
|
|
424
|
+
alignItems: "center",
|
|
425
|
+
mb: 6
|
|
426
|
+
},
|
|
427
|
+
children: row.map((event, index) => {
|
|
428
|
+
var _a;
|
|
429
|
+
const status = getStatus((_a = event.status) == null ? void 0 : _a.title, theme);
|
|
430
|
+
const isDisabled = event.cardType === "disableCard";
|
|
431
|
+
return /* @__PURE__ */ jsx(Grid, { item: true, xs: isMobile ? 12 : 3, children: /* @__PURE__ */ jsx(
|
|
432
|
+
Card,
|
|
433
|
+
{
|
|
434
|
+
variant: "outlined",
|
|
435
|
+
sx: {
|
|
436
|
+
width: "100%",
|
|
437
|
+
borderRadius: 3,
|
|
438
|
+
p: 2,
|
|
439
|
+
borderColor: isDisabled ? theme.palette.success.main : theme.palette.divider,
|
|
440
|
+
backgroundColor: isDisabled ? theme.palette.action.hover : theme.palette.background.paper,
|
|
441
|
+
textAlign: "center",
|
|
442
|
+
boxShadow: 2,
|
|
443
|
+
"&:hover": { boxShadow: 5 }
|
|
444
|
+
},
|
|
445
|
+
children: /* @__PURE__ */ jsxs(CardContent, { children: [
|
|
446
|
+
/* @__PURE__ */ jsxs(
|
|
447
|
+
Box$1,
|
|
448
|
+
{
|
|
449
|
+
sx: {
|
|
450
|
+
display: "flex",
|
|
451
|
+
justifyContent: "space-between",
|
|
452
|
+
alignItems: "center",
|
|
453
|
+
mb: 1
|
|
454
|
+
},
|
|
455
|
+
children: [
|
|
456
|
+
/* @__PURE__ */ jsx(
|
|
457
|
+
Typography,
|
|
458
|
+
{
|
|
459
|
+
variant: "body2",
|
|
460
|
+
color: theme.palette.text.secondary,
|
|
461
|
+
children: event.date
|
|
462
|
+
}
|
|
463
|
+
),
|
|
464
|
+
event.status && /* @__PURE__ */ jsx(
|
|
465
|
+
Chip,
|
|
466
|
+
{
|
|
467
|
+
label: event.status.title,
|
|
468
|
+
sx: {
|
|
469
|
+
backgroundColor: status.bg,
|
|
470
|
+
color: status.text,
|
|
471
|
+
fontSize: 12,
|
|
472
|
+
height: 26,
|
|
473
|
+
fontWeight: 600,
|
|
474
|
+
borderRadius: "16px"
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
)
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
),
|
|
481
|
+
/* @__PURE__ */ jsx(Bull, { count: event.count, isDisabled }),
|
|
482
|
+
/* @__PURE__ */ jsx(
|
|
483
|
+
Typography,
|
|
484
|
+
{
|
|
485
|
+
variant: "subtitle1",
|
|
486
|
+
fontWeight: 600,
|
|
487
|
+
color: isDisabled ? theme.palette.text.secondary : theme.palette.text.primary,
|
|
488
|
+
sx: { mt: 2, mb: 0.5 },
|
|
489
|
+
children: event.title
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
/* @__PURE__ */ jsx(
|
|
493
|
+
Typography,
|
|
494
|
+
{
|
|
495
|
+
variant: "body2",
|
|
496
|
+
color: theme.palette.text.secondary,
|
|
497
|
+
sx: { mb: 1 },
|
|
498
|
+
children: event.subTitle
|
|
499
|
+
}
|
|
500
|
+
),
|
|
501
|
+
event.attachment && /* @__PURE__ */ jsx(Tooltip, { title: "View attachment", children: /* @__PURE__ */ jsx(
|
|
502
|
+
Typography,
|
|
503
|
+
{
|
|
504
|
+
variant: "body2",
|
|
505
|
+
sx: {
|
|
506
|
+
color: theme.palette.primary.main,
|
|
507
|
+
cursor: "pointer",
|
|
508
|
+
fontWeight: 500,
|
|
509
|
+
textDecoration: "underline",
|
|
510
|
+
"&:hover": {
|
|
511
|
+
color: theme.palette.primary.dark
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
onClick: () => handleAttachmentClick(event.attachment),
|
|
515
|
+
children: "Attachment"
|
|
516
|
+
}
|
|
517
|
+
) }),
|
|
518
|
+
/* @__PURE__ */ jsx(
|
|
519
|
+
Typography,
|
|
520
|
+
{
|
|
521
|
+
variant: "caption",
|
|
522
|
+
display: "block",
|
|
523
|
+
color: theme.palette.text.disabled,
|
|
524
|
+
sx: { mt: 2 },
|
|
525
|
+
children: event.time
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
] })
|
|
529
|
+
}
|
|
530
|
+
) }, index);
|
|
531
|
+
})
|
|
532
|
+
},
|
|
533
|
+
rowIndex
|
|
534
|
+
)) });
|
|
535
|
+
}
|
|
536
|
+
var useDebounce = (value, delay) => {
|
|
537
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
538
|
+
useEffect(() => {
|
|
539
|
+
const timeoutId = setTimeout(() => {
|
|
540
|
+
setDebouncedValue(value);
|
|
541
|
+
}, delay);
|
|
542
|
+
return () => clearTimeout(timeoutId);
|
|
543
|
+
}, [value, delay]);
|
|
544
|
+
return debouncedValue;
|
|
545
|
+
};
|
|
546
|
+
var useDebounce_default = useDebounce;
|
|
547
|
+
var SearchBox = ({
|
|
548
|
+
placeHolderTitle,
|
|
549
|
+
searchText,
|
|
550
|
+
handleClearSearch,
|
|
551
|
+
handleInputChange
|
|
552
|
+
}) => {
|
|
553
|
+
return /* @__PURE__ */ jsx(Box$1, { sx: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ jsx(
|
|
554
|
+
TextField,
|
|
555
|
+
{
|
|
556
|
+
variant: "outlined",
|
|
557
|
+
value: searchText,
|
|
558
|
+
onChange: handleInputChange,
|
|
559
|
+
placeholder: placeHolderTitle,
|
|
560
|
+
autoComplete: "off",
|
|
561
|
+
className: "custom-search",
|
|
562
|
+
InputProps: {
|
|
563
|
+
startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx("span", { className: "icon-search-normal-1" }) }),
|
|
564
|
+
endAdornment: searchText ? /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(
|
|
565
|
+
IconButton,
|
|
566
|
+
{
|
|
567
|
+
disableFocusRipple: true,
|
|
568
|
+
disableRipple: true,
|
|
569
|
+
disableTouchRipple: true,
|
|
570
|
+
onClick: handleClearSearch,
|
|
571
|
+
children: /* @__PURE__ */ jsx("span", { className: "icon-close-circle" })
|
|
572
|
+
}
|
|
573
|
+
) }) : null
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
) });
|
|
577
|
+
};
|
|
578
|
+
var SearchBox_default = SearchBox;
|
|
29
579
|
var StyledChipProps = styled(Chip)(({ theme }) => {
|
|
30
580
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
31
581
|
return {
|
|
@@ -55,7 +605,7 @@ var StyledChipProps = styled(Chip)(({ theme }) => {
|
|
|
55
605
|
}
|
|
56
606
|
};
|
|
57
607
|
});
|
|
58
|
-
|
|
608
|
+
styled(Typography)(({ theme }) => ({
|
|
59
609
|
overflow: "hidden",
|
|
60
610
|
textOverflow: "ellipsis",
|
|
61
611
|
whiteSpace: "nowrap",
|
|
@@ -68,16 +618,17 @@ function ApprovalWorkflow({
|
|
|
68
618
|
selectedWorkflowsList = [],
|
|
69
619
|
userInfo
|
|
70
620
|
}) {
|
|
621
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
71
622
|
const theme = useTheme$1();
|
|
72
623
|
const { api, urlBuilder, loadingComponent } = useWorkflowContext();
|
|
73
624
|
const [selectedApprovalOtions, setSelectedApprovalOtions] = useState(
|
|
74
625
|
selectedWorkflowsList.length ? "selected" : "Action Required"
|
|
75
626
|
);
|
|
76
627
|
const [expandedId, setExpandedId] = useState(null);
|
|
77
|
-
const [sendDialog, setSendDialog] =
|
|
78
|
-
const [
|
|
79
|
-
const [
|
|
80
|
-
const [
|
|
628
|
+
const [sendDialog, setSendDialog] = React7.useState(null);
|
|
629
|
+
const [approveTarget, setApproveTarget] = React7.useState(null);
|
|
630
|
+
const [rejectTarget, setRejectTarget] = React7.useState(null);
|
|
631
|
+
const [onHoldTarget, setOnHoldTarget] = React7.useState(null);
|
|
81
632
|
const [expandedDetails, setExpandedDetails] = useState([]);
|
|
82
633
|
const [statusCount, setStatusCount] = useState({});
|
|
83
634
|
const [urlConfig, setUrlConfig] = useState({});
|
|
@@ -85,6 +636,53 @@ function ApprovalWorkflow({
|
|
|
85
636
|
const [pendingRequestArray, setPendingRequestArray] = useState([]);
|
|
86
637
|
const [selectedRequestArray, setSelectedRequestArray] = useState([]);
|
|
87
638
|
const [isLoading, setIsLoading] = useState(false);
|
|
639
|
+
const [searchText, setSearchText] = useState("");
|
|
640
|
+
const handleClearSearch = useCallback(() => {
|
|
641
|
+
setSearchText("");
|
|
642
|
+
}, []);
|
|
643
|
+
const handleSearchChange = useCallback((value) => {
|
|
644
|
+
setSearchText(value);
|
|
645
|
+
}, []);
|
|
646
|
+
const debouncedSearchTerm = useDebounce_default(searchText, 500);
|
|
647
|
+
const filteredSelectedRequestArray = React7.useMemo(() => {
|
|
648
|
+
if (!debouncedSearchTerm) return selectedRequestArray;
|
|
649
|
+
const q = debouncedSearchTerm.toLowerCase();
|
|
650
|
+
return selectedRequestArray.filter((item) => {
|
|
651
|
+
const name = ((item == null ? void 0 : item.activity_name) || "").toString().toLowerCase();
|
|
652
|
+
const desc = ((item == null ? void 0 : item.description_data) || "").toString().toLowerCase();
|
|
653
|
+
return name.includes(q) || desc.includes(q);
|
|
654
|
+
});
|
|
655
|
+
}, [selectedRequestArray, debouncedSearchTerm]);
|
|
656
|
+
const filteredAllRequestArray = React7.useMemo(() => {
|
|
657
|
+
if (!debouncedSearchTerm) return allRequestArray;
|
|
658
|
+
const q = debouncedSearchTerm.toLowerCase();
|
|
659
|
+
return allRequestArray.filter((item) => {
|
|
660
|
+
const name = ((item == null ? void 0 : item.activity_name) || "").toString().toLowerCase();
|
|
661
|
+
const desc = ((item == null ? void 0 : item.description_data) || "").toString().toLowerCase();
|
|
662
|
+
return name.includes(q) || desc.includes(q);
|
|
663
|
+
});
|
|
664
|
+
}, [allRequestArray, debouncedSearchTerm]);
|
|
665
|
+
const filteredPendingRequestArray = React7.useMemo(() => {
|
|
666
|
+
if (!debouncedSearchTerm) return pendingRequestArray;
|
|
667
|
+
const q = debouncedSearchTerm.toLowerCase();
|
|
668
|
+
return pendingRequestArray.filter((item) => {
|
|
669
|
+
const name = ((item == null ? void 0 : item.activity_name) || "").toString().toLowerCase();
|
|
670
|
+
const desc = ((item == null ? void 0 : item.description_data) || "").toString().toLowerCase();
|
|
671
|
+
return name.includes(q) || desc.includes(q);
|
|
672
|
+
});
|
|
673
|
+
}, [pendingRequestArray, debouncedSearchTerm]);
|
|
674
|
+
const handleSendBack = (workflowLogId) => {
|
|
675
|
+
setSendDialog(workflowLogId);
|
|
676
|
+
};
|
|
677
|
+
const handleApprove = (workflowLogId) => {
|
|
678
|
+
setApproveTarget(workflowLogId);
|
|
679
|
+
};
|
|
680
|
+
const handleReject = (workflowLogId) => {
|
|
681
|
+
setRejectTarget(workflowLogId);
|
|
682
|
+
};
|
|
683
|
+
const handleOnHold = (workflowLogId) => {
|
|
684
|
+
setOnHoldTarget(workflowLogId);
|
|
685
|
+
};
|
|
88
686
|
const handleProfileToggle = (option) => {
|
|
89
687
|
setSelectedApprovalOtions(option);
|
|
90
688
|
if (option === "Action Required") fetchPendingActivities();
|
|
@@ -95,80 +693,121 @@ function ApprovalWorkflow({
|
|
|
95
693
|
setExpandedId((prevId) => prevId === id ? null : id);
|
|
96
694
|
fetchExpandedActivityLogs(id);
|
|
97
695
|
};
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
switch (status) {
|
|
696
|
+
const getStatus2 = (status) => {
|
|
697
|
+
switch (status.toLowerCase()) {
|
|
101
698
|
case "approved":
|
|
102
699
|
return {
|
|
103
700
|
title: "Approved",
|
|
104
701
|
color: theme.palette.success.light,
|
|
105
|
-
|
|
702
|
+
// e.g. light green background
|
|
703
|
+
labelColor: theme.palette.grey[100]
|
|
704
|
+
// e.g. light grey text
|
|
106
705
|
};
|
|
107
706
|
case "rejected":
|
|
108
707
|
return {
|
|
109
708
|
title: "Rejected",
|
|
110
|
-
color:
|
|
111
|
-
|
|
709
|
+
color: theme.palette.error.light,
|
|
710
|
+
// light red background
|
|
711
|
+
labelColor: theme.palette.text.primary
|
|
712
|
+
// normal text color
|
|
112
713
|
};
|
|
113
714
|
case "onhold":
|
|
715
|
+
case "on_hold":
|
|
114
716
|
return {
|
|
115
717
|
title: "On Hold",
|
|
116
|
-
color:
|
|
117
|
-
|
|
718
|
+
color: theme.palette.warning.light,
|
|
719
|
+
// soft amber background
|
|
720
|
+
labelColor: theme.palette.warning.main
|
|
721
|
+
// strong amber text
|
|
722
|
+
};
|
|
723
|
+
case "inprogress":
|
|
724
|
+
case "in_progress":
|
|
725
|
+
return {
|
|
726
|
+
title: "In Progress",
|
|
727
|
+
color: theme.palette.info.light,
|
|
728
|
+
// light blue background
|
|
729
|
+
labelColor: theme.palette.info.main
|
|
730
|
+
// blue text
|
|
118
731
|
};
|
|
119
732
|
case "pending":
|
|
120
733
|
default:
|
|
121
734
|
return {
|
|
122
735
|
title: "Pending",
|
|
123
|
-
color:
|
|
124
|
-
|
|
736
|
+
color: theme.palette.grey[200],
|
|
737
|
+
// light grey background
|
|
738
|
+
labelColor: theme.palette.text.primary
|
|
739
|
+
// normal text color
|
|
125
740
|
};
|
|
126
741
|
}
|
|
127
742
|
};
|
|
128
743
|
const approvalChipLabel = [
|
|
129
|
-
{
|
|
130
|
-
|
|
744
|
+
{
|
|
745
|
+
label: "Action Required",
|
|
746
|
+
icon: /* @__PURE__ */ jsx("span", { className: "icon-document-forward" }),
|
|
747
|
+
count: (statusCount == null ? void 0 : statusCount.pending_activities_count) || ""
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
label: "All Requests",
|
|
751
|
+
icon: /* @__PURE__ */ jsx("span", { className: "icon-document-copy" }),
|
|
752
|
+
count: (statusCount == null ? void 0 : statusCount.total_activities_count) || ""
|
|
753
|
+
}
|
|
131
754
|
];
|
|
132
755
|
const fetchExpandedActivityLogs = (workflowLogId) => {
|
|
133
756
|
setExpandedDetails([]);
|
|
134
|
-
api.get({
|
|
757
|
+
api.get({
|
|
758
|
+
url: `/workflow/workflow-activity-logs/${workflowLogId}`,
|
|
759
|
+
serviceURL: "api"
|
|
760
|
+
}).then((res) => setExpandedDetails(res == null ? void 0 : res.data));
|
|
135
761
|
};
|
|
136
762
|
const fetchPendingActivities = () => {
|
|
137
|
-
var
|
|
763
|
+
var _a2;
|
|
138
764
|
setIsLoading(true);
|
|
139
|
-
api.get({
|
|
140
|
-
|
|
141
|
-
|
|
765
|
+
api.get({
|
|
766
|
+
url: `/workflow/activity-workflow/${(_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id}?paginate=false&type=pending`,
|
|
767
|
+
serviceURL: "api"
|
|
768
|
+
}).then((res) => {
|
|
769
|
+
var _a3;
|
|
770
|
+
return setPendingRequestArray((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.activities);
|
|
142
771
|
}).finally(() => setIsLoading(false));
|
|
143
772
|
};
|
|
144
773
|
const fetchAllActivites = () => {
|
|
145
|
-
var
|
|
774
|
+
var _a2;
|
|
146
775
|
setIsLoading(true);
|
|
147
|
-
api.get({
|
|
148
|
-
|
|
149
|
-
|
|
776
|
+
api.get({
|
|
777
|
+
url: `/workflow/activity-workflow/${(_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id}?paginate=false`,
|
|
778
|
+
serviceURL: "api"
|
|
779
|
+
}).then((res) => {
|
|
780
|
+
var _a3;
|
|
781
|
+
return setAllRequestArray((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3.activities);
|
|
150
782
|
}).finally(() => setIsLoading(false));
|
|
151
783
|
};
|
|
152
784
|
const fetchSelectedActivites = () => {
|
|
153
785
|
setIsLoading(true);
|
|
154
|
-
api.post({
|
|
786
|
+
api.post({
|
|
787
|
+
url: `/workflow/bulk-details`,
|
|
788
|
+
serviceURL: "api",
|
|
789
|
+
data: { workflowIds: selectedWorkflowsList }
|
|
790
|
+
}).then((res) => setSelectedRequestArray(res == null ? void 0 : res.data)).finally(() => setIsLoading(false));
|
|
155
791
|
};
|
|
156
792
|
const fetchStatusCount = () => {
|
|
157
|
-
var
|
|
158
|
-
api.get({
|
|
159
|
-
|
|
160
|
-
|
|
793
|
+
var _a2;
|
|
794
|
+
api.get({
|
|
795
|
+
url: `/workflow/status-count/${(_a2 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a2.id}`,
|
|
796
|
+
serviceURL: "api"
|
|
797
|
+
}).then((res) => {
|
|
798
|
+
var _a3;
|
|
799
|
+
setStatusCount((_a3 = res == null ? void 0 : res.data) == null ? void 0 : _a3[0]);
|
|
161
800
|
});
|
|
162
801
|
};
|
|
163
802
|
useEffect(() => {
|
|
164
|
-
if (!sendDialog && !
|
|
803
|
+
if (!sendDialog && !approveTarget && !onHoldTarget && !rejectTarget) {
|
|
165
804
|
fetchAllActivites();
|
|
166
805
|
fetchStatusCount();
|
|
167
806
|
fetchPendingActivities();
|
|
168
807
|
setExpandedDetails([]);
|
|
169
808
|
setExpandedId(null);
|
|
170
809
|
}
|
|
171
|
-
}, [sendDialog,
|
|
810
|
+
}, [sendDialog, approveTarget, onHoldTarget, rejectTarget, userInfo]);
|
|
172
811
|
useEffect(() => {
|
|
173
812
|
api.get({ url: `/workflow/url-config`, serviceURL: "api" }).then((res) => {
|
|
174
813
|
const data = (res == null ? void 0 : res.data) || [];
|
|
@@ -186,445 +825,941 @@ function ApprovalWorkflow({
|
|
|
186
825
|
}, [selectedWorkflowsList]);
|
|
187
826
|
const buildRedirectionUrl = (info) => {
|
|
188
827
|
if (info == null ? void 0 : info.redirection_link) return info.redirection_link;
|
|
189
|
-
if (urlBuilder)
|
|
828
|
+
if (urlBuilder)
|
|
829
|
+
return urlBuilder(
|
|
830
|
+
info == null ? void 0 : info.module_name,
|
|
831
|
+
info == null ? void 0 : info.module_id,
|
|
832
|
+
urlConfig,
|
|
833
|
+
info == null ? void 0 : info.reference_id
|
|
834
|
+
);
|
|
190
835
|
const ref = urlConfig == null ? void 0 : urlConfig[info == null ? void 0 : info.module_name];
|
|
191
836
|
if ((ref == null ? void 0 : ref.base_url) && (ref == null ? void 0 : ref.sub_url)) {
|
|
192
837
|
const qs = new URLSearchParams();
|
|
193
|
-
if (info == null ? void 0 : info.reference_id)
|
|
838
|
+
if (info == null ? void 0 : info.reference_id)
|
|
839
|
+
qs.set("reference_id", String(info == null ? void 0 : info.reference_id));
|
|
194
840
|
if (info == null ? void 0 : info.module_name) qs.set("module_name", String(info == null ? void 0 : info.module_name));
|
|
195
841
|
return `${ref.base_url}${ref.sub_url}${qs.toString() ? `?${qs.toString()}` : ""}`;
|
|
196
842
|
}
|
|
197
843
|
return "#";
|
|
198
844
|
};
|
|
199
845
|
if (isLoading && loadingComponent) return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
children: redir
|
|
272
|
-
}
|
|
273
|
-
) }) })
|
|
274
|
-
] }),
|
|
275
|
-
/* @__PURE__ */ jsxs(Box, { children: [
|
|
276
|
-
/* @__PURE__ */ jsx(Tooltip, { title: "Attachments", children: /* @__PURE__ */ jsx(
|
|
277
|
-
TruncatedTypography,
|
|
278
|
-
{
|
|
279
|
-
variant: "caption",
|
|
280
|
-
color: "customColors.text3",
|
|
281
|
-
sx: { textTransform: "capitalize", lineHeight: "13.2px" },
|
|
282
|
-
children: "Attachments"
|
|
283
|
-
}
|
|
284
|
-
) }),
|
|
285
|
-
((_a = info == null ? void 0 : info.attachment_links) == null ? void 0 : _a.length) ? info == null ? void 0 : info.attachment_links.map((link, idx) => /* @__PURE__ */ jsx(Tooltip, { title: `Attachment ${idx + 1}`, children: /* @__PURE__ */ jsx("a", { href: link, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
|
|
286
|
-
TruncatedTypography,
|
|
287
|
-
{
|
|
288
|
-
variant: "subtitle2",
|
|
289
|
-
color: "primary.dark",
|
|
290
|
-
sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
|
|
291
|
-
children: link || "N/A"
|
|
292
|
-
}
|
|
293
|
-
) }) }, idx)) : /* @__PURE__ */ jsx(Box, { sx: { display: "flex", mt: 2, justifyContent: "center", alignItems: "center", lineHeight: "15.4px" }, children: "N/A" })
|
|
294
|
-
] }),
|
|
295
|
-
/* @__PURE__ */ jsxs(Box, { children: [
|
|
296
|
-
/* @__PURE__ */ jsx(Tooltip, { title: "Date and Time", children: /* @__PURE__ */ jsx(
|
|
297
|
-
TruncatedTypography,
|
|
298
|
-
{
|
|
299
|
-
variant: "caption",
|
|
300
|
-
color: "customColors.text3",
|
|
301
|
-
sx: { textTransform: "capitalize", lineHeight: "13.2px" },
|
|
302
|
-
children: "TAT"
|
|
303
|
-
}
|
|
304
|
-
) }),
|
|
305
|
-
/* @__PURE__ */ jsx(Tooltip, { title: info.dateTime, children: /* @__PURE__ */ jsx(
|
|
306
|
-
TruncatedTypography,
|
|
307
|
-
{
|
|
308
|
-
variant: "subtitle2",
|
|
309
|
-
color: "customColors.mainText",
|
|
310
|
-
sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
|
|
311
|
-
children: ((_c = (_b = info == null ? void 0 : info.levels) == null ? void 0 : _b.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _c.tat_expiry) ? moment((_e = (_d = info == null ? void 0 : info.levels) == null ? void 0 : _d.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _e.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY HH:MM A") : "N/A"
|
|
312
|
-
}
|
|
313
|
-
) })
|
|
314
|
-
] }),
|
|
315
|
-
/* @__PURE__ */ jsxs(Box, { children: [
|
|
316
|
-
/* @__PURE__ */ jsx(Tooltip, { title: "Current active level of Workflow", children: /* @__PURE__ */ jsx(
|
|
317
|
-
TruncatedTypography,
|
|
318
|
-
{
|
|
319
|
-
variant: "caption",
|
|
320
|
-
color: "customColors.text3",
|
|
321
|
-
sx: { textTransform: "capitalize", lineHeight: "13.2px" },
|
|
322
|
-
children: "Current Level"
|
|
323
|
-
}
|
|
324
|
-
) }),
|
|
325
|
-
/* @__PURE__ */ jsx(Box, { sx: { display: "flex", mt: 2, justifyContent: "center", alignItems: "center" }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_g = (_f = info == null ? void 0 : info.levels) == null ? void 0 : _f.findIndex((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) != null ? _g : -1) + 1 || "") })
|
|
326
|
-
] }),
|
|
327
|
-
/* @__PURE__ */ jsxs(Box, { sx: { mt: 2, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
328
|
-
/* @__PURE__ */ jsx(
|
|
329
|
-
Chip,
|
|
330
|
-
{
|
|
331
|
-
variant: "filled",
|
|
332
|
-
sx: {
|
|
333
|
-
backgroundColor: `${(_n = getStatus(
|
|
334
|
-
((_j = (_i = (_h = info == null ? void 0 : info.levels) == null ? void 0 : _h.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _i.selected_status) == null ? void 0 : _j.status_id) === 1 ? "approved" : ((_m = (_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _l.selected_status) == null ? void 0 : _m.status_id) === 3 ? "rejected" : "pending"
|
|
335
|
-
)) == null ? void 0 : _n.color} !important`,
|
|
336
|
-
color: `${(_u = getStatus(
|
|
337
|
-
((_q = (_p = (_o = info == null ? void 0 : info.levels) == null ? void 0 : _o.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _p.selected_status) == null ? void 0 : _q.status_id) === 1 ? "approved" : ((_t = (_s = (_r = info == null ? void 0 : info.levels) == null ? void 0 : _r.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _s.selected_status) == null ? void 0 : _t.status_id) === 3 ? "rejected" : "pending"
|
|
338
|
-
)) == null ? void 0 : _u.labelColor} !important`,
|
|
339
|
-
height: "40px",
|
|
340
|
-
padding: "8px",
|
|
341
|
-
borderRadius: "100px !important",
|
|
342
|
-
border: "0px !important",
|
|
343
|
-
"& .MuiChip-label": {
|
|
344
|
-
fontSize: "14px",
|
|
345
|
-
lineHeight: "15.4px",
|
|
346
|
-
fontWeight: "500",
|
|
347
|
-
textTransform: "capitalize"
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
label: `${((_x = (_w = (_v = info == null ? void 0 : info.levels) == null ? void 0 : _v.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _w.selected_status) == null ? void 0 : _x.status_id) === 2 || (info == null ? void 0 : info.isLevelZero) || !((_z = (_y = info == null ? void 0 : info.levels) == null ? void 0 : _y.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _z.selected_status) ? "pending" : (_C = (_B = (_A = info == null ? void 0 : info.levels) == null ? void 0 : _A.find((lvl) => lvl.id === (info == null ? void 0 : info.current_level))) == null ? void 0 : _B.selected_status) == null ? void 0 : _C.name}`
|
|
351
|
-
}
|
|
352
|
-
),
|
|
353
|
-
/* @__PURE__ */ jsx(Divider, { orientation: "vertical", sx: { ml: 5, borderColor: (_E = (_D = theme.palette) == null ? void 0 : _D.customColors) == null ? void 0 : _E.text4, height: "50px" } }),
|
|
354
|
-
/* @__PURE__ */ jsx(
|
|
355
|
-
IconButton,
|
|
356
|
-
{
|
|
357
|
-
disableFocusRipple: true,
|
|
358
|
-
disableRipple: true,
|
|
359
|
-
color: "primary",
|
|
360
|
-
sx: {
|
|
361
|
-
ml: 5,
|
|
362
|
-
background: (_H = (_G = (_F = theme.palette) == null ? void 0 : _F.customColors) == null ? void 0 : _G.primaryLightest) != null ? _H : "rgba(25,118,210,0.08)",
|
|
363
|
-
boxShadow: "2px 2px 10px 0px #4C4E6426",
|
|
364
|
-
"& span": { color: theme.palette.primary.dark }
|
|
365
|
-
},
|
|
366
|
-
onClick: () => handleExpandClick(info._id),
|
|
367
|
-
children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
|
|
368
|
-
}
|
|
369
|
-
)
|
|
370
|
-
] })
|
|
371
|
-
] })
|
|
372
|
-
}
|
|
373
|
-
),
|
|
374
|
-
expandedId === info._id && /* @__PURE__ */ jsx(Grid, { container: true, xs: 12, spacing: 5, children: /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, sx: { transform: "translateX(3.9%)" }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(Box, { sx: { height: "200px", display: "flex", justifyContent: "center", alignItems: "center" }, children: /* @__PURE__ */ jsx(CircularProgress, { size: 40, sx: { color: theme.palette.primary.dark } }) }) : /* @__PURE__ */ jsx(Box, { sx: { pl: 2 }, children: expandedDetails == null ? void 0 : expandedDetails.map((item, idx) => {
|
|
375
|
-
var _a2;
|
|
376
|
-
return /* @__PURE__ */ jsxs(Box, { sx: { mb: 2 }, children: [
|
|
377
|
-
/* @__PURE__ */ jsx(Typography, { variant: "caption", sx: { mr: 2 }, children: moment(item == null ? void 0 : item.created_at).format("DD-MM-YYYY HH:mm") }),
|
|
378
|
-
/* @__PURE__ */ jsxs(Typography, { variant: "body2", component: "span", children: [
|
|
379
|
-
item == null ? void 0 : item.type,
|
|
380
|
-
" - ",
|
|
381
|
-
((_a2 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _a2.comment) || "No Comments"
|
|
382
|
-
] })
|
|
383
|
-
] }, idx);
|
|
384
|
-
}) }) }) })
|
|
385
|
-
] }, index);
|
|
386
|
-
}) }),
|
|
387
|
-
selectedApprovalOtions === "All Requests" && /* @__PURE__ */ jsx(Box, { className: "fixedModal", sx: { overflowY: "auto", height: "calc(100vh - 180px)" }, children: allRequestArray && allRequestArray.map((info, index) => {
|
|
388
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
|
|
389
|
-
const currentLevel = info == null ? void 0 : info.levels.find((level_) => level_.id === (info == null ? void 0 : info.current_level));
|
|
390
|
-
currentLevel ? currentLevel.status_list : [];
|
|
391
|
-
const redir = buildRedirectionUrl(info);
|
|
392
|
-
return /* @__PURE__ */ jsxs(React2.Fragment, { children: [
|
|
393
|
-
/* @__PURE__ */ jsx(
|
|
394
|
-
Card,
|
|
395
|
-
{
|
|
396
|
-
sx: {
|
|
397
|
-
mb: 8,
|
|
398
|
-
"&.MuiCard-root.MuiPaper-elevation": {
|
|
399
|
-
boxShadow: "2px 2px 10px 0px #4C4E6426",
|
|
400
|
-
padding: "20px",
|
|
401
|
-
borderRadius: "10px"
|
|
402
|
-
}
|
|
403
|
-
},
|
|
404
|
-
children: /* @__PURE__ */ jsxs(CardContent, { sx: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
405
|
-
/* @__PURE__ */ jsxs(Box, { children: [
|
|
406
|
-
/* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(TruncatedTypography, { variant: "h6", color: "text.primary", sx: { textTransform: "capitalize", lineHeight: "22px" }, children: info.activity_name }) }),
|
|
407
|
-
/* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
|
|
408
|
-
TruncatedTypography,
|
|
846
|
+
({
|
|
847
|
+
approved: {
|
|
848
|
+
color: theme.palette.success.light,
|
|
849
|
+
labelColor: theme.palette.success.main
|
|
850
|
+
},
|
|
851
|
+
rejected: {
|
|
852
|
+
color: theme.palette.success.light,
|
|
853
|
+
labelColor: theme.palette.success.main
|
|
854
|
+
},
|
|
855
|
+
onhold: {
|
|
856
|
+
color: theme.palette.success.light,
|
|
857
|
+
labelColor: theme.palette.success.main
|
|
858
|
+
},
|
|
859
|
+
sendback: {
|
|
860
|
+
color: theme.palette.success.light,
|
|
861
|
+
labelColor: theme.palette.success.main
|
|
862
|
+
},
|
|
863
|
+
pending: {
|
|
864
|
+
color: theme.palette.success.light,
|
|
865
|
+
labelColor: theme.palette.success.main
|
|
866
|
+
}
|
|
867
|
+
});
|
|
868
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
869
|
+
/* @__PURE__ */ jsx(
|
|
870
|
+
Box,
|
|
871
|
+
{
|
|
872
|
+
sx: { display: "flex", justifyContent: "center", flexWrap: "nowrap" },
|
|
873
|
+
children: /* @__PURE__ */ jsxs(Box, { sx: { width: "100%", height: "100%" }, children: [
|
|
874
|
+
/* @__PURE__ */ jsxs(
|
|
875
|
+
Box,
|
|
876
|
+
{
|
|
877
|
+
sx: {
|
|
878
|
+
display: "flex",
|
|
879
|
+
justifyContent: "space-between",
|
|
880
|
+
alignItems: "center"
|
|
881
|
+
},
|
|
882
|
+
children: [
|
|
883
|
+
/* @__PURE__ */ jsxs(Box, { sx: { mt: 2, mb: 2 }, children: [
|
|
884
|
+
(selectedWorkflowsList == null ? void 0 : selectedWorkflowsList.length) ? /* @__PURE__ */ jsx(Tooltip, { title: "Selected Workflows", children: /* @__PURE__ */ jsx(
|
|
885
|
+
StyledChipProps,
|
|
886
|
+
{
|
|
887
|
+
label: "Selected",
|
|
888
|
+
icon: /* @__PURE__ */ jsx("span", { className: "icon-eye" }),
|
|
889
|
+
color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes("selected")) ? "primary" : "default",
|
|
890
|
+
variant: "filled",
|
|
891
|
+
sx: {
|
|
892
|
+
mr: 4,
|
|
893
|
+
mb: 4,
|
|
894
|
+
"& .MuiChip-icon": { fontSize: "18px !important" }
|
|
895
|
+
},
|
|
896
|
+
onClick: () => handleProfileToggle("selected")
|
|
897
|
+
}
|
|
898
|
+
) }) : "",
|
|
899
|
+
approvalChipLabel.map(({ label, icon, count }, index) => /* @__PURE__ */ jsx(Tooltip, { title: `${count} ${label}`, children: /* @__PURE__ */ jsx(
|
|
900
|
+
StyledChipProps,
|
|
901
|
+
{
|
|
902
|
+
label: `${count} ${label}`,
|
|
903
|
+
icon,
|
|
904
|
+
color: (selectedApprovalOtions == null ? void 0 : selectedApprovalOtions.includes(label)) ? "primary" : "default",
|
|
905
|
+
variant: "filled",
|
|
906
|
+
sx: {
|
|
907
|
+
mr: 4,
|
|
908
|
+
mb: 4,
|
|
909
|
+
"& .MuiChip-icon": { fontSize: "18px !important" }
|
|
910
|
+
},
|
|
911
|
+
onClick: () => handleProfileToggle(label)
|
|
912
|
+
}
|
|
913
|
+
) }, index))
|
|
914
|
+
] }),
|
|
915
|
+
/* @__PURE__ */ jsx(Box, { sx: { flexGrow: 1, maxWidth: 250, ml: "auto" }, children: /* @__PURE__ */ jsx(
|
|
916
|
+
SearchBox_default,
|
|
409
917
|
{
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
918
|
+
placeHolderTitle: "Search",
|
|
919
|
+
searchText,
|
|
920
|
+
handleClearSearch,
|
|
921
|
+
handleInputChange: (e) => handleSearchChange(e.target.value)
|
|
414
922
|
}
|
|
415
923
|
) })
|
|
416
|
-
]
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
924
|
+
]
|
|
925
|
+
}
|
|
926
|
+
),
|
|
927
|
+
selectedApprovalOtions === "selected" && /* @__PURE__ */ jsx(
|
|
928
|
+
Box,
|
|
929
|
+
{
|
|
930
|
+
className: "fixedModal",
|
|
931
|
+
sx: {
|
|
932
|
+
overflowY: "auto",
|
|
933
|
+
height: "calc(100vh - 180px)",
|
|
934
|
+
px: 2,
|
|
935
|
+
pb: 3
|
|
936
|
+
},
|
|
937
|
+
children: filteredSelectedRequestArray == null ? void 0 : filteredSelectedRequestArray.map((info, index) => {
|
|
938
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
939
|
+
const currentLevel = info == null ? void 0 : info.levels.find(
|
|
940
|
+
(level_) => level_.id === (info == null ? void 0 : info.current_level)
|
|
941
|
+
);
|
|
942
|
+
const statusList = currentLevel ? currentLevel.status_list : [];
|
|
943
|
+
(statusList || []).reduce(
|
|
944
|
+
(acc, s) => {
|
|
945
|
+
if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
|
|
946
|
+
return acc;
|
|
947
|
+
},
|
|
948
|
+
{}
|
|
949
|
+
);
|
|
950
|
+
const redir = buildRedirectionUrl(info);
|
|
951
|
+
const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
|
|
952
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
953
|
+
)) == 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(
|
|
954
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
955
|
+
)) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
|
|
956
|
+
const statusData = getStatus2(currentStatus);
|
|
957
|
+
return /* @__PURE__ */ jsxs(
|
|
958
|
+
Card,
|
|
420
959
|
{
|
|
421
|
-
variant: "caption",
|
|
422
|
-
color: "customColors.text3",
|
|
423
|
-
sx: { textTransform: "capitalize", lineHeight: "13.2px" },
|
|
424
|
-
children: "Links"
|
|
425
|
-
}
|
|
426
|
-
) }),
|
|
427
|
-
/* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx("a", { href: redir, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
|
|
428
|
-
TruncatedTypography,
|
|
429
|
-
{
|
|
430
|
-
variant: "subtitle2",
|
|
431
|
-
color: "primary.dark",
|
|
432
|
-
sx: { mt: "13px", lineHeight: "15.4px" },
|
|
433
|
-
children: redir
|
|
434
|
-
}
|
|
435
|
-
) }) })
|
|
436
|
-
] }),
|
|
437
|
-
/* @__PURE__ */ jsxs(Box, { children: [
|
|
438
|
-
/* @__PURE__ */ jsx(Tooltip, { title: "Attachments", children: /* @__PURE__ */ jsx(
|
|
439
|
-
TruncatedTypography,
|
|
440
|
-
{
|
|
441
|
-
variant: "caption",
|
|
442
|
-
color: "customColors.text3",
|
|
443
|
-
sx: { textTransform: "capitalize", lineHeight: "13.2px" },
|
|
444
|
-
children: "Attachments"
|
|
445
|
-
}
|
|
446
|
-
) }),
|
|
447
|
-
((_a = info == null ? void 0 : info.attachment_links) == null ? void 0 : _a.length) ? info == null ? void 0 : info.attachment_links.map((link, idx) => /* @__PURE__ */ jsx(Tooltip, { title: `Attachment ${idx + 1}`, children: /* @__PURE__ */ jsx("a", { href: link, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
|
|
448
|
-
TruncatedTypography,
|
|
449
|
-
{
|
|
450
|
-
variant: "subtitle2",
|
|
451
|
-
color: "primary.dark",
|
|
452
|
-
sx: { mt: "13px", textTransform: "capitalize", lineHeight: "15.4px" },
|
|
453
|
-
children: link || "N/A"
|
|
454
|
-
}
|
|
455
|
-
) }) }, idx)) : /* @__PURE__ */ jsx(Box, { sx: { display: "flex", mt: 2, justifyContent: "center", alignItems: "center", lineHeight: "15.4px" }, children: "N/A" })
|
|
456
|
-
] }),
|
|
457
|
-
/* @__PURE__ */ jsxs(Box, { sx: { mt: 2, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
458
|
-
/* @__PURE__ */ jsx(
|
|
459
|
-
Chip,
|
|
460
|
-
{
|
|
461
|
-
variant: "filled",
|
|
462
960
|
sx: {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
)) == null ? void 0 : _o.labelColor} !important`,
|
|
469
|
-
height: "40px",
|
|
470
|
-
padding: "8px",
|
|
471
|
-
borderRadius: "100px !important",
|
|
472
|
-
border: "0px !important",
|
|
473
|
-
"& .MuiChip-label": {
|
|
474
|
-
fontSize: "14px",
|
|
475
|
-
lineHeight: "15.4px",
|
|
476
|
-
fontWeight: "500",
|
|
477
|
-
textTransform: "capitalize"
|
|
478
|
-
}
|
|
961
|
+
mb: 3,
|
|
962
|
+
borderRadius: "14px",
|
|
963
|
+
boxShadow: "0px 2px 10px rgba(76, 78, 100, 0.1)",
|
|
964
|
+
px: 3,
|
|
965
|
+
py: 2
|
|
479
966
|
},
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
967
|
+
children: [
|
|
968
|
+
/* @__PURE__ */ jsxs(
|
|
969
|
+
CardContent,
|
|
970
|
+
{
|
|
971
|
+
sx: {
|
|
972
|
+
display: "flex",
|
|
973
|
+
justifyContent: "space-between",
|
|
974
|
+
alignItems: "center",
|
|
975
|
+
flexWrap: { xs: "wrap", md: "nowrap" },
|
|
976
|
+
gap: 2
|
|
977
|
+
},
|
|
978
|
+
children: [
|
|
979
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "22%", minWidth: 220 }, children: [
|
|
980
|
+
/* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(
|
|
981
|
+
Typography,
|
|
982
|
+
{
|
|
983
|
+
variant: "h6",
|
|
984
|
+
fontWeight: 600,
|
|
985
|
+
noWrap: true,
|
|
986
|
+
color: "text.primary",
|
|
987
|
+
children: info.activity_name
|
|
988
|
+
}
|
|
989
|
+
) }),
|
|
990
|
+
/* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
|
|
991
|
+
Typography,
|
|
992
|
+
{
|
|
993
|
+
variant: "body2",
|
|
994
|
+
color: "text.secondary",
|
|
995
|
+
noWrap: true,
|
|
996
|
+
sx: { mt: 0.5 },
|
|
997
|
+
children: info.description_data
|
|
998
|
+
}
|
|
999
|
+
) })
|
|
1000
|
+
] }),
|
|
1001
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "20%", minWidth: 180 }, children: [
|
|
1002
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
|
|
1003
|
+
/* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx(
|
|
1004
|
+
Typography,
|
|
1005
|
+
{
|
|
1006
|
+
component: "a",
|
|
1007
|
+
href: redir,
|
|
1008
|
+
target: "_blank",
|
|
1009
|
+
rel: "noreferrer",
|
|
1010
|
+
sx: {
|
|
1011
|
+
display: "block",
|
|
1012
|
+
color: "primary.dark",
|
|
1013
|
+
fontWeight: 500,
|
|
1014
|
+
textDecoration: "none",
|
|
1015
|
+
overflow: "hidden",
|
|
1016
|
+
textOverflow: "ellipsis",
|
|
1017
|
+
whiteSpace: "nowrap",
|
|
1018
|
+
mt: 0.8
|
|
1019
|
+
},
|
|
1020
|
+
children: redir
|
|
1021
|
+
}
|
|
1022
|
+
) })
|
|
1023
|
+
] }),
|
|
1024
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
|
|
1025
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
|
|
1026
|
+
/* @__PURE__ */ jsx(
|
|
1027
|
+
Typography,
|
|
1028
|
+
{
|
|
1029
|
+
variant: "body2",
|
|
1030
|
+
noWrap: true,
|
|
1031
|
+
sx: {
|
|
1032
|
+
mt: 0.8,
|
|
1033
|
+
color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
|
|
1034
|
+
},
|
|
1035
|
+
children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
|
|
1036
|
+
}
|
|
1037
|
+
)
|
|
1038
|
+
] }),
|
|
1039
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
|
|
1040
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
|
|
1041
|
+
/* @__PURE__ */ jsx(
|
|
1042
|
+
Typography,
|
|
1043
|
+
{
|
|
1044
|
+
variant: "body2",
|
|
1045
|
+
sx: {
|
|
1046
|
+
mt: 0.8,
|
|
1047
|
+
fontWeight: 500,
|
|
1048
|
+
color: "text.primary"
|
|
1049
|
+
},
|
|
1050
|
+
children: (currentLevel == null ? void 0 : currentLevel.tat_expiry) ? moment(currentLevel.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY hh:mm A") : "N/A"
|
|
1051
|
+
}
|
|
1052
|
+
)
|
|
1053
|
+
] }),
|
|
1054
|
+
/* @__PURE__ */ jsxs(
|
|
1055
|
+
Box,
|
|
1056
|
+
{
|
|
1057
|
+
sx: {
|
|
1058
|
+
flexBasis: "8%",
|
|
1059
|
+
minWidth: 80,
|
|
1060
|
+
textAlign: "center"
|
|
1061
|
+
},
|
|
1062
|
+
children: [
|
|
1063
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
|
|
1064
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.findIndex(
|
|
1065
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1066
|
+
)) != null ? _j : -1) + 1 || "") })
|
|
1067
|
+
]
|
|
1068
|
+
}
|
|
1069
|
+
),
|
|
1070
|
+
/* @__PURE__ */ jsxs(
|
|
1071
|
+
Box,
|
|
1072
|
+
{
|
|
1073
|
+
sx: {
|
|
1074
|
+
flexBasis: "18%",
|
|
1075
|
+
minWidth: 200,
|
|
1076
|
+
display: "flex",
|
|
1077
|
+
alignItems: "center",
|
|
1078
|
+
justifyContent: "flex-end",
|
|
1079
|
+
gap: 1.5
|
|
1080
|
+
},
|
|
1081
|
+
children: [
|
|
1082
|
+
(info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
|
|
1083
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1084
|
+
)) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
|
|
1085
|
+
(lvl) => {
|
|
1086
|
+
var _a3;
|
|
1087
|
+
return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
|
|
1088
|
+
}
|
|
1089
|
+
)) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsx(
|
|
1090
|
+
Statusselector_default,
|
|
1091
|
+
{
|
|
1092
|
+
onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
|
|
1093
|
+
onApprove: () => {
|
|
1094
|
+
var _a3;
|
|
1095
|
+
return handleApprove(
|
|
1096
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
|
|
1097
|
+
);
|
|
1098
|
+
},
|
|
1099
|
+
onReject: () => {
|
|
1100
|
+
var _a3;
|
|
1101
|
+
return handleReject(
|
|
1102
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
|
|
1103
|
+
);
|
|
1104
|
+
},
|
|
1105
|
+
onHold: () => {
|
|
1106
|
+
var _a3;
|
|
1107
|
+
return handleOnHold(
|
|
1108
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
|
|
1109
|
+
);
|
|
1110
|
+
},
|
|
1111
|
+
statusList: (info == null ? void 0 : info.isLevelZero) && (info == null ? void 0 : info.created_by) === ((_o = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _o.id) ? statusList == null ? void 0 : statusList.filter(
|
|
1112
|
+
(app) => app.status == 1
|
|
1113
|
+
) : statusList
|
|
1114
|
+
}
|
|
1115
|
+
) : /* @__PURE__ */ jsx(
|
|
1116
|
+
Chip,
|
|
1117
|
+
{
|
|
1118
|
+
variant: "filled",
|
|
1119
|
+
sx: {
|
|
1120
|
+
backgroundColor: getStatus2(currentStatus).color,
|
|
1121
|
+
color: getStatus2(currentStatus).labelColor,
|
|
1122
|
+
height: "40px",
|
|
1123
|
+
px: 2,
|
|
1124
|
+
borderRadius: "100px !important",
|
|
1125
|
+
"& .MuiChip-label": {
|
|
1126
|
+
fontSize: "14px",
|
|
1127
|
+
lineHeight: "15.4px",
|
|
1128
|
+
fontWeight: "500",
|
|
1129
|
+
textTransform: "capitalize"
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
label: statusData.title
|
|
1133
|
+
}
|
|
1134
|
+
),
|
|
1135
|
+
/* @__PURE__ */ jsx(
|
|
1136
|
+
Divider,
|
|
1137
|
+
{
|
|
1138
|
+
orientation: "vertical",
|
|
1139
|
+
flexItem: true,
|
|
1140
|
+
sx: {
|
|
1141
|
+
borderColor: "#E0E0E0",
|
|
1142
|
+
height: "40px"
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
),
|
|
1146
|
+
/* @__PURE__ */ jsx(
|
|
1147
|
+
IconButton,
|
|
1148
|
+
{
|
|
1149
|
+
disableFocusRipple: true,
|
|
1150
|
+
disableRipple: true,
|
|
1151
|
+
color: "primary",
|
|
1152
|
+
sx: {
|
|
1153
|
+
background: "rgba(25,118,210,0.08)",
|
|
1154
|
+
boxShadow: "2px 2px 10px 0px #4C4E6426",
|
|
1155
|
+
"& span": { color: "primary.dark" }
|
|
1156
|
+
},
|
|
1157
|
+
onClick: () => handleExpandClick(info._id),
|
|
1158
|
+
children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
|
|
1159
|
+
}
|
|
1160
|
+
)
|
|
1161
|
+
]
|
|
1162
|
+
}
|
|
1163
|
+
)
|
|
1164
|
+
]
|
|
1165
|
+
}
|
|
1166
|
+
),
|
|
1167
|
+
expandedId === info._id && /* @__PURE__ */ jsx(Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(
|
|
1168
|
+
Box,
|
|
1169
|
+
{
|
|
1170
|
+
sx: {
|
|
1171
|
+
height: 150,
|
|
1172
|
+
display: "flex",
|
|
1173
|
+
justifyContent: "center",
|
|
1174
|
+
alignItems: "center"
|
|
1175
|
+
},
|
|
1176
|
+
children: /* @__PURE__ */ jsx(CircularProgress, { size: 36, color: "primary" })
|
|
1177
|
+
}
|
|
1178
|
+
) : /* @__PURE__ */ jsx(
|
|
1179
|
+
CustomTimelineWithStatus,
|
|
1180
|
+
{
|
|
1181
|
+
events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
|
|
1182
|
+
var _a3, _b3, _c3, _d3;
|
|
1183
|
+
return {
|
|
1184
|
+
date: moment(item == null ? void 0 : item.created_at).format(
|
|
1185
|
+
"DD-MM-YYYY"
|
|
1186
|
+
),
|
|
1187
|
+
time: moment(item == null ? void 0 : item.created_at).format("HH:mm"),
|
|
1188
|
+
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",
|
|
1189
|
+
subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
|
|
1190
|
+
attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
|
|
1191
|
+
count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
|
|
1192
|
+
cardType: "card"
|
|
1193
|
+
};
|
|
1194
|
+
})
|
|
1195
|
+
}
|
|
1196
|
+
) })
|
|
1197
|
+
]
|
|
1198
|
+
},
|
|
1199
|
+
index
|
|
1200
|
+
);
|
|
1201
|
+
})
|
|
1202
|
+
}
|
|
1203
|
+
),
|
|
1204
|
+
selectedApprovalOtions === "All Requests" && /* @__PURE__ */ jsx(
|
|
1205
|
+
Box,
|
|
1206
|
+
{
|
|
1207
|
+
className: "fixedModal",
|
|
1208
|
+
sx: {
|
|
1209
|
+
overflowY: "auto",
|
|
1210
|
+
height: "calc(100vh - 180px)",
|
|
1211
|
+
px: 2,
|
|
1212
|
+
pb: 3
|
|
1213
|
+
},
|
|
1214
|
+
children: filteredAllRequestArray == null ? void 0 : filteredAllRequestArray.map((info, index) => {
|
|
1215
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
1216
|
+
const currentLevel = info == null ? void 0 : info.levels.find(
|
|
1217
|
+
(level_) => level_.id === (info == null ? void 0 : info.current_level)
|
|
1218
|
+
);
|
|
1219
|
+
const statusList = currentLevel ? currentLevel.status_list : [];
|
|
1220
|
+
(statusList || []).reduce(
|
|
1221
|
+
(acc, s) => {
|
|
1222
|
+
if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
|
|
1223
|
+
return acc;
|
|
1224
|
+
},
|
|
1225
|
+
{}
|
|
1226
|
+
);
|
|
1227
|
+
const redir = buildRedirectionUrl(info);
|
|
1228
|
+
const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
|
|
1229
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1230
|
+
)) == 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(
|
|
1231
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1232
|
+
)) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
|
|
1233
|
+
const statusData = getStatus2(currentStatus);
|
|
1234
|
+
return /* @__PURE__ */ jsxs(
|
|
1235
|
+
Card,
|
|
550
1236
|
{
|
|
551
|
-
variant: "caption",
|
|
552
|
-
color: "customColors.text3",
|
|
553
|
-
sx: { textTransform: "capitalize", lineHeight: "13.2px" },
|
|
554
|
-
children: "Links"
|
|
555
|
-
}
|
|
556
|
-
) }),
|
|
557
|
-
/* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx("a", { href: redir, style: { cursor: "pointer", textDecoration: "none" }, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx(
|
|
558
|
-
TruncatedTypography,
|
|
559
|
-
{
|
|
560
|
-
variant: "subtitle2",
|
|
561
|
-
color: "primary.dark",
|
|
562
|
-
sx: { mt: "13px", lineHeight: "15.4px" },
|
|
563
|
-
children: redir
|
|
564
|
-
}
|
|
565
|
-
) }) })
|
|
566
|
-
] }),
|
|
567
|
-
/* @__PURE__ */ jsxs(Box, { sx: { mt: 2, display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
568
|
-
/* @__PURE__ */ jsx(
|
|
569
|
-
Chip,
|
|
570
|
-
{
|
|
571
|
-
variant: "filled",
|
|
572
1237
|
sx: {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
)) == null ? void 0 : _o.labelColor} !important`,
|
|
579
|
-
height: "40px",
|
|
580
|
-
padding: "8px",
|
|
581
|
-
borderRadius: "100px !important",
|
|
582
|
-
border: "0px !important",
|
|
583
|
-
"& .MuiChip-label": {
|
|
584
|
-
fontSize: "14px",
|
|
585
|
-
lineHeight: "15.4px",
|
|
586
|
-
fontWeight: "500",
|
|
587
|
-
textTransform: "capitalize"
|
|
588
|
-
}
|
|
1238
|
+
mb: 3,
|
|
1239
|
+
borderRadius: "14px",
|
|
1240
|
+
boxShadow: "0px 2px 10px rgba(76, 78, 100, 0.1)",
|
|
1241
|
+
px: 3,
|
|
1242
|
+
py: 2
|
|
589
1243
|
},
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
1244
|
+
children: [
|
|
1245
|
+
/* @__PURE__ */ jsxs(
|
|
1246
|
+
CardContent,
|
|
1247
|
+
{
|
|
1248
|
+
sx: {
|
|
1249
|
+
display: "flex",
|
|
1250
|
+
justifyContent: "space-between",
|
|
1251
|
+
alignItems: "center",
|
|
1252
|
+
flexWrap: { xs: "wrap", md: "nowrap" },
|
|
1253
|
+
gap: 2
|
|
1254
|
+
},
|
|
1255
|
+
children: [
|
|
1256
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "20%", minWidth: 220 }, children: [
|
|
1257
|
+
/* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(
|
|
1258
|
+
Typography,
|
|
1259
|
+
{
|
|
1260
|
+
variant: "h6",
|
|
1261
|
+
fontWeight: 600,
|
|
1262
|
+
noWrap: true,
|
|
1263
|
+
color: "text.primary",
|
|
1264
|
+
children: info.activity_name
|
|
1265
|
+
}
|
|
1266
|
+
) }),
|
|
1267
|
+
/* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
|
|
1268
|
+
Typography,
|
|
1269
|
+
{
|
|
1270
|
+
variant: "body2",
|
|
1271
|
+
noWrap: true,
|
|
1272
|
+
sx: { mt: 0.5, color: "text.secondary" },
|
|
1273
|
+
children: info.description_data
|
|
1274
|
+
}
|
|
1275
|
+
) })
|
|
1276
|
+
] }),
|
|
1277
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "18%", minWidth: 180 }, children: [
|
|
1278
|
+
/* @__PURE__ */ jsx(
|
|
1279
|
+
Typography,
|
|
1280
|
+
{
|
|
1281
|
+
variant: "caption",
|
|
1282
|
+
color: "text.secondary",
|
|
1283
|
+
sx: { display: "block" },
|
|
1284
|
+
children: "Links"
|
|
1285
|
+
}
|
|
1286
|
+
),
|
|
1287
|
+
/* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx(
|
|
1288
|
+
Typography,
|
|
1289
|
+
{
|
|
1290
|
+
component: "a",
|
|
1291
|
+
href: redir,
|
|
1292
|
+
target: "_blank",
|
|
1293
|
+
rel: "noreferrer",
|
|
1294
|
+
sx: {
|
|
1295
|
+
display: "block",
|
|
1296
|
+
color: "primary.dark",
|
|
1297
|
+
fontWeight: 500,
|
|
1298
|
+
textDecoration: "none",
|
|
1299
|
+
overflow: "hidden",
|
|
1300
|
+
textOverflow: "ellipsis",
|
|
1301
|
+
whiteSpace: "nowrap",
|
|
1302
|
+
mt: 0.8
|
|
1303
|
+
},
|
|
1304
|
+
children: redir
|
|
1305
|
+
}
|
|
1306
|
+
) })
|
|
1307
|
+
] }),
|
|
1308
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
|
|
1309
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
|
|
1310
|
+
/* @__PURE__ */ jsx(
|
|
1311
|
+
Typography,
|
|
1312
|
+
{
|
|
1313
|
+
variant: "body2",
|
|
1314
|
+
noWrap: true,
|
|
1315
|
+
sx: {
|
|
1316
|
+
mt: 0.8,
|
|
1317
|
+
color: ((_g2 = info == null ? void 0 : info.attachment_links) == null ? void 0 : _g2.length) ? "primary.dark" : "text.disabled"
|
|
1318
|
+
},
|
|
1319
|
+
children: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? `${info.attachment_links.length} file(s)` : "N/A"
|
|
1320
|
+
}
|
|
1321
|
+
)
|
|
1322
|
+
] }),
|
|
1323
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
|
|
1324
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
|
|
1325
|
+
/* @__PURE__ */ jsx(
|
|
1326
|
+
Typography,
|
|
1327
|
+
{
|
|
1328
|
+
variant: "body2",
|
|
1329
|
+
sx: {
|
|
1330
|
+
mt: 0.8,
|
|
1331
|
+
fontWeight: 500,
|
|
1332
|
+
color: "text.primary"
|
|
1333
|
+
},
|
|
1334
|
+
children: (currentLevel == null ? void 0 : currentLevel.tat_expiry) ? moment(currentLevel.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY hh:mm A") : "N/A"
|
|
1335
|
+
}
|
|
1336
|
+
)
|
|
1337
|
+
] }),
|
|
1338
|
+
/* @__PURE__ */ jsxs(
|
|
1339
|
+
Box,
|
|
1340
|
+
{
|
|
1341
|
+
sx: {
|
|
1342
|
+
flexBasis: "8%",
|
|
1343
|
+
minWidth: 80,
|
|
1344
|
+
textAlign: "center"
|
|
1345
|
+
},
|
|
1346
|
+
children: [
|
|
1347
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
|
|
1348
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_j = (_i = info == null ? void 0 : info.levels) == null ? void 0 : _i.findIndex(
|
|
1349
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1350
|
+
)) != null ? _j : -1) + 1 || "") })
|
|
1351
|
+
]
|
|
1352
|
+
}
|
|
1353
|
+
),
|
|
1354
|
+
/* @__PURE__ */ jsxs(
|
|
1355
|
+
Box,
|
|
1356
|
+
{
|
|
1357
|
+
sx: {
|
|
1358
|
+
flexBasis: "18%",
|
|
1359
|
+
minWidth: 200,
|
|
1360
|
+
display: "flex",
|
|
1361
|
+
alignItems: "center",
|
|
1362
|
+
justifyContent: "flex-end",
|
|
1363
|
+
gap: 1.5
|
|
1364
|
+
},
|
|
1365
|
+
children: [
|
|
1366
|
+
(info == null ? void 0 : info.current_status) !== "completed" && ((_l = (_k = info == null ? void 0 : info.levels) == null ? void 0 : _k.find(
|
|
1367
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1368
|
+
)) == null ? void 0 : _l.order) <= ((_n = (_m = info == null ? void 0 : info.levels) == null ? void 0 : _m.find(
|
|
1369
|
+
(lvl) => {
|
|
1370
|
+
var _a3;
|
|
1371
|
+
return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
|
|
1372
|
+
}
|
|
1373
|
+
)) == null ? void 0 : _n.order) ? /* @__PURE__ */ jsx(
|
|
1374
|
+
Statusselector_default,
|
|
1375
|
+
{
|
|
1376
|
+
onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
|
|
1377
|
+
onApprove: () => {
|
|
1378
|
+
var _a3;
|
|
1379
|
+
return handleApprove(
|
|
1380
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
|
|
1381
|
+
);
|
|
1382
|
+
},
|
|
1383
|
+
onReject: () => {
|
|
1384
|
+
var _a3;
|
|
1385
|
+
return handleReject(
|
|
1386
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
|
|
1387
|
+
);
|
|
1388
|
+
},
|
|
1389
|
+
onHold: () => {
|
|
1390
|
+
var _a3;
|
|
1391
|
+
return handleOnHold(
|
|
1392
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
|
|
1393
|
+
);
|
|
1394
|
+
},
|
|
1395
|
+
statusList: (info == null ? void 0 : info.isLevelZero) && (info == null ? void 0 : info.created_by) === ((_o = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _o.id) ? statusList == null ? void 0 : statusList.filter(
|
|
1396
|
+
(app) => app.status == 1
|
|
1397
|
+
) : statusList
|
|
1398
|
+
}
|
|
1399
|
+
) : /* @__PURE__ */ jsx(
|
|
1400
|
+
Chip,
|
|
1401
|
+
{
|
|
1402
|
+
variant: "filled",
|
|
1403
|
+
sx: {
|
|
1404
|
+
backgroundColor: getStatus2(currentStatus).color,
|
|
1405
|
+
color: getStatus2(currentStatus).labelColor,
|
|
1406
|
+
height: "40px",
|
|
1407
|
+
px: 2,
|
|
1408
|
+
borderRadius: "100px !important",
|
|
1409
|
+
"& .MuiChip-label": {
|
|
1410
|
+
fontSize: "14px",
|
|
1411
|
+
lineHeight: "15.4px",
|
|
1412
|
+
fontWeight: "500",
|
|
1413
|
+
textTransform: "capitalize"
|
|
1414
|
+
}
|
|
1415
|
+
},
|
|
1416
|
+
label: statusData.title
|
|
1417
|
+
}
|
|
1418
|
+
),
|
|
1419
|
+
/* @__PURE__ */ jsx(
|
|
1420
|
+
Divider,
|
|
1421
|
+
{
|
|
1422
|
+
orientation: "vertical",
|
|
1423
|
+
flexItem: true,
|
|
1424
|
+
sx: {
|
|
1425
|
+
borderColor: "#E0E0E0",
|
|
1426
|
+
height: "40px"
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
),
|
|
1430
|
+
/* @__PURE__ */ jsx(
|
|
1431
|
+
IconButton,
|
|
1432
|
+
{
|
|
1433
|
+
disableFocusRipple: true,
|
|
1434
|
+
disableRipple: true,
|
|
1435
|
+
color: "primary",
|
|
1436
|
+
sx: {
|
|
1437
|
+
background: "rgba(25,118,210,0.08)",
|
|
1438
|
+
boxShadow: "2px 2px 10px 0px #4C4E6426",
|
|
1439
|
+
"& span": { color: "primary.dark" }
|
|
1440
|
+
},
|
|
1441
|
+
onClick: () => handleExpandClick(info._id),
|
|
1442
|
+
children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
|
|
1443
|
+
}
|
|
1444
|
+
)
|
|
1445
|
+
]
|
|
1446
|
+
}
|
|
1447
|
+
)
|
|
1448
|
+
]
|
|
1449
|
+
}
|
|
1450
|
+
),
|
|
1451
|
+
expandedId === info._id && /* @__PURE__ */ jsx(Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(
|
|
1452
|
+
Box,
|
|
1453
|
+
{
|
|
1454
|
+
sx: {
|
|
1455
|
+
height: 150,
|
|
1456
|
+
display: "flex",
|
|
1457
|
+
justifyContent: "center",
|
|
1458
|
+
alignItems: "center"
|
|
1459
|
+
},
|
|
1460
|
+
children: /* @__PURE__ */ jsx(CircularProgress, { size: 36, color: "primary" })
|
|
1461
|
+
}
|
|
1462
|
+
) : /* @__PURE__ */ jsx(
|
|
1463
|
+
CustomTimelineWithStatus,
|
|
1464
|
+
{
|
|
1465
|
+
events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
|
|
1466
|
+
var _a3, _b3, _c3, _d3;
|
|
1467
|
+
return {
|
|
1468
|
+
date: moment(item == null ? void 0 : item.created_at).format(
|
|
1469
|
+
"DD-MM-YYYY"
|
|
1470
|
+
),
|
|
1471
|
+
time: moment(item == null ? void 0 : item.created_at).format("HH:mm"),
|
|
1472
|
+
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",
|
|
1473
|
+
subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
|
|
1474
|
+
attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
|
|
1475
|
+
count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
|
|
1476
|
+
cardType: "card"
|
|
1477
|
+
};
|
|
1478
|
+
})
|
|
1479
|
+
}
|
|
1480
|
+
) })
|
|
1481
|
+
]
|
|
1482
|
+
},
|
|
1483
|
+
index
|
|
1484
|
+
);
|
|
1485
|
+
})
|
|
1486
|
+
}
|
|
1487
|
+
),
|
|
1488
|
+
selectedApprovalOtions === "Action Required" && /* @__PURE__ */ jsx(
|
|
1489
|
+
Box,
|
|
1490
|
+
{
|
|
1491
|
+
className: "fixedModal",
|
|
1492
|
+
sx: {
|
|
1493
|
+
overflowY: "auto",
|
|
1494
|
+
height: "calc(100vh - 180px)",
|
|
1495
|
+
px: 2,
|
|
1496
|
+
pb: 3
|
|
1497
|
+
},
|
|
1498
|
+
children: filteredPendingRequestArray == null ? void 0 : filteredPendingRequestArray.map((info, index) => {
|
|
1499
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l;
|
|
1500
|
+
const currentLevel = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
|
|
1501
|
+
(level_) => level_.id === (info == null ? void 0 : info.current_level)
|
|
1502
|
+
);
|
|
1503
|
+
const statusList = currentLevel ? currentLevel.status_list : [];
|
|
1504
|
+
(statusList || []).reduce(
|
|
1505
|
+
(acc, s) => {
|
|
1506
|
+
if ((s == null ? void 0 : s.status) != null) acc[s.status] = s;
|
|
1507
|
+
return acc;
|
|
1508
|
+
},
|
|
1509
|
+
{}
|
|
1510
|
+
);
|
|
1511
|
+
const redir = buildRedirectionUrl(info);
|
|
1512
|
+
const currentStatus = ((_d2 = (_c2 = (_b2 = info == null ? void 0 : info.levels) == null ? void 0 : _b2.find(
|
|
1513
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1514
|
+
)) == 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(
|
|
1515
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1516
|
+
)) == null ? void 0 : _f2.selected_status) == null ? void 0 : _g2.status_id) === 3 ? "rejected" : "pending";
|
|
1517
|
+
const statusData = getStatus2(currentStatus);
|
|
1518
|
+
return /* @__PURE__ */ jsxs(
|
|
1519
|
+
Card,
|
|
596
1520
|
{
|
|
597
|
-
disableFocusRipple: true,
|
|
598
|
-
disableRipple: true,
|
|
599
|
-
color: "primary",
|
|
600
1521
|
sx: {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
boxShadow: "
|
|
604
|
-
|
|
1522
|
+
mb: 3,
|
|
1523
|
+
borderRadius: "14px",
|
|
1524
|
+
boxShadow: "0px 2px 10px rgba(76, 78, 100, 0.1)",
|
|
1525
|
+
px: 3,
|
|
1526
|
+
py: 2
|
|
605
1527
|
},
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
1528
|
+
children: [
|
|
1529
|
+
/* @__PURE__ */ jsxs(
|
|
1530
|
+
CardContent,
|
|
1531
|
+
{
|
|
1532
|
+
sx: {
|
|
1533
|
+
display: "flex",
|
|
1534
|
+
justifyContent: "space-between",
|
|
1535
|
+
alignItems: "center",
|
|
1536
|
+
flexWrap: { xs: "wrap", md: "nowrap" },
|
|
1537
|
+
gap: 2
|
|
1538
|
+
},
|
|
1539
|
+
children: [
|
|
1540
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "22%", minWidth: 220 }, children: [
|
|
1541
|
+
/* @__PURE__ */ jsx(Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsx(
|
|
1542
|
+
Typography,
|
|
1543
|
+
{
|
|
1544
|
+
variant: "h6",
|
|
1545
|
+
fontWeight: 600,
|
|
1546
|
+
noWrap: true,
|
|
1547
|
+
color: "text.primary",
|
|
1548
|
+
children: info.activity_name
|
|
1549
|
+
}
|
|
1550
|
+
) }),
|
|
1551
|
+
/* @__PURE__ */ jsx(Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsx(
|
|
1552
|
+
Typography,
|
|
1553
|
+
{
|
|
1554
|
+
variant: "body2",
|
|
1555
|
+
color: "text.secondary",
|
|
1556
|
+
noWrap: true,
|
|
1557
|
+
sx: { mt: 0.5 },
|
|
1558
|
+
children: info.description_data
|
|
1559
|
+
}
|
|
1560
|
+
) })
|
|
1561
|
+
] }),
|
|
1562
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flexBasis: "20%", minWidth: 180 }, children: [
|
|
1563
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
|
|
1564
|
+
/* @__PURE__ */ jsx(Tooltip, { title: redir, children: /* @__PURE__ */ jsx(
|
|
1565
|
+
Typography,
|
|
1566
|
+
{
|
|
1567
|
+
component: "a",
|
|
1568
|
+
href: redir,
|
|
1569
|
+
target: "_blank",
|
|
1570
|
+
rel: "noreferrer",
|
|
1571
|
+
sx: {
|
|
1572
|
+
display: "block",
|
|
1573
|
+
color: "primary.dark",
|
|
1574
|
+
fontWeight: 500,
|
|
1575
|
+
textDecoration: "none",
|
|
1576
|
+
overflow: "hidden",
|
|
1577
|
+
textOverflow: "ellipsis",
|
|
1578
|
+
whiteSpace: "nowrap",
|
|
1579
|
+
mt: 0.8
|
|
1580
|
+
},
|
|
1581
|
+
children: redir
|
|
1582
|
+
}
|
|
1583
|
+
) })
|
|
1584
|
+
] }),
|
|
1585
|
+
/* @__PURE__ */ jsxs(
|
|
1586
|
+
Box,
|
|
1587
|
+
{
|
|
1588
|
+
sx: {
|
|
1589
|
+
flexBasis: "18%",
|
|
1590
|
+
minWidth: 200,
|
|
1591
|
+
display: "flex",
|
|
1592
|
+
alignItems: "center",
|
|
1593
|
+
justifyContent: "flex-end",
|
|
1594
|
+
gap: 1.5
|
|
1595
|
+
},
|
|
1596
|
+
children: [
|
|
1597
|
+
(info == null ? void 0 : info.current_status) !== "completed" && ((_i = (_h = info == null ? void 0 : info.levels) == null ? void 0 : _h.find(
|
|
1598
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1599
|
+
)) == null ? void 0 : _i.order) <= ((_k = (_j = info == null ? void 0 : info.levels) == null ? void 0 : _j.find(
|
|
1600
|
+
(lvl) => {
|
|
1601
|
+
var _a3;
|
|
1602
|
+
return Number(lvl.assign_to[0]) === ((_a3 = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a3.id);
|
|
1603
|
+
}
|
|
1604
|
+
)) == null ? void 0 : _k.order) ? /* @__PURE__ */ jsx(
|
|
1605
|
+
Statusselector_default,
|
|
1606
|
+
{
|
|
1607
|
+
onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
|
|
1608
|
+
onApprove: () => {
|
|
1609
|
+
var _a3;
|
|
1610
|
+
return handleApprove(
|
|
1611
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
|
|
1612
|
+
);
|
|
1613
|
+
},
|
|
1614
|
+
onReject: () => {
|
|
1615
|
+
var _a3;
|
|
1616
|
+
return handleReject(
|
|
1617
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
|
|
1618
|
+
);
|
|
1619
|
+
},
|
|
1620
|
+
onHold: () => {
|
|
1621
|
+
var _a3;
|
|
1622
|
+
return handleOnHold(
|
|
1623
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
|
|
1624
|
+
);
|
|
1625
|
+
},
|
|
1626
|
+
statusList: (info == null ? void 0 : info.isLevelZero) && (info == null ? void 0 : info.created_by) === ((_l = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _l.id) ? statusList == null ? void 0 : statusList.filter(
|
|
1627
|
+
(app) => app.status == 1
|
|
1628
|
+
) : statusList
|
|
1629
|
+
}
|
|
1630
|
+
) : /* @__PURE__ */ jsx(
|
|
1631
|
+
Chip,
|
|
1632
|
+
{
|
|
1633
|
+
variant: "filled",
|
|
1634
|
+
sx: {
|
|
1635
|
+
backgroundColor: getStatus2(currentStatus).color,
|
|
1636
|
+
color: getStatus2(currentStatus).labelColor,
|
|
1637
|
+
height: "40px",
|
|
1638
|
+
px: 2,
|
|
1639
|
+
borderRadius: "100px !important",
|
|
1640
|
+
"& .MuiChip-label": {
|
|
1641
|
+
fontSize: "14px",
|
|
1642
|
+
lineHeight: "15.4px",
|
|
1643
|
+
fontWeight: "500",
|
|
1644
|
+
textTransform: "capitalize"
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
label: statusData.title
|
|
1648
|
+
}
|
|
1649
|
+
),
|
|
1650
|
+
/* @__PURE__ */ jsx(
|
|
1651
|
+
Divider,
|
|
1652
|
+
{
|
|
1653
|
+
orientation: "vertical",
|
|
1654
|
+
flexItem: true,
|
|
1655
|
+
sx: {
|
|
1656
|
+
borderColor: "#E0E0E0",
|
|
1657
|
+
height: "40px"
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
),
|
|
1661
|
+
/* @__PURE__ */ jsx(
|
|
1662
|
+
IconButton,
|
|
1663
|
+
{
|
|
1664
|
+
disableFocusRipple: true,
|
|
1665
|
+
disableRipple: true,
|
|
1666
|
+
color: "primary",
|
|
1667
|
+
sx: {
|
|
1668
|
+
background: "rgba(25,118,210,0.08)",
|
|
1669
|
+
boxShadow: "2px 2px 10px 0px #4C4E6426",
|
|
1670
|
+
"& span": { color: "primary.dark" }
|
|
1671
|
+
},
|
|
1672
|
+
onClick: () => handleExpandClick(info._id),
|
|
1673
|
+
children: expandedId === info._id ? /* @__PURE__ */ jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsx("span", { className: "icon-arrow-right-3" })
|
|
1674
|
+
}
|
|
1675
|
+
)
|
|
1676
|
+
]
|
|
1677
|
+
}
|
|
1678
|
+
)
|
|
1679
|
+
]
|
|
1680
|
+
}
|
|
1681
|
+
),
|
|
1682
|
+
expandedId === info._id && /* @__PURE__ */ jsx(Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsx(
|
|
1683
|
+
Box,
|
|
1684
|
+
{
|
|
1685
|
+
sx: {
|
|
1686
|
+
height: 150,
|
|
1687
|
+
display: "flex",
|
|
1688
|
+
justifyContent: "center",
|
|
1689
|
+
alignItems: "center"
|
|
1690
|
+
},
|
|
1691
|
+
children: /* @__PURE__ */ jsx(CircularProgress, { size: 36, color: "primary" })
|
|
1692
|
+
}
|
|
1693
|
+
) : /* @__PURE__ */ jsx(
|
|
1694
|
+
CustomTimelineWithStatus,
|
|
1695
|
+
{
|
|
1696
|
+
events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
|
|
1697
|
+
var _a3, _b3, _c3, _d3;
|
|
1698
|
+
return {
|
|
1699
|
+
date: moment(item == null ? void 0 : item.created_at).format(
|
|
1700
|
+
"DD-MM-YYYY"
|
|
1701
|
+
),
|
|
1702
|
+
time: moment(item == null ? void 0 : item.created_at).format("HH:mm"),
|
|
1703
|
+
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",
|
|
1704
|
+
subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
|
|
1705
|
+
attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
|
|
1706
|
+
count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
|
|
1707
|
+
cardType: "card"
|
|
1708
|
+
};
|
|
1709
|
+
})
|
|
1710
|
+
}
|
|
1711
|
+
) })
|
|
1712
|
+
]
|
|
1713
|
+
},
|
|
1714
|
+
index
|
|
1715
|
+
);
|
|
1716
|
+
})
|
|
1717
|
+
}
|
|
1718
|
+
)
|
|
1719
|
+
] })
|
|
1720
|
+
}
|
|
1721
|
+
),
|
|
1722
|
+
/* @__PURE__ */ jsx(
|
|
1723
|
+
SendBackDialog_default,
|
|
1724
|
+
{
|
|
1725
|
+
openModal: !!sendDialog,
|
|
1726
|
+
closeModal: () => setSendDialog(null),
|
|
1727
|
+
header: "Send Back",
|
|
1728
|
+
workflowLogId: sendDialog || ""
|
|
1729
|
+
}
|
|
1730
|
+
),
|
|
1731
|
+
/* @__PURE__ */ jsx(
|
|
1732
|
+
ApproveDialog_default,
|
|
1733
|
+
{
|
|
1734
|
+
openModal: !!approveTarget,
|
|
1735
|
+
closeModal: () => setApproveTarget(null),
|
|
1736
|
+
header: "Approve",
|
|
1737
|
+
workflowLogId: (_a = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _a[0],
|
|
1738
|
+
statusId: (_b = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _b[1]
|
|
1739
|
+
}
|
|
1740
|
+
),
|
|
1741
|
+
/* @__PURE__ */ jsx(
|
|
1742
|
+
RejectDialog_default,
|
|
1743
|
+
{
|
|
1744
|
+
openModal: !!rejectTarget,
|
|
1745
|
+
closeModal: () => setRejectTarget(null),
|
|
1746
|
+
header: "Reject",
|
|
1747
|
+
workflowLogId: (_c = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _c[0],
|
|
1748
|
+
statusId: (_d = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _d[1],
|
|
1749
|
+
rejection_reason_master: (_e = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _e[2]
|
|
1750
|
+
}
|
|
1751
|
+
),
|
|
1752
|
+
/* @__PURE__ */ jsx(
|
|
1753
|
+
OnHoldDialog_default,
|
|
1754
|
+
{
|
|
1755
|
+
openModal: !!onHoldTarget,
|
|
1756
|
+
closeModal: () => setOnHoldTarget(null),
|
|
1757
|
+
header: "On Hold",
|
|
1758
|
+
workflowLogId: (_f = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _f[0],
|
|
1759
|
+
statusId: (_g = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _g[1]
|
|
1760
|
+
}
|
|
1761
|
+
)
|
|
1762
|
+
] });
|
|
628
1763
|
}
|
|
629
1764
|
function DialogOpener({
|
|
630
1765
|
openDialog,
|
|
@@ -653,8 +1788,8 @@ function DialogOpener({
|
|
|
653
1788
|
/* @__PURE__ */ jsx(IconButton, { onClick: handleClose, disableFocusRipple: true, disableRipple: true, sx: { float: "right" }, children: /* @__PURE__ */ jsx(HighlightOffIcon, { style: { color: "#666666" } }) }),
|
|
654
1789
|
/* @__PURE__ */ jsx(ApprovalWorkflow, { userInfo: userInfoData, selectedWorkflowsList })
|
|
655
1790
|
] }),
|
|
656
|
-
/* @__PURE__ */ jsx(
|
|
657
|
-
|
|
1791
|
+
/* @__PURE__ */ jsx(DialogActions5, { children: /* @__PURE__ */ jsx(
|
|
1792
|
+
Button7,
|
|
658
1793
|
{
|
|
659
1794
|
variant: "contained",
|
|
660
1795
|
color: "primary",
|