forked from CSI-KJSCE/appointment_to_examiner
semester-wise sort
This commit is contained in:
@@ -26,9 +26,15 @@ const PanelConsolidated = () => {
|
|||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const filteredCourses = courses.filter((course) =>
|
const groupedCourses = {};
|
||||||
course.name.toLowerCase().includes(search.toLowerCase())
|
courses.forEach((course) => {
|
||||||
);
|
if (!groupedCourses[course.semester]) {
|
||||||
|
groupedCourses[course.semester] = [];
|
||||||
|
}
|
||||||
|
groupedCourses[course.semester].push(course);
|
||||||
|
});
|
||||||
|
|
||||||
|
const sortedSemesters = Object.keys(groupedCourses).sort((a, b) => a - b);
|
||||||
|
|
||||||
const courseFacultyMap = {};
|
const courseFacultyMap = {};
|
||||||
faculty.forEach((fac) => {
|
faculty.forEach((fac) => {
|
||||||
@@ -64,46 +70,55 @@ const PanelConsolidated = () => {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{filteredCourses.map((course) => (
|
{sortedSemesters.map((semester) => (
|
||||||
<div key={course.courseId}>
|
<div key={semester}>
|
||||||
<div
|
<h3
|
||||||
onClick={() => toggleCourse(course.courseId)}
|
onClick={() => toggleCourse(courses.courseId)}
|
||||||
style={{
|
style={{ marginTop: "20px", fontSize: "20px", color: "#800000" }}
|
||||||
cursor: "pointer",
|
|
||||||
padding: "12px",
|
|
||||||
backgroundColor: "#fff",
|
|
||||||
marginBottom: "8px",
|
|
||||||
border: "1px solid #ccc",
|
|
||||||
borderRadius: "4px",
|
|
||||||
fontWeight: "bold"
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{course.name}
|
Semester {semester}
|
||||||
</div>
|
</h3>
|
||||||
{expandedCourse === course.courseId && (
|
{groupedCourses[semester].filter((course) => course.name.toLowerCase().includes(search.toLowerCase())).map((course) => (
|
||||||
<table style={{ width: "100%", borderCollapse: "collapse", backgroundColor: "#fff", border: "1px solid #ccc", marginBottom: "16px" }}>
|
<div key={course.courseId}>
|
||||||
<thead>
|
<div
|
||||||
<tr style={{ backgroundColor: "#e5e5e5" }}>
|
onClick={() => toggleCourse(course.courseId)}
|
||||||
<th style={{ border: "1px solid #ccc", padding: "8px" }}>Faculty ID</th>
|
style={{
|
||||||
<th style={{ border: "1px solid #ccc", padding: "8px" }}>Name</th>
|
cursor: "pointer",
|
||||||
<th style={{ border: "1px solid #ccc", padding: "8px" }}>Email</th>
|
padding: "12px",
|
||||||
<th style={{ border: "1px solid #ccc", padding: "8px" }}>Department</th>
|
backgroundColor: "#fff",
|
||||||
</tr>
|
marginBottom: "8px",
|
||||||
</thead>
|
border: "1px solid #ccc",
|
||||||
<tbody>
|
borderRadius: "4px",
|
||||||
{courseFacultyMap[course.courseId]?.map((faculty, index) => (
|
fontWeight: "bold"
|
||||||
<tr key={index}>
|
}}
|
||||||
<td style={{ border: "1px solid #ccc", padding: "8px" }}>{faculty.facultyId}</td>
|
>
|
||||||
<td style={{ border: "1px solid #ccc", padding: "8px" }}>{faculty.name}</td>
|
{course.name}
|
||||||
<td style={{ border: "1px solid #ccc", padding: "8px" }}>{faculty.email}</td>
|
</div>
|
||||||
<td style={{ border: "1px solid #ccc", padding: "8px" }}>{faculty.department}</td>
|
{expandedCourse === course.courseId && (
|
||||||
</tr>
|
<table style={{ width: "100%", borderCollapse: "collapse", backgroundColor: "#fff", border: "1px solid #ccc", marginBottom: "16px" }}>
|
||||||
))}
|
<thead>
|
||||||
</tbody>
|
<tr style={{ backgroundColor: "#e5e5e5" }}>
|
||||||
</table>
|
<th style={{ border: "1px solid #ccc", padding: "8px" }}>Faculty ID</th>
|
||||||
)}
|
<th style={{ border: "1px solid #ccc", padding: "8px" }}>Name</th>
|
||||||
|
<th style={{ border: "1px solid #ccc", padding: "8px" }}>Email</th>
|
||||||
|
<th style={{ border: "1px solid #ccc", padding: "8px" }}>Department</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{courseFacultyMap[course.courseId]?.map((faculty, index) => (
|
||||||
|
<tr key={index}>
|
||||||
|
<td style={{ border: "1px solid #ccc", padding: "8px" }}>{faculty.facultyId}</td>
|
||||||
|
<td style={{ border: "1px solid #ccc", padding: "8px" }}>{faculty.name}</td>
|
||||||
|
<td style={{ border: "1px solid #ccc", padding: "8px" }}>{faculty.email}</td>
|
||||||
|
<td style={{ border: "1px solid #ccc", padding: "8px" }}>{faculty.department}</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user