Skip to content

Commit

Permalink
Merge pull request #50 from pastore99/44-implementation-provide-fe-fo…
Browse files Browse the repository at this point in the history
…r-inviting-patients

44 implementation provide fe for inviting patients
  • Loading branch information
panuozzo77 authored Jan 8, 2024
2 parents ba24b2e + e69079d commit db2a396
Show file tree
Hide file tree
Showing 5 changed files with 216 additions and 99 deletions.
25 changes: 25 additions & 0 deletions src/main/java/controller/invitePatient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package controller;

import model.service.condition.ConditionManager;
import model.service.registration.Registration;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;


@WebServlet("/invitePatient")
public class invitePatient extends HttpServlet {

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
HttpSession session = request.getSession();
model.service.registration.Registration registration=new Registration();
registration.invitePatient((Integer) session.getAttribute("id"),(String) request.getParameter("email"),(String) request.getParameter("nome"),(String) request.getParameter("cognome"));
response.sendRedirect("JSP/homeTherapist.jsp");

}

}
130 changes: 130 additions & 0 deletions src/main/webapp/CSS/invitePatient.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
* {
margin: 0;
padding: 0;
font-family: Georgia, sans-serif;
}

body {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
}

a {
color: #199a8e;
text-decoration: none;
font-size: 13px;
}

/* Aggiunta di stili per il pop-up */
#InvitePopupOverlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 1000;
justify-content: center;
align-items: center;
}

#InvitePage {
width: 154px;
background-color: #fff;
padding: 80px;
border-radius: 10px;
text-align: center;
position: fixed;
top: 43%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1001;
border: 2px solid #000;
}


.homeTherapistOverlay {
transition: opacity 0.3s ease;
}

#InvitePopupOverlay.visible .homeTherapistOverlay {
opacity: 0.5;
}

#InviteTitle{
margin-top: -16%;
font-size: 20px;;
}


#InviteForm{
margin-top: 5%;
width: 70%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}

.inputDiv{
width: 217%;
display: flex;
flex-direction: row;
justify-content: space-between;
background-color: #f9fafb;
border: 2px solid #e8eaed;
border-radius: 500px;
margin-bottom: -1%;
}

.icon{
display: flex;
justify-content: center;
align-items: center;
text-align: center;
width: 10%;
}

.iconLeft{
margin-left: 3%;
}



.icon > img{
width: 50%;
}

.formInput{
padding: 5% 7%;
height: 90%;
width: 80%;
border: none;
border-radius: 27px;
background-color: #f9fafb;
font-size: 15px;
}

.formInput:focus{
border: none;
outline: none;
}


#InviteButton{
color: white;
width: 100%;
background-color: #199a8e;
border: none;
padding: 5% 10%;
border-radius: 500px;
margin-bottom: 20px;
display: inline-block;
font-size: 21px;
}



Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,15 @@ $(document).ready(function () {
}
});
});
});
});
/*POPUP INVITE PATIENT*/
function openInvitePopup() {
document.getElementById("invitePopup").style.display = "block";
}
function InvitePatient(){
window.location.href = "invitePatient.jsp";
}
/*VIEW PATIENT*/
function viewPatient(i){
window.location.href = "view_patient.jsp?patientID="+i;
}
98 changes: 0 additions & 98 deletions src/main/webapp/JSP/homeTherapist.jsp
Original file line number Diff line number Diff line change
@@ -1,98 +0,0 @@
<%@ page import="model.entity.*"%>
<%@ page import="model.service.user.UserData"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.text.SimpleDateFormat" %>
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<meta charset="utf-8" />
<link rel="stylesheet" href="../CSS/homeTherapistGuide.css" />
<link rel="stylesheet" href="../CSS/homeTherapist.css" />
<title>Home</title>
</head>
<body>
<div class="element-home-logopedista">
<div class="div">
<div class="pop-up">
<div class="text-wrapper-2">PAZIENTI</div>
<div class="overlap-group">
<div class="table-container" id="tableContainer">

