formulaire rempli
This commit is contained in:
parent
6e04e8b668
commit
11cdca95ea
@ -165,22 +165,22 @@
|
|||||||
|
|
||||||
|
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<label class="input-group-text" for="SelectorRoles">Roles</label>
|
<label class="input-group-text" for="rolesSelector">Roles</label>
|
||||||
<select class="form-select" id="SelectorRoles">
|
<select class="form-select" id="rolesSelector">
|
||||||
<option value="admin">Administrateur</option>
|
<option value="Admin">Administrateur</option>
|
||||||
<option value="user">Utilisateur</option>
|
<option value="User">Utilisateur</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<span class="input-group-text" id="birthdateUpdate">Date de naissance</span>
|
<span class="input-group-text" id="birthUpdate">Date de naissance</span>
|
||||||
<input id="birthdateUpdateInput" type="date" class="form-control" placeholder="Date de naissance" aria-label="Date de naissance" aria-describedby="birthdateUpdate">
|
<input id="birthUpdateInput" type="date" class="form-control" placeholder="Date de naissance" aria-label="Date de naissance" aria-describedby="birthdateUpdate">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<label class="input-group-text" for="SelectorStatus">Statut</label>
|
<label class="input-group-text" for="statusSelector">Statut</label>
|
||||||
<select class="form-select" id="SelectorStatus" disabled>
|
<select class="form-select" id="statusSelector" disabled>
|
||||||
<option value="-2" selected>Statut</option>
|
<option value="-2" selected>Statut</option>
|
||||||
<option value="-1">En cours de suppression</option>
|
<option value="-1">En cours de suppression</option>
|
||||||
<option value="0">Desactivé</option>
|
<option value="0">Desactivé</option>
|
||||||
|
@ -5,11 +5,22 @@ var id = getQuery("id");
|
|||||||
if(id.length > 0){
|
if(id.length > 0){
|
||||||
instance.get("users/"+id, {withCredentials: true})
|
instance.get("users/"+id, {withCredentials: true})
|
||||||
.then(function(response){
|
.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++){
|
for (var i=0; i<listValue.length; i++){
|
||||||
document.getElementById(listValue[i]+"UpdateInput").value=response.data[listValue[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){
|
.catch(function(error){
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user