From 2c1f7bec7be9f73dac7b4c785d99ff9f621d554b Mon Sep 17 00:00:00 2001 From: Harshitha Shetty <141444342+HarshithaShetty27@users.noreply.github.com> Date: Wed, 29 Jan 2025 02:52:43 +0530 Subject: [PATCH] Email css, faculty consolidated-table --- client/src/Pages/ConsolidatedTable.jsx | 7 +++++-- client/src/api.js | 8 +++++++- server/routes/consolidatedRoutes.js | 10 +++++++--- server/routes/emailRoutes.js | 26 ++++++++++++++++++-------- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/client/src/Pages/ConsolidatedTable.jsx b/client/src/Pages/ConsolidatedTable.jsx index 9d16c00..cd64742 100644 --- a/client/src/Pages/ConsolidatedTable.jsx +++ b/client/src/Pages/ConsolidatedTable.jsx @@ -242,6 +242,7 @@ const ConsolidatedTable = () => {
{currentTeachers.map((teacher, index) => { const teacherData = data.filter((row) => row.Name === teacher); + console.log(teacherData); return (
{ Semester + Program Course Code Course Name Exam Type - Year + Exam Period Marks Name Affiliation/College @@ -309,10 +311,11 @@ const ConsolidatedTable = () => { {teacherData.map((row, idx) => ( {row.semester} + {row.program} {row.courseCode} {row.courseName} {row.examType} - {row.year} + {row.examPeriod +" "+ row.academicYear} {row.marks} {row.Name} {row.affiliation} diff --git a/client/src/api.js b/client/src/api.js index 16cf96c..fae21de 100644 --- a/client/src/api.js +++ b/client/src/api.js @@ -183,10 +183,14 @@ export const sendEmail = async (formData) => { export const createExcelBook = (teacherData, teacher) => { const workbook = XLSX.utils.book_new(); + // Extract academicYear and examPeriod from the first entry in the teacherData array + const { academicYear, examPeriod } = teacherData[0] || {}; + // Define header information const headerInfo = [ ["Somaiya Vidyavihar University"], ["K. J. SOMAIYA COLLEGE OF ENGINEERING"], + [`Examination: ${examPeriod} ${academicYear}`], [ "Appointment of Internal Examiners for Paper Setting / OR/PR/Assessment/Reassessment", ], @@ -199,6 +203,7 @@ export const createExcelBook = (teacherData, teacher) => { [ "Sr No", "Semester", + "Program", "Course Code", "Course Name", "Exam Type", @@ -220,10 +225,11 @@ export const createExcelBook = (teacherData, teacher) => { const dataRows = teacherData.map((row, index) => [ index + 1, row.semester, + row.program, row.courseCode, row.courseName, row.examType, - row.year, + Math.ceil(row.semester/2), row.marks, row.Name, row.affiliation, diff --git a/server/routes/consolidatedRoutes.js b/server/routes/consolidatedRoutes.js index c27d42a..894fa58 100644 --- a/server/routes/consolidatedRoutes.js +++ b/server/routes/consolidatedRoutes.js @@ -23,7 +23,9 @@ router.get("/consolidated-table", async (req, res) => { courseName: appointment.courseName, semester: "", examType: "", - year: "", + academicYear: appointment.academicYear, // Added from appointment + examPeriod: appointment.examPeriod, // Added from appointment + program: "", marks: "100+25", // Dummy value, replace with actual logic affiliation: "KJSCE", // Replace with actual value qualification: "M.E.", // Replace with actual value @@ -40,7 +42,7 @@ router.get("/consolidated-table", async (req, res) => { if (course) { data.semester = course.semester; data.examType = course.scheme; - data.year = course.program; + data.program = course.program; } }); @@ -51,7 +53,9 @@ router.get("/consolidated-table", async (req, res) => { courseCode: data.courseId, courseName: data.courseName, examType: data.examType, - year: data.year, + academicYear: data.academicYear, + examPeriod : data.examPeriod, + program : data.program, marks: data.marks, Name: data.facultyName, affiliation: data.affiliation, diff --git a/server/routes/emailRoutes.js b/server/routes/emailRoutes.js index fae8e7c..e6eabc1 100644 --- a/server/routes/emailRoutes.js +++ b/server/routes/emailRoutes.js @@ -38,17 +38,27 @@ router.post("/", upload.single("file"), async (req, res) => { // Email options const mailOptions = { - from: "swdc.ate@gmail.com", // Replace with your email + from: "SWDC Admin ", // Replace with your email to: recipientEmail, - subject: `Excel File for ${teacher}`, - text: `Attached is the Excel file for ${teacher}.`, + subject: `Examination Appointments for ${teacher}`, + text: `Dear Sir/Madam, + +Please find attached the Excel sheet regarding various appointments for the May-June 2024 Examination. Kindly find the tick mark (√) for the respective appointments. + +Note: Kindly download the Excel sheet to view the hidden columns referring to the Scheme and other information. + + +If you have any queries, please contact the H.O.D or the Examination In-charge. + +Your cooperation regarding the upcoming examination duties is highly solicited.`, attachments: [ - { - filename: fileName, - path: req.file.path, // Use the uploaded file's path - }, + { + filename: fileName, + path: req.file.path, // Use the uploaded file's path + }, ], - }; +}; + try { // Send email