<table>
<thead class="table-header">
<tr>
<th></th> <!--icon-->
<th></th> <!--full name-->
<th>Inizio Terapia</th> <!--start date of therapy-->
<th>Progressi</th> <!--progress-->
</tr>
</thead>
<tbody>
<%
if(session.getAttribute("type")!=null && session.getAttribute("type").equals("therapist")){
@SuppressWarnings("unchecked")
ArrayList<UserInfo> list_user= new UserData().getUsersAndPersonalInfoByIdTherapist((Integer) session.getAttribute("id"));
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
for(UserInfo u: list_user){
%>
<!-- <form action="../view_patientServlet" method="post" -->
<tr class="hoverable-row">
<td><svg xmlns="http://www.w3.org/2000/svg" height="16" width="18" viewBox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 96c48.6 0 88 39.4 88 88s-39.4 88-88 88-88-39.4-88-88 39.4-88 88-88zm0 344c-58.7 0-111.3-26.6-146.5-68.2 18.8-35.4 55.6-59.8 98.5-59.8 2.4 0 4.8 .4 7.1 1.1 13 4.2 26.6 6.9 40.9 6.9 14.3 0 28-2.7 40.9-6.9 2.3-.7 4.7-1.1 7.1-1.1 42.9 0 79.7 24.4 98.5 59.8C359.3 421.4 306.7 448 248 448z"/></svg></td>
<td><%=u.getFirstname()%> <%=u.getLastname()%></td>
<td><%= sdf.format(u.getActivationDate()) %></td>
<td>
<div class="element-wrapper"><div class="element">72%</div></div>
</td>
<td>
<input type="hidden" name="userId" value="<%= u.getId() %>">
<!-- <button type="submit" class="button">Visualizza</button> -->
<buttom onclick="viewPatient(<%=u.getId()%>)" class="button">Visualizza</buttom>
</td>
</tr>
<!-- </form> -->
<%
}
} else {
response.sendRedirect("../errorPage/403.html");
}
%>
</tbody>
</table>
</div>

</div>
</div>
<!--NAVBAR-->
<div class="overlap-3">
<div class="rectangle-2"></div>
<div class="group-2">
<div class="iconly-light-outline"><img class="home" src="../images/homeTherapist/home.png" /></div>
<img class="iconly-bold-calendar" src="../images/homeTherapist/iconly-bold-calendar.svg" />
<img class="iconly-light-message" src="../images/homeTherapist/iconly-light-message.svg" />
<img class="iconly-light-profile" src="../images/homeTherapist/iconly-light-profile.svg" />
</div>
<img class="img" src="../images/homeTherapist/doctor.png" />
<img class="logovettoriale" src="../images/homeTherapist/logovettoriale-1.png" />
<img class="line" src="../images/homeTherapist/line-9.svg" />
<div class="text-wrapper-3">Dr.</br> <%=(String) session.getAttribute("name") + " " + (String)session.getAttribute("surname")%></div>
<img class="ellipse-2" src="../images/homeTherapist/ellipse-94.svg" />
</div>
<div class="material-symbols-wrapper">
<input type="text" id="searchInput" placeholder="Cerca per nome o cognome">
<img class="material-symbols" src="../images/homeTherapist/material-symbols-search-rounded.svg" />
</div>
<div class="overlap">
<div class="button-only-text"><button class="button">Invita paziente</button></div>
</div>
</div>
</div>
<script src="../JS/searchBar.js"></script>
<script>
function viewPatient(i){
window.location.href = "viewPatient.jsp?patientID="+i;
}
</script>
</body>
</html>
49 changes: 49 additions & 0 deletions src/main/webapp/JSP/invitePatient.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="it">
<head>
<title>Invita Paziente</title>
</head>
<body>
<%
if(session.getAttribute("type")!=null && session.getAttribute("type").equals("therapist")){
%>
<div id="InvitePage">
<div id="InviteTitle">
<p>Invita Paziente</p>
</div>
<br>
<form id="InviteForm" action="../invitePatient" method="post">
<div class="inputDiv">
<div class="icon iconLeft">
<img class="img" src="../images/registration/icon-email.svg" />
</div>
<input class="formInput" type="email" name="email" placeholder="La sua email" required>
</div>
<br>
<div class="inputDiv">
<div class="icon iconLeft">
<img class="img" src="../images/registration/icon-user-outline.svg" />
</div>
<input class="formInput" type="text" name="nome" placeholder="Nome" required>
</div>
<br>
<div class="inputDiv">
<div class="icon iconLeft">
<img class="img" src="../images/registration/icon-user-outline.svg" />
</div>
<input class="formInput" type="text" name="cognome" placeholder="Cognome" required>
</div>
<br>
<br>
<button type="submit" value="Invite" id="InviteButton">Invita</button>
<a id="return" href="homeTherapist.jsp"> < Torna alla home</a>
</form>
</div>
<link rel="stylesheet" href="../CSS/invitePatient.css">
<%
}else {
response.sendRedirect("../errorPage/403.html");
}
%>
</body>
</html>

0 comments on commit db2a396

Please sign in to comment.