Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correction redirection et affichage index admin #21

Merged
merged 1 commit into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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