forked from CSI-KJSCE/appointment_to_examiner
fixed bulk mail
This commit is contained in:
@@ -333,7 +333,7 @@ const CourseConsolidated = () => {
|
||||
|
||||
// Group appointments by Faculty ID and by role
|
||||
const facultyMap = {};
|
||||
const roleFaculties = {}; // Store faculties by role
|
||||
const roleFaculties = {}; // Store faculty IDs by role
|
||||
|
||||
for (const { key, role } of roles) {
|
||||
if (!courseData[key] || courseData[key].length === 0) continue;
|
||||
@@ -348,9 +348,9 @@ const CourseConsolidated = () => {
|
||||
}
|
||||
facultyMap[teacher.facultyId].appointments.push({ role, teacher });
|
||||
|
||||
// Add faculty to the role-specific list
|
||||
// Add facultyId to the role-specific list
|
||||
if (!roleFaculties[role]) roleFaculties[role] = [];
|
||||
roleFaculties[role].push(teacher.facultyName);
|
||||
roleFaculties[role].push(teacher.facultyId); // Store facultyId instead of facultyName
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,13 +387,20 @@ const CourseConsolidated = () => {
|
||||
doc.text("CONFIDENTIAL", 10, 60);
|
||||
doc.text(`LETTER OF APPOINTMENT AS ${role.toUpperCase()}`, 105, 70, { align: "center" });
|
||||
|
||||
// Include all faculties performing the same role in the same list
|
||||
const allFacultiesInRole = roleFaculties[role].join(", ");
|
||||
doc.text(`Faculties performing the same role: ${allFacultiesInRole}`, 10, 90);
|
||||
// Include all faculties performing the same role inside the table
|
||||
const roleFacultyDetails = roleFaculties[role].map((facultyId) => {
|
||||
const facultyDetail = facultyMap[facultyId]; // Access by facultyId
|
||||
return [
|
||||
facultyDetail.facultyName,
|
||||
"K. J. Somaiya School of Engineering",
|
||||
role,
|
||||
facultyDetail.email,
|
||||
];
|
||||
});
|
||||
|
||||
autoTable(doc, {
|
||||
head: [["Name", "Affiliation", "Appointment Role", "Email"]],
|
||||
body: [[faculty.facultyName, "K. J. Somaiya School of Engineering", role, faculty.email]],
|
||||
body: roleFacultyDetails, // Mapping through all faculties in the role
|
||||
startY: 100,
|
||||
theme: "grid",
|
||||
headStyles: { fillColor: maroon, textColor: [255, 255, 255] },
|
||||
@@ -440,6 +447,7 @@ const CourseConsolidated = () => {
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user