addevents and lists finish

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

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;
}
}
}