Skip to content

Commit

Permalink
correction redirection et affichage index admin
Browse files Browse the repository at this point in the history
  • Loading branch information
darsane21 committed Jun 21, 2023
1 parent b71a6ec commit ffcd474
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 71 deletions.
13 changes: 9 additions & 4 deletions app/controllers/AdminController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import {FicheDePosteRepository} from "../repository/FicheDePosteRepository";

export class AdminController {
static index(req: express.Request, res: express.Response) {
res.render("admin/index", { title: "Home", userLogged: loggedInNoRedirection(req, res)});
FicheDePosteRepository.getDistinctRegion().then((regions: string[]) => {
OfferRepository.getAll().then((offers: OffreDePoste[]) => {
res.render("admin/index", {title: "Home", offers: offers, regions: regions, userLogged: loggedInNoRedirection(req, res)});
});
});
}

static utilisateurs(req: express.Request, res: express.Response) {
Expand Down Expand Up @@ -129,9 +133,10 @@ export class AdminController {
}

static offres(req: express.Request, res: express.Response) {
OfferRepository.getAll().then((offers: OffreDePoste[]) => {
console.log(offers);
res.render("admin/offres", {title: "Offres", offers: offers, userLogged: loggedInNoRedirection(req, res)});
FicheDePosteRepository.getDistinctRegion().then((regions: string[]) => {
OfferRepository.getAll().then((offers: OffreDePoste[]) => {
res.render("admin/offres", {title: "Offres", offers: offers, regions: regions, userLogged: loggedInNoRedirection(req, res)});
});
});
}

Expand Down
67 changes: 22 additions & 45 deletions app/views/admin/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -20,65 +20,42 @@
alt="Bootstrap Themes" width="700"
height="500" loading="lazy">
</div>
<div class="col-lg-6">
<h1 class="display-5 fw-bold lh-1 mb-3">Site de recrutement</h1>
<div class="d-grid gap-2 d-md-flex justify-content-md-start">
<a type="button" class="btn btn-primary btn-lg px-4 me-md-2" href="login.html">Se connecter pour voir
les offres</a>
</div>
</div>

</div>
<div class="row">
<div class="col-md-3">
<h4>Filtres</h4>
<hr>
<h5>Salaire</h5>
<input type="range" class="form-range" id="salary" min="0" max="100000" step="1000" oninput="updateSalaryValue()">
<input type="range" class="form-range" id="salary" min="0" max="100000" step="1000"
onmouseup="updateSalaryValue()">
<p class="text-muted">Salaire minimum : <span id="salary-value"></span></p>
<h5>Région</h5>
<select class="form-select" id="region">
<option value="">Toutes les régions</option>
<option value="Paris">Paris</option>
<option value="Lyon">Lyon</option>
<option value="Marseille">Marseille</option>
<select class="form-select" id="region" name="region" onchange="updateRegionValue()">
<option value="all">Toutes les régions</option>
<% regions.forEach((region) => {
%>
<option value="<%= region %>"><%= region %></option>
<% }) %>
</select>
</div>
<div class="col-md-9">
<div class="border-1 border p-2 my-2">
<h4 class="">Développeur Front-end <span class="badge text-bg-secondary float-end">45000 €</span></h4>
<p>Nous cherchons un développeur Front-end pour rejoindre notre équipe de développement. Le candidat
idéal
possède une solide expérience en HTML, CSS et JavaScript.</p>
<p>Organisation : Nom de l'organisation</p>
<a href="candidater.html" class="btn btn-primary">Postuler</a>
</div>
<div class="border-1 border p-2 my-2">
<h4 class="">Ingénieur DevOps <span class="badge text-bg-secondary float-end">45000 €</span></h4>
<p>Nous recherchons un ingénieur DevOps pour rejoindre notre équipe de
développement. Le candidat idéal doit posséder une expérience approfondie en administration système,
en déploiement d'applications et en gestion de serveurs</p>
<a href="candidater.html" class="btn btn-primary">Postuler</a>
</div>
<div class="border-1 border p-2 my-2">
<h4 class="">Analyste financier <span class="badge text-bg-secondary float-end">45000 €</span></h4>
<p>Nous cherchons un analyste financier pour rejoindre notre équipe
financière. Le candidat idéal doit posséder une expérience en analyse financière, en modélisation
financière et en gestion de portefeuille.</p>
<a href="candidater.html" class="btn btn-primary">Postuler</a>
<h4>Offres d'emploi</h4>
<div id="offers">

<% offers.forEach((offer) => { %>
<div class="border-1 border p-2 my-2">
<h4 class=""><%= offer.ficheDePoste.typeMetier %> <span
class="badge text-bg-secondary float-end"><%= offer.ficheDePoste.salaire %></span>
</h4>
<p><%= offer.ficheDePoste.description %></p>
<p>Organisation : <%= offer.ficheDePoste.organisation.nom %></p>
</div>
<% }) %>
</div>
</div>


</div>
</div>
<script>
//When the page is loaded, update the salary value
window.onload = updateSalaryValue;
function updateSalaryValue() {
document.getElementById("salary-value").innerHTML = document.getElementById("salary").value;
}
</script>
<script src="js/filter.js"></script>
</body>
</html>
36 changes: 16 additions & 20 deletions app/views/admin/offres.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,21 @@
<div class="container col-xxl-8 px-4 py-5">
<div class="row">
<div class="col-md-3">
<h4>Filtres</h4>
<hr>
<h5>Région</h5>
<select class="form-select" id="region">
<option value="">Toutes les régions</option>
<option value="Paris">Paris</option>
<option value="Lyon">Lyon</option>
<option value="Marseille">Marseille</option>
</select>
<h5 class="mt-3">Entreprise</h5>
<select class="form-select" id="entreprise">
<option value="">Toutes les Entreprises</option>
<option value="Carrefour">Carrefour</option>
<option value="Renault">Renault</option>
<option value="Orpi">Orpi</option>
</select>
<h5 class="mt-4">Salaire</h5>
<input type="range" class="form-range" id="salary" min="0" max="100000" step="1000" oninput="updateSalaryValue()">
<p class="text-muted">Salaire minimum : <span id="salary-value"></span></p>
</div>
<h4>Filtres</h4>
<hr>
<h5>Salaire</h5>
<input type="range" class="form-range" id="salary" min="0" max="100000" step="1000"
onmouseup="updateSalaryValue()">
<p class="text-muted">Salaire minimum : <span id="salary-value"></span></p>
<h5>Région</h5>
<select class="form-select" id="region" name="region" onchange="updateRegionValue()">
<option value="all">Toutes les régions</option>
<% regions.forEach((region) => {
%>
<option value="<%= region %>"><%= region %></option>
<% }) %>
</select>
</div>
<div class="col-md-9">
<h4>Offres d'emploi</h4>
<% offers.forEach((offer) => {%>
Expand All @@ -38,5 +33,6 @@
</div>
</div>

<script src="js/filter.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion app/views/partials/adminHeader.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</a>
<ul class="dropdown-menu" aria-labelledby="userMenuDropdown">
<li><a class="dropdown-item" href="/logout">Déconnexion</a></li>
<li><a class="dropdown-item" href="/admin">Espace candidat</a></li>
<li><a class="dropdown-item" href="/">Espace candidat</a></li>
</ul>
</li>
<% } %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/partials/recruteurHeader.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</a>
<ul class="dropdown-menu" aria-labelledby="userMenuDropdown">
<li><a class="dropdown-item" href="/logout">Déconnexion</a></li>
<li><a class="dropdown-item" href="/admin">Espace candidat</a></li>
<li><a class="dropdown-item" href="/">Espace candidat</a></li>
</ul>
</li>
<% } %>
Expand Down

0 comments on commit ffcd474

Please sign in to comment.