diff --git a/Request_Test/testHTTP.http b/Request_Test/testHTTP.http index 1c42112..7ebcd87 100644 --- a/Request_Test/testHTTP.http +++ b/Request_Test/testHTTP.http @@ -1,51 +1,4 @@ GET http://ajax.yanisrff/src/API/requests.php/api/rdv-praticient?id=1 Accept: application/json -### - -POST http://serveur-projet-s4.felix/src/API/requests.php/api/requests -Content-Type: application/x-www-form-urlencoded - -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 - -### - -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/src/API/requests.php b/src/API/requests.php index 50d3b3b..90f2464 100644 --- a/src/API/requests.php +++ b/src/API/requests.php @@ -128,7 +128,7 @@ $router->DELETE('/api/requests', ["test"], function($test){ $router->GET('/api/rdv-praticient', ["id"], function($id){ global $pdo; dbRequestRdvPraticien($pdo, $id); - getAllLieux($pdo); + //getAllLieux($pdo); }); $router->GET('/api/rdv-patient', ["id"], function($id){ diff --git a/src/API/test/database.php b/src/API/test/database.php index d596c37..cbdca98 100644 --- a/src/API/test/database.php +++ b/src/API/test/database.php @@ -49,7 +49,7 @@ function dbRequestRdvPatient($pdo, $id){ INNER JOIN lieu on lieu.l_id = rendez_vous.l_id WHERE NOW() <= (rdv_date + rdv_time) AND patient.p_id = :id - ORDER BY rdv_date, rdv_time ASC"); + ORDER BY rdv_date ASC, rdv_time ASC"); $statement->bindParam(':id', $id); $statement->execute(); @@ -71,7 +71,7 @@ function getPastRdvByPatient($pdo, $id){ INNER JOIN lieu on lieu.l_id = rendez_vous.l_id WHERE NOW() > (rdv_date + rdv_time) AND patient.p_id = :id - ORDER BY rdv_date, rdv_time ASC"); + ORDER BY rdv_date DESC, rdv_time DESC LIMIT 5"); $statement->bindParam(':id', $id); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); diff --git a/src/js/AJAX/index.js b/src/js/AJAX/index.js index 573c65b..4b78cb1 100644 --- a/src/js/AJAX/index.js +++ b/src/js/AJAX/index.js @@ -1,6 +1,7 @@ import {attachSearchEventListener} from "./search.js"; import {attachLoginUserDisplayEventListener, attachLoginPraticienDisplayEventListener, attachDisconnectEventListener} from "./login.js"; import {displayHome, displayHomeTopBar} from "./home.js"; +import {TokenDecode} from "./lib.js"; console.log("index.js loaded"); @@ -27,18 +28,40 @@ function attachReturnHomeEventListener() { //Yanis Part +document.addEventListener("DOMContentLoaded", function() { + ButtonShowRdvPraticient(); +}); + +function ButtonShowRdvPraticient() { + try { + console.log("test1"); + document.getElementById("praticien-calendar").addEventListener("click", function () { + console.log("test2"); + ajaxRequest('GET', "src/API/requests.php/api/rdv-praticient?id=" + 1, function (data) { + console.log("test3"); + DisplayRDVPraticient(data); + }); + }); + } + catch (e) { + //Do nothing + //console.error(e); + } +} + function DisplayRDVPraticient(rdv){ let count = rdv.length; - $('#content').empty(); - $('#content').html('
' + $rdvPatient[i].rdv_time + '
' + '