FUCK IT !!!! (Bon j'ai enfin un peu la page rdv praticient)

This commit is contained in:
sinbad
2024-04-17 17:23:21 +02:00
parent 2fd891b260
commit 65b016b30a
5 changed files with 42 additions and 76 deletions

View File

@@ -2,50 +2,3 @@ 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
###

View File

@@ -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){

View File

@@ -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);

View File

@@ -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('<div class="h-100"> <div class="d-flex flex-row flex-wrap my-5 mx-5 gap-5 justify-content-center text-center">');
let content = document.getElementById("content");
content.innerHTML = "";
content.innerHTML = '<div class="h-100"> <div class="d-flex flex-row flex-wrap my-5 mx-5 gap-5 justify-content-center text-center">';
if(count === 0){
$('#content').append('<h1>Vous n\'avez pas de rendez-vous</h1>');
content.append('<h1>Vous n\'avez pas de rendez-vous</h1>');
}
else {
for (let i = 0; i < count; i++){
date = Date(rdv[i].rdv_date).toDateString();
if (rdv[i].p_mail !== "null")
$('#content').append('' +
console.log(rdv[i]);
if (rdv[i].p_mail !== null){
content.innerHTML = '' +
'<div class="card rounded-4 mx-2 pointer">' +
'<div class="card-header bg-danger">' +
'<div class="d-flex flex-row justify-content-between text-white">' +
@@ -50,9 +73,10 @@ function DisplayRDVPraticient(rdv){
'<a href="mailto:' + rdv[i].p_mail + '" class="card-subtitle mb-2 text-body-secondary">' + rdv[i].email + '</a>' +
'<br>' +
'<a href="tel:0' + rdv[i].p_phone + '" class="card-subtitle mb-2 text-body-secondary">' + '0' + rdv[i].phone + '</a>' +
'</div>' + '</div>');
'</div>' + '</div>';
}
else{
$('#content').append('' +
content.innerHTML = '' +
'<div class="card rounded-4 mx-2 pointer">' +
'<div class="card-header bg-danger">' +
'<div class="d-flex flex-row justify-content-between text-white">' +
@@ -61,30 +85,18 @@ function DisplayRDVPraticient(rdv){
'</div>' + '</div>' +
'<div class="card-body">' +
'<h5 class="card-title">Vous n\'avez pas de' + '<br>' + 'patient pour ce créneau</h5>' +
'</div>' + '</div>');
'</div>' + '</div>';
}
}
}
}
function ButtonShowRdvPraticient() {
try {
document.getElementById("PraticientCalendar").addEventListener("click", function () {
ajaxRequest('GET', "src/API/requests.php/api/rdv-praticient?id=" + 1, function (data) {
DisplayRDVPraticient(data);
});
});
}
catch (e) {
//Do nothing
//console.error(e);
}
}
/*
function DisplayRDVPatient(rdv){
$rdvPatient = rdv[0];
$lieux = rdv[1];
let rdvPatient = rdv[0];
let lieux = rdv[1];
let count = $rdvPatient.length;
$('#content').empty();
@@ -103,10 +115,10 @@ function DisplayRDVPatient(rdv){
'<p>' + $rdvPatient[i].rdv_time + '</p>' +
'</div>' + '</div>' +
'<div class="card-body">' +
'<h5 class="card-title
}
'<h5 class="card-title"
}
}
}*/

View File

@@ -18,6 +18,7 @@ function ajaxRequest(type, url, callback, data = null)
{
case 200:
case 201:
console.log(xhr.responseText);
callback(JSON.parse(xhr.responseText));
break;
default: