Skip to content

Commit

Permalink
merged with branch 44 | added invitations
Browse files Browse the repository at this point in the history
  • Loading branch information
panuozzo77 committed Jan 8, 2024
1 parent 48395f4 commit fbfb818
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 35 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");

}

}
69 changes: 34 additions & 35 deletions src/main/webapp/JSP/homeTherapist.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@
<div class="pop-up">
<div class="text-wrapper-2">PAZIENTI</div>
<div class="overlap-group">
<div class="table-container" id="tableContainer">
<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");
<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" -->
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>
Expand All @@ -51,16 +51,16 @@
<buttom onclick="viewPatient(<%=u.getId()%>)" class="button">Visualizza</buttom>
</td>
</tr>
<!-- </form> -->
<%
<!-- </form> -->
<%
}
} else {
response.sendRedirect("../errorPage/403.html");
}
} else {
response.sendRedirect("../errorPage/403.html");
}
%>
</tbody>
</table>
</div>
%>
</tbody>
</table>
</div>

</div>
</div>
Expand All @@ -84,15 +84,14 @@
<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 class="button-only-text"><button class="button" onclick="openInvitePopup()">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>
<!--POPUP INVITE PATIENT-->
<div id="invitePopup" style="display: none;">
<%@include file="invitePatient.jsp" %>
</div>
<script src="../JS/homeTherapist.js"></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 fbfb818

Please sign in to comment.