diff --git a/web/html/event.html b/web/html/event.html index 433d074..328c5e8 100644 --- a/web/html/event.html +++ b/web/html/event.html @@ -126,12 +126,12 @@
@@ -141,7 +141,7 @@ @@ -197,13 +197,13 @@
- Date de début - + Date de début +
- Date de fin - + Date de fin +
@@ -243,11 +243,11 @@
- - - - - + + + + +
diff --git a/web/js/item.js b/web/js/item.js index e6a89c2..36069e9 100644 --- a/web/js/item.js +++ b/web/js/item.js @@ -8,7 +8,17 @@ var id = getQuery("id"); if(id.length > 0){ instance.get(pathURL + "s/"+id, {withCredentials: true}) .then(function(response){ - var listValue = [ "id", "username", "name", "firstName", "email", "birth"]; + 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 0){ var listSelector = ["roles", "status"]; for (var i=0; i 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 0){ } } } - - dataPut = { - "id": document.getElementById("idUpdateInput").value, - "username": document.getElementById("usernameUpdateInput").value, - "email": document.getElementById("emailUpdateInput").value, - "name": document.getElementById("nameUpdateInput").value, - "firstName": document.getElementById("firstNameUpdateInput").value, - "birth": document.getElementById("birthUpdateInput").value, - "status": selector["status"], - "password": document.getElementById("passwordUpdateInput").value, - "roles": selector["roles"], - "created_at": "", - "updated_at": "", - "deleted_at": "", - "disabled_at":"", - "connected_at": "" - + switch (pathURL){ + case "user": + dataPut = { + "id": document.getElementById("idUpdateInput").value, + "username": document.getElementById("usernameUpdateInput").value, + "email": document.getElementById("emailUpdateInput").value, + "name": document.getElementById("nameUpdateInput").value, + "firstName": document.getElementById("firstNameUpdateInput").value, + "birth": document.getElementById("birthUpdateInput").value, + "status": selector["status"], + "password": document.getElementById("passwordUpdateInput").value, + "roles": selector["roles"], + "created_at": "", + "updated_at": "", + "deleted_at": "", + "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",