formulaire pour utilisateur specifique

This commit is contained in:
Valentin CZERYBA 2022-08-04 00:03:57 +02:00
parent 282c81adfa
commit b5023429e9
5 changed files with 213 additions and 7 deletions

View File

@ -156,6 +156,7 @@
<th scope="col">Pseudo</th>
<th scope="col">Mail</th>
<th scope="col">Rôle</th>
<th scope="col">Statut</th>
</tr>
</thead>
<tbody>
@ -164,6 +165,7 @@
<td></td>
<td></td>
<td></td>
<td><span class="activeStatus hidden">Activé</span><span class="disableStatus hidden">Désactivé</span></td>
</tr>
</tbody>

190
web/html/users.html Normal file
View File

@ -0,0 +1,190 @@
<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
<meta name="generator" content="Hugo 0.101.0">
<title>Dashboard Template · Bootstrap v5.2</title>
<link rel="canonical" href="https://getbootstrap.com/docs/5.2/examples/dashboard/">
<link href="../css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<!-- Favicons -->
<link rel="apple-touch-icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/apple-touch-icon.png" sizes="180x180">
<link rel="icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="manifest" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/manifest.json">
<link rel="mask-icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/safari-pinned-tab.svg" color="#712cf9">
<link rel="icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/favicon.ico">
<meta name="theme-color" content="#712cf9">
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
.b-example-divider {
height: 3rem;
background-color: rgba(0, 0, 0, .1);
border: solid rgba(0, 0, 0, .15);
border-width: 1px 0;
box-shadow: inset 0 .5em 1.5em rgba(0, 0, 0, .1), inset 0 .125em .5em rgba(0, 0, 0, .15);
}
.b-example-vr {
flex-shrink: 0;
width: 1.5rem;
height: 100vh;
}
.bi {
vertical-align: -.125em;
fill: currentColor;
}
.nav-scroller {
position: relative;
z-index: 2;
height: 2.75rem;
overflow-y: hidden;
}
.nav-scroller .nav {
display: flex;
flex-wrap: nowrap;
padding-bottom: 1rem;
margin-top: -1px;
overflow-x: auto;
text-align: center;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
}
</style>
<!-- Custom styles for this template -->
<link href="../css/dashboard.css" rel="stylesheet">
<link href="../css/style.css" rel="stylesheet">
<header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-md-3 col-lg-2 me-0 px-3 fs-6" href="#">Company name</a>
<button class="navbar-toggler position-absolute d-md-none collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#sidebarMenu" aria-controls="sidebarMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<input class="form-control form-control-dark w-100 rounded-0 border-0" type="text" placeholder="Search" aria-label="Search">
<div class="navbar-nav">
<div class="nav-item text-nowrap">
<a class="nav-link px-3" id="signout" href="#">Sign out</a>
</div>
</div>
</header>
<div class="container-fluid">
<div class="row">
<nav id="sidebarMenu" class="col-md-3 col-lg-2 d-md-block bg-light sidebar collapse">
<div class="position-sticky pt-3 sidebar-sticky">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home align-text-bottom" aria-hidden="true"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>
Utilisateur
</a>
</li>
</ul>
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted text-uppercase">
<span>Saved reports</span>
<a class="link-secondary" href="#" aria-label="Add a new report">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-plus-circle align-text-bottom" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg>
</a>
</h6>
<ul class="nav flex-column mb-2">
<li class="nav-item">
<a class="nav-link" href="#">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text align-text-bottom" aria-hidden="true"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>
Current month
</a>
</li>
</ul>
</div>
</nav>
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
<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">Utilisateurs</h1>
</div>
<h2>Utilisateur</h2>
<div class="input-group mb-3">
<span class="input-group-text" id="idUpdate">ID</span>
<input 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 type="text" class="form-control" placeholder="Pseudo" aria-label="Pseudo" aria-describedby="pseudoUpdate">
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="nameUpdate">Nom</span>
<input type="text" class="form-control" placeholder="Nom" aria-label="Nom" aria-describedby="nameUpdate">
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="firstNameUpdate">Prenom</span>
<input type="text" class="form-control" placeholder="Prenom" aria-label="Prenom" aria-describedby="firstNameUpdate">
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="emailUpdate">Email</span>
<input type="text" class="form-control" placeholder="Email" aria-label="Email" aria-describedby="emailUpdate">
</div>
<div class="input-group mb-3">
<label class="input-group-text" for="inputGroupSelect01">Roles</label>
<select class="form-select" id="inputGroupSelect01">
<option value="admin">Administrateur</option>
<option value="user">Utilisateur</option>
</select>
</div>
</main>
</div>
</div>
<script src="../js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
<script src="../js/feather.min.js" integrity="sha384-uO3SXW5IuS1ZpFPKugNNWqTZRRglnUJK6UAZ/gxOX80nxEkN9NcGZTftn6RzhGWE" crossorigin="anonymous"></script>
<script src="../js/config.js"></script>
<script src="../js/library.js"></script>
<script src="../js/users.js"></script>
</body></html>

View File

@ -1,4 +1,5 @@
checkToken();
signOut();
var nbPages = 20;
@ -32,6 +33,12 @@ instance.get("users", {withCredentials: true, params :{ page:0, nbPages: nbPages
td[1].textContent = listData[i].pseudo
td[2].textContent = listData[i].email
td[3].textContent = listData[i].roles
var classTd = ".disableStatus";
if(listData[i].status){
classTd = ".activeStatus";
}
td[4].querySelector(classTd).classList.remove("hidden");
trAll[i].addEventListener("click", function(e){
console.log(e.currentTarget)
});
@ -40,11 +47,4 @@ instance.get("users", {withCredentials: true, params :{ page:0, nbPages: nbPages
});
document.getElementById("signout").addEventListener("click", function(){
instance.delete("token" , {withCredentials:true}).then(function(response){
if(response.status == 200){
location.href="/"
}
});
});

View File

@ -13,4 +13,16 @@ function checkToken(){
}
});
}
function signOut(){
document.getElementById("signout").addEventListener("click", function(){
instance.delete("token" , {withCredentials:true}).then(function(response){
if(response.status == 200){
location.href="/"
}
});
});
}

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

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