amp-workflow-ui 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1120 -611
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1123 -613
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,7 +12,6 @@ var material = require('@mui/material');
|
|
|
12
12
|
var HighlightOffIcon = require('@mui/icons-material/HighlightOff');
|
|
13
13
|
var system = require('@mui/system');
|
|
14
14
|
var moment = require('moment');
|
|
15
|
-
var toast = require('react-hot-toast');
|
|
16
15
|
|
|
17
16
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
17
|
|
|
@@ -24,7 +23,6 @@ var DialogActions5__default = /*#__PURE__*/_interopDefault(DialogActions5);
|
|
|
24
23
|
var DialogContent__default = /*#__PURE__*/_interopDefault(DialogContent);
|
|
25
24
|
var HighlightOffIcon__default = /*#__PURE__*/_interopDefault(HighlightOffIcon);
|
|
26
25
|
var moment__default = /*#__PURE__*/_interopDefault(moment);
|
|
27
|
-
var toast__default = /*#__PURE__*/_interopDefault(toast);
|
|
28
26
|
|
|
29
27
|
// src/context.tsx
|
|
30
28
|
var WorkflowContext = React7.createContext(null);
|
|
@@ -46,6 +44,7 @@ var ActionMenu = ({
|
|
|
46
44
|
onApprove,
|
|
47
45
|
onReject,
|
|
48
46
|
onHold,
|
|
47
|
+
level,
|
|
49
48
|
statusList
|
|
50
49
|
}) => {
|
|
51
50
|
const [anchorEl, setAnchorEl] = React7.useState(null);
|
|
@@ -56,31 +55,40 @@ var ActionMenu = ({
|
|
|
56
55
|
const handleClose = () => setAnchorEl(null);
|
|
57
56
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
58
57
|
/* @__PURE__ */ jsxRuntime.jsx(material.Button, { variant: "contained", color: "primary", onClick: handleActionClick, children: "Apply Action" }),
|
|
59
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
59
|
+
material.Menu,
|
|
60
|
+
{
|
|
61
|
+
anchorEl,
|
|
62
|
+
open,
|
|
63
|
+
onClose: handleClose,
|
|
64
|
+
MenuListProps: { "aria-labelledby": "basic-button" },
|
|
65
|
+
children: [
|
|
66
|
+
!level && /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
material.MenuItem,
|
|
68
|
+
{
|
|
69
|
+
onClick: () => {
|
|
70
|
+
onSendBack();
|
|
71
|
+
handleClose();
|
|
72
|
+
},
|
|
73
|
+
children: "Send Back"
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
statusList.map((list) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
material.MenuItem,
|
|
78
|
+
{
|
|
79
|
+
onClick: () => {
|
|
80
|
+
if (list.status === 1) onApprove();
|
|
81
|
+
else if (list.status === 2) onHold();
|
|
82
|
+
else if (list.status === 3) onReject();
|
|
83
|
+
handleClose();
|
|
84
|
+
},
|
|
85
|
+
children: list.name
|
|
86
|
+
},
|
|
87
|
+
list.id
|
|
88
|
+
))
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
)
|
|
84
92
|
] });
|
|
85
93
|
};
|
|
86
94
|
var Statusselector_default = ActionMenu;
|
|
@@ -98,6 +106,12 @@ function SendBackDialog({
|
|
|
98
106
|
const [loading, setLoading] = React7.useState(false);
|
|
99
107
|
const [fileLoading, setFileLoading] = React7.useState(false);
|
|
100
108
|
const fileInputRef = React7.useRef(null);
|
|
109
|
+
const [snackbar, setSnackbar] = React7.useState({
|
|
110
|
+
open: false,
|
|
111
|
+
message: "",
|
|
112
|
+
severity: "success"
|
|
113
|
+
});
|
|
114
|
+
const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
|
|
101
115
|
const handleAttachment = () => {
|
|
102
116
|
var _a;
|
|
103
117
|
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
@@ -110,12 +124,22 @@ function SendBackDialog({
|
|
|
110
124
|
const response = await api.post({
|
|
111
125
|
url: "/workflow/upload-document",
|
|
112
126
|
data: formData,
|
|
127
|
+
serviceURL: "api",
|
|
113
128
|
headers: { "Content-Type": "multipart/form-data" }
|
|
114
129
|
});
|
|
115
130
|
setFileName(response.data.file);
|
|
116
131
|
setSelectedFile(response.data.file);
|
|
132
|
+
setSnackbar({
|
|
133
|
+
open: true,
|
|
134
|
+
message: "File uploaded successfully!",
|
|
135
|
+
severity: "success"
|
|
136
|
+
});
|
|
117
137
|
} catch (error2) {
|
|
118
|
-
|
|
138
|
+
setSnackbar({
|
|
139
|
+
open: true,
|
|
140
|
+
message: "File upload failed.",
|
|
141
|
+
severity: "error"
|
|
142
|
+
});
|
|
119
143
|
} finally {
|
|
120
144
|
setFileLoading(false);
|
|
121
145
|
}
|
|
@@ -141,7 +165,7 @@ function SendBackDialog({
|
|
|
141
165
|
return isValid;
|
|
142
166
|
};
|
|
143
167
|
const onSubmit = async () => {
|
|
144
|
-
var _a, _b, _c;
|
|
168
|
+
var _a, _b, _c, _d;
|
|
145
169
|
if (!validateFields()) return;
|
|
146
170
|
setLoading(true);
|
|
147
171
|
try {
|
|
@@ -154,127 +178,186 @@ function SendBackDialog({
|
|
|
154
178
|
},
|
|
155
179
|
serviceURL: "api"
|
|
156
180
|
});
|
|
157
|
-
if ((res == null ? void 0 : res.status) === 200)
|
|
158
|
-
|
|
159
|
-
|
|
181
|
+
if ((res == null ? void 0 : res.status) === 200) {
|
|
182
|
+
setSnackbar({
|
|
183
|
+
open: true,
|
|
184
|
+
message: "Workflow sent back successfully!",
|
|
185
|
+
severity: "success"
|
|
186
|
+
});
|
|
187
|
+
} else {
|
|
188
|
+
setSnackbar({
|
|
189
|
+
open: true,
|
|
190
|
+
message: ((_b = res == null ? void 0 : res.error) == null ? void 0 : _b.message) || "Something went wrong. Try again.",
|
|
191
|
+
severity: "error"
|
|
192
|
+
});
|
|
160
193
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
194
|
+
} catch (e) {
|
|
195
|
+
setSnackbar({
|
|
196
|
+
open: true,
|
|
197
|
+
message: ((_d = (_c = e == null ? void 0 : e.response) == null ? void 0 : _c.data) == null ? void 0 : _d.message) || "Oops! Something went wrong.",
|
|
198
|
+
severity: "error"
|
|
199
|
+
});
|
|
164
200
|
} finally {
|
|
201
|
+
setComment("");
|
|
202
|
+
setSelectedFile(null);
|
|
203
|
+
setFileName("");
|
|
165
204
|
setLoading(false);
|
|
205
|
+
closeModal && closeModal();
|
|
166
206
|
}
|
|
167
207
|
};
|
|
168
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
sx: {
|
|
180
|
-
display: "flex",
|
|
181
|
-
justifyContent: "space-between",
|
|
182
|
-
alignItems: "center"
|
|
183
|
-
},
|
|
184
|
-
children: [
|
|
185
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
|
|
186
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
|
|
187
|
-
]
|
|
188
|
-
}
|
|
189
|
-
),
|
|
190
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { container: true, spacing: 5, children: [
|
|
191
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
192
|
-
material.TextField,
|
|
208
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
210
|
+
Dialog__default.default,
|
|
211
|
+
{
|
|
212
|
+
open: openModal,
|
|
213
|
+
onClose: closeModal,
|
|
214
|
+
"aria-labelledby": "responsive-dialog-title",
|
|
215
|
+
sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
|
|
216
|
+
children: [
|
|
217
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
218
|
+
material.Box,
|
|
193
219
|
{
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
220
|
+
sx: {
|
|
221
|
+
display: "flex",
|
|
222
|
+
justifyContent: "space-between",
|
|
223
|
+
alignItems: "center"
|
|
224
|
+
},
|
|
225
|
+
children: [
|
|
226
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
|
|
227
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
|
|
228
|
+
]
|
|
202
229
|
}
|
|
203
|
-
)
|
|
204
|
-
/* @__PURE__ */ jsxRuntime.jsxs(material.Grid, {
|
|
205
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
230
|
+
),
|
|
231
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { container: true, spacing: 5, children: [
|
|
232
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
206
233
|
material.TextField,
|
|
207
234
|
{
|
|
208
|
-
type: "text",
|
|
209
235
|
fullWidth: true,
|
|
210
|
-
label: "
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
error: !!error.file,
|
|
218
|
-
helperText: error.file
|
|
236
|
+
label: "Comment",
|
|
237
|
+
value: comment,
|
|
238
|
+
placeholder: "Comment Here",
|
|
239
|
+
onChange: (e) => setComment(e.target.value),
|
|
240
|
+
required: true,
|
|
241
|
+
error: !!error.comment,
|
|
242
|
+
helperText: error.comment
|
|
219
243
|
}
|
|
220
|
-
),
|
|
221
|
-
/* @__PURE__ */ jsxRuntime.
|
|
222
|
-
"input",
|
|
223
|
-
{
|
|
224
|
-
type: "file",
|
|
225
|
-
ref: fileInputRef,
|
|
226
|
-
style: { display: "none" },
|
|
227
|
-
onChange: handleFileChange
|
|
228
|
-
}
|
|
229
|
-
)
|
|
230
|
-
] })
|
|
231
|
-
] }) }) }),
|
|
232
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
233
|
-
material.Box,
|
|
234
|
-
{
|
|
235
|
-
sx: {
|
|
236
|
-
display: "flex",
|
|
237
|
-
justifyContent: "flex-end",
|
|
238
|
-
alignItems: "center"
|
|
239
|
-
},
|
|
240
|
-
children: [
|
|
244
|
+
) }),
|
|
245
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { item: true, xs: 12, children: [
|
|
241
246
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
242
|
-
material.
|
|
247
|
+
material.TextField,
|
|
243
248
|
{
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
249
|
+
type: "text",
|
|
250
|
+
fullWidth: true,
|
|
251
|
+
label: "Attachment",
|
|
252
|
+
placeholder: "Attachment",
|
|
253
|
+
InputProps: {
|
|
254
|
+
endAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.InputAdornment, { position: "end", children: fileLoading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 20, color: "inherit" }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
255
|
+
"span",
|
|
256
|
+
{
|
|
257
|
+
className: "icon-export-1",
|
|
258
|
+
style: { cursor: "pointer" },
|
|
259
|
+
onClick: handleAttachment
|
|
260
|
+
}
|
|
261
|
+
) })
|
|
262
|
+
},
|
|
263
|
+
onClick: handleAttachment,
|
|
264
|
+
value: fileName,
|
|
265
|
+
error: !!error.file,
|
|
266
|
+
helperText: error.file
|
|
250
267
|
}
|
|
251
268
|
),
|
|
252
269
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
253
|
-
|
|
270
|
+
"input",
|
|
254
271
|
{
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
disabled: loading || fileLoading,
|
|
260
|
-
children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit"
|
|
272
|
+
type: "file",
|
|
273
|
+
ref: fileInputRef,
|
|
274
|
+
style: { display: "none" },
|
|
275
|
+
onChange: handleFileChange
|
|
261
276
|
}
|
|
262
277
|
)
|
|
263
|
-
]
|
|
278
|
+
] })
|
|
279
|
+
] }) }) }),
|
|
280
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
281
|
+
material.Box,
|
|
282
|
+
{
|
|
283
|
+
sx: {
|
|
284
|
+
display: "flex",
|
|
285
|
+
justifyContent: "flex-end",
|
|
286
|
+
alignItems: "center"
|
|
287
|
+
},
|
|
288
|
+
children: [
|
|
289
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
290
|
+
material.Button,
|
|
291
|
+
{
|
|
292
|
+
onClick: closeModal,
|
|
293
|
+
size: "large",
|
|
294
|
+
variant: "outlined",
|
|
295
|
+
color: "primary",
|
|
296
|
+
sx: { mr: 2 },
|
|
297
|
+
children: "Close"
|
|
298
|
+
}
|
|
299
|
+
),
|
|
300
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
301
|
+
material.Button,
|
|
302
|
+
{
|
|
303
|
+
onClick: onSubmit,
|
|
304
|
+
size: "large",
|
|
305
|
+
variant: "contained",
|
|
306
|
+
color: "primary",
|
|
307
|
+
disabled: loading || fileLoading,
|
|
308
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit"
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
) })
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
318
|
+
material.Snackbar,
|
|
319
|
+
{
|
|
320
|
+
open: snackbar.open,
|
|
321
|
+
autoHideDuration: 3e3,
|
|
322
|
+
onClose: handleCloseSnackbar,
|
|
323
|
+
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
324
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
325
|
+
material.Alert,
|
|
326
|
+
{
|
|
327
|
+
onClose: handleCloseSnackbar,
|
|
328
|
+
severity: snackbar.severity,
|
|
329
|
+
sx: {
|
|
330
|
+
width: "100%",
|
|
331
|
+
color: snackbar.severity === "error" ? "#fff" : "inherit",
|
|
332
|
+
bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
|
|
333
|
+
},
|
|
334
|
+
children: snackbar.message
|
|
264
335
|
}
|
|
265
|
-
)
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
);
|
|
336
|
+
)
|
|
337
|
+
}
|
|
338
|
+
)
|
|
339
|
+
] });
|
|
269
340
|
}
|
|
270
341
|
var SendBackDialog_default = SendBackDialog;
|
|
271
|
-
function ApproveDialog({
|
|
342
|
+
function ApproveDialog({
|
|
343
|
+
openModal,
|
|
344
|
+
closeModal,
|
|
345
|
+
header,
|
|
346
|
+
workflowLogId,
|
|
347
|
+
statusId
|
|
348
|
+
}) {
|
|
272
349
|
const { userInfo, api } = useWorkflowContext();
|
|
273
350
|
const theme = styles.useTheme();
|
|
274
351
|
useMediaQuery__default.default(theme.breakpoints.down("lg"));
|
|
275
352
|
const [comment, setComment] = React7.useState("");
|
|
276
353
|
const [error, setError] = React7.useState({});
|
|
277
354
|
const [loading, setLoading] = React7.useState(false);
|
|
355
|
+
const [snackbar, setSnackbar] = React7.useState({
|
|
356
|
+
open: false,
|
|
357
|
+
message: "",
|
|
358
|
+
severity: "success"
|
|
359
|
+
});
|
|
360
|
+
const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
|
|
278
361
|
const validateFields = () => {
|
|
279
362
|
let isValid = true;
|
|
280
363
|
const newError = {};
|
|
@@ -286,60 +369,185 @@ function ApproveDialog({ openModal, closeModal, header, workflowLogId, statusId
|
|
|
286
369
|
return isValid;
|
|
287
370
|
};
|
|
288
371
|
const onSubmit = async () => {
|
|
289
|
-
var _a;
|
|
372
|
+
var _a, _b, _c;
|
|
290
373
|
if (!validateFields()) return;
|
|
291
374
|
setLoading(true);
|
|
292
375
|
try {
|
|
293
|
-
await api.post(
|
|
294
|
-
|
|
295
|
-
|
|
376
|
+
await api.post({
|
|
377
|
+
url: `/workflow/update-status/${workflowLogId}/${statusId}`,
|
|
378
|
+
data: {
|
|
379
|
+
comment,
|
|
380
|
+
created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
|
|
381
|
+
},
|
|
382
|
+
serviceURL: "api"
|
|
383
|
+
});
|
|
384
|
+
setSnackbar({
|
|
385
|
+
open: true,
|
|
386
|
+
message: "Approved successfully!",
|
|
387
|
+
severity: "success"
|
|
388
|
+
});
|
|
389
|
+
} catch (e) {
|
|
390
|
+
setSnackbar({
|
|
391
|
+
open: true,
|
|
392
|
+
message: ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Something unexpected occurred!",
|
|
393
|
+
severity: "error"
|
|
296
394
|
});
|
|
297
|
-
toast__default.default.success("approved successfully!!!");
|
|
298
|
-
closeModal && closeModal();
|
|
299
|
-
} catch {
|
|
300
|
-
toast__default.default.error("something unexpected occured!!!");
|
|
301
395
|
} finally {
|
|
396
|
+
setComment("");
|
|
302
397
|
setLoading(false);
|
|
398
|
+
closeModal && closeModal();
|
|
303
399
|
}
|
|
304
400
|
};
|
|
305
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
306
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
401
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
402
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
403
|
+
Dialog__default.default,
|
|
404
|
+
{
|
|
405
|
+
open: openModal,
|
|
406
|
+
onClose: closeModal,
|
|
407
|
+
"aria-labelledby": "responsive-dialog-title",
|
|
408
|
+
sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
|
|
409
|
+
children: [
|
|
410
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
411
|
+
material.Box,
|
|
412
|
+
{
|
|
413
|
+
sx: {
|
|
414
|
+
display: "flex",
|
|
415
|
+
justifyContent: "space-between",
|
|
416
|
+
alignItems: "center"
|
|
417
|
+
},
|
|
418
|
+
children: [
|
|
419
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
|
|
420
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
|
|
421
|
+
]
|
|
422
|
+
}
|
|
423
|
+
),
|
|
424
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
425
|
+
material.TextField,
|
|
426
|
+
{
|
|
427
|
+
fullWidth: true,
|
|
428
|
+
label: "Comment",
|
|
429
|
+
value: comment,
|
|
430
|
+
placeholder: "Comment Here",
|
|
431
|
+
onChange: (e) => setComment(e.target.value),
|
|
432
|
+
required: true,
|
|
433
|
+
error: !!error.comment,
|
|
434
|
+
helperText: error.comment
|
|
435
|
+
}
|
|
436
|
+
) }) }) }) }),
|
|
437
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
438
|
+
material.Box,
|
|
439
|
+
{
|
|
440
|
+
sx: {
|
|
441
|
+
display: "flex",
|
|
442
|
+
justifyContent: "flex-end",
|
|
443
|
+
alignItems: "center"
|
|
444
|
+
},
|
|
445
|
+
children: [
|
|
446
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
447
|
+
material.Button,
|
|
448
|
+
{
|
|
449
|
+
onClick: closeModal,
|
|
450
|
+
size: "large",
|
|
451
|
+
variant: "outlined",
|
|
452
|
+
color: "primary",
|
|
453
|
+
sx: { mr: 2 },
|
|
454
|
+
children: "Close"
|
|
455
|
+
}
|
|
456
|
+
),
|
|
457
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
458
|
+
material.Button,
|
|
459
|
+
{
|
|
460
|
+
onClick: onSubmit,
|
|
461
|
+
size: "large",
|
|
462
|
+
variant: "contained",
|
|
463
|
+
color: "primary",
|
|
464
|
+
disabled: loading,
|
|
465
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit"
|
|
466
|
+
}
|
|
467
|
+
)
|
|
468
|
+
]
|
|
469
|
+
}
|
|
470
|
+
) })
|
|
471
|
+
]
|
|
472
|
+
}
|
|
473
|
+
),
|
|
474
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
475
|
+
material.Snackbar,
|
|
476
|
+
{
|
|
477
|
+
open: snackbar.open,
|
|
478
|
+
autoHideDuration: 3e3,
|
|
479
|
+
onClose: handleCloseSnackbar,
|
|
480
|
+
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
481
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
482
|
+
material.Alert,
|
|
483
|
+
{
|
|
484
|
+
onClose: handleCloseSnackbar,
|
|
485
|
+
severity: snackbar.severity,
|
|
486
|
+
sx: {
|
|
487
|
+
width: "100%",
|
|
488
|
+
color: snackbar.severity === "error" ? "#fff" : "inherit",
|
|
489
|
+
bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
|
|
490
|
+
},
|
|
491
|
+
children: snackbar.message
|
|
492
|
+
}
|
|
493
|
+
)
|
|
494
|
+
}
|
|
495
|
+
)
|
|
315
496
|
] });
|
|
316
497
|
}
|
|
317
498
|
var ApproveDialog_default = ApproveDialog;
|
|
318
|
-
function RejectDialog({
|
|
499
|
+
function RejectDialog({
|
|
500
|
+
openModal,
|
|
501
|
+
closeModal,
|
|
502
|
+
header,
|
|
503
|
+
workflowLogId,
|
|
504
|
+
statusId,
|
|
505
|
+
rejection_reason_master
|
|
506
|
+
}) {
|
|
319
507
|
const { userInfo, api } = useWorkflowContext();
|
|
320
508
|
const theme = styles.useTheme();
|
|
321
509
|
useMediaQuery__default.default(theme.breakpoints.down("lg"));
|
|
322
510
|
const DownArrow = () => {
|
|
323
511
|
var _a;
|
|
324
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
512
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
513
|
+
"span",
|
|
514
|
+
{
|
|
515
|
+
style: { color: ((_a = theme.palette.customColors) == null ? void 0 : _a.mainText) || "#333" },
|
|
516
|
+
className: "icon-arrow-down-1"
|
|
517
|
+
}
|
|
518
|
+
);
|
|
325
519
|
};
|
|
326
520
|
const [rejectReasons, setRejectReasons] = React7.useState("");
|
|
327
521
|
const [comment, setComment] = React7.useState("");
|
|
328
522
|
const [error, setError] = React7.useState({ reason: "", comment: "" });
|
|
329
523
|
const [statusApplicableList, setStatusApplicableList] = React7.useState([]);
|
|
330
524
|
const [loading, setLoading] = React7.useState(false);
|
|
525
|
+
const [snackbar, setSnackbar] = React7.useState({
|
|
526
|
+
open: false,
|
|
527
|
+
message: "",
|
|
528
|
+
severity: "success"
|
|
529
|
+
});
|
|
530
|
+
const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
|
|
331
531
|
React7.useEffect(() => {
|
|
332
532
|
(async () => {
|
|
333
533
|
var _a;
|
|
334
534
|
try {
|
|
335
535
|
if (!statusApplicableList.length) {
|
|
336
|
-
const res = await api.get(
|
|
536
|
+
const res = await api.get({
|
|
537
|
+
url: `/workflow/applicableStatuses?type=${rejection_reason_master}`,
|
|
538
|
+
serviceURL: "api"
|
|
539
|
+
});
|
|
337
540
|
setStatusApplicableList(((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || []);
|
|
338
541
|
}
|
|
339
542
|
} catch (e) {
|
|
543
|
+
setSnackbar({
|
|
544
|
+
open: true,
|
|
545
|
+
message: "Failed to load reject reasons.",
|
|
546
|
+
severity: "error"
|
|
547
|
+
});
|
|
340
548
|
}
|
|
341
549
|
})();
|
|
342
|
-
}, []);
|
|
550
|
+
}, [rejection_reason_master]);
|
|
343
551
|
const validateFields = () => {
|
|
344
552
|
let isValid = true;
|
|
345
553
|
const errors = { reason: "", comment: "" };
|
|
@@ -355,48 +563,174 @@ function RejectDialog({ openModal, closeModal, header, workflowLogId, statusId,
|
|
|
355
563
|
return isValid;
|
|
356
564
|
};
|
|
357
565
|
const onSubmit = async () => {
|
|
358
|
-
var _a;
|
|
566
|
+
var _a, _b, _c;
|
|
359
567
|
if (!validateFields()) return;
|
|
360
568
|
setLoading(true);
|
|
361
569
|
try {
|
|
362
|
-
await api.post(
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
570
|
+
await api.post({
|
|
571
|
+
url: `/workflow/update-status/${workflowLogId}/${statusId}`,
|
|
572
|
+
data: {
|
|
573
|
+
reason: rejectReasons,
|
|
574
|
+
comment,
|
|
575
|
+
created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
|
|
576
|
+
},
|
|
577
|
+
serviceURL: "api"
|
|
578
|
+
});
|
|
579
|
+
setSnackbar({
|
|
580
|
+
open: true,
|
|
581
|
+
message: "Rejected successfully!",
|
|
582
|
+
severity: "success"
|
|
366
583
|
});
|
|
367
|
-
closeModal && closeModal();
|
|
368
584
|
} catch (e) {
|
|
585
|
+
const message = ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Something went wrong!";
|
|
586
|
+
console.error("\u274C Reject Error:", message);
|
|
587
|
+
setSnackbar({
|
|
588
|
+
open: true,
|
|
589
|
+
message,
|
|
590
|
+
severity: "error"
|
|
591
|
+
});
|
|
369
592
|
} finally {
|
|
593
|
+
setComment("");
|
|
594
|
+
setRejectReasons("");
|
|
370
595
|
setLoading(false);
|
|
596
|
+
closeModal && closeModal();
|
|
371
597
|
}
|
|
372
598
|
};
|
|
373
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
374
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
599
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
600
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
601
|
+
Dialog__default.default,
|
|
602
|
+
{
|
|
603
|
+
open: openModal,
|
|
604
|
+
onClose: closeModal,
|
|
605
|
+
"aria-labelledby": "responsive-dialog-title",
|
|
606
|
+
sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
|
|
607
|
+
children: [
|
|
608
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
609
|
+
material.Box,
|
|
610
|
+
{
|
|
611
|
+
sx: {
|
|
612
|
+
display: "flex",
|
|
613
|
+
justifyContent: "space-between",
|
|
614
|
+
alignItems: "center"
|
|
615
|
+
},
|
|
616
|
+
children: [
|
|
617
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
|
|
618
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
|
|
619
|
+
]
|
|
620
|
+
}
|
|
621
|
+
),
|
|
622
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxRuntime.jsxs(material.Grid, { container: true, spacing: 5, children: [
|
|
623
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth: true, required: true, error: !!error.reason, children: [
|
|
624
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.InputLabel, { required: true, id: "reject-reason-label", children: "Reject Reasons" }),
|
|
625
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
626
|
+
material.Select,
|
|
627
|
+
{
|
|
628
|
+
IconComponent: DownArrow,
|
|
629
|
+
label: "Reject Reasons",
|
|
630
|
+
value: rejectReasons,
|
|
631
|
+
id: "reject-reason",
|
|
632
|
+
labelId: "reject-reason-label",
|
|
633
|
+
onChange: (e) => setRejectReasons(e.target.value),
|
|
634
|
+
children: statusApplicableList == null ? void 0 : statusApplicableList.map((reason_) => /* @__PURE__ */ jsxRuntime.jsx(material.MenuItem, { value: reason_ == null ? void 0 : reason_.id, children: reason_ == null ? void 0 : reason_.name }, reason_ == null ? void 0 : reason_.id))
|
|
635
|
+
}
|
|
636
|
+
),
|
|
637
|
+
error.reason && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "error", children: error.reason })
|
|
638
|
+
] }) }),
|
|
639
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
640
|
+
material.TextField,
|
|
641
|
+
{
|
|
642
|
+
fullWidth: true,
|
|
643
|
+
label: "Comment",
|
|
644
|
+
value: comment,
|
|
645
|
+
placeholder: "Comment Here",
|
|
646
|
+
onChange: (e) => setComment(e.target.value),
|
|
647
|
+
required: true,
|
|
648
|
+
error: !!error.comment,
|
|
649
|
+
helperText: error.comment
|
|
650
|
+
}
|
|
651
|
+
) })
|
|
652
|
+
] }) }) }),
|
|
653
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
654
|
+
material.Box,
|
|
655
|
+
{
|
|
656
|
+
sx: {
|
|
657
|
+
display: "flex",
|
|
658
|
+
justifyContent: "flex-end",
|
|
659
|
+
alignItems: "center"
|
|
660
|
+
},
|
|
661
|
+
children: [
|
|
662
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
663
|
+
material.Button,
|
|
664
|
+
{
|
|
665
|
+
onClick: closeModal,
|
|
666
|
+
size: "large",
|
|
667
|
+
variant: "outlined",
|
|
668
|
+
color: "primary",
|
|
669
|
+
sx: { mr: 2 },
|
|
670
|
+
children: "Close"
|
|
671
|
+
}
|
|
672
|
+
),
|
|
673
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
674
|
+
material.Button,
|
|
675
|
+
{
|
|
676
|
+
onClick: onSubmit,
|
|
677
|
+
size: "large",
|
|
678
|
+
variant: "contained",
|
|
679
|
+
color: "primary",
|
|
680
|
+
disabled: loading,
|
|
681
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit"
|
|
682
|
+
}
|
|
683
|
+
)
|
|
684
|
+
]
|
|
685
|
+
}
|
|
686
|
+
) })
|
|
687
|
+
]
|
|
688
|
+
}
|
|
689
|
+
),
|
|
690
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
691
|
+
material.Snackbar,
|
|
692
|
+
{
|
|
693
|
+
open: snackbar.open,
|
|
694
|
+
autoHideDuration: 3e3,
|
|
695
|
+
onClose: handleCloseSnackbar,
|
|
696
|
+
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
697
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
698
|
+
material.Alert,
|
|
699
|
+
{
|
|
700
|
+
onClose: handleCloseSnackbar,
|
|
701
|
+
severity: snackbar.severity,
|
|
702
|
+
sx: {
|
|
703
|
+
width: "100%",
|
|
704
|
+
color: snackbar.severity === "error" ? "#fff" : "inherit",
|
|
705
|
+
bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
|
|
706
|
+
},
|
|
707
|
+
children: snackbar.message
|
|
708
|
+
}
|
|
709
|
+
)
|
|
710
|
+
}
|
|
711
|
+
)
|
|
390
712
|
] });
|
|
391
713
|
}
|
|
392
714
|
var RejectDialog_default = RejectDialog;
|
|
393
|
-
function OnHoldDialog({
|
|
715
|
+
function OnHoldDialog({
|
|
716
|
+
openModal,
|
|
717
|
+
closeModal,
|
|
718
|
+
header,
|
|
719
|
+
workflowLogId,
|
|
720
|
+
statusId
|
|
721
|
+
}) {
|
|
394
722
|
const { userInfo, api } = useWorkflowContext();
|
|
395
723
|
const theme = styles.useTheme();
|
|
396
724
|
useMediaQuery__default.default(theme.breakpoints.down("lg"));
|
|
397
725
|
const [comment, setComment] = React7.useState("");
|
|
398
726
|
const [error, setError] = React7.useState({ comment: "" });
|
|
399
727
|
const [loading, setLoading] = React7.useState(false);
|
|
728
|
+
const [snackbar, setSnackbar] = React7.useState({
|
|
729
|
+
open: false,
|
|
730
|
+
message: "",
|
|
731
|
+
severity: "success"
|
|
732
|
+
});
|
|
733
|
+
const handleCloseSnackbar = () => setSnackbar((prev) => ({ ...prev, open: false }));
|
|
400
734
|
const validateFields = () => {
|
|
401
735
|
let isValid = true;
|
|
402
736
|
const errors = { comment: "" };
|
|
@@ -408,271 +742,331 @@ function OnHoldDialog({ openModal, closeModal, header, workflowLogId, statusId }
|
|
|
408
742
|
return isValid;
|
|
409
743
|
};
|
|
410
744
|
const onSubmit = async () => {
|
|
411
|
-
var _a;
|
|
745
|
+
var _a, _b, _c;
|
|
412
746
|
if (!validateFields()) return;
|
|
413
747
|
setLoading(true);
|
|
414
748
|
try {
|
|
415
|
-
await api.post(
|
|
416
|
-
|
|
417
|
-
|
|
749
|
+
await api.post({
|
|
750
|
+
url: `/workflow/update-status/${workflowLogId}/${statusId}`,
|
|
751
|
+
data: {
|
|
752
|
+
comment,
|
|
753
|
+
created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
|
|
754
|
+
},
|
|
755
|
+
serviceURL: "api"
|
|
756
|
+
});
|
|
757
|
+
setSnackbar({
|
|
758
|
+
open: true,
|
|
759
|
+
message: "Moved to On-Hold successfully!",
|
|
760
|
+
severity: "success"
|
|
761
|
+
});
|
|
762
|
+
} catch (e) {
|
|
763
|
+
setSnackbar({
|
|
764
|
+
open: true,
|
|
765
|
+
message: ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Failed to submit the form",
|
|
766
|
+
severity: "error"
|
|
418
767
|
});
|
|
419
|
-
closeModal && closeModal();
|
|
420
|
-
} catch {
|
|
421
|
-
toast__default.default.error("Failed to submit the form");
|
|
422
768
|
} finally {
|
|
769
|
+
setComment("");
|
|
770
|
+
closeModal && closeModal();
|
|
423
771
|
setLoading(false);
|
|
424
772
|
}
|
|
425
773
|
};
|
|
426
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
427
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
428
|
-
|
|
429
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
|
|
430
|
-
] }),
|
|
431
|
-
/* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(material.TextField, { fullWidth: true, label: "Comment", value: comment, placeholder: "Comment Here", onChange: (e) => setComment(e.target.value), required: true, error: !!error.comment, helperText: error.comment }) }) }) }) }),
|
|
432
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", justifyContent: "flex-end", alignItems: "center" }, children: [
|
|
433
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: closeModal, size: "large", variant: "outlined", color: "primary", sx: { mr: 2 }, children: "Close" }),
|
|
434
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: onSubmit, size: "large", variant: "contained", color: "primary", disabled: loading, children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit" })
|
|
435
|
-
] }) })
|
|
436
|
-
] });
|
|
437
|
-
}
|
|
438
|
-
var OnHoldDialog_default = OnHoldDialog;
|
|
439
|
-
var getStatus = (status, theme) => {
|
|
440
|
-
const s = status == null ? void 0 : status.toLowerCase();
|
|
441
|
-
const colors = {
|
|
442
|
-
approved: {
|
|
443
|
-
bg: theme.palette.success.light,
|
|
444
|
-
text: theme.palette.success.main
|
|
445
|
-
},
|
|
446
|
-
rejected: { bg: theme.palette.error.light, text: theme.palette.error.main },
|
|
447
|
-
onhold: {
|
|
448
|
-
bg: theme.palette.warning.light,
|
|
449
|
-
text: theme.palette.warning.main
|
|
450
|
-
},
|
|
451
|
-
inprogress: { bg: theme.palette.info.light, text: theme.palette.info.main },
|
|
452
|
-
pending: { bg: theme.palette.grey[200], text: theme.palette.text.primary }
|
|
453
|
-
};
|
|
454
|
-
return colors[s] || colors.pending;
|
|
455
|
-
};
|
|
456
|
-
function ConnectedTimeline({ events }) {
|
|
457
|
-
const { api } = useWorkflowContext();
|
|
458
|
-
const theme = material.useTheme();
|
|
459
|
-
const [isMobile, setIsMobile] = React7.useState(false);
|
|
460
|
-
React7.useEffect(() => {
|
|
461
|
-
const checkScreen = () => setIsMobile(window.innerWidth < 768);
|
|
462
|
-
checkScreen();
|
|
463
|
-
window.addEventListener("resize", checkScreen);
|
|
464
|
-
return () => window.removeEventListener("resize", checkScreen);
|
|
465
|
-
}, []);
|
|
466
|
-
const handleAttachmentClick = (attachment) => {
|
|
467
|
-
api.get({
|
|
468
|
-
url: `/workflow/uploaded-document-url/${attachment.split("/").reverse()[0]}`,
|
|
469
|
-
serviceURL: "api"
|
|
470
|
-
}).then((res) => window.open(res.data, "_blank"));
|
|
471
|
-
};
|
|
472
|
-
const columns = 4;
|
|
473
|
-
const rows = [];
|
|
474
|
-
for (let i = 0; i < (events == null ? void 0 : events.length); i += columns)
|
|
475
|
-
rows.push(events.slice(i, i + columns));
|
|
476
|
-
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { py: 4, position: "relative" }, children: rows.map((row, rowIndex) => {
|
|
477
|
-
const reversed = rowIndex % 2 === 1;
|
|
478
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
479
|
-
material.Box,
|
|
774
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
775
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
776
|
+
Dialog__default.default,
|
|
480
777
|
{
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
position: "relative",
|
|
488
|
-
mb: 8,
|
|
489
|
-
flexWrap: isMobile ? "wrap" : "nowrap"
|
|
490
|
-
},
|
|
491
|
-
children: row.map((event, index) => {
|
|
492
|
-
var _a;
|
|
493
|
-
const globalIndex = rowIndex * columns + index;
|
|
494
|
-
const status = getStatus((_a = event.status) == null ? void 0 : _a.title, theme);
|
|
495
|
-
const isDisabled = event.cardType === "disableCard";
|
|
496
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
778
|
+
open: openModal,
|
|
779
|
+
onClose: closeModal,
|
|
780
|
+
"aria-labelledby": "responsive-dialog-title",
|
|
781
|
+
sx: { "& .MuiPaper-root.MuiDialog-paper": { width: "550px" } },
|
|
782
|
+
children: [
|
|
783
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
497
784
|
material.Box,
|
|
498
785
|
{
|
|
499
786
|
sx: {
|
|
500
|
-
position: "relative",
|
|
501
787
|
display: "flex",
|
|
502
|
-
justifyContent: "
|
|
788
|
+
justifyContent: "space-between",
|
|
503
789
|
alignItems: "center"
|
|
504
790
|
},
|
|
505
791
|
children: [
|
|
506
|
-
|
|
507
|
-
|
|
792
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { id: "responsive-dialog-title", children: header }),
|
|
793
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.IconButton, { disableFocusRipple: true, disableRipple: true, onClick: closeModal, children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } }) })
|
|
794
|
+
]
|
|
795
|
+
}
|
|
796
|
+
),
|
|
797
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { mb: 5 }, children: /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { container: true, spacing: 5, children: /* @__PURE__ */ jsxRuntime.jsx(material.Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
798
|
+
material.TextField,
|
|
799
|
+
{
|
|
800
|
+
fullWidth: true,
|
|
801
|
+
label: "Comment",
|
|
802
|
+
value: comment,
|
|
803
|
+
placeholder: "Comment Here",
|
|
804
|
+
onChange: (e) => setComment(e.target.value),
|
|
805
|
+
required: true,
|
|
806
|
+
error: !!error.comment,
|
|
807
|
+
helperText: error.comment
|
|
808
|
+
}
|
|
809
|
+
) }) }) }) }),
|
|
810
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogActions, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
811
|
+
material.Box,
|
|
812
|
+
{
|
|
813
|
+
sx: {
|
|
814
|
+
display: "flex",
|
|
815
|
+
justifyContent: "flex-end",
|
|
816
|
+
alignItems: "center"
|
|
817
|
+
},
|
|
818
|
+
children: [
|
|
819
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
820
|
+
material.Button,
|
|
508
821
|
{
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
background: theme.palette.primary.main,
|
|
516
|
-
zIndex: 0
|
|
517
|
-
}
|
|
822
|
+
onClick: closeModal,
|
|
823
|
+
size: "large",
|
|
824
|
+
variant: "outlined",
|
|
825
|
+
color: "primary",
|
|
826
|
+
sx: { mr: 2 },
|
|
827
|
+
children: "Close"
|
|
518
828
|
}
|
|
519
829
|
),
|
|
520
|
-
|
|
521
|
-
material.
|
|
830
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
831
|
+
material.Button,
|
|
522
832
|
{
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
background: theme.palette.primary.main,
|
|
530
|
-
zIndex: 0
|
|
531
|
-
}
|
|
833
|
+
onClick: onSubmit,
|
|
834
|
+
size: "large",
|
|
835
|
+
variant: "contained",
|
|
836
|
+
color: "primary",
|
|
837
|
+
disabled: loading,
|
|
838
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 24, color: "inherit" }) : "Submit"
|
|
532
839
|
}
|
|
533
|
-
)
|
|
534
|
-
|
|
535
|
-
|
|
840
|
+
)
|
|
841
|
+
]
|
|
842
|
+
}
|
|
843
|
+
) })
|
|
844
|
+
]
|
|
845
|
+
}
|
|
846
|
+
),
|
|
847
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
848
|
+
material.Snackbar,
|
|
849
|
+
{
|
|
850
|
+
open: snackbar.open,
|
|
851
|
+
autoHideDuration: 3e3,
|
|
852
|
+
onClose: handleCloseSnackbar,
|
|
853
|
+
anchorOrigin: { vertical: "top", horizontal: "right" },
|
|
854
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
855
|
+
material.Alert,
|
|
856
|
+
{
|
|
857
|
+
onClose: handleCloseSnackbar,
|
|
858
|
+
severity: snackbar.severity,
|
|
859
|
+
sx: {
|
|
860
|
+
width: "100%",
|
|
861
|
+
color: snackbar.severity === "error" ? "#fff" : "inherit",
|
|
862
|
+
bgcolor: snackbar.severity === "error" ? "#d32f2f" : void 0
|
|
863
|
+
},
|
|
864
|
+
children: snackbar.message
|
|
865
|
+
}
|
|
866
|
+
)
|
|
867
|
+
}
|
|
868
|
+
)
|
|
869
|
+
] });
|
|
870
|
+
}
|
|
871
|
+
var OnHoldDialog_default = OnHoldDialog;
|
|
872
|
+
var CONNECTOR_STYLE = {
|
|
873
|
+
horizontal: {
|
|
874
|
+
thickness: 3,
|
|
875
|
+
lengthExtra: 20,
|
|
876
|
+
color: "#2C35FF",
|
|
877
|
+
offsetY: 90,
|
|
878
|
+
offsetReverseExtra: 30
|
|
879
|
+
// extra offset for reversed rows to avoid overlap
|
|
880
|
+
},
|
|
881
|
+
vertical: {
|
|
882
|
+
thickness: 3,
|
|
883
|
+
height: 60,
|
|
884
|
+
color: "#2C35FF"}
|
|
885
|
+
};
|
|
886
|
+
var CARD_WIDTH = 200;
|
|
887
|
+
var CARD_HEIGHT = 220;
|
|
888
|
+
var GAP = 65;
|
|
889
|
+
var ROW_GAP = 60;
|
|
890
|
+
var CustomCard = styles.styled(material.Card)(
|
|
891
|
+
({ theme, cardType }) => ({
|
|
892
|
+
width: CARD_WIDTH,
|
|
893
|
+
height: CARD_HEIGHT,
|
|
894
|
+
borderRadius: 16,
|
|
895
|
+
backgroundColor: cardType === "subCard" ? "#FFF2D8" : cardType === "disableCard" ? "#ECECEC" : "#F1F1FF",
|
|
896
|
+
border: cardType === "disableCard" ? "none" : `1px solid ${theme.palette.primary.dark}`,
|
|
897
|
+
position: "relative"
|
|
898
|
+
})
|
|
899
|
+
);
|
|
900
|
+
var Bull = ({ count, cardType }) => {
|
|
901
|
+
const theme = styles.useTheme();
|
|
902
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
903
|
+
material.Box,
|
|
904
|
+
{
|
|
905
|
+
sx: {
|
|
906
|
+
width: 40,
|
|
907
|
+
height: 40,
|
|
908
|
+
display: "flex",
|
|
909
|
+
justifyContent: "center",
|
|
910
|
+
alignItems: "center",
|
|
911
|
+
borderRadius: "50%",
|
|
912
|
+
background: "#fff",
|
|
913
|
+
border: cardType === "disableCard" ? `2px solid ${theme.palette.grey[400]}` : `2px solid ${theme.palette.primary.dark}`,
|
|
914
|
+
color: cardType === "disableCard" ? theme.palette.grey[700] : theme.palette.primary.dark,
|
|
915
|
+
fontWeight: 600,
|
|
916
|
+
fontSize: 16
|
|
917
|
+
},
|
|
918
|
+
children: count
|
|
919
|
+
}
|
|
920
|
+
);
|
|
921
|
+
};
|
|
922
|
+
function SnakeTimeline({ events }) {
|
|
923
|
+
const { api } = useWorkflowContext();
|
|
924
|
+
styles.useTheme();
|
|
925
|
+
const rows = [];
|
|
926
|
+
for (let i = 0; i < events.length; i += 4) rows.push(events.slice(i, i + 4));
|
|
927
|
+
const computeColumn = (index) => {
|
|
928
|
+
const row = Math.floor(index / 4);
|
|
929
|
+
const pos = index % 4;
|
|
930
|
+
return row % 2 === 0 ? pos : 3 - pos;
|
|
931
|
+
};
|
|
932
|
+
const getHorizontalOffsetY = (rowIndex) => rowIndex % 2 === 0 ? CONNECTOR_STYLE.horizontal.offsetY : CONNECTOR_STYLE.horizontal.offsetY + CONNECTOR_STYLE.horizontal.offsetReverseExtra;
|
|
933
|
+
const hasNextCard = (currentIndex) => currentIndex + 1 < events.length;
|
|
934
|
+
const handleAttachmentClick = (att) => {
|
|
935
|
+
if (!att) return;
|
|
936
|
+
api.get({
|
|
937
|
+
url: `/workflow/uploaded-document-url/${att.split("/").pop()}`,
|
|
938
|
+
serviceURL: "api"
|
|
939
|
+
}).then((res) => window.open(res.data, "_blank"));
|
|
940
|
+
};
|
|
941
|
+
return /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { width: "100%", overflowX: "auto", p: 2 }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
942
|
+
material.Box,
|
|
943
|
+
{
|
|
944
|
+
sx: {
|
|
945
|
+
position: "relative",
|
|
946
|
+
display: "grid",
|
|
947
|
+
gridTemplateColumns: `repeat(4, ${CARD_WIDTH}px)`,
|
|
948
|
+
columnGap: `${GAP}px`,
|
|
949
|
+
rowGap: `${ROW_GAP}px`,
|
|
950
|
+
width: "max-content"
|
|
951
|
+
},
|
|
952
|
+
children: events.map((event, index) => {
|
|
953
|
+
console.log("\u{1F680} ~ SnakeTimeline ~ event:", event);
|
|
954
|
+
const row = Math.floor(index / 4);
|
|
955
|
+
const col = computeColumn(index);
|
|
956
|
+
const isLastInRow = index % 4 === 3;
|
|
957
|
+
const isVerticalConnectorNeeded = (index + 1) % 4 === 0 && hasNextCard(index);
|
|
958
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
959
|
+
material.Box,
|
|
960
|
+
{
|
|
961
|
+
sx: {
|
|
962
|
+
gridColumn: col + 1,
|
|
963
|
+
gridRow: row + 1,
|
|
964
|
+
position: "relative"
|
|
965
|
+
},
|
|
966
|
+
children: [
|
|
967
|
+
!isLastInRow && hasNextCard(index) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
968
|
+
material.Box,
|
|
969
|
+
{
|
|
970
|
+
sx: {
|
|
971
|
+
position: "absolute",
|
|
972
|
+
top: getHorizontalOffsetY(row),
|
|
973
|
+
left: row % 2 === 0 ? CARD_WIDTH : "auto",
|
|
974
|
+
right: row % 2 !== 0 ? CARD_WIDTH : "auto",
|
|
975
|
+
width: GAP + CONNECTOR_STYLE.horizontal.lengthExtra,
|
|
976
|
+
borderTop: `${CONNECTOR_STYLE.horizontal.thickness}px dashed ${CONNECTOR_STYLE.horizontal.color}`,
|
|
977
|
+
zIndex: 10
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
),
|
|
981
|
+
isVerticalConnectorNeeded && /* @__PURE__ */ jsxRuntime.jsx(
|
|
982
|
+
material.Box,
|
|
983
|
+
{
|
|
984
|
+
sx: {
|
|
985
|
+
position: "absolute",
|
|
986
|
+
top: CARD_HEIGHT,
|
|
987
|
+
left: CARD_WIDTH / 2 - CONNECTOR_STYLE.vertical.thickness / 2,
|
|
988
|
+
width: CONNECTOR_STYLE.vertical.thickness,
|
|
989
|
+
height: CONNECTOR_STYLE.vertical.height,
|
|
990
|
+
borderLeft: `${CONNECTOR_STYLE.vertical.thickness}px dashed ${CONNECTOR_STYLE.vertical.color}`,
|
|
991
|
+
zIndex: 10
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
),
|
|
995
|
+
/* @__PURE__ */ jsxRuntime.jsx(CustomCard, { cardType: event.cardType, children: /* @__PURE__ */ jsxRuntime.jsxs(material.CardContent, { sx: { px: 2, pt: 2, pb: 1 }, children: [
|
|
996
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
997
|
+
material.Box,
|
|
536
998
|
{
|
|
537
999
|
sx: {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
textAlign: "center",
|
|
544
|
-
boxShadow: "0px 4px 10px rgba(0,0,0,0.05)",
|
|
545
|
-
transition: "all 0.25s ease-in-out",
|
|
546
|
-
"&:hover": {
|
|
547
|
-
boxShadow: "0px 6px 14px rgba(0,0,0,0.1)",
|
|
548
|
-
transform: "translateY(-2px)"
|
|
549
|
-
}
|
|
1000
|
+
mb: 1,
|
|
1001
|
+
display: "flex",
|
|
1002
|
+
justifyContent: "space-between",
|
|
1003
|
+
alignItems: "center",
|
|
1004
|
+
height: 28
|
|
550
1005
|
},
|
|
551
|
-
children:
|
|
552
|
-
/* @__PURE__ */ jsxRuntime.
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
sx: {
|
|
556
|
-
display: "flex",
|
|
557
|
-
justifyContent: "space-between",
|
|
558
|
-
alignItems: "center",
|
|
559
|
-
mb: 1
|
|
560
|
-
},
|
|
561
|
-
children: [
|
|
562
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
563
|
-
material.Typography,
|
|
564
|
-
{
|
|
565
|
-
variant: "body2",
|
|
566
|
-
color: theme.palette.text.secondary,
|
|
567
|
-
children: event.date
|
|
568
|
-
}
|
|
569
|
-
),
|
|
570
|
-
event.status && /* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
-
material.Chip,
|
|
572
|
-
{
|
|
573
|
-
label: event.status.title,
|
|
574
|
-
sx: {
|
|
575
|
-
backgroundColor: status.bg,
|
|
576
|
-
color: status.text,
|
|
577
|
-
fontSize: 12,
|
|
578
|
-
height: 24,
|
|
579
|
-
fontWeight: 600,
|
|
580
|
-
borderRadius: "16px"
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
)
|
|
584
|
-
]
|
|
585
|
-
}
|
|
586
|
-
),
|
|
587
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
588
|
-
material.Box,
|
|
589
|
-
{
|
|
590
|
-
sx: {
|
|
591
|
-
width: 36,
|
|
592
|
-
height: 36,
|
|
593
|
-
borderRadius: "50%",
|
|
594
|
-
border: `2px solid ${theme.palette.primary.main}`,
|
|
595
|
-
display: "flex",
|
|
596
|
-
justifyContent: "center",
|
|
597
|
-
alignItems: "center",
|
|
598
|
-
color: theme.palette.primary.main,
|
|
599
|
-
fontWeight: 600,
|
|
600
|
-
fontSize: 14,
|
|
601
|
-
mx: "auto",
|
|
602
|
-
mb: 1.5
|
|
603
|
-
},
|
|
604
|
-
children: event.count
|
|
605
|
-
}
|
|
606
|
-
),
|
|
607
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: event.title, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
608
|
-
material.Typography,
|
|
609
|
-
{
|
|
610
|
-
variant: "subtitle1",
|
|
611
|
-
fontWeight: 600,
|
|
612
|
-
color: isDisabled ? theme.palette.text.secondary : theme.palette.text.primary,
|
|
613
|
-
sx: {
|
|
614
|
-
overflow: "hidden",
|
|
615
|
-
textOverflow: "ellipsis",
|
|
616
|
-
whiteSpace: "nowrap",
|
|
617
|
-
mb: 0.5
|
|
618
|
-
},
|
|
619
|
-
children: event.title
|
|
620
|
-
}
|
|
621
|
-
) }),
|
|
622
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
623
|
-
material.Typography,
|
|
624
|
-
{
|
|
625
|
-
variant: "body2",
|
|
626
|
-
color: theme.palette.text.secondary,
|
|
627
|
-
sx: {
|
|
628
|
-
minHeight: "20px",
|
|
629
|
-
mb: 0.8,
|
|
630
|
-
textOverflow: "ellipsis",
|
|
631
|
-
whiteSpace: "nowrap",
|
|
632
|
-
overflow: "hidden"
|
|
633
|
-
},
|
|
634
|
-
children: event.subTitle || "No Comments"
|
|
635
|
-
}
|
|
636
|
-
),
|
|
637
|
-
event.attachment && /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: "View attachment", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
638
|
-
material.Typography,
|
|
1006
|
+
children: [
|
|
1007
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", children: event.date }),
|
|
1008
|
+
event.status && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1009
|
+
material.Chip,
|
|
639
1010
|
{
|
|
640
|
-
|
|
1011
|
+
label: event.status.title,
|
|
641
1012
|
sx: {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
}
|
|
649
|
-
},
|
|
650
|
-
onClick: () => handleAttachmentClick(event.attachment),
|
|
651
|
-
children: "Attachment"
|
|
652
|
-
}
|
|
653
|
-
) }),
|
|
654
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
655
|
-
material.Typography,
|
|
656
|
-
{
|
|
657
|
-
variant: "caption",
|
|
658
|
-
display: "block",
|
|
659
|
-
color: theme.palette.text.disabled,
|
|
660
|
-
sx: { mt: 1 },
|
|
661
|
-
children: event.time
|
|
1013
|
+
backgroundColor: event.status.color,
|
|
1014
|
+
color: event.status.labelColor,
|
|
1015
|
+
borderRadius: "50px",
|
|
1016
|
+
height: 28,
|
|
1017
|
+
fontWeight: 600
|
|
1018
|
+
}
|
|
662
1019
|
}
|
|
663
1020
|
)
|
|
664
|
-
]
|
|
1021
|
+
]
|
|
1022
|
+
}
|
|
1023
|
+
),
|
|
1024
|
+
/* @__PURE__ */ jsxRuntime.jsx(Bull, { count: event.count, cardType: event.cardType }),
|
|
1025
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1026
|
+
material.Typography,
|
|
1027
|
+
{
|
|
1028
|
+
variant: "subtitle2",
|
|
1029
|
+
sx: { mt: 2, fontWeight: 600 },
|
|
1030
|
+
children: event.title
|
|
1031
|
+
}
|
|
1032
|
+
),
|
|
1033
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { sx: { mb: 1 }, variant: "body2", children: event.subTitle }),
|
|
1034
|
+
event.attachment && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1035
|
+
material.Typography,
|
|
1036
|
+
{
|
|
1037
|
+
sx: {
|
|
1038
|
+
cursor: "pointer",
|
|
1039
|
+
color: "#0B56CA",
|
|
1040
|
+
fontWeight: 600
|
|
1041
|
+
},
|
|
1042
|
+
onClick: () => handleAttachmentClick(event.attachment),
|
|
1043
|
+
children: [
|
|
1044
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-link" }),
|
|
1045
|
+
" Attachment"
|
|
1046
|
+
]
|
|
1047
|
+
}
|
|
1048
|
+
),
|
|
1049
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1050
|
+
material.Typography,
|
|
1051
|
+
{
|
|
1052
|
+
variant: "body2",
|
|
1053
|
+
sx: {
|
|
1054
|
+
position: "absolute",
|
|
1055
|
+
bottom: 12,
|
|
1056
|
+
left: 14,
|
|
1057
|
+
color: "#777"
|
|
1058
|
+
},
|
|
1059
|
+
children: event.time
|
|
665
1060
|
}
|
|
666
1061
|
)
|
|
667
|
-
]
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}) });
|
|
1062
|
+
] }) })
|
|
1063
|
+
]
|
|
1064
|
+
},
|
|
1065
|
+
index
|
|
1066
|
+
);
|
|
1067
|
+
})
|
|
1068
|
+
}
|
|
1069
|
+
) });
|
|
676
1070
|
}
|
|
677
1071
|
var useDebounce = (value, delay) => {
|
|
678
1072
|
const [debouncedValue, setDebouncedValue] = React7.useState(value);
|
|
@@ -757,6 +1151,7 @@ function ApprovalWorkflow({
|
|
|
757
1151
|
selectedWorkflowsList.length ? "selected" : "Action Required"
|
|
758
1152
|
);
|
|
759
1153
|
const [expandedId, setExpandedId] = React7.useState(null);
|
|
1154
|
+
console.log("\u{1F680} ~ ApprovalWorkflow ~ expandedId:", expandedId);
|
|
760
1155
|
const [sendDialog, setSendDialog] = React7__default.default.useState(null);
|
|
761
1156
|
const [approveTarget, setApproveTarget] = React7__default.default.useState(null);
|
|
762
1157
|
const [rejectTarget, setRejectTarget] = React7__default.default.useState(null);
|
|
@@ -825,12 +1220,15 @@ function ApprovalWorkflow({
|
|
|
825
1220
|
},
|
|
826
1221
|
[isLoading, selectedApprovalOtions]
|
|
827
1222
|
);
|
|
828
|
-
const visibleAllRequests = filteredAllRequestArray.slice(
|
|
829
|
-
|
|
1223
|
+
const visibleAllRequests = (filteredAllRequestArray || []).slice(
|
|
1224
|
+
0,
|
|
1225
|
+
visibleAll
|
|
1226
|
+
);
|
|
1227
|
+
const visiblePendingRequests = (filteredPendingRequestArray || []).slice(
|
|
830
1228
|
0,
|
|
831
1229
|
visiblePending
|
|
832
1230
|
);
|
|
833
|
-
const visibleSelectedRequests = filteredSelectedRequestArray.slice(
|
|
1231
|
+
const visibleSelectedRequests = (filteredSelectedRequestArray || []).slice(
|
|
834
1232
|
0,
|
|
835
1233
|
visibleSelected
|
|
836
1234
|
);
|
|
@@ -853,10 +1251,11 @@ function ApprovalWorkflow({
|
|
|
853
1251
|
if (option === "selected") fetchSelectedActivites();
|
|
854
1252
|
};
|
|
855
1253
|
const handleExpandClick = (id) => {
|
|
1254
|
+
console.log("\u{1F680} ~ handleExpandClick ~ id:", id);
|
|
856
1255
|
setExpandedId((prevId) => prevId === id ? null : id);
|
|
857
1256
|
fetchExpandedActivityLogs(id);
|
|
858
1257
|
};
|
|
859
|
-
const
|
|
1258
|
+
const getStatus = (status) => {
|
|
860
1259
|
switch (status.toLowerCase()) {
|
|
861
1260
|
case "approved":
|
|
862
1261
|
return {
|
|
@@ -907,12 +1306,12 @@ function ApprovalWorkflow({
|
|
|
907
1306
|
{
|
|
908
1307
|
label: "Action Required",
|
|
909
1308
|
icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-document-forward" }),
|
|
910
|
-
count: pendingRequestArray.length
|
|
1309
|
+
count: pendingRequestArray ? pendingRequestArray.length : 0
|
|
911
1310
|
},
|
|
912
1311
|
{
|
|
913
1312
|
label: "All Requests",
|
|
914
1313
|
icon: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-document-copy" }),
|
|
915
|
-
count: allRequestArray.length
|
|
1314
|
+
count: allRequestArray ? allRequestArray.length : 0
|
|
916
1315
|
}
|
|
917
1316
|
];
|
|
918
1317
|
const fetchExpandedActivityLogs = (workflowLogId) => {
|
|
@@ -1003,6 +1402,32 @@ function ApprovalWorkflow({
|
|
|
1003
1402
|
}
|
|
1004
1403
|
return "#";
|
|
1005
1404
|
};
|
|
1405
|
+
const StatusObj = {
|
|
1406
|
+
approved: {
|
|
1407
|
+
title: "Approved",
|
|
1408
|
+
color: theme.palette.success.light,
|
|
1409
|
+
labelColor: theme.palette.success.dark
|
|
1410
|
+
},
|
|
1411
|
+
rejected: {
|
|
1412
|
+
title: "Rejected",
|
|
1413
|
+
color: theme.palette.error.light,
|
|
1414
|
+
labelColor: theme.palette.error.dark
|
|
1415
|
+
},
|
|
1416
|
+
onhold: {
|
|
1417
|
+
title: "On Hold",
|
|
1418
|
+
color: theme.palette.warning.light,
|
|
1419
|
+
labelColor: theme.palette.warning.dark
|
|
1420
|
+
},
|
|
1421
|
+
sendback: {
|
|
1422
|
+
title: "Send Back",
|
|
1423
|
+
color: theme.palette.info.light,
|
|
1424
|
+
labelColor: theme.palette.info.dark
|
|
1425
|
+
},
|
|
1426
|
+
pending: {
|
|
1427
|
+
color: theme.palette.grey[300],
|
|
1428
|
+
labelColor: theme.palette.text.primary
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1006
1431
|
if (isLoading && loadingComponent) return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingComponent });
|
|
1007
1432
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1008
1433
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1074,7 +1499,7 @@ function ApprovalWorkflow({
|
|
|
1074
1499
|
pb: 3
|
|
1075
1500
|
},
|
|
1076
1501
|
children: visibleSelectedRequests == null ? void 0 : visibleSelectedRequests.map((info, index) => {
|
|
1077
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n
|
|
1502
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n;
|
|
1078
1503
|
const currentLevel = info == null ? void 0 : info.levels.find(
|
|
1079
1504
|
(level_) => level_.id === (info == null ? void 0 : info.current_level)
|
|
1080
1505
|
);
|
|
@@ -1086,13 +1511,17 @@ function ApprovalWorkflow({
|
|
|
1086
1511
|
},
|
|
1087
1512
|
{}
|
|
1088
1513
|
);
|
|
1514
|
+
const filterRejectForLevelZero = (statusList2, info2) => {
|
|
1515
|
+
if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
|
|
1516
|
+
return statusList2.filter((item) => item.status !== 3);
|
|
1517
|
+
};
|
|
1089
1518
|
const redir = buildRedirectionUrl(info);
|
|
1090
1519
|
const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
|
|
1091
1520
|
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1092
1521
|
)) == 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(
|
|
1093
1522
|
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1094
1523
|
)) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
|
|
1095
|
-
const statusData =
|
|
1524
|
+
const statusData = getStatus(currentStatus);
|
|
1096
1525
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1097
1526
|
material.Card,
|
|
1098
1527
|
{
|
|
@@ -1255,17 +1684,19 @@ function ApprovalWorkflow({
|
|
|
1255
1684
|
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
|
|
1256
1685
|
);
|
|
1257
1686
|
},
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1687
|
+
level: info == null ? void 0 : info.isLevelZero,
|
|
1688
|
+
statusList: filterRejectForLevelZero(
|
|
1689
|
+
statusList,
|
|
1690
|
+
info
|
|
1691
|
+
)
|
|
1261
1692
|
}
|
|
1262
1693
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1263
1694
|
material.Chip,
|
|
1264
1695
|
{
|
|
1265
1696
|
variant: "filled",
|
|
1266
1697
|
sx: {
|
|
1267
|
-
backgroundColor:
|
|
1268
|
-
color:
|
|
1698
|
+
backgroundColor: getStatus(currentStatus).color,
|
|
1699
|
+
color: getStatus(currentStatus).labelColor,
|
|
1269
1700
|
height: "40px",
|
|
1270
1701
|
px: 2,
|
|
1271
1702
|
borderRadius: "100px !important",
|
|
@@ -1323,7 +1754,7 @@ function ApprovalWorkflow({
|
|
|
1323
1754
|
children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
|
|
1324
1755
|
}
|
|
1325
1756
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1326
|
-
|
|
1757
|
+
SnakeTimeline,
|
|
1327
1758
|
{
|
|
1328
1759
|
events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
|
|
1329
1760
|
var _a3, _b3, _c3, _d3;
|
|
@@ -1336,7 +1767,8 @@ function ApprovalWorkflow({
|
|
|
1336
1767
|
subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
|
|
1337
1768
|
attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
|
|
1338
1769
|
count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
|
|
1339
|
-
cardType: "card"
|
|
1770
|
+
cardType: "card",
|
|
1771
|
+
status: (item == null ? void 0 : item.type) === "approve" ? StatusObj.approved : (item == null ? void 0 : item.type) === "reject" ? StatusObj.rejected : (item == null ? void 0 : item.type) === "send_back" ? StatusObj.sendback : (item == null ? void 0 : item.type) === "onhold" ? StatusObj.onhold : null
|
|
1340
1772
|
};
|
|
1341
1773
|
})
|
|
1342
1774
|
}
|
|
@@ -1359,7 +1791,7 @@ function ApprovalWorkflow({
|
|
|
1359
1791
|
pb: 3
|
|
1360
1792
|
},
|
|
1361
1793
|
children: visibleAllRequests == null ? void 0 : visibleAllRequests.map((info, index) => {
|
|
1362
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n
|
|
1794
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k, _l, _m, _n;
|
|
1363
1795
|
const currentLevel = info == null ? void 0 : info.levels.find(
|
|
1364
1796
|
(level_) => level_.id === (info == null ? void 0 : info.current_level)
|
|
1365
1797
|
);
|
|
@@ -1371,13 +1803,17 @@ function ApprovalWorkflow({
|
|
|
1371
1803
|
},
|
|
1372
1804
|
{}
|
|
1373
1805
|
);
|
|
1806
|
+
const filterRejectForLevelZero = (statusList2, info2) => {
|
|
1807
|
+
if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
|
|
1808
|
+
return statusList2.filter((item) => item.status !== 3);
|
|
1809
|
+
};
|
|
1374
1810
|
const redir = buildRedirectionUrl(info);
|
|
1375
1811
|
const currentStatus = ((_c2 = (_b2 = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
|
|
1376
1812
|
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1377
1813
|
)) == 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(
|
|
1378
1814
|
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1379
1815
|
)) == null ? void 0 : _e2.selected_status) == null ? void 0 : _f2.status_id) === 3 ? "rejected" : "pending";
|
|
1380
|
-
const statusData =
|
|
1816
|
+
const statusData = getStatus(currentStatus);
|
|
1381
1817
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1382
1818
|
material.Card,
|
|
1383
1819
|
{
|
|
@@ -1547,17 +1983,19 @@ function ApprovalWorkflow({
|
|
|
1547
1983
|
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
|
|
1548
1984
|
);
|
|
1549
1985
|
},
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1986
|
+
level: info == null ? void 0 : info.isLevelZero,
|
|
1987
|
+
statusList: filterRejectForLevelZero(
|
|
1988
|
+
statusList,
|
|
1989
|
+
info
|
|
1990
|
+
)
|
|
1553
1991
|
}
|
|
1554
1992
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1555
1993
|
material.Chip,
|
|
1556
1994
|
{
|
|
1557
1995
|
variant: "filled",
|
|
1558
1996
|
sx: {
|
|
1559
|
-
backgroundColor:
|
|
1560
|
-
color:
|
|
1997
|
+
backgroundColor: getStatus(currentStatus).color,
|
|
1998
|
+
color: getStatus(currentStatus).labelColor,
|
|
1561
1999
|
height: "40px",
|
|
1562
2000
|
px: 2,
|
|
1563
2001
|
borderRadius: "100px !important",
|
|
@@ -1615,7 +2053,7 @@ function ApprovalWorkflow({
|
|
|
1615
2053
|
children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
|
|
1616
2054
|
}
|
|
1617
2055
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1618
|
-
|
|
2056
|
+
SnakeTimeline,
|
|
1619
2057
|
{
|
|
1620
2058
|
events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
|
|
1621
2059
|
var _a3, _b3, _c3, _d3;
|
|
@@ -1628,7 +2066,8 @@ function ApprovalWorkflow({
|
|
|
1628
2066
|
subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
|
|
1629
2067
|
attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
|
|
1630
2068
|
count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
|
|
1631
|
-
cardType: "card"
|
|
2069
|
+
cardType: "card",
|
|
2070
|
+
status: (item == null ? void 0 : item.type) === "approve" ? StatusObj.approved : (item == null ? void 0 : item.type) === "reject" ? StatusObj.rejected : (item == null ? void 0 : item.type) === "send_back" ? StatusObj.sendback : (item == null ? void 0 : item.type) === "onhold" ? StatusObj.onhold : null
|
|
1632
2071
|
};
|
|
1633
2072
|
})
|
|
1634
2073
|
}
|
|
@@ -1652,18 +2091,24 @@ function ApprovalWorkflow({
|
|
|
1652
2091
|
},
|
|
1653
2092
|
children: visiblePendingRequests == null ? void 0 : visiblePendingRequests.map((info, index) => {
|
|
1654
2093
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j, _k;
|
|
2094
|
+
console.log("\u{1F680} ~ ApprovalWorkflow ~ info:", info);
|
|
1655
2095
|
const currentLevel = (_a2 = info == null ? void 0 : info.levels) == null ? void 0 : _a2.find(
|
|
1656
2096
|
(level_) => level_.id === (info == null ? void 0 : info.current_level)
|
|
1657
2097
|
);
|
|
1658
2098
|
const statusList = currentLevel ? currentLevel.status_list : [];
|
|
2099
|
+
const filterRejectForLevelZero = (statusList2, info2) => {
|
|
2100
|
+
if (!(info2 == null ? void 0 : info2.isLevelZero)) return statusList2;
|
|
2101
|
+
return statusList2.filter((item) => item.status !== 3);
|
|
2102
|
+
};
|
|
2103
|
+
console.log("statusList", statusList);
|
|
1659
2104
|
const redir = buildRedirectionUrl(info);
|
|
1660
2105
|
const currentStatus = ((_d2 = (_c2 = (_b2 = info == null ? void 0 : info.levels) == null ? void 0 : _b2.find(
|
|
1661
2106
|
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1662
2107
|
)) == 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(
|
|
1663
2108
|
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
1664
2109
|
)) == null ? void 0 : _f2.selected_status) == null ? void 0 : _g2.status_id) === 3 ? "rejected" : "pending";
|
|
1665
|
-
const statusData =
|
|
1666
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
2110
|
+
const statusData = getStatus(currentStatus);
|
|
2111
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1667
2112
|
material.Card,
|
|
1668
2113
|
{
|
|
1669
2114
|
ref: index === visiblePendingRequests.length - 1 ? lastCardRef : null,
|
|
@@ -1674,192 +2119,229 @@ function ApprovalWorkflow({
|
|
|
1674
2119
|
px: 3,
|
|
1675
2120
|
py: 2
|
|
1676
2121
|
},
|
|
1677
|
-
children:
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1690
|
-
|
|
1691
|
-
material.
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1733
|
-
|
|
1734
|
-
|
|
2122
|
+
children: [
|
|
2123
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2124
|
+
material.CardContent,
|
|
2125
|
+
{
|
|
2126
|
+
sx: {
|
|
2127
|
+
display: "flex",
|
|
2128
|
+
justifyContent: "space-between",
|
|
2129
|
+
alignItems: "center",
|
|
2130
|
+
flexWrap: { xs: "wrap", md: "nowrap" },
|
|
2131
|
+
gap: 2
|
|
2132
|
+
},
|
|
2133
|
+
children: [
|
|
2134
|
+
/* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "20%", minWidth: 220 }, children: [
|
|
2135
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.activityInstruction, children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "h6", fontWeight: 600, noWrap: true, children: info.activity_name }) }),
|
|
2136
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: info.description_data, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2137
|
+
material.Typography,
|
|
2138
|
+
{
|
|
2139
|
+
variant: "body2",
|
|
2140
|
+
color: "text.secondary",
|
|
2141
|
+
noWrap: true,
|
|
2142
|
+
sx: { mt: 0.5 },
|
|
2143
|
+
children: info.description_data
|
|
2144
|
+
}
|
|
2145
|
+
) })
|
|
2146
|
+
] }),
|
|
2147
|
+
/* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "18%", minWidth: 180 }, children: [
|
|
2148
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Links" }),
|
|
2149
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: redir, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2150
|
+
"a",
|
|
2151
|
+
{
|
|
2152
|
+
href: redir,
|
|
2153
|
+
target: "_blank",
|
|
2154
|
+
rel: "noreferrer",
|
|
2155
|
+
style: {
|
|
2156
|
+
cursor: "pointer",
|
|
2157
|
+
textDecoration: "none"
|
|
2158
|
+
},
|
|
2159
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2160
|
+
material.Typography,
|
|
2161
|
+
{
|
|
2162
|
+
variant: "subtitle2",
|
|
2163
|
+
color: "primary.dark",
|
|
2164
|
+
sx: {
|
|
2165
|
+
mt: 0.8,
|
|
2166
|
+
lineHeight: "15.4px",
|
|
2167
|
+
overflow: "hidden",
|
|
2168
|
+
textOverflow: "ellipsis",
|
|
2169
|
+
whiteSpace: "nowrap"
|
|
2170
|
+
},
|
|
2171
|
+
children: redir
|
|
2172
|
+
}
|
|
2173
|
+
)
|
|
2174
|
+
}
|
|
2175
|
+
) })
|
|
2176
|
+
] }),
|
|
2177
|
+
/* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "12%", minWidth: 120 }, children: [
|
|
2178
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Attachments" }),
|
|
2179
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2180
|
+
material.Typography,
|
|
2181
|
+
{
|
|
2182
|
+
variant: "body2",
|
|
2183
|
+
noWrap: true,
|
|
2184
|
+
sx: {
|
|
2185
|
+
mt: 0.8,
|
|
2186
|
+
color: ((_h = info == null ? void 0 : info.attachment_links) == null ? void 0 : _h.length) ? "primary.dark" : "text.disabled"
|
|
2187
|
+
},
|
|
2188
|
+
children: ((_i = info == null ? void 0 : info.attachment_links) == null ? void 0 : _i.length) ? `${info.attachment_links.length} file(s)` : "N/A"
|
|
2189
|
+
}
|
|
2190
|
+
)
|
|
2191
|
+
] }),
|
|
2192
|
+
/* @__PURE__ */ jsxRuntime.jsxs(system.Box, { sx: { flexBasis: "14%", minWidth: 130 }, children: [
|
|
2193
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
|
|
2194
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2195
|
+
material.Typography,
|
|
2196
|
+
{
|
|
2197
|
+
variant: "body2",
|
|
2198
|
+
sx: {
|
|
2199
|
+
mt: 0.8,
|
|
2200
|
+
fontWeight: 500,
|
|
2201
|
+
color: "text.primary"
|
|
2202
|
+
},
|
|
2203
|
+
children: (currentLevel == null ? void 0 : currentLevel.tat_expiry) ? moment__default.default(currentLevel.tat_expiry).utcOffset("UTC+05:30").format("DD/MM/YYYY hh:mm A") : "N/A"
|
|
2204
|
+
}
|
|
2205
|
+
)
|
|
2206
|
+
] }),
|
|
2207
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2208
|
+
system.Box,
|
|
1735
2209
|
{
|
|
1736
|
-
variant: "body2",
|
|
1737
|
-
noWrap: true,
|
|
1738
2210
|
sx: {
|
|
1739
|
-
|
|
1740
|
-
|
|
2211
|
+
flexBasis: "8%",
|
|
2212
|
+
minWidth: 80,
|
|
2213
|
+
textAlign: "center"
|
|
1741
2214
|
},
|
|
1742
|
-
children:
|
|
2215
|
+
children: [
|
|
2216
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "Current Level" }),
|
|
2217
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body2", sx: { mt: 0.8 }, children: (info == null ? void 0 : info.isLevelZero) ? "L0" : "L" + (((_k = (_j = info == null ? void 0 : info.levels) == null ? void 0 : _j.findIndex(
|
|
2218
|
+
(lvl) => lvl.id === (info == null ? void 0 : info.current_level)
|
|
2219
|
+
)) != null ? _k : -1) + 1 || "") })
|
|
2220
|
+
]
|
|
1743
2221
|
}
|
|
1744
|
-
)
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", children: "TAT" }),
|
|
1748
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1749
|
-
material.Typography,
|
|
2222
|
+
),
|
|
2223
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2224
|
+
system.Box,
|
|
1750
2225
|
{
|
|
1751
|
-
variant: "body2",
|
|
1752
2226
|
sx: {
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
2227
|
+
flexBasis: "18%",
|
|
2228
|
+
minWidth: 200,
|
|
2229
|
+
display: "flex",
|
|
2230
|
+
alignItems: "center",
|
|
2231
|
+
justifyContent: "flex-end",
|
|
2232
|
+
gap: 1.5
|
|
1756
2233
|
},
|
|
1757
|
-
children:
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
material.Chip,
|
|
1815
|
-
{
|
|
1816
|
-
variant: "filled",
|
|
1817
|
-
sx: {
|
|
1818
|
-
backgroundColor: statusData.color,
|
|
1819
|
-
color: statusData.labelColor,
|
|
1820
|
-
height: "40px",
|
|
1821
|
-
px: 2,
|
|
1822
|
-
borderRadius: "100px !important",
|
|
1823
|
-
"& .MuiChip-label": {
|
|
1824
|
-
fontSize: "14px",
|
|
1825
|
-
lineHeight: "15.4px",
|
|
1826
|
-
fontWeight: "500",
|
|
1827
|
-
textTransform: "capitalize"
|
|
2234
|
+
children: [
|
|
2235
|
+
(info == null ? void 0 : info.current_status) !== "completed" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2236
|
+
Statusselector_default,
|
|
2237
|
+
{
|
|
2238
|
+
onSendBack: () => handleSendBack(info == null ? void 0 : info._id),
|
|
2239
|
+
onApprove: () => {
|
|
2240
|
+
var _a3;
|
|
2241
|
+
return handleApprove(
|
|
2242
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 1)) == null ? void 0 : _a3.id}`
|
|
2243
|
+
);
|
|
2244
|
+
},
|
|
2245
|
+
onReject: () => {
|
|
2246
|
+
var _a3;
|
|
2247
|
+
return handleReject(
|
|
2248
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 3)) == null ? void 0 : _a3.id}|${info == null ? void 0 : info.reasons}`
|
|
2249
|
+
);
|
|
2250
|
+
},
|
|
2251
|
+
onHold: () => {
|
|
2252
|
+
var _a3;
|
|
2253
|
+
return handleOnHold(
|
|
2254
|
+
`${info == null ? void 0 : info._id}|${(_a3 = statusList.find((i) => i.status == 2)) == null ? void 0 : _a3.id}`
|
|
2255
|
+
);
|
|
2256
|
+
},
|
|
2257
|
+
level: info == null ? void 0 : info.isLevelZero,
|
|
2258
|
+
statusList: filterRejectForLevelZero(
|
|
2259
|
+
statusList,
|
|
2260
|
+
info
|
|
2261
|
+
)
|
|
2262
|
+
}
|
|
2263
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2264
|
+
material.Chip,
|
|
2265
|
+
{
|
|
2266
|
+
variant: "filled",
|
|
2267
|
+
sx: {
|
|
2268
|
+
backgroundColor: statusData.color,
|
|
2269
|
+
color: statusData.labelColor,
|
|
2270
|
+
height: "40px",
|
|
2271
|
+
px: 2,
|
|
2272
|
+
borderRadius: "100px !important",
|
|
2273
|
+
"& .MuiChip-label": {
|
|
2274
|
+
fontSize: "14px",
|
|
2275
|
+
lineHeight: "15.4px",
|
|
2276
|
+
fontWeight: "500",
|
|
2277
|
+
textTransform: "capitalize"
|
|
2278
|
+
}
|
|
2279
|
+
},
|
|
2280
|
+
label: statusData.title
|
|
2281
|
+
}
|
|
2282
|
+
),
|
|
2283
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2284
|
+
material.Divider,
|
|
2285
|
+
{
|
|
2286
|
+
orientation: "vertical",
|
|
2287
|
+
flexItem: true,
|
|
2288
|
+
sx: {
|
|
2289
|
+
borderColor: "#E0E0E0",
|
|
2290
|
+
height: "40px"
|
|
1828
2291
|
}
|
|
1829
|
-
},
|
|
1830
|
-
label: statusData.title
|
|
1831
|
-
}
|
|
1832
|
-
),
|
|
1833
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1834
|
-
material.Divider,
|
|
1835
|
-
{
|
|
1836
|
-
orientation: "vertical",
|
|
1837
|
-
flexItem: true,
|
|
1838
|
-
sx: {
|
|
1839
|
-
borderColor: "#E0E0E0",
|
|
1840
|
-
height: "40px"
|
|
1841
2292
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
2293
|
+
),
|
|
2294
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2295
|
+
material.IconButton,
|
|
2296
|
+
{
|
|
2297
|
+
color: "primary",
|
|
2298
|
+
sx: {
|
|
2299
|
+
background: "rgba(25,118,210,0.08)",
|
|
2300
|
+
boxShadow: "2px 2px 10px 0px #4C4E6426",
|
|
2301
|
+
"& span": { color: "primary.dark" }
|
|
2302
|
+
},
|
|
2303
|
+
onClick: () => handleExpandClick(info._id),
|
|
2304
|
+
children: expandedId === info._id ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-down-1" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "icon-arrow-right-3" })
|
|
2305
|
+
}
|
|
2306
|
+
)
|
|
2307
|
+
]
|
|
2308
|
+
}
|
|
2309
|
+
)
|
|
2310
|
+
]
|
|
2311
|
+
}
|
|
2312
|
+
),
|
|
2313
|
+
expandedId === info._id && /* @__PURE__ */ jsxRuntime.jsx(system.Box, { sx: { mt: 2, ml: 2 }, children: !(expandedDetails == null ? void 0 : expandedDetails.length) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2314
|
+
system.Box,
|
|
2315
|
+
{
|
|
2316
|
+
sx: {
|
|
2317
|
+
height: 150,
|
|
2318
|
+
display: "flex",
|
|
2319
|
+
justifyContent: "center",
|
|
2320
|
+
alignItems: "center"
|
|
2321
|
+
},
|
|
2322
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(material.CircularProgress, { size: 36, color: "primary" })
|
|
2323
|
+
}
|
|
2324
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
2325
|
+
SnakeTimeline,
|
|
2326
|
+
{
|
|
2327
|
+
events: expandedDetails == null ? void 0 : expandedDetails.map((item) => {
|
|
2328
|
+
var _a3, _b3, _c3, _d3;
|
|
2329
|
+
return {
|
|
2330
|
+
date: moment__default.default(item == null ? void 0 : item.created_at).format(
|
|
2331
|
+
"DD-MM-YYYY"
|
|
2332
|
+
),
|
|
2333
|
+
time: moment__default.default(item == null ? void 0 : item.created_at).format("HH:mm"),
|
|
2334
|
+
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",
|
|
2335
|
+
subTitle: ((_c3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _c3.comment) || "No Comments",
|
|
2336
|
+
attachment: ((_d3 = item == null ? void 0 : item.comment_reasons) == null ? void 0 : _d3.file) || null,
|
|
2337
|
+
count: (item == null ? void 0 : item.current_level) == "L0" ? "L0" : item == null ? void 0 : item.current_level_count,
|
|
2338
|
+
cardType: "card",
|
|
2339
|
+
status: (item == null ? void 0 : item.type) === "approve" ? StatusObj.approved : (item == null ? void 0 : item.type) === "reject" ? StatusObj.rejected : (item == null ? void 0 : item.type) === "send_back" ? StatusObj.sendback : (item == null ? void 0 : item.type) === "onhold" ? StatusObj.onhold : null
|
|
2340
|
+
};
|
|
2341
|
+
})
|
|
2342
|
+
}
|
|
2343
|
+
) })
|
|
2344
|
+
]
|
|
1863
2345
|
},
|
|
1864
2346
|
index
|
|
1865
2347
|
);
|
|
@@ -1919,7 +2401,15 @@ function DialogOpener({
|
|
|
1919
2401
|
}) {
|
|
1920
2402
|
const theme = styles.useTheme();
|
|
1921
2403
|
useMediaQuery__default.default(theme.breakpoints.down("lg"));
|
|
1922
|
-
const [screenWidth, setScreenWidth] = React7.useState(
|
|
2404
|
+
const [screenWidth, setScreenWidth] = React7.useState(
|
|
2405
|
+
typeof window !== "undefined" ? window.innerWidth : 0
|
|
2406
|
+
);
|
|
2407
|
+
console.log("Dialog opener props", {
|
|
2408
|
+
openDialog,
|
|
2409
|
+
handleClose,
|
|
2410
|
+
userInfoData,
|
|
2411
|
+
selectedWorkflowsList
|
|
2412
|
+
});
|
|
1923
2413
|
React7.useEffect(() => {
|
|
1924
2414
|
const updateScreenWidth = () => setScreenWidth(window.innerWidth);
|
|
1925
2415
|
window.addEventListener("resize", updateScreenWidth);
|
|
@@ -1932,18 +2422,37 @@ function DialogOpener({
|
|
|
1932
2422
|
open: openDialog,
|
|
1933
2423
|
onClose: () => handleClose && handleClose(),
|
|
1934
2424
|
"aria-labelledby": "responsive-dialog-title",
|
|
1935
|
-
sx: { zIndex:
|
|
2425
|
+
sx: { zIndex: 1234 },
|
|
1936
2426
|
children: [
|
|
1937
2427
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogContent__default.default, { children: [
|
|
1938
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1939
|
-
|
|
2428
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2429
|
+
material.IconButton,
|
|
2430
|
+
{
|
|
2431
|
+
onClick: handleClose,
|
|
2432
|
+
disableFocusRipple: true,
|
|
2433
|
+
disableRipple: true,
|
|
2434
|
+
sx: { float: "right" },
|
|
2435
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(HighlightOffIcon__default.default, { style: { color: "#666666" } })
|
|
2436
|
+
}
|
|
2437
|
+
),
|
|
2438
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2439
|
+
ApprovalWorkflow,
|
|
2440
|
+
{
|
|
2441
|
+
userInfo: userInfoData,
|
|
2442
|
+
selectedWorkflowsList
|
|
2443
|
+
}
|
|
2444
|
+
)
|
|
1940
2445
|
] }),
|
|
1941
2446
|
/* @__PURE__ */ jsxRuntime.jsx(DialogActions5__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1942
2447
|
Button7__default.default,
|
|
1943
2448
|
{
|
|
1944
2449
|
variant: "contained",
|
|
1945
2450
|
color: "primary",
|
|
1946
|
-
sx: {
|
|
2451
|
+
sx: {
|
|
2452
|
+
display: "flex",
|
|
2453
|
+
justifyContent: "flex-end",
|
|
2454
|
+
alignItems: "center"
|
|
2455
|
+
},
|
|
1947
2456
|
onClick: handleClose,
|
|
1948
2457
|
children: "Close"
|
|
1949
2458
|
}
|