mirror of
https://github.com/BreizhHardware/ProjetS4COMWEB.git
synced 2026-01-18 16:47:35 +01:00
Merge branch 'felix' of github.com:BreizhHardware/ProjetS4COMWEB into cfouche
This commit is contained in:
@@ -52,3 +52,11 @@ 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"
|
||||
|
||||
###
|
||||
|
||||
|
||||
17
index.php
17
index.php
@@ -13,20 +13,6 @@
|
||||
<link rel="icon" href="src/img/favicon.png" type="image/x-icon"/>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
require('src/php/db/dbconnect.php');
|
||||
require('src/php/db/Patient.php');
|
||||
require('src/php/db/Medecin.php');
|
||||
require('src/php/constants.php');
|
||||
require('src/php/components/check.php');
|
||||
require('src/php/components/token.php');
|
||||
require('src/php/components/user-login.php');
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
session_start();
|
||||
$pdo = dbConnect();
|
||||
?>
|
||||
<div id="topbar">
|
||||
<div id="topInfo">
|
||||
<a href="index.php">
|
||||
@@ -38,6 +24,7 @@
|
||||
<?php
|
||||
//loginUI($pdo);
|
||||
?>
|
||||
<!--
|
||||
<div class="d-flex flex-row align-items-center gap-3 me-2">
|
||||
<img src="https://1.gravatar.com/avatar/4d43af207280d1d23e2a2905577c7b6167723fec2d33f946cc86f114c1a85b8d?size=64" alt="avatar" id="avatar" style="width: 14.3%; height: auto; border-radius: 50%">
|
||||
<div>
|
||||
@@ -45,6 +32,8 @@
|
||||
</div>
|
||||
<a class="text-white fw-bold link-underline-opacity-75-hover link-underline link-underline-opacity-0 link-offset-3-hover link-underline-light" id="praticien-calendar">Mon calendrier</a>
|
||||
</div>
|
||||
-->
|
||||
<button type="button" class="btn btn-danger" style="top: 0.4375em;" id="login-praticien">Vous êtes praticien ?</button> <button type="button" class="btn btn-danger" style="top: 0.4375em;" id="login-user">Se connecter</button><p> </p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="searchbar"></div>
|
||||
|
||||
@@ -4,6 +4,7 @@ body{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
#DoctISEN{
|
||||
@@ -15,6 +16,53 @@ body{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.login-ui{
|
||||
height: 78vh;
|
||||
background-color: #EEF2F7;
|
||||
}
|
||||
|
||||
.signup-ui{
|
||||
height: 100vh;
|
||||
background-color: #EEF2F7;
|
||||
}
|
||||
|
||||
.signup-ui-praticien{
|
||||
height: 125vh;
|
||||
background-color: #EEF2F7;
|
||||
}
|
||||
|
||||
#signup-sign-part{
|
||||
background-color: white;
|
||||
height: 75%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
|
||||
#login-part{
|
||||
background-color: white;
|
||||
height: 45%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
|
||||
margin-top: 10%;
|
||||
}
|
||||
|
||||
#signup-part{
|
||||
background-color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
|
||||
margin-top: 10%;
|
||||
}
|
||||
|
||||
#topbar{
|
||||
background-color: #ff0000;
|
||||
height: 22vh;
|
||||
@@ -78,13 +126,7 @@ body{
|
||||
padding-top: 5%;
|
||||
}
|
||||
|
||||
.logButton{
|
||||
width: 30%;
|
||||
height: 100%;
|
||||
background-color: #ff0000;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
.pointer{
|
||||
cursor: pointer;
|
||||
|
||||
@@ -249,6 +249,7 @@ function displayHome() {
|
||||
<p class="text-secondary">Annuaire des médecins du CNOM • Annuaire des chirurgiens-dentistes de l'ONCD • Ordre National des Médecins • Ordre National des Chirurgiens-Dentistes</p>
|
||||
</footer>`;
|
||||
attachSearchEventListener();
|
||||
attachLoginUserDisplayEventListener();
|
||||
displayAlert("Rendez-vous pris avec succès");
|
||||
}
|
||||
|
||||
@@ -279,6 +280,271 @@ function performSearch(event) {
|
||||
}
|
||||
}
|
||||
|
||||
function displayLoginUser() {
|
||||
let container = document.getElementById("content");
|
||||
container.innerHTML = "";
|
||||
container.className = 'd-flex flex-column justify-content-center text-center w-100 login-ui';
|
||||
container.innerHTML = `
|
||||
<div class="h-100 d-flex flex-column gap-0 justify-content-center text-center w-50 mx-6">
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0" id="login-part">
|
||||
<div class="text-center align-content-center">
|
||||
<h5 class="text-center fw-bold">J'ai déjà un compte Doct'ISEN</h5>
|
||||
<form class="px-4 py-3">
|
||||
<div class="mb-3">
|
||||
<label for="user-login-mail" class="form-label">Adresse mail</label>
|
||||
<input type="email" class="form-control" id="user-login-mail" placeholder="email@example.com" name="mail">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="user-login-password" class="form-label">Mot de passe</label>
|
||||
<input type="password" class="form-control" id="user-login-password" placeholder="********" name="password">
|
||||
</div>
|
||||
<div class="text-center justify-content-center">
|
||||
<button type="submit" class="btn btn-danger logButton" id="user-login-button">Se connecter</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0 text-center justify-content-center mt-5" id="signup-part">
|
||||
<div class="text-center align-content-center">
|
||||
<h5 class="fw-bold">Nouveau sur Doct'ISEN?</h5>
|
||||
<a id="signup-user">
|
||||
<button class="btn btn-danger logButton">S'inscrire</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
document.getElementById("user-login-button").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
let mail = document.getElementById("user-login-mail").value;
|
||||
let password = document.getElementById("user-login-password").value;
|
||||
let data = "mail=" + mail + "&password=" + password;
|
||||
ajaxRequest('POST', "src/API/requests.php/api/login/patient", function (data) {
|
||||
if (data.success) {
|
||||
sessionStorage.setItem("user_id", data.id);
|
||||
sessionStorage.setItem("user_type", "patient");
|
||||
sessionStorage.setItem("user_mail", mail);
|
||||
sessionStorage.setItem("user_name", data.name);
|
||||
sessionStorage.setItem("user_surname", data.surname);
|
||||
displayHome();
|
||||
} else {
|
||||
alert("Erreur lors de la connexion");
|
||||
}
|
||||
}, data);
|
||||
});
|
||||
document.getElementById("signup-user").addEventListener("click", function(event) {
|
||||
displaySignUpUser();
|
||||
});
|
||||
}
|
||||
|
||||
function displayLoginPraticien() {
|
||||
let container = document.getElementById("content");
|
||||
container.innerHTML = "";
|
||||
container.className = 'd-flex flex-column justify-content-center text-center w-100 login-ui';
|
||||
container.innerHTML = `
|
||||
<div class="h-100 d-flex flex-column gap-0 justify-content-center text-center w-50 mx-6">
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0" id="login-part">
|
||||
<div class="text-center align-content-center">
|
||||
<h5 class="text-center fw-bold">J'ai déjà un compte praticien Doct'ISEN</h5>
|
||||
<form class="px-4 py-3">
|
||||
<div class="mb-3">
|
||||
<label for="praticien-login-mail" class="form-label">Adresse mail</label>
|
||||
<input type="email" class="form-control" id="praticien-login-mail" placeholder="email@example.com" name="mail">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="praticien-login-password" class="form-label">Mot de passe</label>
|
||||
<input type="password" class="form-control" id="praticien-login-password" placeholder="********" name="password">
|
||||
</div>
|
||||
<div class="text-center justify-content-center">
|
||||
<button type="submit" class="btn btn-danger logButton" id="praticien-login-button">Se connecter</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0 text-center justify-content-center mt-5" id="signup-part">
|
||||
<div class="text-center align-content-center">
|
||||
<h5 class="fw-bold">Nouveau praticien sur Doct'ISEN?</h5>
|
||||
<a id="signup-praticien">
|
||||
<button class="btn btn-danger logButton">S'inscrire</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
document.getElementById("praticien-login-button").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
let mail = document.getElementById("praticien-login-mail").value;
|
||||
let password = document.getElementById("praticien-login-password").value;
|
||||
let data = "mail=" + mail + "&password=" + password;
|
||||
ajaxRequest('POST', "src/API/requests.php/api/login/praticien", function (data) {
|
||||
if (data.success) {
|
||||
sessionStorage.setItem("user_id", data.id);
|
||||
sessionStorage.setItem("user_type", "praticien");
|
||||
sessionStorage.setItem("user_mail", mail);
|
||||
sessionStorage.setItem("user_name", data.name);
|
||||
sessionStorage.setItem("user_surname", data.surname);
|
||||
displayHome();
|
||||
} else {
|
||||
alert("Erreur lors de la connexion");
|
||||
}
|
||||
}, data);
|
||||
});
|
||||
document.getElementById("signup-praticien").addEventListener("click", function(event) {
|
||||
displaySignUpPraticien();
|
||||
});
|
||||
}
|
||||
|
||||
function displaySignUpPraticien() {
|
||||
let container = document.getElementById("content");
|
||||
container.innerHTML = "";
|
||||
container.className = 'd-flex flex-column justify-content-center text-center w-100 signup-ui-praticien';
|
||||
container.innerHTML = `
|
||||
<div class="h-100 d-flex flex-column gap-0 justify-content-center text-center w-50 mx-6" style="margin-top: -15%;">
|
||||
<div class="p-3 m-0 border-0 bd-example border-0" id="signup-sign-part">
|
||||
<div class="text-center align-content-center">
|
||||
<h5 class="text-center fw-bold">Inscription praticien sur Doct'ISEN</h5>
|
||||
<form class="px-4 py-3">
|
||||
<div class="mb-3">
|
||||
<label for="praticien-signup-name" class="form-label">Nom</label>
|
||||
<input type="text" class="form-control" id="praticien-signup-name" placeholder="Nom" name="name">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="praticien-signup-surname" class="form-label">Prénom</label>
|
||||
<input type="text" class="form-control" id="praticien-signup-surname" placeholder="Prénom" name="surname">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="praticien-signup-mail" class="form-label">Adresse mail</label>
|
||||
<input type="email" class="form-control" id="praticien-signup-mail" placeholder="example@example.com" name="mail">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="praticien-signup-mail-confirm" class="form-label">Confirmer adresse mail</label>
|
||||
<input type="email" class="form-control" id="praticien-signup-mail-confirm" placeholder="example@example.com" name="mail-confirm">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="praticien-signup-password" class="form-label">Mot de passe</label>
|
||||
<input type="password" class="form-control" id="praticien-signup-password" placeholder="********" name="password">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="praticien-signup-password-confirm" class="form-label">Confirmer mot de passe</label>
|
||||
<input type="password" class="form-control" id="praticien-signup-password-confirm" placeholder="********" name="password-confirm">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="praticien-signup-phone" class="form-label">Numéro de téléphone</label>
|
||||
<input type="tel" class="form-control" id="praticien-signup-phone" placeholder="06********" name="phone">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="praticien-signup-specialty" class="form-label">Spécialité</label>
|
||||
<input type="text" class="form-control" id="praticien-signup-specialty" placeholder="Spécialité" name="specialty">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="praticien-signup-postal" class="form-label">Code postal</label>
|
||||
<input type="text" class="form-control" id="praticien-signup-postal" placeholder="Code postal" name="postal">
|
||||
</div>
|
||||
<div class="text-center justify-content-center">
|
||||
<button type="submit" class="btn btn-danger logButton" id="praticien-signup-button">S'inscrire</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0 text-center justify-content-center mt-5" id="signup-part">
|
||||
<div class="text-center align-content-center">
|
||||
<h5 class="fw-bold">Déjà inscrit en tant que praticien ?</h5>
|
||||
<a id="login-praticien2">
|
||||
<button class="btn btn-danger logButton">Se connecter</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
document.getElementById("login-praticien2").addEventListener("click", function(event) {
|
||||
displayLoginPraticien();
|
||||
});
|
||||
}
|
||||
|
||||
function displaySignUpUser() {
|
||||
let container = document.getElementById("content");
|
||||
container.innerHTML = "";
|
||||
container.className = 'd-flex flex-column justify-content-center text-center w-100 signup-ui';
|
||||
container.innerHTML = `
|
||||
<div class="h-100 d-flex flex-column gap-0 justify-content-center text-center w-50 mx-6" style="margin-top: -15%;">
|
||||
<div class="p-3 m-0 border-0 bd-example border-0" id="signup-sign-part">
|
||||
<div class="text-center align-content-center">
|
||||
<h5 class="text-center fw-bold">Inscription sur Doct'ISEN</h5>
|
||||
<form class="px-4 py-3">
|
||||
<div class="mb-3">
|
||||
<label for="user-signup-name" class="form-label">Nom</label>
|
||||
<input type="text" class="form-control" id="user-signup-name" placeholder="Nom" name="name">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="user-signup-surname" class="form-label">Prénom</label>
|
||||
<input type="text" class="form-control" id="user-signup-surname" placeholder="Prénom" name="surname">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="user-signup-mail" class="form-label">Adresse mail</label>
|
||||
<input type="email" class="form-control" id="user-signup-mail" placeholder="email@example.com" name="mail">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="user-signup-mail-confirm" class="form-label">Confirmer adresse mail</label>
|
||||
<input type="email" class="form-control" id="user-signup-mail-confirm" placeholder="email@example.com" name="mail-confirm">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="user-signup-password" class="form-label">Mot de passe</label>
|
||||
<input type="password" class="form-control" id="user-signup-password" placeholder="********" name="password">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="user-signup-password-confirm" class="form-label">Confirmer mot de passe</label>
|
||||
<input type="password" class="form-control" id="user-signup-password-confirm" placeholder="********" name="password-confirm">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="user-signup-phone" class="form-label">Numéro de téléphone</label>
|
||||
<input type="tel" class="form-control" id="user-signup-phone" placeholder="06********" name="phone">
|
||||
</div>
|
||||
<div class="text-center justify-content-center">
|
||||
<button type="submit" class="btn btn-danger logButton" id="user-signup-button">S'inscrire</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="p-3 m-0 border-0 bd-example m-0 border-0 text-center justify-content-center mt-5" id="signup-part">
|
||||
<div class="text-center align-content-center">
|
||||
<h5 class="fw-bold">Déjà inscrit ?</h5>
|
||||
<a id="login-user2">
|
||||
<button class="btn btn-danger logButton">Se connecter</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
document.getElementById("login-user2").addEventListener("click", function(event) {
|
||||
displayLoginUser();
|
||||
});
|
||||
document.getElementById("user-signup-button").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
let name = document.getElementById("user-signup-name").value;
|
||||
let surname = document.getElementById("user-signup-surname").value;
|
||||
let mail = document.getElementById("user-signup-mail").value;
|
||||
let mailConfirm = document.getElementById("user-signup-mail-confirm").value;
|
||||
let password = document.getElementById("user-signup-password").value;
|
||||
let passwordConfirm = document.getElementById("user-signup-password-confirm").value;
|
||||
let phone = document.getElementById("user-signup-phone").value;
|
||||
if (mail !== mailConfirm) {
|
||||
alert("Les adresses mail ne correspondent pas");
|
||||
return;
|
||||
}
|
||||
if (password !== passwordConfirm) {
|
||||
alert("Les mots de passe ne correspondent pas");
|
||||
return;
|
||||
}
|
||||
let data = "name=" + name + "&surname=" + surname + "&mail=" + mail + "&password=" + password + "&phone=" + phone;
|
||||
ajaxRequest('POST', "src/API/requests.php/api/signup/patient", function (data) {
|
||||
if (data.success) {
|
||||
sessionStorage.setItem("user_id", data.id);
|
||||
sessionStorage.setItem("user_type", "patient");
|
||||
sessionStorage.setItem("user_mail", mail);
|
||||
sessionStorage.setItem("user_name", name);
|
||||
sessionStorage.setItem("user_surname", surname);
|
||||
displayHome();
|
||||
} else {
|
||||
alert("Erreur lors de l'inscription");
|
||||
}
|
||||
}, data);
|
||||
});
|
||||
}
|
||||
|
||||
function attachSearchEventListener() {
|
||||
try{
|
||||
document.getElementById("recherche").addEventListener("click", function (event) {
|
||||
@@ -322,6 +588,31 @@ function attachPrendreRDVEventListener() {
|
||||
});
|
||||
}
|
||||
|
||||
function attachLoginUserDisplayEventListener() {
|
||||
try {
|
||||
document.getElementById("login-user").addEventListener("click", function (event) {
|
||||
displayLoginUser();
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
//Do nothing
|
||||
//console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
function attachLoginPraticienDisplayEventListener() {
|
||||
try {
|
||||
document.getElementById("login-praticien").addEventListener("click", function (event) {
|
||||
displayLoginPraticien();
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
//Do nothing
|
||||
//console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Yanis Part
|
||||
|
||||
function DisplayRDVPraticient(rdv){
|
||||
@@ -383,4 +674,6 @@ function ButtonShowRdvPraticient() {
|
||||
//End Call
|
||||
|
||||
ButtonShowRdvPraticient();
|
||||
attachSearchEventListener();
|
||||
attachSearchEventListener();
|
||||
attachLoginUserDisplayEventListener();
|
||||
attachLoginPraticienDisplayEventListener();
|
||||
@@ -24,7 +24,7 @@
|
||||
echo '<a href="rdv-praticien.php" class="text-white fw-bold link-underline-opacity-75-hover link-underline link-underline-opacity-0 link-offset-3-hover link-underline-light">Mon calendrier</a></div>';
|
||||
}
|
||||
} else {
|
||||
echo '<a href="login-praticien.php"> <button type="button" class="btn btn-danger" style="top: 0.4375em;">Vous êtes praticien ?</button> </a><a href="login.php"> <button type="button" class="btn btn-danger" style="top: 0.4375em;">Se connecter</button></a><p> </p>';
|
||||
echo '<a href="login-praticien.php"> <button type="button" class="btn btn-danger" style="top: 0.4375em;" id="login-praticien">Vous êtes praticien ?</button> </a><a href="login.php"> <button type="button" class="btn btn-danger" style="top: 0.4375em;" id="login-user">Se connecter</button></a><p> </p>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user