2023-11-01 02:01:31 +00:00
|
|
|
<%- include('includes/head', {Title : 'Admin page'}) %>
|
|
|
|
<link rel="stylesheet" type="text/css" href="css/adminPage.css">
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<%- include('includes/header') %>
|
|
|
|
<main>
|
|
|
|
<video id="background-video" autoplay loop muted>
|
|
|
|
<source src="video/videoBackground.mp4" type="video/mp4">
|
|
|
|
</video>
|
|
|
|
<div id="first_div">
|
|
|
|
<h1>
|
|
|
|
This is the admin page
|
|
|
|
</h1>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<h2>
|
|
|
|
Faire de quelqu'un un admin
|
|
|
|
</h2>
|
|
|
|
<form action="/mettreAdmin">
|
|
|
|
<label for="utilisateurs">Nom d'utilisateur : </label>
|
|
|
|
<select name="utilisateurs" id="utilisateurs">
|
|
|
|
<% users.forEach(user => { %>
|
|
|
|
<option value="<%= user.nom_dutilisateur %>"><%= user.nom_dutilisateur %></option>
|
|
|
|
<% }); %>
|
|
|
|
</select>
|
|
|
|
<button>
|
|
|
|
submit
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<h2>
|
|
|
|
enlever un admin
|
|
|
|
</h2>
|
|
|
|
<form action="/supprAdmin">
|
|
|
|
<label for="utilisateurs">Nom d'utilisateur : </label>
|
|
|
|
<select name="utilisateurs" id="utilisateurs">
|
|
|
|
<% users.forEach(user => { %>
|
|
|
|
<option value="<%= user.nom_dutilisateur %>"><%= user.nom_dutilisateur %></option>
|
|
|
|
<% }); %>
|
|
|
|
</select>
|
|
|
|
<button>
|
2023-11-01 20:03:07 +00:00
|
|
|
Submit
|
2023-11-01 02:01:31 +00:00
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<h2>
|
|
|
|
Créer un poste pour la hotLine
|
|
|
|
</h2>
|
2023-11-01 20:03:07 +00:00
|
|
|
<form action="/creerPost" method="post">
|
2023-11-01 02:01:31 +00:00
|
|
|
<div>
|
|
|
|
<label for="title">Titre du poste: </label>
|
|
|
|
<input type="text" name="titre" id="titre">
|
|
|
|
</div>
|
|
|
|
<div id="divPostComment">
|
2023-11-01 20:03:07 +00:00
|
|
|
<label for="commentairePost">Commentaire du poste : </label>
|
2023-11-01 02:01:31 +00:00
|
|
|
<input type="text" id="commentairePost" name="commentairePost">
|
|
|
|
</div>
|
2023-11-01 20:03:07 +00:00
|
|
|
<div>
|
|
|
|
<label for="recompense">Récompense : </label>
|
|
|
|
<input type="text" id="recompense" name="recompense">
|
|
|
|
</div>
|
2023-11-01 02:01:31 +00:00
|
|
|
<button>Submit</button>
|
|
|
|
</form>
|
|
|
|
</li>
|
2023-11-01 23:03:46 +00:00
|
|
|
<li>
|
|
|
|
<h2>Les postes</h2>
|
|
|
|
<% postData.forEach(post => { %>
|
2023-11-02 00:37:15 +00:00
|
|
|
<% if (post.isFinish) {%>
|
|
|
|
<div id="postFinish">
|
|
|
|
<h2><%= post.titre %></h2>
|
|
|
|
<p>
|
|
|
|
<%= post.commentairePost %>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Récompense : <%= post.recompense %>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
statue : Accepté
|
|
|
|
</p>
|
2023-11-02 19:15:23 +00:00
|
|
|
<p>
|
|
|
|
gagnant : <%= post.winner %>
|
|
|
|
</p>
|
|
|
|
<form action="/supprimerPost/<%= post._id %>" method="post">
|
|
|
|
<button>
|
|
|
|
Supprimer le poste
|
|
|
|
</button>
|
|
|
|
</form>
|
2023-11-02 00:37:15 +00:00
|
|
|
</div>
|
|
|
|
<% } else {%>
|
|
|
|
<div id="postNotFinish">
|
|
|
|
<h2><%= post.titre %></h2>
|
|
|
|
<p>
|
|
|
|
Déscription : <%= post.commentaire %>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Récompense : <%= post.recompense %>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
statue : en attente
|
|
|
|
</p>
|
2023-11-02 19:15:23 +00:00
|
|
|
<form action="/accepterPost/<%= post._id %>" method="post">
|
2023-11-02 00:37:15 +00:00
|
|
|
<div>
|
|
|
|
<label for="utilisateur">Le gagnant est : </label>
|
|
|
|
<select name="utilisateur" id="utilisateur">
|
|
|
|
<% users.forEach(user => { %>
|
|
|
|
<option value="<%= user.nom_dutilisateur %>"><%= user.nom_dutilisateur %></option>
|
|
|
|
<% }); %>
|
|
|
|
</select>
|
|
|
|
</div>
|
2023-11-02 19:15:23 +00:00
|
|
|
<button id="but<%= post._id %>" >
|
2023-11-02 00:37:15 +00:00
|
|
|
Accepter
|
|
|
|
</button>
|
|
|
|
</form>
|
2023-11-02 19:15:23 +00:00
|
|
|
<form action="/supprimerPost/<%= post._id %>" method="post">
|
|
|
|
<button>
|
|
|
|
Supprimer le poste
|
|
|
|
</button>
|
|
|
|
</form>
|
2023-11-02 00:37:15 +00:00
|
|
|
</div>
|
|
|
|
<% } %>
|
|
|
|
<% resData.forEach(res => {%>
|
|
|
|
<% if (res.postId === post._id.toString()) { %>
|
|
|
|
<% console.log(res.postId)
|
|
|
|
console.log(post._id)
|
|
|
|
%>
|
|
|
|
<div>
|
|
|
|
<h3>
|
|
|
|
<%= res.nom %> <%= res.prenom %>
|
|
|
|
</h3>
|
|
|
|
<p>
|
|
|
|
<%= res.description %>
|
|
|
|
</p>
|
2023-11-02 19:15:23 +00:00
|
|
|
<img src="/<%= res.imagePath %>" alt="image de la resolution">
|
2023-11-02 00:37:15 +00:00
|
|
|
</div>
|
|
|
|
<% } %>
|
|
|
|
<% }) %>
|
2023-11-01 23:03:46 +00:00
|
|
|
<% }); %>
|
|
|
|
</li>
|
2023-11-01 02:01:31 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
<%- include('includes/footer') %>
|
|
|
|
</body>
|