addevents and lists finish

This commit is contained in:
Valentin CZERYBA 2023-11-12 18:41:15 +01:00
parent f5135eb85a
commit 6f32a4d1eb
4 changed files with 33 additions and 30 deletions

View File

@ -107,13 +107,13 @@
<div class="position-sticky pt-3 sidebar-sticky">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link" aria-current="page" href="#">
<a class="nav-link" aria-current="page" href="/html/users.html">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home align-text-bottom" aria-hidden="true"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>
Utilisateurs
</a>
</li>
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/html/events.html">
<a class="nav-link active" aria-current="page" href="#">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home align-text-bottom" aria-hidden="true"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>
Évènements
</a>
@ -138,7 +138,7 @@
<h2>Liste d'évènement</h2>
<div class="table-responsive">
<div class="row g-3">
<div class="col-auto">
<label for="inputStatus" class="form-label">Statut</label>
<select class="form-select" id="inputStatus" aria-label="Default select example">
@ -159,12 +159,13 @@
<option value="100">100</option>
</select>
</div>
</div>
</div>
<br />
<button type="button" class="btn btn-success" id="enableUserButton" data-bs-toggle="modal" data-bs-target="#enableUserModal">Activer l'utilisateur</button>
<button type="button" class="btn btn-success" id="enableUserButton" data-bs-toggle="modal" data-bs-target="#enableUserModal">Activer l'évènement</button>
<button type="button" class="btn btn-warning " id="disableUserButton" data-bs-toggle="modal" data-bs-target="#disableUserModal">Désactiver l'utilisateur</button>
<button type="button" class="btn btn-danger" id="removeUserButton" data-bs-toggle="modal" data-bs-target="#removeUserModal">Supprimer l'utilisateur</button>
<button type="button" class="btn btn-warning " id="disableUserButton" data-bs-toggle="modal" data-bs-target="#disableUserModal">Désactiver l'évènement</button>
<button type="button" class="btn btn-danger" id="removeUserButton" data-bs-toggle="modal" data-bs-target="#removeUserModal">Supprimer l'évènement</button>
<br /><br /><br />
<table id=users class="table table-striped table-sm">
<thead>

View File

@ -6,10 +6,10 @@ pathURL = document.location.pathname.split("/")[document.location.pathname.split
document.getElementById("addUser").addEventListener("click", function(){
switch (pathURL){
case "users":
case "user":
var updateProfil = ["username", "email", "firstName", "birth", "password"];
break;
case "events":
case "event":
var updateProfil = ["name", "place", "start_date", "end_date"];
break;
default:
@ -18,7 +18,7 @@ document.getElementById("addUser").addEventListener("click", function(){
}
var updateOk = true;
for (var i=0; i<updateProfil.length; i++){
if(updateProfile[i] == "place"){
if(updateProfil[i] == "place"){
size = document.getElementsByClassName("mapboxgl-ctrl-geocoder--input")[0].value.length
} else {
size= document.getElementById(updateProfil[i]+"UpdateInput").value.length
@ -40,7 +40,7 @@ document.getElementById("addUser").addEventListener("click", function(){
}
}
switch(pathURL){
case "users":
case "user":
dataPut = {
"username": document.getElementById("usernameUpdateInput").value,
"email": document.getElementById("emailUpdateInput").value,
@ -51,7 +51,7 @@ document.getElementById("addUser").addEventListener("click", function(){
"roles": selector["roles"]
};
break;
case "events":
case "event":
dataPut = {
"name": document.getElementById("nameUpdateInput").value,
"place": document.getElementsByClassName("mapboxgl-ctrl-geocoder--input")[0].value,

View File

@ -1,7 +1,7 @@
mapboxgl.accessToken = 'pk.eyJ1IjoidmFsY3plODAiLCJhIjoiY2xpY2FhOTM5MGxwczNrdGV6a2J1Z2Q4diJ9.I_WRpX1aO4z32ajcE2Ef7A';
const geocoder = new MapboxGeocoder({
accessToken: mapboxgl.accessToken,
types: 'country,region,place,postcode,locality,neighborhood'
types: 'country,region,place,postcode,locality,neighborhood,poi'
});
geocoder.addTo('#placeUpdateInput');

View File

@ -29,24 +29,26 @@ function buildParam(typeInput){
listId =["inputRoles", "inputStatus", "inputPages"]
for (var i=0; i<listId.length; i++) {
var select = document.getElementById(listId[i]);
var getId = select.options[select.selectedIndex].value;
switch (listId[i])
{
case "inputRoles":
if (getId != "All"){
param = param + "roles=" + getId + "&";
}
break;
case "inputStatus":
if (getId != "-2"){
param = param + "status=" + getId + "&";
}
break;
case "inputPages":
param = param + "limit=" + getId + "&";
break;
default:
break;
if (select != null){
var getId = select.options[select.selectedIndex].value;
switch (listId[i])
{
case "inputRoles":
if (getId != "All"){
param = param + "roles=" + getId + "&";
}
break;
case "inputStatus":
if (getId != "-2"){
param = param + "status=" + getId + "&";
}
break;
case "inputPages":
param = param + "limit=" + getId + "&";
break;
default:
break;
}
}
}