jobs - add check if jobs are available

This commit is contained in:
LinuxSquare 2024-03-09 14:34:31 +01:00
parent e57625adc9
commit f6c545a946
2 changed files with 54 additions and 45 deletions

View file

@ -21,7 +21,7 @@
<label for="experience">Your experience in this is position *</label>
<textarea class="rounded-md" name="experience" id="experience" cols="30" rows="5"></textarea>
<label for="references">Your references *</label>
<textarea class="rounded-md" name="" id="" cols="30" rows="5"></textarea>
<textarea class="rounded-md" name="references" id="" cols="30" rows="5"></textarea>
</div>
</div>
<div class="apply-section -docs">

View file

@ -3,6 +3,14 @@ let jobsContainer = document.getElementById("jobsContainer")
fetch('/json/jobs.json')
.then((response) => response.json())
.then((json) => {
if(json.length <= 0) {
const jobContainer = document.createElement("div");
jobContainer.classList.add("flex-auto");
jobContainer.appendChild(document.createElement("h2")).innerHTML = "There are currently no open jobs to apply for"
jobContainer.appendChild(document.createElement("p")).innerHTML = "Please try again to a different time"
jobsContainer.appendChild(jobContainer);
} else {
json.forEach((job) => {
const jobContainer = document.createElement("div");
jobContainer.classList.add("flex-auto");
@ -49,6 +57,7 @@ fetch('/json/jobs.json')
applyButton.innerHTML = "Apply"
jobsContainer.appendChild(jobContainer)
jobContainer.appendChild(applyButton)
});
jobsContainer.appendChild(applyButton)
});
}
});