forked from v4l3n71n/covas-bo
formulaire rempli
This commit is contained in:
parent
6e04e8b668
commit
11cdca95ea
@ -165,22 +165,22 @@
|
||||
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<label class="input-group-text" for="SelectorRoles">Roles</label>
|
||||
<select class="form-select" id="SelectorRoles">
|
||||
<option value="admin">Administrateur</option>
|
||||
<option value="user">Utilisateur</option>
|
||||
<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>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="birthdateUpdate">Date de naissance</span>
|
||||
<input id="birthdateUpdateInput" type="date" class="form-control" placeholder="Date de naissance" aria-label="Date de naissance" aria-describedby="birthdateUpdate">
|
||||
<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">
|
||||
<label class="input-group-text" for="SelectorStatus">Statut</label>
|
||||
<select class="form-select" id="SelectorStatus" disabled>
|
||||
<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>
|
||||
|
@ -5,11 +5,22 @@ var id = getQuery("id");
|
||||
if(id.length > 0){
|
||||
instance.get("users/"+id, {withCredentials: true})
|
||||
.then(function(response){
|
||||
var listValue = [ "id", "pseudo", "name", "firstName", "email"];
|
||||
var listValue = [ "id", "pseudo", "name", "firstName", "email", "birth"];
|
||||
for (var i=0; i<listValue.length; i++){
|
||||
document.getElementById(listValue[i]+"UpdateInput").value=response.data[listValue[i]];
|
||||
}
|
||||
|
||||
|
||||
var listSelector = ["roles", "status"];
|
||||
for (var i=0; i<listSelector.length; i++){
|
||||
var select = document.getElementById(listSelector[i]+"Selector").querySelectorAll("option");
|
||||
for (var j=0; j<select.length; j++){
|
||||
if(select[j].value == response.data[listSelector[i]]){
|
||||
select[j].setAttribute("selected", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
.catch(function(error){
|
||||
console.log(error);
|
||||
|
Loading…
x
Reference in New Issue
Block a user