-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added job applications page and connected to db
- Loading branch information
1 parent
7067c71
commit d5954f7
Showing
5 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="icon" href="../../../assets/favicon.png"> | ||
<title>Job Applications</title> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet"> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<div class="container mt-5"> | ||
<div class="card friend-request-card mx-auto p-3 shadow-sm"> | ||
<div class="d-flex justify-content-between"> | ||
<h5>Applicants</h5> | ||
</div> | ||
<div class="friend-request-list mt-3" id="applicantsList"> | ||
|
||
<!-- Applicants will be added here--> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
const BASE_URL = "http://localhost:5000"; | ||
const userdetails = JSON.parse(sessionStorage.getItem("userdetails")); | ||
|
||
// Handle Confirm button clicks | ||
document.querySelectorAll(".confirm-btn").forEach((button) => { | ||
button.addEventListener("click", () => { | ||
// Remove the parent element of the clicked button (the request item) | ||
const requestItem = button.closest(".d-flex"); | ||
requestItem.remove(); | ||
}); | ||
}); | ||
|
||
// Handle Cancel button clicks | ||
document.querySelectorAll(".cancel-btn").forEach((button) => { | ||
button.addEventListener("click", () => { | ||
// Remove the parent element of the clicked button (the request item) | ||
const requestItem = button.closest(".d-flex"); | ||
requestItem.remove(); | ||
}); | ||
}); | ||
|
||
//get the details of the applicants | ||
const getLabourInfo = async (username) => { | ||
const response = await fetch(`${BASE_URL}/labour-info/${username}`); | ||
const data = await response.json(); | ||
// console.log(data); | ||
return await data; | ||
}; | ||
|
||
//get all the applications sent to this recruiter | ||
const getApplications = async (username) => { | ||
const response = await fetch( | ||
`${BASE_URL}/job-application-recruiter/${username}` | ||
); | ||
const data = await response.json(); | ||
// console.log(data); | ||
return await data; | ||
}; | ||
|
||
addEventListener("load", async () => { | ||
const applications = await getApplications(userdetails.userdetails); | ||
displayApplicants(applications); | ||
}); | ||
|
||
function getStars(rating) { | ||
return '★'.repeat(rating) + '☆'.repeat(5 - rating); | ||
} | ||
|
||
const displayApplicants = async(applications) => { | ||
applications.forEach(async(item) => { | ||
console.log(item); | ||
const applicantDetails = await getLabourInfo(item.applicant); | ||
console.log(applicantDetails); | ||
document.getElementById( | ||
"applicantsList" | ||
).innerHTML += `<div class="d-flex justify-content-between align-items-center mb-3"> | ||
<div class="d-flex align-items-center"> | ||
<div> | ||
<strong>${item.applicant} <span class="rating" style="color: gold;">${getStars(2)}</span> </strong><br> | ||
<small>${applicantDetails.completions} Jobs Completed</small> | ||
</div> | ||
</div> | ||
<div> | ||
<button class="btn btn-outline-success me-2 confirm-btn">Hire</button> | ||
<button class="btn btn-outline-danger cancel-btn">Reject</button> | ||
</div> | ||
</div>`; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.friend-request-card { | ||
max-width: 80rem; | ||
border-radius: 10px; | ||
} | ||
|
||
.view-all-link { | ||
font-size: 0.9rem; | ||
color: #007bff; | ||
} | ||
|
||
.friend-request-list .d-flex { | ||
transition: all 0.2s ease; | ||
} | ||
|
||
.friend-request-list .d-flex:hover { | ||
background-color: #f9f9f9; | ||
border-radius: 10px; | ||
padding: 10px; | ||
cursor: pointer; | ||
} | ||
|
||
@media (max-width: 576px) { | ||
.friend-request-card { | ||
max-width: 100%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters