formulaire de modification en cours
This commit is contained in:
parent
18704d4dcc
commit
6e04e8b668
@ -140,27 +140,27 @@
|
||||
<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>
|
||||
<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 type="text" class="form-control" placeholder="Pseudo" aria-label="Pseudo" 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">
|
||||
<span class="input-group-text" id="nameUpdate">Nom</span>
|
||||
<input type="text" class="form-control" placeholder="Nom" aria-label="Nom" aria-describedby="nameUpdate">
|
||||
<input id="nameUpdateInput" 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">
|
||||
<input id="firstNameUpdateInput" 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">
|
||||
<input id="emailUpdateInput" type="text" class="form-control" placeholder="Email" aria-label="Email" aria-describedby="emailUpdate">
|
||||
</div>
|
||||
|
||||
|
||||
@ -175,12 +175,12 @@
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="birthdateUpdate">Date de naissance</span>
|
||||
<input type="date" class="form-control" placeholder="Date de naissance" aria-label="Date de naissance" aria-describedby="birthdateUpdate">
|
||||
<input id="birthdateUpdateInput" 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=statusUpdate">Status</span>
|
||||
<select class="form-select" id="SelectorRoles" disabled>
|
||||
<label class="input-group-text" for="SelectorStatus">Statut</label>
|
||||
<select class="form-select" id="SelectorStatus" disabled>
|
||||
<option value="-2" selected>Statut</option>
|
||||
<option value="-1">En cours de suppression</option>
|
||||
<option value="0">Desactivé</option>
|
||||
|
@ -54,7 +54,8 @@ instance.get("users", {withCredentials: true, params :{ page:0, nbPages: nbPages
|
||||
td[4].querySelector(classTd).classList.remove("hidden");
|
||||
|
||||
trAll[i].addEventListener("click", function(e){
|
||||
console.log(e.currentTarget)
|
||||
var id = e.currentTarget.querySelector("td").textContent;
|
||||
location.href="/html/users.html?id="+id;
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -29,12 +29,14 @@ function signOut(){
|
||||
|
||||
|
||||
function getQuery(param){
|
||||
query = location.search.split("?")[1];
|
||||
var variables = query.split("&")
|
||||
var result = "";
|
||||
for (var i=0; i<variables.length; i++){
|
||||
if(variables[i].split("=")[0] == param){
|
||||
result = variables[i].split("=")[1];
|
||||
if(location.search.length >0){
|
||||
query = location.search.split("?")[1];
|
||||
var variables = query.split("&")
|
||||
for (var i=0; i<variables.length; i++){
|
||||
if(variables[i].split("=")[0] == param){
|
||||
result = variables[i].split("=")[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -1,11 +1,18 @@
|
||||
checkToken();
|
||||
signOut();
|
||||
var id = getParam("id");
|
||||
var id = getQuery("id");
|
||||
|
||||
instance.get("users/"+id, {withCredentials: true})
|
||||
.then(function(response){
|
||||
if(id.length > 0){
|
||||
instance.get("users/"+id, {withCredentials: true})
|
||||
.then(function(response){
|
||||
var listValue = [ "id", "pseudo", "name", "firstName", "email"];
|
||||
for (var i=0; i<listValue.length; i++){
|
||||
document.getElementById(listValue[i]+"UpdateInput").value=response.data[listValue[i]];
|
||||
}
|
||||
|
||||
})
|
||||
.catch(function(error){
|
||||
console.log(error);
|
||||
|
||||
})
|
||||
.catch(function(error){
|
||||
|
||||
});
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user