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,34 +1,25 @@
|
|
|
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 } 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 CourseReport() {
|
|
19
|
-
const [token, setToken] =
|
|
20
|
-
const navigate =
|
|
21
|
-
const [subjects, setSubjects] =
|
|
22
|
-
const [courses, setCourses] =
|
|
23
|
-
const [selectedSubject, setSelectedSubject] =
|
|
24
|
-
const [selectedCourse, setSelectedCourse] =
|
|
25
|
-
const [reportTypes] =
|
|
26
|
-
const [selectedReportType, setSelectedReportType] =
|
|
27
|
-
const [alertMessage, setAlertMessage] =
|
|
28
|
-
const [loading, setLoading] =
|
|
29
|
-
const [alertOpen, setAlertOpen] =
|
|
10
|
+
const [token, setToken] = useState(localStorage.getItem("token"));
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
const [subjects, setSubjects] = useState([]);
|
|
13
|
+
const [courses, setCourses] = useState([]);
|
|
14
|
+
const [selectedSubject, setSelectedSubject] = useState(null);
|
|
15
|
+
const [selectedCourse, setSelectedCourse] = useState(null);
|
|
16
|
+
const [reportTypes] = useState(['Summary', 'Daywise']);
|
|
17
|
+
const [selectedReportType, setSelectedReportType] = useState(null);
|
|
18
|
+
const [alertMessage, setAlertMessage] = useState('');
|
|
19
|
+
const [loading, setLoading] = useState(false);
|
|
20
|
+
const [alertOpen, setAlertOpen] = useState(false);
|
|
30
21
|
const baseURL = process.env.REACT_APP_BASE_URL;
|
|
31
|
-
|
|
22
|
+
useEffect(() => {
|
|
32
23
|
if (token == null) {
|
|
33
24
|
navigate("/login");
|
|
34
25
|
} else {
|
|
@@ -37,7 +28,7 @@ function CourseReport() {
|
|
|
37
28
|
}, []);
|
|
38
29
|
const fetchAllSubjects = async () => {
|
|
39
30
|
try {
|
|
40
|
-
const response = await (
|
|
31
|
+
const response = await axios({
|
|
41
32
|
method: "get",
|
|
42
33
|
url: `${baseURL}api/showAllSubjects`,
|
|
43
34
|
headers: {
|
|
@@ -51,7 +42,7 @@ function CourseReport() {
|
|
|
51
42
|
};
|
|
52
43
|
const fetchCourses = async subjectId => {
|
|
53
44
|
try {
|
|
54
|
-
const response = await (
|
|
45
|
+
const response = await axios({
|
|
55
46
|
method: "get",
|
|
56
47
|
params: {
|
|
57
48
|
subjectId
|
|
@@ -89,7 +80,7 @@ function CourseReport() {
|
|
|
89
80
|
} else if (selectedReportType === 'Daywise') {
|
|
90
81
|
url = `${baseURL}api/downloadUserCorpCourseExcelDayWise?corpCourseId=${selectedCourse.id}`;
|
|
91
82
|
}
|
|
92
|
-
const response = await
|
|
83
|
+
const response = await axios.get(url, {
|
|
93
84
|
responseType: 'blob',
|
|
94
85
|
headers: {
|
|
95
86
|
Authorization: `Bearer ${token}`
|
|
@@ -120,124 +111,144 @@ function CourseReport() {
|
|
|
120
111
|
setLoading(false);
|
|
121
112
|
}
|
|
122
113
|
};
|
|
123
|
-
return /*#__PURE__*/
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
114
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
115
|
+
children: [/*#__PURE__*/_jsx(Header, {}), /*#__PURE__*/_jsx(Sidebar, {}), /*#__PURE__*/_jsxs("div", {
|
|
116
|
+
style: {
|
|
117
|
+
padding: "100px 0px 0px 100px",
|
|
118
|
+
marginLeft: "140px"
|
|
119
|
+
},
|
|
120
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
121
|
+
sx: {
|
|
122
|
+
maxWidth: 800,
|
|
123
|
+
mx: 'auto',
|
|
124
|
+
my: 4,
|
|
125
|
+
p: 3,
|
|
126
|
+
backgroundColor: '#f5f5f5',
|
|
127
|
+
borderRadius: 2
|
|
128
|
+
},
|
|
129
|
+
children: /*#__PURE__*/_jsxs(Paper, {
|
|
130
|
+
elevation: 6,
|
|
131
|
+
sx: {
|
|
132
|
+
p: 5,
|
|
133
|
+
textAlign: 'center',
|
|
134
|
+
backgroundColor: '#fff'
|
|
135
|
+
},
|
|
136
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
137
|
+
variant: "h4",
|
|
138
|
+
component: "h1",
|
|
139
|
+
gutterBottom: true,
|
|
140
|
+
sx: {
|
|
141
|
+
color: '#3f51b5',
|
|
142
|
+
marginBottom: "20px"
|
|
143
|
+
},
|
|
144
|
+
children: "Course Report"
|
|
145
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
|
146
|
+
container: true,
|
|
147
|
+
spacing: 2,
|
|
148
|
+
justifyContent: "center",
|
|
149
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
150
|
+
item: true,
|
|
151
|
+
xs: 12,
|
|
152
|
+
sm: 4,
|
|
153
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
154
|
+
fullWidth: true,
|
|
155
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
156
|
+
id: "ddlSubject",
|
|
157
|
+
options: subjects,
|
|
158
|
+
getOptionLabel: option => option.subjectName,
|
|
159
|
+
value: selectedSubject,
|
|
160
|
+
onChange: handleSubjectChange,
|
|
161
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
162
|
+
...params,
|
|
163
|
+
label: "Subject"
|
|
164
|
+
})
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
168
|
+
item: true,
|
|
169
|
+
xs: 12,
|
|
170
|
+
sm: 4,
|
|
171
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
172
|
+
fullWidth: true,
|
|
173
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
174
|
+
id: "ddlCourse",
|
|
175
|
+
options: courses,
|
|
176
|
+
getOptionLabel: option => option.courseName,
|
|
177
|
+
value: selectedCourse,
|
|
178
|
+
onChange: handleCourseChange,
|
|
179
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
180
|
+
...params,
|
|
181
|
+
label: "Course"
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
186
|
+
item: true,
|
|
187
|
+
xs: 12,
|
|
188
|
+
sm: 4,
|
|
189
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
190
|
+
fullWidth: true,
|
|
191
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
192
|
+
id: "ddlReportType",
|
|
193
|
+
options: reportTypes,
|
|
194
|
+
getOptionLabel: option => option,
|
|
195
|
+
value: selectedReportType,
|
|
196
|
+
onChange: handleReportTypeChange,
|
|
197
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
198
|
+
...params,
|
|
199
|
+
label: "Report Type"
|
|
200
|
+
})
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
})]
|
|
204
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
205
|
+
sx: {
|
|
206
|
+
mt: 3,
|
|
207
|
+
position: 'relative'
|
|
208
|
+
},
|
|
209
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
210
|
+
variant: "contained",
|
|
211
|
+
color: "primary",
|
|
212
|
+
onClick: handleDownload,
|
|
213
|
+
disabled: !selectedSubject || !selectedCourse || !selectedReportType || loading,
|
|
214
|
+
sx: {
|
|
215
|
+
width: 'auto',
|
|
216
|
+
backgroundColor: '#3f51b5',
|
|
217
|
+
'&:hover': {
|
|
218
|
+
backgroundColor: '#303f9f'
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
children: loading ? 'Downloading...' : 'Download Report'
|
|
222
|
+
}), loading && /*#__PURE__*/_jsx(CircularProgress, {
|
|
223
|
+
size: 24,
|
|
224
|
+
sx: {
|
|
225
|
+
position: 'absolute',
|
|
226
|
+
top: '50%',
|
|
227
|
+
left: '50%',
|
|
228
|
+
marginTop: '-12px',
|
|
229
|
+
marginLeft: '-12px'
|
|
230
|
+
}
|
|
231
|
+
})]
|
|
232
|
+
})]
|
|
233
|
+
})
|
|
234
|
+
}), /*#__PURE__*/_jsx(Snackbar, {
|
|
235
|
+
open: alertOpen,
|
|
236
|
+
autoHideDuration: 6000,
|
|
237
|
+
onClose: () => setAlertOpen(false),
|
|
238
|
+
anchorOrigin: {
|
|
239
|
+
vertical: 'top',
|
|
240
|
+
horizontal: 'center'
|
|
241
|
+
},
|
|
242
|
+
children: /*#__PURE__*/_jsx(Alert, {
|
|
243
|
+
onClose: () => setAlertOpen(false),
|
|
244
|
+
severity: "info",
|
|
245
|
+
sx: {
|
|
246
|
+
width: '100%'
|
|
247
|
+
},
|
|
248
|
+
children: alertMessage
|
|
249
|
+
})
|
|
250
|
+
})]
|
|
251
|
+
})]
|
|
252
|
+
});
|
|
242
253
|
}
|
|
243
|
-
|
|
254
|
+
export default CourseReport;
|