Merge branch 'refs/heads/main' into felix

This commit is contained in:
2024-04-17 17:28:28 +02:00
6 changed files with 64 additions and 156 deletions

View File

@@ -1,93 +1,4 @@
GET http://serveur-projet-s4.felix/src/API/requests.php/api/search?type=Généraliste&location=35
GET http://ajax.yanisrff/src/API/requests.php/api/rdv-praticient?id=1
Accept: application/json
###
GET http://serveur-projet-s4.felix/src/API/requests.php/api/search-postal?postal=44
Accept: application/json
###
GET http://serveur-projet-s4.felix/src/API/requests.php/api/search-type?type=Généraliste
Accept: application/json
###
GET http://serveur-projet-s4.felix/src/API/requests.php/api/rdv-available?id=1
Accept: application/json
###
GET http://serveur-projet-s4.felix/src/API/requests.php/api/rdv-date?date=2024-03-18&id=1
Accept: application/json
###
GET http://serveur-projet-s4.felix/src/API/requests.php/api/search?type=G%C3%A9n%C3%A9raliste&postal=35
Accept: application/json
###
GET http://serveur-projet-s4.felix/src/API/requests.php/api/praticien?id=1
Accept: application/json
###
PUT http://serveur-projet-s4.felix/src/API/requests.php/api/rdv
Content-Type: application/x-www-form-urlencoded
rdv_id = 46792 &
patient_id = 1
###
PUT 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/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

@@ -1,48 +1,4 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title> RDV </title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Just+Me+Again+Down+Here&family=Open+Sans&display=swap" rel="stylesheet">
<link rel="stylesheet" href="src/css/styles.css">
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
<?php
require('src/php/db/dbconnect.php');
require('src/php/constants.php');
require('src/php/db/Login.php');
require('src/php/components/check.php');
require('src/php/components/token.php');
require('src/php/components/user-login.php');
require('src/php/db/Medecin.php');
require('src/php/db/Patient.php');
require('src/php/db/Rdv-praticien.php');
ini_set('display_errors', 1);
error_reporting(E_ALL);
$pdo = dbConnect();
session_start();
checkMedecin();
?>
</head>
<body>
<div id="topbar" class="d-flex justify-content-between flex-row">
<div>
<a href="index.php">
<p id="DoctISEN" class="top-0">
Doct'ISEN
</p>
</a>
</div>
<div class="d-flex flex-row align-items-center gap-3 me-2">
<div class="d-flex flex-row align-items-center gap-3 me-2">
<?php
loginUI($pdo);
?>
</div>
</div>
</div>
<div class="h-100">
<div class="d-flex flex-row flex-wrap my-5 mx-5 gap-5 justify-content-center text-center">

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,8 @@
import {attachSearchEventListener} from "./search.js";
import {attachLoginUserDisplayEventListener, attachLoginPraticienDisplayEventListener, attachDisconnectEventListener} from "./login.js";
import {TokenDecode} from "./lib.js";
import {displayHome, displayHomeTopBar, attachReturnHomeEventListener} from "./home.js";
console.log("index.js loaded");
@@ -15,17 +17,40 @@ document.addEventListener("DOMContentLoaded", function() {
//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++){
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">' +
@@ -37,9 +62,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">' +
@@ -48,26 +74,40 @@ 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("CalendarPraticient").addEventListener("click", function () {
ajaxRequest('GET', "src/API/requests.php/api/rdv-praticient?id=" + 1, function (data) {
DisplayRDVPraticient(data);
});
});
/*
function DisplayRDVPatient(rdv){
let rdvPatient = rdv[0];
let lieux = rdv[1];
let count = $rdvPatient.length;
$('#content').empty();
$('#content').html('<div class="h-100"> <div class="row"> <div class="col-3 border-end border-dark border-3 h-100 mt-2 text-center d-flex flex-column justify-content-center"> <div class="d-flex flex-column"> <div class="border-bottom pb-3 border-dark border-3 align-self-center"> <h5 class="text-center">Vos rendez-vous à venir</h5>');
if(count === 0){
$('#content').append('<h1>Bienvenue sur Doct\'ISEN, veuillez prendre un rendez-vous en allant à l\'acceuil et en recherchant un praticient!</h1>');
}
catch (e) {
//Do nothing
//console.error(e);
else {
for (let i = 0; i < count; i++){
if($rdvPatient !== "null")
$('#content').append('' +
'<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">' +
'<p>' + $rdvPatient[i].rdv_date + '</p>' +
'<p>' + $rdvPatient[i].rdv_time + '</p>' +
'</div>' + '</div>' +
'<div class="card-body">' +
'<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: