icleafreportui 0.2.5 → 0.2.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 +1 -1
- package/dist/Reports/CourseReport.js +73 -30
- package/dist/Reports/ImportContent/CourseReportContent.js +213 -0
- package/dist/Reports/ImportContent/ExamPackReportContent.js +522 -0
- package/dist/Reports/ImportContent/ExamReportContent.js +206 -0
- package/dist/Reports/ImportContent/ReportContent.js +275 -0
- package/dist/Reports/ImportContent/ReportViewer.js +42 -0
- package/dist/Reports/Report.js +1 -1
- package/dist/package.js +4 -1
- package/package.json +16 -14
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Autocomplete, FormControl, Button, Grid, Box, Typography, Paper, Snackbar, Alert, CircularProgress, TextField } from '@mui/material';
|
|
3
|
+
import { useTenant } from '../context/TenantProvider';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
function ExamReportContent() {
|
|
6
|
+
const {
|
|
7
|
+
apiClient
|
|
8
|
+
} = useTenant();
|
|
9
|
+
const [subjects, setSubjects] = useState([]);
|
|
10
|
+
const [examPacks, setExamPacks] = useState([]);
|
|
11
|
+
const [exams, setExams] = useState([]);
|
|
12
|
+
const [selectedSubject, setSelectedSubject] = useState(null);
|
|
13
|
+
const [selectedExamPack, setSelectedExamPack] = useState(null);
|
|
14
|
+
const [selectedExam, setSelectedExam] = useState(null);
|
|
15
|
+
const [alertMessage, setAlertMessage] = useState('');
|
|
16
|
+
const [openAlert, setOpenAlert] = useState(false);
|
|
17
|
+
const [loading, setLoading] = useState(false);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
fetchAllSubjects();
|
|
20
|
+
}, []);
|
|
21
|
+
const fetchAllSubjects = async () => {
|
|
22
|
+
try {
|
|
23
|
+
const data = await apiClient.get('/api/showAllSubjects');
|
|
24
|
+
setSubjects(data);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('Error fetching subjects:', error);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const fetchExamPacks = async subjectId => {
|
|
30
|
+
try {
|
|
31
|
+
const data = await apiClient.get(`/api/getAllExamPacks?subjectId=${subjectId}`);
|
|
32
|
+
setExamPacks(data);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('Error fetching exam packs:', error);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const fetchExams = async examPackId => {
|
|
38
|
+
try {
|
|
39
|
+
const data = await apiClient.get(`/api/getAllExams?examPackId=${examPackId}`);
|
|
40
|
+
setExams(data);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error('Error fetching exams:', error);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const handleSubjectChange = (event, newValue) => {
|
|
46
|
+
setSelectedSubject(newValue);
|
|
47
|
+
setSelectedExamPack(null);
|
|
48
|
+
setSelectedExam(null);
|
|
49
|
+
setExamPacks([]);
|
|
50
|
+
setExams([]);
|
|
51
|
+
if (newValue) {
|
|
52
|
+
fetchExamPacks(newValue.subjectId);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const handleExamPackChange = (event, newValue) => {
|
|
56
|
+
setSelectedExamPack(newValue);
|
|
57
|
+
setSelectedExam(null);
|
|
58
|
+
setExams([]);
|
|
59
|
+
if (newValue) {
|
|
60
|
+
fetchExams(newValue.id);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const handleExamChange = (event, newValue) => {
|
|
64
|
+
setSelectedExam(newValue);
|
|
65
|
+
};
|
|
66
|
+
const handleDownload = async () => {
|
|
67
|
+
setLoading(true);
|
|
68
|
+
try {
|
|
69
|
+
const response = await fetch(`${apiClient.baseURL}/api/generateReportForExam?subjectId=${selectedSubject.subjectId}&examPackId=${selectedExamPack.id}&examId=${selectedExam.id}`, {
|
|
70
|
+
headers: {
|
|
71
|
+
'X-Tenant-Token': apiClient.tenantToken
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const blob = await response.blob();
|
|
75
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
76
|
+
const link = document.createElement('a');
|
|
77
|
+
link.href = blobUrl;
|
|
78
|
+
link.setAttribute('download', 'QuestionewiseExamReport.xlsx');
|
|
79
|
+
document.body.appendChild(link);
|
|
80
|
+
link.click();
|
|
81
|
+
link.parentNode.removeChild(link);
|
|
82
|
+
URL.revokeObjectURL(blobUrl);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.error('Error downloading report:', error);
|
|
85
|
+
} finally {
|
|
86
|
+
setLoading(false);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
90
|
+
sx: {
|
|
91
|
+
maxWidth: 800,
|
|
92
|
+
mx: 'auto',
|
|
93
|
+
my: 4,
|
|
94
|
+
p: 3,
|
|
95
|
+
backgroundColor: '#f5f5f5',
|
|
96
|
+
borderRadius: 2
|
|
97
|
+
},
|
|
98
|
+
children: [/*#__PURE__*/_jsxs(Paper, {
|
|
99
|
+
elevation: 6,
|
|
100
|
+
sx: {
|
|
101
|
+
p: 5,
|
|
102
|
+
textAlign: 'center',
|
|
103
|
+
backgroundColor: '#fff'
|
|
104
|
+
},
|
|
105
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
106
|
+
variant: "h4",
|
|
107
|
+
component: "h1",
|
|
108
|
+
gutterBottom: true,
|
|
109
|
+
sx: {
|
|
110
|
+
color: '#3f51b5',
|
|
111
|
+
marginBottom: "20px"
|
|
112
|
+
},
|
|
113
|
+
children: "Exam Questions Report"
|
|
114
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
|
115
|
+
container: true,
|
|
116
|
+
spacing: 2,
|
|
117
|
+
justifyContent: "center",
|
|
118
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
119
|
+
item: true,
|
|
120
|
+
xs: 12,
|
|
121
|
+
sm: 6,
|
|
122
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
123
|
+
fullWidth: true,
|
|
124
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
125
|
+
options: subjects,
|
|
126
|
+
getOptionLabel: option => option.subjectName,
|
|
127
|
+
value: selectedSubject,
|
|
128
|
+
onChange: handleSubjectChange,
|
|
129
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
130
|
+
...params,
|
|
131
|
+
label: "Subject"
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
136
|
+
item: true,
|
|
137
|
+
xs: 12,
|
|
138
|
+
sm: 6,
|
|
139
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
140
|
+
fullWidth: true,
|
|
141
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
142
|
+
options: examPacks,
|
|
143
|
+
getOptionLabel: option => option.name,
|
|
144
|
+
value: selectedExamPack,
|
|
145
|
+
onChange: handleExamPackChange,
|
|
146
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
147
|
+
...params,
|
|
148
|
+
label: "Exam Pack"
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
})
|
|
152
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
153
|
+
item: true,
|
|
154
|
+
xs: 12,
|
|
155
|
+
sm: 6,
|
|
156
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
157
|
+
fullWidth: true,
|
|
158
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
159
|
+
options: exams,
|
|
160
|
+
getOptionLabel: option => option.examName,
|
|
161
|
+
value: selectedExam,
|
|
162
|
+
onChange: handleExamChange,
|
|
163
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
164
|
+
...params,
|
|
165
|
+
label: "Exam"
|
|
166
|
+
})
|
|
167
|
+
})
|
|
168
|
+
})
|
|
169
|
+
})]
|
|
170
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
171
|
+
sx: {
|
|
172
|
+
mt: 3,
|
|
173
|
+
position: 'relative'
|
|
174
|
+
},
|
|
175
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
176
|
+
variant: "contained",
|
|
177
|
+
color: "primary",
|
|
178
|
+
onClick: handleDownload,
|
|
179
|
+
disabled: !selectedSubject || !selectedExamPack || !selectedExam || loading,
|
|
180
|
+
sx: {
|
|
181
|
+
width: 'auto',
|
|
182
|
+
backgroundColor: '#3f51b5'
|
|
183
|
+
},
|
|
184
|
+
children: loading ? 'Downloading...' : 'Download Report'
|
|
185
|
+
}), loading && /*#__PURE__*/_jsx(CircularProgress, {
|
|
186
|
+
size: 24,
|
|
187
|
+
sx: {
|
|
188
|
+
position: 'absolute',
|
|
189
|
+
top: '50%',
|
|
190
|
+
left: '50%'
|
|
191
|
+
}
|
|
192
|
+
})]
|
|
193
|
+
})]
|
|
194
|
+
}), /*#__PURE__*/_jsx(Snackbar, {
|
|
195
|
+
open: openAlert,
|
|
196
|
+
autoHideDuration: 6000,
|
|
197
|
+
onClose: () => setOpenAlert(false),
|
|
198
|
+
children: /*#__PURE__*/_jsx(Alert, {
|
|
199
|
+
onClose: () => setOpenAlert(false),
|
|
200
|
+
severity: "info",
|
|
201
|
+
children: alertMessage
|
|
202
|
+
})
|
|
203
|
+
})]
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
export default ExamReportContent;
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Autocomplete, FormControl, Button, Grid, Box, Typography, Paper, Snackbar, Alert, CircularProgress, TextField, Checkbox, FormControlLabel } from '@mui/material';
|
|
3
|
+
import { useTenant } from '../../context/TenantProvider';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
function ReportContent() {
|
|
6
|
+
const {
|
|
7
|
+
apiClient
|
|
8
|
+
} = useTenant();
|
|
9
|
+
const [subjects, setSubjects] = useState([]);
|
|
10
|
+
const [examPacks, setExamPacks] = useState([]);
|
|
11
|
+
const [exams, setExams] = useState([]);
|
|
12
|
+
const [users, setUsers] = useState([]);
|
|
13
|
+
const [selectedSubject, setSelectedSubject] = useState(null);
|
|
14
|
+
const [selectedExamPack, setSelectedExamPack] = useState(null);
|
|
15
|
+
const [selectedExam, setSelectedExam] = useState(null);
|
|
16
|
+
const [selectedUser, setSelectedUser] = useState(null);
|
|
17
|
+
const [alertMessage, setAlertMessage] = useState('');
|
|
18
|
+
const [openAlert, setOpenAlert] = useState(false);
|
|
19
|
+
const [loading, setLoading] = useState(false);
|
|
20
|
+
const [onlyWrongAnswers, setOnlyWrongAnswers] = useState(false);
|
|
21
|
+
const baseURL = process.env.REACT_APP_BASE_URL;
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
fetchAllSubjects();
|
|
24
|
+
}, []);
|
|
25
|
+
const fetchAllSubjects = async () => {
|
|
26
|
+
try {
|
|
27
|
+
const data = await apiClient.get('/api/showAllSubjects');
|
|
28
|
+
setSubjects(data);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.error('Error fetching subjects:', error);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const fetchExamPacks = async subjectId => {
|
|
34
|
+
try {
|
|
35
|
+
const data = await apiClient.get(`/api/getAllExamPacks?subjectId=${subjectId}`);
|
|
36
|
+
setExamPacks(data);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('Error fetching exam packs:', error);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const fetchExams = async examPackId => {
|
|
42
|
+
try {
|
|
43
|
+
const data = await apiClient.get(`/api/getAllExams?examPackId=${examPackId}`);
|
|
44
|
+
setExams(data);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error('Error fetching exams:', error);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const fetchUsers = async examId => {
|
|
50
|
+
try {
|
|
51
|
+
const data = await apiClient.get(`/api/getAllUsers?examId=${examId}`);
|
|
52
|
+
setUsers(data);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.error('Error fetching users:', error);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const handleSubjectChange = (event, newValue) => {
|
|
58
|
+
setSelectedSubject(newValue);
|
|
59
|
+
setSelectedExamPack(null);
|
|
60
|
+
setSelectedExam(null);
|
|
61
|
+
setSelectedUser(null);
|
|
62
|
+
setExamPacks([]);
|
|
63
|
+
setExams([]);
|
|
64
|
+
setUsers([]);
|
|
65
|
+
if (newValue) {
|
|
66
|
+
fetchExamPacks(newValue.subjectId);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const handleExamPackChange = (event, newValue) => {
|
|
70
|
+
setSelectedExamPack(newValue);
|
|
71
|
+
setSelectedExam(null);
|
|
72
|
+
setSelectedUser(null);
|
|
73
|
+
setExams([]);
|
|
74
|
+
setUsers([]);
|
|
75
|
+
if (newValue) {
|
|
76
|
+
fetchExams(newValue.id);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const handleExamChange = (event, newValue) => {
|
|
80
|
+
setSelectedExam(newValue);
|
|
81
|
+
setSelectedUser(null);
|
|
82
|
+
setUsers([]);
|
|
83
|
+
if (newValue) {
|
|
84
|
+
fetchUsers(newValue.id);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const handleUserChange = (event, newValue) => {
|
|
88
|
+
setSelectedUser(newValue);
|
|
89
|
+
};
|
|
90
|
+
const handleDownload = async () => {
|
|
91
|
+
setLoading(true);
|
|
92
|
+
try {
|
|
93
|
+
const response = await fetch(`${baseURL}api/generateReportForSingleUser?subjectId=${selectedSubject.subjectId}&examPackId=${selectedExamPack.id}&examId=${selectedExam.id}&userId=${selectedUser.id}&wrongAnswerFlag=${onlyWrongAnswers}`, {
|
|
94
|
+
headers: {
|
|
95
|
+
'X-Tenant-Token': apiClient.tenantToken
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
const blob = await response.blob();
|
|
99
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
100
|
+
const link = document.createElement('a');
|
|
101
|
+
link.href = blobUrl;
|
|
102
|
+
link.setAttribute('download', 'Report.xlsx');
|
|
103
|
+
document.body.appendChild(link);
|
|
104
|
+
link.click();
|
|
105
|
+
link.parentNode.removeChild(link);
|
|
106
|
+
URL.revokeObjectURL(blobUrl);
|
|
107
|
+
} catch (error) {
|
|
108
|
+
console.error('Error downloading report:', error);
|
|
109
|
+
} finally {
|
|
110
|
+
setLoading(false);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
114
|
+
sx: {
|
|
115
|
+
maxWidth: 800,
|
|
116
|
+
mx: 'auto',
|
|
117
|
+
my: 4,
|
|
118
|
+
p: 3,
|
|
119
|
+
backgroundColor: '#f5f5f5',
|
|
120
|
+
borderRadius: 2
|
|
121
|
+
},
|
|
122
|
+
children: [/*#__PURE__*/_jsxs(Paper, {
|
|
123
|
+
elevation: 6,
|
|
124
|
+
sx: {
|
|
125
|
+
p: 5,
|
|
126
|
+
textAlign: 'center',
|
|
127
|
+
backgroundColor: '#fff'
|
|
128
|
+
},
|
|
129
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
130
|
+
variant: "h4",
|
|
131
|
+
component: "h1",
|
|
132
|
+
gutterBottom: true,
|
|
133
|
+
sx: {
|
|
134
|
+
color: '#3f51b5',
|
|
135
|
+
marginBottom: "20px"
|
|
136
|
+
},
|
|
137
|
+
children: "Exam Report"
|
|
138
|
+
}), /*#__PURE__*/_jsxs(Grid, {
|
|
139
|
+
container: true,
|
|
140
|
+
spacing: 2,
|
|
141
|
+
justifyContent: "center",
|
|
142
|
+
children: [/*#__PURE__*/_jsx(Grid, {
|
|
143
|
+
item: true,
|
|
144
|
+
xs: 12,
|
|
145
|
+
sm: 6,
|
|
146
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
147
|
+
fullWidth: true,
|
|
148
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
149
|
+
id: "ddlSubject",
|
|
150
|
+
options: subjects,
|
|
151
|
+
getOptionLabel: option => option.subjectName,
|
|
152
|
+
value: selectedSubject,
|
|
153
|
+
onChange: handleSubjectChange,
|
|
154
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
155
|
+
...params,
|
|
156
|
+
label: "Subject"
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
161
|
+
item: true,
|
|
162
|
+
xs: 12,
|
|
163
|
+
sm: 6,
|
|
164
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
165
|
+
fullWidth: true,
|
|
166
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
167
|
+
id: "ddlExamPack",
|
|
168
|
+
options: examPacks,
|
|
169
|
+
getOptionLabel: option => option.name,
|
|
170
|
+
value: selectedExamPack,
|
|
171
|
+
onChange: handleExamPackChange,
|
|
172
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
173
|
+
...params,
|
|
174
|
+
label: "Exam Pack"
|
|
175
|
+
})
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
179
|
+
item: true,
|
|
180
|
+
xs: 12,
|
|
181
|
+
sm: 6,
|
|
182
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
183
|
+
fullWidth: true,
|
|
184
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
185
|
+
id: "ddlExam",
|
|
186
|
+
options: exams,
|
|
187
|
+
getOptionLabel: option => option.examName,
|
|
188
|
+
value: selectedExam,
|
|
189
|
+
onChange: handleExamChange,
|
|
190
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
191
|
+
...params,
|
|
192
|
+
label: "Exam"
|
|
193
|
+
})
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
}), /*#__PURE__*/_jsx(Grid, {
|
|
197
|
+
item: true,
|
|
198
|
+
xs: 12,
|
|
199
|
+
sm: 6,
|
|
200
|
+
children: /*#__PURE__*/_jsx(FormControl, {
|
|
201
|
+
fullWidth: true,
|
|
202
|
+
children: /*#__PURE__*/_jsx(Autocomplete, {
|
|
203
|
+
id: "ddlUser",
|
|
204
|
+
options: users,
|
|
205
|
+
getOptionLabel: option => option.userName,
|
|
206
|
+
value: selectedUser,
|
|
207
|
+
onChange: handleUserChange,
|
|
208
|
+
renderInput: params => /*#__PURE__*/_jsx(TextField, {
|
|
209
|
+
...params,
|
|
210
|
+
label: "User"
|
|
211
|
+
})
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
})]
|
|
215
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
216
|
+
sx: {
|
|
217
|
+
mt: 3,
|
|
218
|
+
position: 'relative'
|
|
219
|
+
},
|
|
220
|
+
children: [/*#__PURE__*/_jsx(FormControlLabel, {
|
|
221
|
+
control: /*#__PURE__*/_jsx(Checkbox, {
|
|
222
|
+
checked: onlyWrongAnswers,
|
|
223
|
+
onChange: e => setOnlyWrongAnswers(e.target.checked)
|
|
224
|
+
}),
|
|
225
|
+
label: "Only Wrong Answers"
|
|
226
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
227
|
+
sx: {
|
|
228
|
+
mt: 2,
|
|
229
|
+
position: 'relative'
|
|
230
|
+
},
|
|
231
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
232
|
+
variant: "contained",
|
|
233
|
+
color: "primary",
|
|
234
|
+
onClick: handleDownload,
|
|
235
|
+
disabled: !selectedSubject || !selectedExamPack || !selectedExam || !selectedUser || loading,
|
|
236
|
+
sx: {
|
|
237
|
+
width: 'auto',
|
|
238
|
+
backgroundColor: '#3f51b5',
|
|
239
|
+
'&:hover': {
|
|
240
|
+
backgroundColor: '#303f9f'
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
children: loading ? 'Downloading...' : 'Download Report'
|
|
244
|
+
}), loading && /*#__PURE__*/_jsx(CircularProgress, {
|
|
245
|
+
size: 24,
|
|
246
|
+
sx: {
|
|
247
|
+
position: 'absolute',
|
|
248
|
+
top: '50%',
|
|
249
|
+
left: '50%',
|
|
250
|
+
marginTop: '-12px',
|
|
251
|
+
marginLeft: '-12px'
|
|
252
|
+
}
|
|
253
|
+
})]
|
|
254
|
+
})]
|
|
255
|
+
})]
|
|
256
|
+
}), /*#__PURE__*/_jsx(Snackbar, {
|
|
257
|
+
open: openAlert,
|
|
258
|
+
autoHideDuration: 6000,
|
|
259
|
+
onClose: () => setOpenAlert(false),
|
|
260
|
+
anchorOrigin: {
|
|
261
|
+
vertical: 'top',
|
|
262
|
+
horizontal: 'center'
|
|
263
|
+
},
|
|
264
|
+
children: /*#__PURE__*/_jsx(Alert, {
|
|
265
|
+
onClose: () => setOpenAlert(false),
|
|
266
|
+
severity: "info",
|
|
267
|
+
sx: {
|
|
268
|
+
width: '100%'
|
|
269
|
+
},
|
|
270
|
+
children: alertMessage
|
|
271
|
+
})
|
|
272
|
+
})]
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
export default ReportContent;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Header from '../components/Header';
|
|
3
|
+
import Sidebar from '../components/sidebar';
|
|
4
|
+
import ExamReportContent from './ExamReportContent';
|
|
5
|
+
import CourseReportContent from './CourseReportContent';
|
|
6
|
+
import ExamPackReportContent from './ExamPackReportContent';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
function ReportViewer(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
type = 'exam',
|
|
11
|
+
embedded = false
|
|
12
|
+
} = _ref;
|
|
13
|
+
const renderContent = () => {
|
|
14
|
+
switch (type) {
|
|
15
|
+
case 'exam':
|
|
16
|
+
return /*#__PURE__*/_jsx(ExamReportContent, {});
|
|
17
|
+
case 'course':
|
|
18
|
+
return /*#__PURE__*/_jsx(CourseReportContent, {});
|
|
19
|
+
case 'exampack':
|
|
20
|
+
return /*#__PURE__*/_jsx(ExamPackReportContent, {});
|
|
21
|
+
default:
|
|
22
|
+
return /*#__PURE__*/_jsx(ExamReportContent, {});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// If embedded mode, just return the content (no Header/Sidebar)
|
|
27
|
+
if (embedded) {
|
|
28
|
+
return renderContent();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Full layout with Header and Sidebar
|
|
32
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
33
|
+
children: [/*#__PURE__*/_jsx(Header, {}), /*#__PURE__*/_jsx(Sidebar, {}), /*#__PURE__*/_jsx("div", {
|
|
34
|
+
style: {
|
|
35
|
+
padding: "100px 0px 0px 100px",
|
|
36
|
+
marginLeft: "140px"
|
|
37
|
+
},
|
|
38
|
+
children: renderContent()
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export default ReportViewer;
|
package/dist/Reports/Report.js
CHANGED
|
@@ -374,7 +374,7 @@ function Report(_ref) {
|
|
|
374
374
|
const handleDownload = async () => {
|
|
375
375
|
setLoading(true);
|
|
376
376
|
try {
|
|
377
|
-
const response = await fetch(`${baseURL}api/generateReportForSingleUser?subjectId=${selectedSubject.subjectId}&examPackId=${selectedExamPack.id}&examId=${selectedExam.id}&userId=${selectedUser.id}&wrongAnswerFlag=${onlyWrongAnswers}`, {
|
|
377
|
+
const response = await fetch(`${baseURL}/api/generateReportForSingleUser?subjectId=${selectedSubject.subjectId}&examPackId=${selectedExamPack.id}&examId=${selectedExam.id}&userId=${selectedUser.id}&wrongAnswerFlag=${onlyWrongAnswers}`, {
|
|
378
378
|
headers: {
|
|
379
379
|
'X-Tenant-Token': apiClient.tenantToken
|
|
380
380
|
}
|
package/dist/package.js
CHANGED
|
@@ -13,7 +13,10 @@ export { default as ExamReport } from './Reports/ExamReport';
|
|
|
13
13
|
export { default as ExamPackReport } from './Reports/ExamPackReport';
|
|
14
14
|
|
|
15
15
|
//no header and sidebar
|
|
16
|
-
export { default as ReportContent } from './Reports/ReportContent';
|
|
16
|
+
export { default as ReportContent } from './Reports/ImportContent/ReportContent';
|
|
17
|
+
|
|
18
|
+
// src/package.js
|
|
19
|
+
export { default as ReportViewer } from './Reports/ImportContent/ReportViewer';
|
|
17
20
|
|
|
18
21
|
// Context
|
|
19
22
|
export { TenantProvider, useTenant } from './context/TenantProvider';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "icleafreportui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/package.js",
|
|
6
6
|
"files": [
|
|
@@ -8,25 +8,27 @@
|
|
|
8
8
|
],
|
|
9
9
|
"homepage": "/reports",
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"react": "^
|
|
12
|
-
"
|
|
13
|
-
"@mui/material": "^5.15.20",
|
|
11
|
+
"@emotion/react": "^11.11.4",
|
|
12
|
+
"@emotion/styled": "^11.11.5",
|
|
14
13
|
"@mui/icons-material": "^5.15.20",
|
|
14
|
+
"@mui/material": "^5.15.20",
|
|
15
15
|
"@mui/x-data-grid": "^7.27.1",
|
|
16
16
|
"antd": "^5.18.3",
|
|
17
|
-
"react
|
|
17
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
18
18
|
"react-bootstrap": "^2.10.3",
|
|
19
|
-
"
|
|
20
|
-
"
|
|
19
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
20
|
+
"react-router-dom": "^6.24.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@csstools/normalize.css": "^12.1.1",
|
|
24
24
|
"axios": "^1.7.2",
|
|
25
|
+
"bootstrap": "^5.3.8",
|
|
25
26
|
"file-saver": "^2.0.5",
|
|
26
|
-
"react-custom-scrollbars": "^4.2.1",
|
|
27
27
|
"react-icons": "^5.2.1",
|
|
28
28
|
"react-loader-spinner": "^6.1.6",
|
|
29
|
+
"react-scripts": "^5.0.1",
|
|
29
30
|
"sanitize.css": "^13.0.0",
|
|
31
|
+
"web-vitals": "^5.2.0",
|
|
30
32
|
"xlsx": "^0.18.5"
|
|
31
33
|
},
|
|
32
34
|
"scripts": {
|
|
@@ -58,15 +60,15 @@
|
|
|
58
60
|
"@babel/core": "^7.28.6",
|
|
59
61
|
"@babel/preset-env": "^7.29.2",
|
|
60
62
|
"@babel/preset-react": "^7.28.5",
|
|
61
|
-
"react": "^
|
|
62
|
-
"
|
|
63
|
-
"@mui/material": "^5.15.20",
|
|
63
|
+
"@emotion/react": "^11.11.4",
|
|
64
|
+
"@emotion/styled": "^11.11.5",
|
|
64
65
|
"@mui/icons-material": "^5.15.20",
|
|
66
|
+
"@mui/material": "^5.15.20",
|
|
65
67
|
"@mui/x-data-grid": "^7.27.1",
|
|
66
68
|
"antd": "^5.18.3",
|
|
67
|
-
"react
|
|
69
|
+
"react": "^18.3.1",
|
|
68
70
|
"react-bootstrap": "^2.10.3",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
+
"react-dom": "^18.3.1",
|
|
72
|
+
"react-router-dom": "^6.24.0"
|
|
71
73
|
}
|
|
72
74
|
}
|