From 585615cdf09bb8a2cb052044a77febe0c81c3e16 Mon Sep 17 00:00:00 2001
From: Harshitha Shetty <141444342+HarshithaShetty27@users.noreply.github.com>
Date: Sun, 26 Jan 2025 01:12:07 +0530
Subject: [PATCH] UI for consolidated
---
client/src/Pages/ConsolidatedTable.jsx | 232 +++++++++++++------------
1 file changed, 125 insertions(+), 107 deletions(-)
diff --git a/client/src/Pages/ConsolidatedTable.jsx b/client/src/Pages/ConsolidatedTable.jsx
index bdea1b0..4d47e6e 100644
--- a/client/src/Pages/ConsolidatedTable.jsx
+++ b/client/src/Pages/ConsolidatedTable.jsx
@@ -9,6 +9,7 @@ const ConsolidatedTable = () => {
const [loading, setLoading] = useState(true);
const [currentPage, setCurrentPage] = useState(1);
const tablesPerPage = 5;
+ const [expandedTeacher, setExpandedTeacher] = useState(null);
useEffect(() => {
const fetchData = async () => {
@@ -34,19 +35,19 @@ const ConsolidatedTable = () => {
// Extract unique faculty names
const uniqueTeachers = [...new Set(data.map((row) => row.Name))];
- //pagination
+ // Pagination
const indexOfLastTable = currentPage * tablesPerPage;
const indexOfFirstTable = indexOfLastTable - tablesPerPage;
- const currentTeachers = uniqueTeachers.slice(indexOfFirstTable,indexOfLastTable);
+ const currentTeachers = uniqueTeachers.slice(indexOfFirstTable, indexOfLastTable);
- const totalPages = Math.ceil(uniqueTeachers.length/tablesPerPage);
+ const totalPages = Math.ceil(uniqueTeachers.length / tablesPerPage);
- const handleNextPage = ()=>{
- if(currentPage < totalPages) setCurrentPage((prevPage)=>prevPage+1);
+ const handleNextPage = () => {
+ if (currentPage < totalPages) setCurrentPage((prevPage) => prevPage + 1);
};
- const handlePrevPage = ()=>{
- if(currentPage > 1) setCurrentPage((prevPage)=>prevPage-1);
+ const handlePrevPage = () => {
+ if (currentPage > 1) setCurrentPage((prevPage) => prevPage - 1);
};
const createExcelFile = (teacherData, teacherName) => {
@@ -82,7 +83,7 @@ const ConsolidatedTable = () => {
const formData = new FormData();
formData.append("teacher", teacher);
- formData.append("fileName", fileName);
+ formData.append("fileName", fileName);
formData.append("recipientEmail", facultyEmail);
formData.append("file", file);
@@ -150,104 +151,122 @@ const ConsolidatedTable = () => {
const teacherData = data.filter((row) => row.Name === teacher);
return (
-
{teacher}'s Table
-
setExpandedTeacher(expandedTeacher === teacher ? null : teacher)}
>
-
-
- | Semester |
- Course Code |
- Course Name |
- Exam Type |
- Year |
- Marks |
- Name |
- Affiliation/College |
- Highest Qualification |
- Career Experience |
- Oral/Practical |
- Assessment |
- Reassessment |
- Paper Setting |
- Moderation |
- PwD Paper Setting |
-
-
-
- {teacherData.map((row, idx) => (
-
- | {row.semester} |
- {row.courseCode} |
- {row.courseName} |
- {row.examType} |
- {row.year} |
- {row.marks} |
- {row.Name} |
- {row.affiliation} |
- {row.qualification} |
- {row.experience} |
- {row.oralPractical} |
- {row.assessment} |
- {row.reassessment} |
- {row.paperSetting} |
- {row.moderation} |
- {row.pwdPaperSetting} |
-
- ))}
-
-
+
{teacher}'s Table
+
+
+
+
+
-
- {/* Send Email Button */}
-
+ {expandedTeacher === teacher && (
+
+
+
+ | Semester |
+ Course Code |
+ Course Name |
+ Exam Type |
+ Year |
+ Marks |
+ Name |
+ Affiliation/College |
+ Highest Qualification |
+ Career Experience |
+ Oral/Practical |
+ Assessment |
+ Reassessment |
+ Paper Setting |
+ Moderation |
+ PwD Paper Setting |
+
+
+
+ {teacherData.map((row, idx) => (
+
+ | {row.semester} |
+ {row.courseCode} |
+ {row.courseName} |
+ {row.examType} |
+ {row.year} |
+ {row.marks} |
+ {row.Name} |
+ {row.affiliation} |
+ {row.qualification} |
+ {row.experience} |
+ {row.oralPractical} |
+ {row.assessment} |
+ {row.reassessment} |
+ {row.paperSetting} |
+ {row.moderation} |
+ {row.pwdPaperSetting} |
+
+ ))}
+
+
+ )}
);
})}
- {/* pagination controls */}
-
+ {/* Pagination controls */}
+
@@ -255,17 +274,16 @@ const ConsolidatedTable = () => {
Page {currentPage} of {totalPages}