sdisM2/web/WEB-INF/lesDispoJSP.jsp
thomas.millot eae43733b0 Merge origin/master
Conflicts:
	src/java/bdd/PompierMysql.java
	web/WEB-INF/ProfilJSP.jsp
2021-12-14 08:44:24 +01:00

87 lines
3.8 KiB
Plaintext

<%--
Document : LesDispoJSP
Created on : 6 déc. 2021, 15:15:56
Author : thomas.millot
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file= "jspf/debutJSP.jspf" %>
<body>
<%@include file= "jspf/header.jspf" %>
<div class="container">
<section id="contenuAffiche" class="row">
<legend>
Les disponibilités
</legend>
<form action="affectation" method="POST">
<table class="table">
<thead>
<tr>
<th rowspan="2"> Id</th>
<th rowspan="2"> Nom prénom</th>
<c:forEach items="${sessionScope.lesDatesEnString}"
var= "uneDate" varStatus="status">
<th colspan="4" class= "text-center" >${uneDate}</th>
</c:forEach>
</tr>
<tr>
<c:forEach var="i" begin ="0" end="6" step="1">
<c:forEach items="${sessionScope.lesPeriodes}"
var= "unePeriode" varStatus="status">
<th class= "text-center" >${unePeriode}</th>
</c:forEach>
</c:forEach>
</tr>
</thead>
<tbody>
<c:set var="oldId" value="-1" scope="page"/>
<c:forEach items="${sessionScope.lesVentilInit}"
var="uneVentil" varStatus="status">
<c:set var="newId" value="${uneVentil.getPompier().getId()}" scope="page"/>
<c:if test="${oldId != newId}" var="test" scope="page">
<tr></tr>
<td>${uneVentil.getPompier().getId()}</td>
<td>${uneVentil.getPompier().getNom()}
${uneVentil.getPompier().getPrenom()}</td>
<c:set var="oldId" value="${newId}" scope="page"/>
</c:if>
<c:set var="activite" value="${uneVentil.getActivite()}" scope="page"/>
<td>
<input type ="text" value="${activite}" name="lesActivites" class="ztVentil ${sessionScope.lesCouleurs[activite]}"/>
</td>
</c:forEach>
</tbody>
</table>
<div class="text-center">
<button type="submit" value="Valider" class="btn btn-danger"><i class="bi bi-check2"></i> Valider</button>
</div>
</form>
<div id="legendCouleurs">
<span class="${sessionScope.lesCouleurs[0]}">Disponible</span>
<span class="${sessionScope.lesCouleurs[1]}">Au travail</span>
<span class="${sessionScope.lesCouleurs[2]}">Indisponible</span>
</div>
</section> <!-- /section id contenuAffiche -->
</div>
<script>
var lesCouleurs = ["vert", "orange", "rouge"];
var lesActivites = document.getElementsByClassName("ztVentil");
for (var uneActivite of lesActivites) {
uneActivite.onclick = function () {
var act = this.value;
var newAct = (act + 1) % 3;
var couleur = lesCouleurs[newAct];
this.classList.remove(lesCouleurs[act]);
this.classList.add(couleur);
this.value = newAct;
//alert("Click ok, Nouvelle Couleur : "+ act);
}
}
</script>
</body>