Skip to content

Commit f454172

Browse files
committed
continuing candidates page
1 parent a6505c4 commit f454172

File tree

3 files changed

+53
-3
lines changed
  • jobsdoor360-website/src/main/ejs/main-files/myaccount/hire/candidates
  • myaccount/hire/candidates
  • staticfiles/mainfiles/myaccount/hire/candidates

3 files changed

+53
-3
lines changed

jobsdoor360-website/src/main/ejs/main-files/myaccount/hire/candidates/index.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@
154154
<th>Degree</th>
155155
<th>Resume</th>
156156
<th>Graduation Date</th>
157-
<th>Skills</th>
158157
<th>Age</th>
158+
<th>Skills</th>
159159
<th>Social Links</th>
160160
<th>Experience</th>
161161
<th>Address</th>

myaccount/hire/candidates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@
328328
<th>Degree</th>
329329
<th>Resume</th>
330330
<th>Graduation Date</th>
331-
<th>Skills</th>
332331
<th>Age</th>
332+
<th>Skills</th>
333333
<th>Social Links</th>
334334
<th>Experience</th>
335335
<th>Address</th>

staticfiles/mainfiles/myaccount/hire/candidates/script.js

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,44 @@ console.log("Filtered Users:", filteredUsers);
586586
}
587587
</td>
588588
<td>${user.education?.[0]?.graduation_date || "N/A"}</td>
589+
<td>${user.about?.dob ? calculateAge(user.about.dob) + " years" : "N/A"}</td>
589590
<td>${user.skills?.join(", ") || "N/A"}</td>
590-
`;
591+
<td>
592+
${user.social?.github ? `<a href="${user.social.github}" target="_blank">GitHub</a><br>` : ""}
593+
${user.social?.instagram ? `<a href="${user.social.instagram}" target="_blank">Instagram</a><br>` : ""}
594+
${user.social?.leetcode ? `<a href="${user.social.leetcode}" target="_blank">LeetCode</a><br>` : ""}
595+
${user.social?.linkedin ? `<a href="${user.social.linkedin}" target="_blank">LinkedIn</a>` : ""}
596+
</td>
597+
<td>
598+
${user.experience?.map(exp => {
599+
const duration = calculateExperience(exp.startDate, exp.endDate);
600+
return `<div><strong>${exp.companyName}</strong>: ${duration}</div>`;
601+
}).join("") || "N/A"}
602+
</td>
603+
<td>
604+
<strong>Present:</strong><br>
605+
${user.address?.present?.address || ""} ${user.address?.present?.city || ""} ${user.address?.present?.state || ""} ${user.address?.present?.zip || ""} <br><br>
606+
<strong>Permanent:</strong><br>
607+
${user.address?.permanent?.address || ""} ${user.address?.permanent?.city || ""} ${user.address?.permanent?.state || ""} ${user.address?.permanent?.zip || ""}
608+
</td>
609+
610+
`;
611+
612+
// calculating experience
613+
function calculateExperience(start, end) {
614+
const startDate = new Date(start);
615+
const endDate = new Date(end);
616+
if (isNaN(startDate) || isNaN(endDate)) return "Invalid dates";
617+
618+
const months =
619+
(endDate.getFullYear() - startDate.getFullYear()) * 12 +
620+
(endDate.getMonth() - startDate.getMonth());
621+
622+
if (months < 12) return `${months} months`;
623+
const years = Math.floor(months / 12);
624+
const remMonths = months % 12;
625+
return `${years} year${years > 1 ? "s" : ""}${remMonths ? ` ${remMonths} months` : ""}`;
626+
}
591627

592628
// Rating Dropdown
593629
const ratingCell = document.createElement("td");
@@ -710,6 +746,20 @@ console.log("Filtered Users:", filteredUsers);
710746
}
711747
}
712748

749+
// calculating age from dob
750+
function calculateAge(dob) {
751+
if (!dob) return "N/A";
752+
const birthDate = new Date(dob);
753+
const today = new Date();
754+
let age = today.getFullYear() - birthDate.getFullYear();
755+
const monthDiff = today.getMonth() - birthDate.getMonth();
756+
757+
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
758+
age--;
759+
}
760+
return age;
761+
}
762+
713763
// Function to update user rating in Firestore
714764
async function updateUserRating(email, rating) {
715765
try {

0 commit comments

Comments
 (0)