icleafreportui 0.1.6 → 0.1.7
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/App.js +39 -43
- package/dist/Login.js +130 -121
- package/dist/Reports/CourseReport.js +163 -152
- package/dist/Reports/ExamPackReport.js +245 -226
- package/dist/Reports/ExamReport.js +173 -161
- package/dist/Reports/Report.js +193 -178
- package/dist/api/client.js +1 -7
- package/dist/components/Header.js +76 -78
- package/dist/components/Loader.js +16 -22
- package/dist/components/imagePathUrl.js +5 -11
- package/dist/components/sidebar.js +96 -65
- package/dist/context/TenantProvider.js +13 -22
- package/dist/index.js +16 -15
- package/dist/package.js +15 -100
- package/dist/reportWebVitals.js +2 -10
- package/dist/setupTests.js +5 -3
- package/package.json +1 -1
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _material = require("@mui/material");
|
|
10
|
-
var _reactRouterDom = require("react-router-dom");
|
|
11
|
-
var _Header = _interopRequireDefault(require("../components/Header"));
|
|
12
|
-
var _sidebar = _interopRequireDefault(require("../components/sidebar"));
|
|
13
|
-
require("../App.css");
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { Autocomplete, FormControl, Button, Grid, Box, Typography, Paper, Snackbar, Alert, CircularProgress, TextField, Checkbox, FormControlLabel } from '@mui/material';
|
|
4
|
+
import { useNavigate } from 'react-router-dom';
|
|
5
|
+
import Header from '../components/Header';
|
|
6
|
+
import Sidebar from '../components/sidebar';
|
|
7
|
+
import '../App.css';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
9
|
function ExamReport() {
|
|
19
|
-
const [token, setToken] =
|
|
20
|
-
const navigate =
|
|
21
|
-
const [subjects, setSubjects] =
|
|
22
|
-
const [examPacks, setExamPacks] =
|
|
23
|
-
const [exams, setExams] =
|
|
24
|
-
const [users, setUsers] =
|
|
25
|
-
const [selectedSubject, setSelectedSubject] =
|
|
26
|
-
const [selectedExamPack, setSelectedExamPack] =
|
|
27
|
-
const [selectedExam, setSelectedExam] =
|
|
28
|
-
const [selectedUser, setSelectedUser] =
|
|
29
|
-
const [alertMessage, setAlertMessage] =
|
|
30
|
-
const [openAlert, setOpenAlert] =
|
|
31
|
-
const [loading, setLoading] =
|
|
10
|
+
const [token, setToken] = useState(localStorage.getItem("token"));
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
const [subjects, setSubjects] = useState([]);
|
|
13
|
+
const [examPacks, setExamPacks] = useState([]);
|
|
14
|
+
const [exams, setExams] = useState([]);
|
|
15
|
+
const [users, setUsers] = useState([]);
|
|
16
|
+
const [selectedSubject, setSelectedSubject] = useState(null);
|
|
17
|
+
const [selectedExamPack, setSelectedExamPack] = useState(null);
|
|
18
|
+
const [selectedExam, setSelectedExam] = useState(null);
|
|
19
|
+
const [selectedUser, setSelectedUser] = useState(null);
|
|
20
|
+
const [alertMessage, setAlertMessage] = useState('');
|
|
21
|
+
const [openAlert, setOpenAlert] = useState(false);
|
|
22
|
+
const [loading, setLoading] = useState(false);
|
|
32
23
|
const baseURL = process.env.REACT_APP_BASE_URL;
|
|
33
|
-
|
|
24
|
+
useEffect(() => {
|
|
34
25
|
if (token == null) {
|
|
35
26
|
navigate("/login");
|
|
36
27
|
} else {
|
|
@@ -39,7 +30,7 @@ function ExamReport() {
|
|
|
39
30
|
}, []);
|
|
40
31
|
const fetchAllSubjects = async () => {
|
|
41
32
|
try {
|
|
42
|
-
const response = await (
|
|
33
|
+
const response = await axios({
|
|
43
34
|
method: "get",
|
|
44
35
|
url: `${baseURL}api/showAllSubjects`,
|
|
45
36
|
headers: {
|
|
@@ -53,7 +44,7 @@ function ExamReport() {
|
|
|
53
44
|
};
|
|
54
45
|
const fetchExamPacks = async subjectId => {
|
|
55
46
|
try {
|
|
56
|
-
const response = await (
|
|
47
|
+
const response = await axios({
|
|
57
48
|
method: "get",
|
|
58
49
|
params: {
|
|
59
50
|
subjectId
|
|
@@ -70,7 +61,7 @@ function ExamReport() {
|
|
|
70
61
|
};
|
|
71
62
|
const fetchExams = async examPackId => {
|
|
72
63
|
try {
|
|
73
|
-
const response = await (
|
|
64
|
+
const response = await axios({
|
|
74
65
|
method: "get",
|
|
75
66
|
params: {
|
|
76
67
|
examPackId
|
|
@@ -87,7 +78,7 @@ function ExamReport() {
|
|
|
87
78
|
};
|
|
88
79
|
const fetchUsers = async examId => {
|
|
89
80
|
try {
|
|
90
|
-
const response = await (
|
|
81
|
+
const response = await axios({
|
|
91
82
|
method: "get",
|
|
92
83
|
params: {
|
|
93
84
|
examId
|
|
@@ -139,7 +130,7 @@ function ExamReport() {
|
|
|
139
130
|
setLoading(true);
|
|
140
131
|
try {
|
|
141
132
|
const url = `${baseURL}api/generateReportForExam?subjectId=${selectedSubject.subjectId}&examPackId=${selectedExamPack.id}&examId=${selectedExam.id}`;
|
|
142
|
-
const response = await
|
|
133
|
+
const response = await axios.get(url, {
|
|
143
134
|
responseType: 'blob',
|
|
144
135
|
headers: {
|
|
145
136
|
Authorization: `Bearer ${token}`
|
|
@@ -162,129 +153,150 @@ function ExamReport() {
|
|
|
162
153
|
setLoading(false);
|
|
163
154
|
}
|
|
164
155
|
};
|
|
165
|
-
return /*#__PURE__*/
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
156
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
157
|
+
children: [/*#__PURE__*/_jsx(Header, {}), /*#__PURE__*/_jsx(Sidebar, {}), /*#__PURE__*/_jsxs("div", {
|
|
158
|
+
style: {
|
|
159
|
+
padding: "100px 0px 0px 100px",
|
|
160
|
+
marginLeft: "140px"
|
|
161
|
+
},
|
|
162
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
163
|
+
sx: {
|
|
164
|
+
maxWidth: 800,
|
|
165
|
+
mx: 'auto',
|
|
166
|
+
my: 4,
|
|
167
|
+
p: 3,
|
|
168
|
+
backgroundColor: '#f5f5f5',
|
|
169
|
+
borderRadius: 2
|
|
170
|
+
},
|
|
171
|
+
children: /*#__PURE__*/_jsxs(Paper, {
|
|
172
|
+
elevation: 6,
|
|
173
|
+
sx: {
|
|
174
|
+
p: 5,
|
|
175
|
+
textAlign: 'center',
|
|
176
|
+
backgroundColor: '#fff'
|
|
177
|
+
},
|
|
178
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
179
|
+
variant: "h4",
|
|
180
|
+
component: "h1",
|
|
181
|
+
gutterBottom: true,
|
|
182
|
+
sx: {
|
|
183
|
+
color: '#3f51b5',
|
|
184
|
+
marginBottom: "20px"
|
|
185
|
+
},
|
|
186
|
+
children: "Exam Questions Report"
|
|
187
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
|
188
|
+
container: true,
|
|
189
|
+
spacing: 2,
|
|
190
|
+
justifyContent: "center",
|
|
191
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
192
|
+
item: true,
|
|
193
|
+
xs: 12,
|
|
194
|
+
sm: 6,
|
|
195
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
196
|
+
fullWidth: true,
|
|
197
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
198
|
+
id: "ddlSubject",
|
|
199
|
+
options: subjects,
|
|
200
|
+
getOptionLabel: option => option.subjectName,
|
|
201
|
+
value: selectedSubject,
|
|
202
|
+
onChange: handleSubjectChange,
|
|
203
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
204
|
+
...params,
|
|
205
|
+
label: "Subject"
|
|
206
|
+
})
|
|
207
|
+
})
|
|
208
|
+
})
|
|
209
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
210
|
+
item: true,
|
|
211
|
+
xs: 12,
|
|
212
|
+
sm: 6,
|
|
213
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
214
|
+
fullWidth: true,
|
|
215
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
216
|
+
id: "ddlExamPack",
|
|
217
|
+
options: examPacks,
|
|
218
|
+
getOptionLabel: option => option.name,
|
|
219
|
+
value: selectedExamPack,
|
|
220
|
+
onChange: handleExamPackChange,
|
|
221
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
222
|
+
...params,
|
|
223
|
+
label: "Exam Pack"
|
|
224
|
+
})
|
|
225
|
+
})
|
|
226
|
+
})
|
|
227
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
228
|
+
item: true,
|
|
229
|
+
xs: 12,
|
|
230
|
+
sm: 6,
|
|
231
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
232
|
+
fullWidth: true,
|
|
233
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
234
|
+
id: "ddlExam",
|
|
235
|
+
options: exams,
|
|
236
|
+
getOptionLabel: option => option.examName,
|
|
237
|
+
value: selectedExam,
|
|
238
|
+
onChange: handleExamChange,
|
|
239
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
240
|
+
...params,
|
|
241
|
+
label: "Exam"
|
|
242
|
+
})
|
|
243
|
+
})
|
|
244
|
+
})
|
|
245
|
+
})]
|
|
246
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
247
|
+
sx: {
|
|
248
|
+
mt: 3,
|
|
249
|
+
position: 'relative'
|
|
250
|
+
},
|
|
251
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
252
|
+
sx: {
|
|
253
|
+
mt: 2,
|
|
254
|
+
position: 'relative'
|
|
255
|
+
},
|
|
256
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
257
|
+
variant: "contained",
|
|
258
|
+
color: "primary",
|
|
259
|
+
onClick: handleDownload,
|
|
260
|
+
disabled: !selectedSubject || !selectedExamPack || !selectedExam || loading,
|
|
261
|
+
sx: {
|
|
262
|
+
width: 'auto',
|
|
263
|
+
backgroundColor: '#3f51b5',
|
|
264
|
+
'&:hover': {
|
|
265
|
+
backgroundColor: '#303f9f'
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
children: loading ? 'Downloading...' : 'Download Report'
|
|
269
|
+
}), loading && /*#__PURE__*/_jsx(CircularProgress, {
|
|
270
|
+
size: 24,
|
|
271
|
+
sx: {
|
|
272
|
+
position: 'absolute',
|
|
273
|
+
top: '50%',
|
|
274
|
+
left: '50%',
|
|
275
|
+
marginTop: '-12px',
|
|
276
|
+
marginLeft: '-12px'
|
|
277
|
+
}
|
|
278
|
+
})]
|
|
279
|
+
})
|
|
280
|
+
})]
|
|
281
|
+
})
|
|
282
|
+
}), /*#__PURE__*/_jsx(Snackbar, {
|
|
283
|
+
open: openAlert,
|
|
284
|
+
autoHideDuration: 6000,
|
|
285
|
+
onClose: () => setOpenAlert(false),
|
|
286
|
+
anchorOrigin: {
|
|
287
|
+
vertical: 'top',
|
|
288
|
+
horizontal: 'center'
|
|
289
|
+
},
|
|
290
|
+
children: /*#__PURE__*/_jsx(Alert, {
|
|
291
|
+
onClose: () => setOpenAlert(false),
|
|
292
|
+
severity: "info",
|
|
293
|
+
sx: {
|
|
294
|
+
width: '100%'
|
|
295
|
+
},
|
|
296
|
+
children: alertMessage
|
|
297
|
+
})
|
|
298
|
+
})]
|
|
299
|
+
})]
|
|
300
|
+
});
|
|
289
301
|
}
|
|
290
|
-
|
|
302
|
+
export default ExamReport;
|