From 48c7e38c872d8c6a8c14c76f65e7dbd09258563c Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Tue, 7 Nov 2023 21:09:45 +0100 Subject: [PATCH] add name --- web/html/events.html | 8 +++++--- web/js/addItem.js | 15 +++++++-------- web/js/library.js | 8 +++++--- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/web/html/events.html b/web/html/events.html index c19e7e3..639d999 100644 --- a/web/html/events.html +++ b/web/html/events.html @@ -171,9 +171,10 @@ ID - Username - Mail - Rôle + Nom + Lieu + Date de début + Date de fin Statut @@ -185,6 +186,7 @@ + diff --git a/web/js/addItem.js b/web/js/addItem.js index ce6641d..519548b 100644 --- a/web/js/addItem.js +++ b/web/js/addItem.js @@ -26,14 +26,13 @@ document.getElementById("addUser").addEventListener("click", function(){ } dataPut = { - "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, - "password": document.getElementById("passwordUpdateInput").value, - "roles": selector["roles"] - + "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, + "password": document.getElementById("passwordUpdateInput").value, + "roles": selector["roles"] } instance({ method : "put", diff --git a/web/js/library.js b/web/js/library.js index 8db4cd5..edde26b 100644 --- a/web/js/library.js +++ b/web/js/library.js @@ -59,11 +59,13 @@ function buildParam(typeInput){ if(search.length > 0){ if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(search)){ param = param + "email="+search+"&"; - } else { + } else if (/^[a-fA-F0-9]{24}$/.test(search)){ param = param + "id="+search+"&"; - } + } else { + param = param + "name="+search+"&"; + } } else { - listParam.push("email"); listParam.push("id"); + listParam.push("email"); listParam.push("id"); listParam.push("name"); } for (var i=0; i