liste date

This commit is contained in:
Valentin CZERYBA 2022-08-07 18:11:48 +02:00
parent 36b3416e37
commit 10e5747e22
2 changed files with 30 additions and 1 deletions

View File

@ -161,6 +161,26 @@
<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>

View File

@ -6,8 +6,17 @@ if(id.length > 0){
instance.get("users/"+id, {withCredentials: true})
.then(function(response){
var listValue = [ "id", "pseudo", "name", "firstName", "email", "birth"];
var listTime = ["connected_at", "created_at", "updated_at", "deleted_at"];
for (var i=0; i<listValue.length; i++){
document.getElementById(listValue[i]+"UpdateInput").value=response.data[listValue[i]];
if(response.data[listValue[i]] != null){
document.getElementById(listValue[i]+"UpdateInput").value=response.data[listValue[i]];
}
}
for (var i=0; i<listTime.length; i++){
if(response.data[listTime[i]] != null){
document.getElementById(listTime[i]+"UpdateInput").value=new Date(response.data[listTime[i]]).toLocaleString();
}
}