diff --git a/Request_Test/testHTTP.http b/Request_Test/testHTTP.http index b6ac60f..e4e1141 100644 --- a/Request_Test/testHTTP.http +++ b/Request_Test/testHTTP.http @@ -55,8 +55,39 @@ test = "coucou" POST http://serveur-projet-s4.felix/src/API/requests.php/api/login/patient Content-Type: application/x-www-form-urlencoded -mail = "nicolasgrenier@example.com" & -password = "a" +mail = nicolasgrenier@example.com & +password = a ### +POST http://serveur-projet-s4.felix/src/API/requests.php/api/login/medecin +Content-Type: application/x-www-form-urlencoded + +mail = cberger@example.org & +password = a + +### + +PUT http://serveur-projet-s4.felix/src/API/requests.php/api/signup/patient +Content-Type: application/x-www-form-urlencoded + +mail = felix.marquet@isen-ouest.yncrea.fr & +password = a & +name = Marquet & +surname = Félix & +phone = 0645383602 + +### + +PUT http://serveur-projet-s4.felix/src/API/requests.php/api/signup/medecin +Content-Type: application/x-www-form-urlencoded + +mail = felix.marquet@isen-ouest.yncrea.fr & +password = a & +name = Marquet & +surname = Félix & +phone = 0645383602 & +specialite = Test & +postal = 44470 + +### \ No newline at end of file diff --git a/index.php b/index.php index 40fdcb9..d189965 100644 --- a/index.php +++ b/index.php @@ -82,5 +82,7 @@ + + \ No newline at end of file diff --git a/src/js/AJAX/index.js b/src/js/AJAX/index.js index 2220f87..38aaa3c 100644 --- a/src/js/AJAX/index.js +++ b/src/js/AJAX/index.js @@ -204,13 +204,81 @@ function clearAlert() { alert.innerHTML = ""; } +function displayHomeTopBar() { + let topbar = document.getElementById("topbar"); + topbar.innerHTML = ""; + if(sessionStorage.getItem("token") === null) { + topbar.innerHTML = ` +
+ +

+ Doct'ISEN +

+
+
+

+
+
+ `; + attachLoginUserDisplayEventListener(); + attachLoginPraticienDisplayEventListener(); + } + else { + let token = sessionStorage.getItem("token"); + let user = TokenDecode(token); + const mailMD5 = CryptoJS.MD5(user.mail); + if(user.type === "patient") { + topbar.innerHTML = ` +
+ +

+ Doct'ISEN +

+
+
+ avatar +
+

${user.name} ${user.surname}

+
+ +
+
`; + } + else if (user.type === "medecin") { + topbar.innerHTML = ` +
+ +

+ Doct'ISEN +

+
+
+ avatar +
+

${user.name} ${user.surname}

+
+ +
+
`; + } + else { + topbar.innerHTML = ` +
+

Erreur

+
`; + } + } +} + function displayHome() { removeSearchTopBar(); + displayHomeTopBar(); let container = document.getElementById("content"); + container.classList = ""; container.innerHTML = ""; container.innerHTML = `
-
+
img_index

Trouvez un rendez vous avec un medecin

@@ -593,7 +661,7 @@ function attachPrendreRDVEventListener() { buttons.forEach(function (button) { button.addEventListener("click", function (event) { let RDVid = event.target.id.split("-")[2]; - data = "rdv_id=" + RDVid + "&patient_id=" + 1; + let data = "rdv_id=" + RDVid + "&patient_id=" + 1; ajaxRequest('PUT', "src/API/requests.php/api/rdv", function (returnData){ if (returnData.success) { displayHome();