From 0a6b087db0c2112823c62425292dde535ec57fa8 Mon Sep 17 00:00:00 2001 From: "ms@Nicro" Date: Thu, 18 Jan 2024 15:44:40 +0100 Subject: [PATCH] Completed merge, removed useless pages, completed Therapist homepage --- src/main/java/controller/Login.java | 2 +- .../CSS/RecommendationAndConditionManager.css | 43 +++++ src/main/webapp/CSS/acceptanceExercisesAI.css | 4 +- src/main/webapp/CSS/homepageTherapist.css | 17 +- src/main/webapp/CSS/viewPatientInfo.css | 10 ++ src/main/webapp/JS/exercise.js | 2 +- src/main/webapp/JS/homeTherapist.js | 35 ----- src/main/webapp/JS/homepageTherapist.js | 40 ++++- src/main/webapp/JS/navbar.js | 10 +- src/main/webapp/JS/viewPatientInfo.js | 34 ++++ .../JSP/{AiApprove.jsp => aiApprove.jsp} | 50 +++--- .../webapp/JSP/exerciseRecommendation.jsp | 25 ++- src/main/webapp/JSP/homeConditionManager.jsp | 40 ----- .../webapp/JSP/homeExerciseRecommendation.jsp | 41 ----- src/main/webapp/JSP/homeTherapist.jsp | 100 ------------ src/main/webapp/JSP/homepageTherapist.jsp | 17 +- src/main/webapp/JSP/invitePatient.jsp | 2 +- .../webapp/JSP/patientConditionManager.jsp | 32 ++-- src/main/webapp/JSP/patientReport.jsp | 2 +- src/main/webapp/JSP/viewPatient.jsp | 148 ------------------ src/main/webapp/JSP/viewPatientInfo.jsp | 37 ++--- src/main/webapp/images/AI.png | Bin 0 -> 6102 bytes src/main/webapp/images/AISelected.png | Bin 0 -> 6143 bytes 23 files changed, 230 insertions(+), 461 deletions(-) delete mode 100644 src/main/webapp/JS/homeTherapist.js create mode 100644 src/main/webapp/JS/viewPatientInfo.js rename src/main/webapp/JSP/{AiApprove.jsp => aiApprove.jsp} (78%) delete mode 100644 src/main/webapp/JSP/homeConditionManager.jsp delete mode 100644 src/main/webapp/JSP/homeExerciseRecommendation.jsp delete mode 100644 src/main/webapp/JSP/homeTherapist.jsp delete mode 100644 src/main/webapp/JSP/viewPatient.jsp create mode 100644 src/main/webapp/images/AI.png create mode 100644 src/main/webapp/images/AISelected.png diff --git a/src/main/java/controller/Login.java b/src/main/java/controller/Login.java index b4fef2f..a3213bb 100644 --- a/src/main/java/controller/Login.java +++ b/src/main/java/controller/Login.java @@ -64,7 +64,7 @@ private String setSessionAttributes(int id, HttpServletRequest request){ else { session.setAttribute("type", "therapist"); session.setAttribute("surname", personalInfo.getLastname()); - return "JSP/homeTherapist.jsp"; + return "JSP/homepageTherapist.jsp"; } } } diff --git a/src/main/webapp/CSS/RecommendationAndConditionManager.css b/src/main/webapp/CSS/RecommendationAndConditionManager.css index f99ffc5..d9f870c 100644 --- a/src/main/webapp/CSS/RecommendationAndConditionManager.css +++ b/src/main/webapp/CSS/RecommendationAndConditionManager.css @@ -39,4 +39,47 @@ caption { outline: none; border-color: #145C53; box-shadow: 0 0 5px rgba(25, 154, 142, 0.5); +} + +.buttonApprove { + display: inline-block; + padding: 8px 16px; + font-size: 14px; + font-weight: bold; + text-align: center; + text-decoration: none; + cursor: pointer; + border: 2px solid #199A8E; + color: #199A8E; + background-color: transparent; + border-radius: 3px; + transition: background-color 0.3s, color 0.3s, border-color 0.3s; + margin-bottom: 5px; +} + +.buttonRemove { + display: inline-block; + padding: 8px 16px; + font-size: 14px; + font-weight: bold; + text-align: center; + text-decoration: none; + cursor: pointer; + border: 2px solid #f44336; + color: #f44336; + background-color: transparent; + border-radius: 3px; + transition: background-color 0.3s, color 0.3s, border-color 0.3s; +} + +.buttonApprove:hover { + background-color: #199A8E; + color: #fff; + border-color: #fff; +} + +.buttonRemove:hover { + background-color: #f44336; + color: #fff; + border-color: #fff; } \ No newline at end of file diff --git a/src/main/webapp/CSS/acceptanceExercisesAI.css b/src/main/webapp/CSS/acceptanceExercisesAI.css index 9d73643..f02a8fc 100644 --- a/src/main/webapp/CSS/acceptanceExercisesAI.css +++ b/src/main/webapp/CSS/acceptanceExercisesAI.css @@ -15,7 +15,7 @@ } -table { +#aiContent table { width: 100%; border-collapse: collapse; margin-top: 20px; @@ -25,7 +25,7 @@ table { } -th, td { +#aiContent th, td { padding: 10px; text-align: center; } diff --git a/src/main/webapp/CSS/homepageTherapist.css b/src/main/webapp/CSS/homepageTherapist.css index 80f81a0..7111921 100644 --- a/src/main/webapp/CSS/homepageTherapist.css +++ b/src/main/webapp/CSS/homepageTherapist.css @@ -56,6 +56,7 @@ body{ #navIcons > div > img{ width: 25%; + cursor: pointer; } #logoIcon{ @@ -67,6 +68,7 @@ body{ display: flex; flex-direction: column; margin-bottom: 40%; + cursor: pointer; } #docIcon{ @@ -168,11 +170,24 @@ tr.hoverable-row:hover { color: deepskyblue; } -#scrollableDiv { +.scrollableDiv { display: flex; align-content: center; + text-align: center; + align-items: center; justify-content: center; + flex-direction: column; width: 100%; max-height: 100%; overflow-y: auto; +} + +#aiContainer{ + display: none; + max-height: 100%; + overflow-y: auto; +} + +#NoExercise{ + text-align: center; } \ No newline at end of file diff --git a/src/main/webapp/CSS/viewPatientInfo.css b/src/main/webapp/CSS/viewPatientInfo.css index 04ad18a..5c350e4 100644 --- a/src/main/webapp/CSS/viewPatientInfo.css +++ b/src/main/webapp/CSS/viewPatientInfo.css @@ -47,3 +47,13 @@ height: 90%; width: 90%; } + +#exercisesDiv, #conditionsDiv{ + max-height: 90%; + overflow: auto; +} + + + + + diff --git a/src/main/webapp/JS/exercise.js b/src/main/webapp/JS/exercise.js index 3fb2000..ff6c5bf 100644 --- a/src/main/webapp/JS/exercise.js +++ b/src/main/webapp/JS/exercise.js @@ -122,7 +122,7 @@ function redirect(where){ if (USERTYPE === "patient"){ window.location.href = "homePagePatient.jsp"; }else if (USERTYPE === "therapist"){ - window.location.href = "homeTherapist.jsp"; + window.location.href = "homepageTherapist.jsp"; } } else{ diff --git a/src/main/webapp/JS/homeTherapist.js b/src/main/webapp/JS/homeTherapist.js deleted file mode 100644 index 5e169b0..0000000 --- a/src/main/webapp/JS/homeTherapist.js +++ /dev/null @@ -1,35 +0,0 @@ -//search bar for name and surname -$(document).ready(function () { - var tableContainer = document.getElementById('tableContainer'); - - // Aggiungi un gestore di eventi all'input di ricerca - $('#searchInput').on('input', function () { - var searchText = $(this).val().toLowerCase(); - - // Nascondi tutte le righe - tableContainer.getElementsByTagName('tbody')[0].style.marginTop = '0'; - - // Filtra e mostra solo le righe che corrispondono alla ricerca - $('tbody tr').each(function () { - var name = $(this).find('td:eq(1)').text().toLowerCase(); - var lastName = $(this).find('td:eq(2)').text().toLowerCase(); - - if (name.includes(searchText) || lastName.includes(searchText)) { - $(this).show(); - } else { - $(this).hide(); - } - }); - }); -}); -/*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 = "viewPatient.jsp?patientID="+i; -} \ No newline at end of file diff --git a/src/main/webapp/JS/homepageTherapist.js b/src/main/webapp/JS/homepageTherapist.js index 9c712ba..9e76f6b 100644 --- a/src/main/webapp/JS/homepageTherapist.js +++ b/src/main/webapp/JS/homepageTherapist.js @@ -1,8 +1,12 @@ $(document).ready(function () { - $("#home").click(() => redirect("homepageTherapist.jsp")); + $("#iaIconSelected").hide(); + $("#homeIcon").hide(); + + $("#home").click(() => redirect("home")); $("#message").click(() => redirect("messageCenter.jsp")); $("#agenda").click(() => redirect("schedule.jsp")); - $("#profile").click(() => redirect("userArea.jsp")); + $("#ia").click(() => redirect("AI")); + $("#docInfo").click(() => redirect("userArea.jsp")); let tableContainer = $("#tableContainer"); @@ -28,6 +32,24 @@ $(document).ready(function () { }); }); +function showAI(){ + $("#homeSelectedIcon").hide(); + $("#homeIcon").show() + $("#aiContainer").show(); + $("#tableContainer").hide(); + $("#iaIcon").hide(); + $("#iaIconSelected").show(); +} + +function hideAI(){ + $("#homeSelectedIcon").show(); + $("#homeIcon").hide() + $("#aiContainer").hide(); + $("#tableContainer").show(); + $("#iaIcon").show(); + $("#iaIconSelected").hide(); +} + function openInvitePopup() { @@ -40,5 +62,17 @@ function viewPatient(i){ function redirect(where){ - window.location.href = where; + if(where==="AI" || where === "home"){ + let path = window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1); + console.log(path); + if(path!=="homepageTherapist.jsp"){ + window.location.href = "homepageTherapist.jsp"; + }else if(where==="AI"){ + showAI(); + }else if(where === "home"){ + hideAI(); + } + }else{ + window.location.href = where; + } } \ No newline at end of file diff --git a/src/main/webapp/JS/navbar.js b/src/main/webapp/JS/navbar.js index d2f9d0d..9efeabb 100644 --- a/src/main/webapp/JS/navbar.js +++ b/src/main/webapp/JS/navbar.js @@ -11,10 +11,10 @@ const profileIconS = $("#profileIconSelected") let USERTYPE const page = window.location.pathname.split('/').pop() -const homePages = ["homePagePatient.jsp", "patientReport.jsp"] //TODO: Mettere le pagine da considerare "Home" -const messagePages = ["messageCenter.jsp"] //TODO: Mettere le pagine da considerare "Message" -const calendarPages = ["schedule.jsp"] //TODO: Mettere le pagine da considerare "Calendar" -const profilePages = ["userArea.jsp"] //TODO: Mettere le pagine da considerare "Profile" +const homePages = ["homePagePatient.jsp", "patientReport.jsp", "userReport.jsp"] +const messagePages = ["messageCenter.jsp"] +const calendarPages = ["schedule.jsp"] +const profilePages = ["userArea.jsp", "changePassw.jsp"] $("document").ready(()=>{ USERTYPE = $("#userInfo").data("type"); @@ -60,7 +60,7 @@ function redirect(where){ if (USERTYPE === "patient"){ window.location.href = "homePagePatient.jsp"; }else if (USERTYPE === "therapist"){ - window.location.href = "homeTherapist.jsp"; + window.location.href = "homepageTherapist.jsp"; } } else{ diff --git a/src/main/webapp/JS/viewPatientInfo.js b/src/main/webapp/JS/viewPatientInfo.js new file mode 100644 index 0000000..36d219a --- /dev/null +++ b/src/main/webapp/JS/viewPatientInfo.js @@ -0,0 +1,34 @@ +$(document).ready(function () { + let canvas = document.getElementById('myChart'); + let parentContainer = canvas.parentNode; + + $("#home").click(() => redirect("homepageTherapist.jsp")); + $("#message").click(() => redirect("messageCenter.jsp")); + $("#agenda").click(() => redirect("schedule.jsp")); + $("#docInfo").click(() => redirect("userArea.jsp")); + + canvas.width = parentContainer.offsetWidth; + canvas.height = parentContainer.offsetHeight; +}) + +function showExercises(){ + $("#content").hide(); + $("#conditionsDiv").hide(); + $("#exercisesDiv").show(); +} + +function showCondition(){ + $("#content").hide(); + $("#exercisesDiv").hide(); + $("#conditionsDiv").show(); +} + +function showPatient(){ + $("#exercisesDiv").hide(); + $("#conditionsDiv").hide(); + $("#content").show(); +} + +function redirect(where){ + window.location.href = where; +} \ No newline at end of file diff --git a/src/main/webapp/JSP/AiApprove.jsp b/src/main/webapp/JSP/aiApprove.jsp similarity index 78% rename from src/main/webapp/JSP/AiApprove.jsp rename to src/main/webapp/JSP/aiApprove.jsp index be2f056..dcff0cd 100644 --- a/src/main/webapp/JSP/AiApprove.jsp +++ b/src/main/webapp/JSP/aiApprove.jsp @@ -9,42 +9,43 @@ <%@ page contentType="text/html;charset=UTF-8" language="java" %> - - - Gestione AI - - - + + <% ExerciseManager em = new ExerciseManager(); List exercises = em.retrieveAiRaccomandation((Integer) session.getAttribute("id")); UserData ud = new UserData(); - ArrayList u = ud.getUsersAndPersonalInfoByIdTherapist((Integer) session.getAttribute("id")); + ArrayList users = ud.getUsersAndPersonalInfoByIdTherapist((Integer) session.getAttribute("id")); Gson g = new GsonBuilder().disableHtmlEscaping().create(); %> - - <% int index=0; - for (UserInfo user : u) { +

Non ci sono esercizi da valutare

+ <% + int index=0; + int trID = 0; + for (UserInfo user : users) { index++; boolean sentinel=false; %>
- +

Paziente:

<%=user.getFirstname()%> <%=user.getLastname()%>

- - + +
@@ -55,11 +56,12 @@ - <% for (SlimmerExercise ex : exercises){ + <% + for (SlimmerExercise ex : exercises){ if(ex.getUserId() == user.getId()){ - sentinel=true; + sentinel=true; %> - + @@ -67,12 +69,12 @@ <% - } + trID++; } } %> @@ -85,12 +87,17 @@ + <% + }else{ + %> + <% } } %> - + + diff --git a/src/main/webapp/JSP/exerciseRecommendation.jsp b/src/main/webapp/JSP/exerciseRecommendation.jsp index b02d6e8..2085a15 100644 --- a/src/main/webapp/JSP/exerciseRecommendation.jsp +++ b/src/main/webapp/JSP/exerciseRecommendation.jsp @@ -1,34 +1,27 @@ -<%@ page import="java.util.ArrayList" %> -<%@ page import="model.service.condition.ConditionManager" %> <%@ page import="model.service.user.UserData" %> <%@ page import="model.service.exercise.ExerciseManager" %> <%@ page import="java.util.List" %> <%@ page import="model.entity.*" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> - - Raccomanda Esercizio - - <% - int userId = 0; - if(session.getAttribute("type")!=null && !session.getAttribute("type").equals("therapist") || request.getParameter("userId")==null) { + int patientIdEX = 0; + if(session.getAttribute("type")==null || !session.getAttribute("type").equals("therapist") || request.getParameter("patientID") == null) { response.sendRedirect("../errorPage/403.html"); }else { - userId = Integer.parseInt((request.getParameter("userId"))); + patientIdEX = Integer.parseInt(request.getParameter("patientID")); - int userTherapist = new UserData().getUser(userId).getIdTherapist(); - if (userTherapist != (Integer) session.getAttribute("id")) { + User user = new UserData().getUser(patientIdEX); + if (user.getIdTherapist() != (Integer) session.getAttribute("id")) { response.sendRedirect("../errorPage/403.html"); } } ExerciseManager ExerciseService= new ExerciseManager(); - List list_Exercisedone = ExerciseService.retrieveAllPatientExerciseGlossaryDone(userId); - List list_ExerciseNOTdone = ExerciseService.retrieveAllPatientExerciseGlossaryNotDone(userId); + List list_Exercisedone = ExerciseService.retrieveAllPatientExerciseGlossaryDone(patientIdEX); + List list_ExerciseNOTdone = ExerciseService.retrieveAllPatientExerciseGlossaryNotDone(patientIdEX); %> -
Nome
<%= ex.getName() %> <%= ex.getDescription() %><%= ex.getDifficulty() %> <%= ex.getTarget() %> - - + +
@@ -80,8 +73,8 @@ diff --git a/src/main/webapp/JSP/homeConditionManager.jsp b/src/main/webapp/JSP/homeConditionManager.jsp deleted file mode 100644 index e8273bf..0000000 --- a/src/main/webapp/JSP/homeConditionManager.jsp +++ /dev/null @@ -1,40 +0,0 @@ -<%@ page import="model.entity.*"%> -<%@ page import="model.service.user.UserData"%> -<%@ page import="java.util.ArrayList"%> -<%@ page import="java.text.SimpleDateFormat" %> - - - - - - - - Home - - -
-
-
-
- <%@ include file="patientConditionManager.jsp" %> -
-
- -
-
-
-
- - - -
- - - -
Dr.
<%=(String) session.getAttribute("name") + " " + (String)session.getAttribute("surname")%>
- -
-
-
- - \ No newline at end of file diff --git a/src/main/webapp/JSP/homeExerciseRecommendation.jsp b/src/main/webapp/JSP/homeExerciseRecommendation.jsp deleted file mode 100644 index 9c034f3..0000000 --- a/src/main/webapp/JSP/homeExerciseRecommendation.jsp +++ /dev/null @@ -1,41 +0,0 @@ -<%@ page import="model.entity.*"%> -<%@ page import="model.service.user.UserData"%> -<%@ page import="java.util.ArrayList"%> -<%@ page import="java.text.SimpleDateFormat" %> - - - - - - - - Home - - -
-
-
-
- <%@ include file="exerciseRecommendation.jsp" %> -
-
- -
-
-
-
- - - -
- - - -
Dr.
<%=(String) session.getAttribute("name") + " " + (String)session.getAttribute("surname")%>
- -
-
-
- - - \ No newline at end of file diff --git a/src/main/webapp/JSP/homeTherapist.jsp b/src/main/webapp/JSP/homeTherapist.jsp deleted file mode 100644 index b2161f9..0000000 --- a/src/main/webapp/JSP/homeTherapist.jsp +++ /dev/null @@ -1,100 +0,0 @@ -<%@ page import="model.entity.*"%> -<%@ page import="model.service.user.UserData"%> -<%@ page import="java.util.ArrayList"%> -<%@ page import="java.text.SimpleDateFormat" %> - - - - - - - - TalkAId - Homepage - - - -
-
-
-
PAZIENTI
-
-
- -
Esercizi Fatti / Già Raccomandati
- - + +
- - - - - - - - - <% - if(session.getAttribute("type")!=null && session.getAttribute("type").equals("therapist")){ - @SuppressWarnings("unchecked") - ArrayList list_user= new UserData().getUsersAndPersonalInfoByIdTherapist((Integer) session.getAttribute("id")); - SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); - - for(UserInfo u: list_user){ - %> - - - - - - - - - <% - } - } - %> - -
Inizio Terapia
<%=u.getFirstname()%> <%=u.getLastname()%><%= sdf.format(u.getActivationDate()) %> - - - Visualizza -
-
- - - - -
-
-
-
- - - - - - - - - - - -
- - - -
Dr.
<%=(String) session.getAttribute("name") + " " + (String)session.getAttribute("surname")%>
- -
-
- - -
-
-
-
- - - - - - - \ No newline at end of file diff --git a/src/main/webapp/JSP/homepageTherapist.jsp b/src/main/webapp/JSP/homepageTherapist.jsp index 4b902a0..283939e 100644 --- a/src/main/webapp/JSP/homepageTherapist.jsp +++ b/src/main/webapp/JSP/homepageTherapist.jsp @@ -5,6 +5,7 @@ + Homepage @@ -15,7 +16,8 @@