Skip to content
Snippets Groups Projects
Commit 4eca093b authored by Paul Cancel's avatar Paul Cancel
Browse files

Fin de l implementation

parent f644317a
Branches
Tags
No related merge requests found
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
</div> </div>
<div class="logo"> <div class="logo">
<a href="${pageContext.request.contextPath}/user/listeAction"> <a href="${pageContext.request.contextPath}/user/listeAction">
<span class="logo-icon">📅</span> <span class="logo-icon">
<img src="${pageContext.request.contextPath}/uploads/logo.jpg" alt="Logo" style="width: 50px; height: 50px;">
</span>
<h1><spring:message code="header.title"/></h1> <h1><spring:message code="header.title"/></h1>
</a> </a>
</div> </div>
......
...@@ -20,9 +20,13 @@ ...@@ -20,9 +20,13 @@
<input type="password" id="password" name="password"> <input type="password" id="password" name="password">
</div> </div>
<button type="submit" class="submit"><spring:message code="login.submit"/></button> <button type="submit" class="submit"><spring:message code="login.submit"/></button>
<br><br>
<a href="register"> <a href="register">
<spring:message code="login.register"/> <spring:message code="login.register"/>
</a> </a>
<a href="password_change">
<spring:message code="password.change.title"/>
</a>
</form> </form>
<% <%
String errorMessage = (String) request.getAttribute("errorMessage"); String errorMessage = (String) request.getAttribute("errorMessage");
......
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html>
<head>
<title><spring:message code="password.change.title"/></title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/styles/main.css">
</head>
<body>
<%@ include file="../common/header.jsp" %>
<div class="container">
<h2><spring:message code="password.change.title"/></h2>
<form action="${pageContext.request.contextPath}/public/perform_password_change" method="POST">
<div class="form-group">
<label for="email"><spring:message code="password.change.email"/></label>
<input type="email" id="email" name="email" required>
</div>
<div class="form-group">
<label for="newPassword"><spring:message code="password.change.newPassword"/></label>
<input type="password" id="newPassword" name="newPassword" required>
</div>
<button type="submit" class="submit"><spring:message code="password.change.submit"/></button>
</form>
<%-- Affichage du message d'erreur s'il existe --%>
<%
String errorMessage = (String) request.getAttribute("errorMessage");
if (errorMessage != null) {
%>
<div class="error"><%= errorMessage %></div>
<%
}
%>
<%-- Affichage du message de succès s'il existe --%>
<%
String successMessage = (String) request.getAttribute("successMessage");
if (successMessage != null) {
%>
<div class="success"><%= successMessage %></div>
<%
}
%>
<a href="login">
<spring:message code="register.login"/>
</a>
</div>
<%@ include file="../common/footer.jsp" %>
</body>
</html>
...@@ -7,6 +7,11 @@ ...@@ -7,6 +7,11 @@
<%@ page import="java.util.Locale" %> <%@ page import="java.util.Locale" %>
<%@ page import="fr.but.infoetu.meetingplannr.config.Config" %> <%@ page import="fr.but.infoetu.meetingplannr.config.Config" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page import="java.util.List" %>
<%@ page import="fr.but.infoetu.meetingplannr.pojo.Meeting" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.Collections" %>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
...@@ -19,19 +24,12 @@ ...@@ -19,19 +24,12 @@
<h1><spring:message code="calendar.title"/></h1> <h1><spring:message code="calendar.title"/></h1>
<% <%
String monthParam = request.getParameter("month"); LocalDate currentDate = (LocalDate) request.getAttribute("currentDate");
String yearParam = request.getParameter("year"); LocalDate previousMonth = (LocalDate) request.getAttribute("previousMonth");
LocalDate today = LocalDate.now(); LocalDate nextMonth = (LocalDate) request.getAttribute("nextMonth");
LocalDate currentDate; LocalDate today = (LocalDate) request.getAttribute("today");
Map<LocalDate, List<Meeting>> meetingsByDate = (Map<LocalDate, List<Meeting>>) request.getAttribute("meetingsByDate");
if (monthParam != null && yearParam != null) { int totalSlots = Config.createTimeSlots().size();
currentDate = LocalDate.of(Integer.parseInt(yearParam), Integer.parseInt(monthParam), 1);
} else {
currentDate = LocalDate.now().withDayOfMonth(1);
}
LocalDate previousMonth = currentDate.minusMonths(1);
LocalDate nextMonth = currentDate.plusMonths(1);
%> %>
<div class="calendar-navigation"> <div class="calendar-navigation">
...@@ -56,27 +54,31 @@ ...@@ -56,27 +54,31 @@
<div class="calendar-header"><spring:message code="calendar.wednesday"/></div> <div class="calendar-header"><spring:message code="calendar.wednesday"/></div>
<div class="calendar-header"><spring:message code="calendar.thursday"/></div> <div class="calendar-header"><spring:message code="calendar.thursday"/></div>
<div class="calendar-header"><spring:message code="calendar.friday"/></div> <div class="calendar-header"><spring:message code="calendar.friday"/></div>
<div class="calendar-header weekend"><spring:message code="calendar.saturday"/></div> <div class="calendar-header"><spring:message code="calendar.saturday"/></div>
<div class="calendar-header weekend"><spring:message code="calendar.sunday"/></div> <div class="calendar-header"><spring:message code="calendar.sunday"/></div>
<% <%
LocalDate date = currentDate; LocalDate date = currentDate;
int month = date.getMonthValue(); int month = date.getMonthValue();
int firstDayOfWeek = date.getDayOfWeek().getValue(); int firstDayOfWeek = date.getDayOfWeek().getValue();
%>
<%
for (int i = 1; i < firstDayOfWeek; i++) { for (int i = 1; i < firstDayOfWeek; i++) {
%><div class="calendar-day"></div><% %><div class="calendar-day"></div><%
} }
while (date.getMonthValue() == month) { while (date.getMonthValue() == month) {
DayOfWeek dow = date.getDayOfWeek(); DayOfWeek dow = date.getDayOfWeek();
boolean isWeekend = dow == DayOfWeek.SATURDAY || dow == DayOfWeek.SUNDAY;
boolean isPast = date.isBefore(today); boolean isPast = date.isBefore(today);
boolean isConfiguredDay = Config.WEEK_DAYS.contains(dow.name()); boolean isConfiguredDay = Config.WEEK_DAYS.contains(dow.name());
String dayClass = isWeekend ? "weekend" : isPast ? "past-day" : "active-day"; List<Meeting> meetingsForDay = meetingsByDate.getOrDefault(date, Collections.emptyList());
int bookedSlots = meetingsForDay.size();
double availabilityRatio = (double) bookedSlots / totalSlots;
String color = isConfiguredDay ? String.format("rgb(255, %d, %d)", (int) (255 * (1 - availabilityRatio)), (int) (255 * (1 - availabilityRatio))) : "";
String dayClass = !isConfiguredDay ? "weekend" : isPast ? "past-day" : "active-day";
%> %>
<div class="calendar-day <%= dayClass %>"> <div class="calendar-day <%= dayClass %>" style="<%= isConfiguredDay ? "background-color: " + color : "" %>;">
<%= date.getDayOfMonth() %> <%= date.getDayOfMonth() %>
<% if (!isPast && isConfiguredDay) { %> <% if (!isPast && isConfiguredDay) { %>
<form action="${pageContext.request.contextPath}/user/meetings/new" method="get"> <form action="${pageContext.request.contextPath}/user/meetings/new" method="get">
......
...@@ -30,10 +30,14 @@ ...@@ -30,10 +30,14 @@
for (java.sql.Time timeSlot : Config.createTimeSlots()) { for (java.sql.Time timeSlot : Config.createTimeSlots()) {
LocalTime time = timeSlot.toLocalTime(); LocalTime time = timeSlot.toLocalTime();
if (isTimeAvailable.apply(time)) {
String formattedTime = String.format("%02d:%02d", time.getHour(), time.getMinute()); String formattedTime = String.format("%02d:%02d", time.getHour(), time.getMinute());
if (isTimeAvailable.apply(time)) {
%> %>
<option value="<%= formattedTime %>"><%= formattedTime %></option> <option value="<%= formattedTime %>"><%= formattedTime %></option>
<%
} else {
%>
<option value="<%= formattedTime %>" disabled style="color: gray;"> <%= formattedTime %> <spring:message code="meeting.new.occupied"/></option>
<% <%
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment