ajout utilisateur en cours

This commit is contained in:
Valentin CZERYBA 2022-08-12 21:40:29 +02:00
parent 4f7502333d
commit ecbc87a061
4 changed files with 16 additions and 158 deletions

View File

@ -119,38 +119,14 @@
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
<div class="alert alert-danger alert-dismissible hidden" id="pseudoAlert" role="alert">
<div>Champ pseudo vide</div>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div class="alert alert-danger alert-dismissible hidden" id="emailAlert" role="alert">
<div>Champ email vide</div>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div class="alert alert-danger alert-dismissible hidden" id="firstNameAlert" role="alert">
<div>Champ prenom vide</div>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div class="alert alert-danger alert-dismissible hidden" id="nameAlert" role="alert">
<div>Champ nom vide</div>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Utilisateur</h1>
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="idUpdate">ID</span>
<input id="idUpdateInput" type="text" class="form-control" placeholder="" aria-label="Id" aria-describedby="idUpdate" disabled>
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="pseudoUpdate">Pseudo</span>
<input id="pseudoUpdateInput" type="text" class="form-control" placeholder="Mot de passe" aria-label="Mot de passe" aria-describedby="pseudoUpdate">
<input id="pseudoUpdateInput" type="text" class="form-control" placeholder="Pseudo" aria-label="Pseudo" aria-describedby="pseudoUpdate">
</div>
<div class="input-group mb-3">
@ -178,143 +154,18 @@
<label class="input-group-text" for="rolesSelector">Roles</label>
<select class="form-select" id="rolesSelector">
<option value="Admin">Administrateur</option>
<option value="User">Utilisateur</option>
<option value="User" selected>Utilisateur</option>
</select>
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="birthUpdate">Date de naissance</span>
<input id="birthUpdateInput" type="date" class="form-control" placeholder="Date de naissance" aria-label="Date de naissance" aria-describedby="birthdateUpdate">
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="connected_atUpdate">Dernière connexion</span>
<input id="connected_atUpdateInput" type="text" class="form-control" placeholder="" aria-label="Dernière connexion" aria-describedby="connected_atUpdate" disabled>
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="created_atUpdate">Date de création</span>
<input id="created_atUpdateInput" type="text" class="form-control" placeholder="" aria-label="Date de création" aria-describedby="created_atUpdate" disabled>
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="updated_atUpdate">Date de mise à jour</span>
<input id="updated_atUpdateInput" type="text" class="form-control" placeholder="" aria-label="Date de mise à jour" aria-describedby="updated_atUpdate" disabled>
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="deleted_atUpdate">Date de suppression</span>
<input id="deleted_atUpdateInput" type="text" class="form-control" placeholder="" aria-label="Date de suppression" aria-describedby="deleted_atUpdate" disabled>
</div>
<div class="input-group mb-3">
<label class="input-group-text" for="statusSelector">Statut</label>
<select class="form-select" id="statusSelector" disabled>
<option value="-2" selected>Statut</option>
<option value="-1">En cours de suppression</option>
<option value="0">Desactivé</option>
<option value="1">Activé</option>
<option value="2">En attente de validation</option>
</select>
</div>
<div class="d-grid gap-2 col-6 mx-auto">
<button type="button" class="btn btn-success hidden" id="enableUser" data-bs-toggle="modal" data-bs-target="#enableUserModal">Activer l'utilisateur</button>
<button type="button" class="btn btn-success hidden" id="cancelUser" data-bs-toggle="modal" data-bs-target="#cancelUserModal">Annuler la suppression de l'utilisateur</button>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#updateUserModal">Mettre à jour l'utilisateur</button>
<button type="button" class="btn btn-warning hidden" id="disableUser" data-bs-toggle="modal" data-bs-target="#disableUserModal">Désactiver l'utilisateur</button>
<button type="button" class="btn btn-danger" id="removeUser" data-bs-toggle="modal" data-bs-target="#removeUserModal">Supprimer l'utilisateur</button>
</div>
<div class="modal fade" id="updateUserModal" tabindex="-1" aria-labelledby="updateUserModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="updateUserModalLabel">Mettre à jour l'utilisateur</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Voulez-vous mettre à jour l'utilisateur ?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
<button type="button" class="btn btn-primary" id="updateUserButton">Mettre à jour</button>
</div>
</div>
</div>
<button type="button" class="btn btn-success" id="addUser" data-bs-toggle="modal" data-bs-target="#enableUserModal">Activer l'utilisateur</button>
</div>
<div class="modal fade" id="disableUserModal" tabindex="-1" aria-labelledby="disableUserModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="disableUserModalLabel">Désactiver l'utilisateur</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Voulez-vous désactiver l'utilisateur ?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
<button type="button" class="btn btn-warning" id="disableUserButton">Désactiver</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="removeUserModal" tabindex="-1" aria-labelledby="removeUserModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="updateUserModalLabel">Supprimer l'utilisateur</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Etes-vous sûr de supprimer l'utilisateur ?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
<button type="button" class="btn btn-danger" id="removeUserButton">Supprimer</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="enableUserModal" tabindex="-1" aria-labelledby="enableUserModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="enableUserModalLabel">Activer l'utilisateur</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Voulez-vous activer l'utilisateur ?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
<button type="button" class="btn btn-success" id="enableUserButton">Activer</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="cancelUserModal" tabindex="-1" aria-labelledby="cancelUserModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="cancelUserModalLabel">Annuler la suppression de l'utilisateur</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Voulez-vous annuller la suppression de l'utilisateur ?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
<button type="button" class="btn btn-success" id="cancelUserButton">Annuler la suppression de l'utilisateur</button>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
@ -326,5 +177,5 @@
<script src="../js/config.js"></script>
<script src="../js/library.js"></script>
<script src="../js/user.js"></script>
<script src="../js/addUser.js"></script>
</body></html>

View File

@ -150,7 +150,7 @@
<div class="input-group mb-3">
<span class="input-group-text" id="pseudoUpdate">Pseudo</span>
<input id="pseudoUpdateInput" type="text" class="form-control" placeholder="Mot de passe" aria-label="Mot de passe" aria-describedby="pseudoUpdate">
<input id="pseudoUpdateInput" type="text" class="form-control" placeholder="Pseudo" aria-label="Pseudo" aria-describedby="pseudoUpdate">
</div>
<div class="input-group mb-3">

2
web/js/addUser.js Normal file
View File

@ -0,0 +1,2 @@
checkToken();
signOut();

View File

@ -93,4 +93,9 @@ instance.get("users", {withCredentials: true, params :{ page:page, nbPages: nbPa
});
document.getElementById("addUser").addEventListener("click", function(){
location.href="/html/adduser.html";
})