forked from v4l3n71n/covas-bo
add event
This commit is contained in:
parent
6f32a4d1eb
commit
ce3c896947
@ -126,12 +126,12 @@
|
||||
<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
|
||||
|
||||
<div class="alert alert-warning alert-dismissible hidden" id="notModifiedAlert" role="alert">
|
||||
<div>Utilisateur non modifié</div>
|
||||
<div>Évènement non modifié</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-danger alert-dismissible hidden" id="notAuthorizedAlert" role="alert">
|
||||
<div>Création d'utilisateur non autorisée avec ce compte</div>
|
||||
<div>Création d'évènement non autorisée avec ce compte</div>
|
||||
<button type="button" class="btn-close" aria-label="Close"></button>
|
||||
</div>
|
||||
|
||||
@ -141,7 +141,7 @@
|
||||
</div>
|
||||
|
||||
<div class="alert alert-danger alert-dismissible hidden" id="noContentAlert" role="alert">
|
||||
<div>Utilisateur non modifié</div>
|
||||
<div>Évènement non modifié</div>
|
||||
<button type="button" class="btn-close" aria-label="Close"></button>
|
||||
</div>
|
||||
|
||||
@ -197,13 +197,13 @@
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="dateUpdate">Date de début</span>
|
||||
<input id="startDateUpdateInput" type="date" class="form-control" placeholder="Date de début" aria-label="Date de début" aria-describedby="startDateUpdate">
|
||||
<span class="input-group-text" id="start_dateUpdate">Date de début</span>
|
||||
<input id="start_dateUpdateInput" type="datetime-local" class="form-control" placeholder="Date de début" aria-label="Date de début" aria-describedby="start_dateUpdate">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="endDateUpdate">Date de fin</span>
|
||||
<input id="endDateUpdateInput" type="date" class="form-control" placeholder="Date de fin" aria-label="Date de fin" aria-describedby="endDateUpdate">
|
||||
<span class="input-group-text" id="start_dateUpdate">Date de fin</span>
|
||||
<input id="end_dateUpdateInput" type="datetime-local" class="form-control" placeholder="Date de fin" aria-label="Date de fin" aria-describedby="start_dateUpdate">
|
||||
</div>
|
||||
|
||||
|
||||
@ -243,11 +243,11 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="d-grid gap-2 col-6 mx-auto">
|
||||
<button type="button" class="btn btn-success hidden" id="enableUser" data-bs-toggle="modal" data-bs-target="#enableUserModal">Activer l'utilisateur</button>
|
||||
<button type="button" class="btn btn-success hidden" id="cancelUser" data-bs-toggle="modal" data-bs-target="#cancelUserModal">Annuler la suppression de l'utilisateur</button>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#updateUserModal">Mettre à jour l'utilisateur</button>
|
||||
<button type="button" class="btn btn-warning hidden" id="disableUser" data-bs-toggle="modal" data-bs-target="#disableUserModal">Désactiver l'utilisateur</button>
|
||||
<button type="button" class="btn btn-danger" id="removeUser" data-bs-toggle="modal" data-bs-target="#removeUserModal">Supprimer l'utilisateur</button>
|
||||
<button type="button" class="btn btn-success hidden" id="enableUser" data-bs-toggle="modal" data-bs-target="#enableUserModal">Activer l'évènement</button>
|
||||
<button type="button" class="btn btn-success hidden" id="cancelUser" data-bs-toggle="modal" data-bs-target="#cancelUserModal">Annuler la suppression de l'évènement</button>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#updateUserModal">Mettre à jour l'évènement</button>
|
||||
<button type="button" class="btn btn-warning hidden" id="disableUser" data-bs-toggle="modal" data-bs-target="#disableUserModal">Désactiver l'évènement</button>
|
||||
<button type="button" class="btn btn-danger" id="removeUser" data-bs-toggle="modal" data-bs-target="#removeUserModal">Supprimer l'évènement</button>
|
||||
</div>
|
||||
<div class="modal fade" id="updateUserModal" tabindex="-1" aria-labelledby="updateUserModal" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
@ -311,7 +311,7 @@
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Voulez-vous activer l'utilisateur ?
|
||||
Voulez-vous activer l'évènement ?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
|
||||
@ -329,11 +329,11 @@
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Voulez-vous annuller la suppression de l'utilisateur ?
|
||||
Voulez-vous annuler la suppression de l'évènement ?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
|
||||
<button type="button" class="btn btn-success" id="cancelUserButton">Annuler la suppression de l'utilisateur</button>
|
||||
<button type="button" class="btn btn-success" id="cancelUserButton">Annuler la suppression de l'évènement</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -8,7 +8,17 @@ var id = getQuery("id");
|
||||
if(id.length > 0){
|
||||
instance.get(pathURL + "s/"+id, {withCredentials: true})
|
||||
.then(function(response){
|
||||
switch(pathURL){
|
||||
case "user":
|
||||
var listValue = [ "id", "username", "name", "firstName", "email", "birth"];
|
||||
break;
|
||||
case "event":
|
||||
var listValue = [ "id", "name", "place", "start_date", "end_date"];
|
||||
break;
|
||||
default:
|
||||
var listValue = []
|
||||
break;
|
||||
}
|
||||
var listTime = ["connected_at", "created_at", "updated_at", "deleted_at", "disabled_at"];
|
||||
for (var i=0; i<listValue.length; i++){
|
||||
if(response.data[listValue[i]] != null){
|
||||
@ -25,6 +35,7 @@ if(id.length > 0){
|
||||
|
||||
var listSelector = ["roles", "status"];
|
||||
for (var i=0; i<listSelector.length; i++){
|
||||
if (document.getElementById(listSelector[i]+"Selector") != null){
|
||||
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]]){
|
||||
@ -32,6 +43,7 @@ if(id.length > 0){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var buttonUser = "";
|
||||
switch(response.data.status){
|
||||
@ -103,7 +115,17 @@ if(id.length > 0){
|
||||
|
||||
|
||||
document.getElementById("updateUserButton").addEventListener("click", function(){
|
||||
var updateProfil = ["id", "username", "email", "firstName", "birth"];
|
||||
switch(pathURL){
|
||||
case "user":
|
||||
var updateProfil = [ "id", "username", "name", "firstName", "email", "birth"];
|
||||
break;
|
||||
case "event":
|
||||
var updateProfil = [ "id", "name", "place", "start_date", "end_date"];
|
||||
break;
|
||||
default:
|
||||
var updateProfil = []
|
||||
break;
|
||||
}
|
||||
var updateOk = true;
|
||||
for (var i=0; i<updateProfil.length; i++){
|
||||
if(document.getElementById(updateProfil[i]+"UpdateInput").value.length == 0){
|
||||
@ -122,7 +144,8 @@ if(id.length > 0){
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch (pathURL){
|
||||
case "user":
|
||||
dataPut = {
|
||||
"id": document.getElementById("idUpdateInput").value,
|
||||
"username": document.getElementById("usernameUpdateInput").value,
|
||||
@ -139,6 +162,27 @@ if(id.length > 0){
|
||||
"disabled_at":"",
|
||||
"connected_at": ""
|
||||
|
||||
};
|
||||
break;
|
||||
case "event":
|
||||
dataPut = {
|
||||
"id": document.getElementById("idUpdateInput").value,
|
||||
"name": document.getElementById("nameUpdateInput").value,
|
||||
"place": document.getElementById("placeUpdateInput").value,
|
||||
"start_date": document.getElementById("start_dateUpdateInput").value,
|
||||
"end_date": document.getElementById("end_dateUpdateInput").value,
|
||||
"status": selector["status"],
|
||||
"created_at": "",
|
||||
"updated_at": "",
|
||||
"deleted_at": "",
|
||||
"disabled_at":"",
|
||||
"connected_at": ""
|
||||
|
||||
};
|
||||
break;
|
||||
default:
|
||||
datePut = {};
|
||||
break;
|
||||
}
|
||||
instance({
|
||||
method : "put",
|
||||
|
Loading…
x
Reference in New Issue
Block a user