Merge origin/master
Conflicts: src/java/bdd/gardeMySQL.java src/java/bean/Gardes.java src/java/servlet/GardesServlet.java web/WEB-INF/jspf/header.jspf
This commit is contained in:
commit
07aaf3248d
@ -1,8 +1,8 @@
|
||||
build.xml.data.CRC32=b54f128f
|
||||
build.xml.script.CRC32=111e10f7
|
||||
build.xml.stylesheet.CRC32=1707db4f@1.87.0.1
|
||||
build.xml.stylesheet.CRC32=1707db4f@1.86.0.1
|
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||
nbproject/build-impl.xml.data.CRC32=b54f128f
|
||||
nbproject/build-impl.xml.script.CRC32=bc2b5756
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=334708a0@1.87.0.1
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=334708a0@1.86.0.1
|
||||
|
@ -36,7 +36,7 @@ j2ee.compile.on.save=true
|
||||
j2ee.copy.static.files.on.save=true
|
||||
j2ee.deploy.on.save=true
|
||||
j2ee.platform=1.7-web
|
||||
j2ee.platform.classpath=${j2ee.server.domain}/lib/annotations-api.jar:${j2ee.server.domain}/lib/catalina-ant.jar:${j2ee.server.domain}/lib/catalina-ha.jar:${j2ee.server.domain}/lib/catalina-ssi.jar:${j2ee.server.domain}/lib/catalina-storeconfig.jar:${j2ee.server.domain}/lib/catalina-tribes.jar:${j2ee.server.domain}/lib/catalina.jar:${j2ee.server.domain}/lib/ecj-4.20.jar:${j2ee.server.domain}/lib/el-api.jar:${j2ee.server.domain}/lib/jakartaee-migration-1.0.0-shaded.jar:${j2ee.server.domain}/lib/jasper-el.jar:${j2ee.server.domain}/lib/jasper.jar:${j2ee.server.domain}/lib/jaspic-api.jar:${j2ee.server.domain}/lib/jsp-api.jar:${j2ee.server.domain}/lib/servlet-api.jar:${j2ee.server.domain}/lib/tomcat-api.jar:${j2ee.server.domain}/lib/tomcat-coyote.jar:${j2ee.server.domain}/lib/tomcat-dbcp.jar:${j2ee.server.domain}/lib/tomcat-i18n-cs.jar:${j2ee.server.domain}/lib/tomcat-i18n-de.jar:${j2ee.server.domain}/lib/tomcat-i18n-es.jar:${j2ee.server.domain}/lib/tomcat-i18n-fr.jar:${j2ee.server.domain}/lib/tomcat-i18n-ja.jar:${j2ee.server.domain}/lib/tomcat-i18n-ko.jar:${j2ee.server.domain}/lib/tomcat-i18n-pt-BR.jar:${j2ee.server.domain}/lib/tomcat-i18n-ru.jar:${j2ee.server.domain}/lib/tomcat-i18n-zh-CN.jar:${j2ee.server.domain}/lib/tomcat-jdbc.jar:${j2ee.server.domain}/lib/tomcat-jni.jar:${j2ee.server.domain}/lib/tomcat-util-scan.jar:${j2ee.server.domain}/lib/tomcat-util.jar:${j2ee.server.domain}/lib/tomcat-websocket.jar:${j2ee.server.domain}/lib/websocket-api.jar
|
||||
j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-ssi.jar:${j2ee.server.home}/lib/catalina-storeconfig.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.20.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jakartaee-migration-1.0.0-shaded.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jaspic-api.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-cs.jar:${j2ee.server.home}/lib/tomcat-i18n-de.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-i18n-ko.jar:${j2ee.server.home}/lib/tomcat-i18n-pt-BR.jar:${j2ee.server.home}/lib/tomcat-i18n-ru.jar:${j2ee.server.home}/lib/tomcat-i18n-zh-CN.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-jni.jar:${j2ee.server.home}/lib/tomcat-util-scan.jar:${j2ee.server.home}/lib/tomcat-util.jar:${j2ee.server.home}/lib/tomcat-websocket.jar:${j2ee.server.home}/lib/websocket-api.jar
|
||||
j2ee.server.type=Tomcat
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
|
@ -8,7 +8,7 @@ package bdd;
|
||||
import bean.Caserne;
|
||||
import bean.Gardes;
|
||||
import bean.Pompier;
|
||||
import com.sdis29a.util.TrmtDate;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -18,6 +18,7 @@ import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import util.TrmtDate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -13,11 +13,11 @@ import java.util.Objects;
|
||||
* @author funcha.ahamadi
|
||||
*/
|
||||
public class Gardes {
|
||||
public Calendar jourGarde;
|
||||
public int periode;
|
||||
public Pompier pompier;
|
||||
public int disponibilite;
|
||||
public boolean isInBDD;
|
||||
Calendar jourGarde;
|
||||
int periode;
|
||||
Pompier pompier;
|
||||
int disponibilite;
|
||||
boolean isInBDD;
|
||||
|
||||
public Gardes(Calendar jourGarde, int periode, Pompier pompier, int disponibilite, boolean isInBDD) {
|
||||
this.jourGarde = jourGarde;
|
||||
|
@ -60,7 +60,6 @@ public class Pompier {
|
||||
this.prenom = prenom;
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
51
src/java/form/DispoForm.java
Normal file
51
src/java/form/DispoForm.java
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package form;
|
||||
|
||||
import bdd.gardeMySQL;
|
||||
import bean.Gardes;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clementine.desrucques
|
||||
*/
|
||||
public class DispoForm {
|
||||
HttpServletRequest request;
|
||||
|
||||
public void verifDispo(HttpServletRequest request){
|
||||
HttpSession maS = request.getSession();
|
||||
ArrayList <Gardes> lesG = (ArrayList<Gardes>) maS.getAttribute("lesVentilInit");
|
||||
|
||||
gardeMySQL vm = new gardeMySQL();
|
||||
Map<String, String[]> map = request.getParameterMap();
|
||||
String[] lesNvVentil = map.get("lesAct");
|
||||
int i = 0;
|
||||
for(Gardes uneGarde : lesG){
|
||||
int oldAct = uneGarde.getDisponibilite();
|
||||
int newAct = Integer.parseInt(lesNvVentil[i]);
|
||||
if(oldAct != newAct){
|
||||
if(uneGarde.isIsInBDD()){
|
||||
if(newAct == 0){
|
||||
vm.delete(uneGarde);
|
||||
uneGarde.setIsInBDD(false);
|
||||
} else {
|
||||
uneGarde.setDisponibilite(newAct);
|
||||
vm.update(uneGarde);
|
||||
}
|
||||
} else {
|
||||
uneGarde.setDisponibilite(newAct);
|
||||
vm.create(uneGarde);
|
||||
uneGarde.setIsInBDD(true);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
@ -5,8 +5,12 @@
|
||||
*/
|
||||
package servlet;
|
||||
|
||||
import bdd.GardeMySQL;
|
||||
import bdd.gardeMySQL;
|
||||
import bean.Gardes;
|
||||
import bean.Pompier;
|
||||
import com.sdis29a.util.TrmtDate;
|
||||
import form.DispoForm;
|
||||
import util.TrmtDate;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import jakarta.servlet.ServletException;
|
||||
@ -63,23 +67,38 @@ public class GardesServlet extends HttpServlet {
|
||||
throws ServletException, IOException {
|
||||
//processRequest(request, response);
|
||||
HttpSession maSession = request.getSession();
|
||||
|
||||
if(maSession.getAttribute("lesVentilInit") == null){
|
||||
ArrayList<Pompier> lesPompiers = (ArrayList<Pompier>) maSession.getAttribute("lesPompiers");
|
||||
Calendar[] lesDates = new Calendar[7];
|
||||
String[] lesDatesEnString = new String[7];
|
||||
lesDates[0] = TrmtDate.getDateDebutSemaine();
|
||||
lesDatesEnString[0] = TrmtDate.getDateAAfficher(lesDates[0]);
|
||||
|
||||
for (int i = 1; i < lesDates.length; i++) {
|
||||
lesDates[i] = TrmtDate.addDays(lesDates[0], i);
|
||||
lesDatesEnString[i] = TrmtDate.getDateAAfficher(lesDates[i]);
|
||||
}
|
||||
maSession.setAttribute("lesDates", lesDates);
|
||||
|
||||
maSession.setAttribute("lesDatesEnString", lesDatesEnString);
|
||||
System.out.println(lesDatesEnString.toString());
|
||||
/*Initialisation des periodes */
|
||||
int[] lesPeriodes = {1,2,3,4};
|
||||
maSession.setAttribute("lesPeriodes", lesPeriodes);
|
||||
System.out.println(lesPeriodes.toString());
|
||||
/* Recherche des ventilations */
|
||||
|
||||
GardeMySQL vm = new GardeMySQL();
|
||||
ArrayList<Gardes> lesVentilInit = vm.getLesDisponibilite(lesDates, lesPeriodes);
|
||||
//System.out.println("lesVentilInit : " + lesVentilInit);
|
||||
maSession.setAttribute("lesVentilInit", lesVentilInit);
|
||||
|
||||
|
||||
|
||||
/* Initialisation des couleurs */
|
||||
String[] lesCouleurs = {"blanc", "gris", "jaune"};
|
||||
maSession.setAttribute("lesCouleurs", lesCouleurs);
|
||||
}
|
||||
/* Affichage de la page de ventilation */
|
||||
getServletContext().getRequestDispatcher("/WEB-INF/feuilleGardes.jsp").forward(request, response);
|
||||
}
|
||||
@ -95,7 +114,10 @@ public class GardesServlet extends HttpServlet {
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
processRequest(request, response);
|
||||
// processRequest(request, response);
|
||||
DispoForm vf = new DispoForm();
|
||||
vf.verifDispo(request);
|
||||
getServletContext().getRequestDispatcher("/WEB-INF/pompierJSP.jsp").forward(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +74,7 @@ public class PompierServlet extends HttpServlet {
|
||||
boolean isNumeric = StringUtils.isStrictlyNumeric(pageEnString);
|
||||
if (isNumeric) {
|
||||
pageDemandee = Integer.parseInt(pageEnString);
|
||||
if (pageDemandee != 2 && pageDemandee != 3) { // erreur
|
||||
if (pageDemandee != 2 && pageDemandee != 3 && pageDemandee != 5) { // erreur
|
||||
erreur = true;
|
||||
}
|
||||
} else {
|
||||
@ -101,6 +101,7 @@ public class PompierServlet extends HttpServlet {
|
||||
page = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (erreur) {
|
||||
request.getRequestDispatcher("/authentification").forward(request, response); // redirection servlet
|
||||
} else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.sdis29a.util;
|
||||
package util;
|
||||
/*
|
||||
* Classe abstraite facilitant le traitement des dates
|
||||
* Toutes les méthodes sont statiques, appel : TrmtDate.nomMéthode
|
||||
|
@ -3,8 +3,17 @@
|
||||
Created on : 6 déc. 2021, 15:07:45
|
||||
Author : funcha.ahamadi
|
||||
--%>
|
||||
|
||||
<%@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">
|
||||
|
||||
|
||||
<fieldset class="row mt-1 mb-10">
|
||||
|
||||
<legend>
|
||||
Feuille de gardes
|
||||
</legend>
|
||||
@ -12,43 +21,26 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2">N° de BIP</th>
|
||||
<th rowspan="2">No</th>
|
||||
<th rowspan="2">Nom Prenom</th>
|
||||
<c:forEach items='${sessionScope.lesDatesEnString}' var="uneDate" varStatus="status">
|
||||
<th colspan="2" class="text-center"> ${uneDate}</th>
|
||||
<th colspan="4" class="text-center"> ${uneDate}</th>
|
||||
</c:forEach>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<c:forEach var="i" begin="0" end="4" step="1">
|
||||
<c:forEach var="i" begin="0" end="6" step="1">
|
||||
<c:forEach items='${sessionScope.lesPeriodes}' var="unePeriode" varStatus="status">
|
||||
<td class="text-center">${unePeriode}</td>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:set var="oldId" value="-1" scope="page"/>
|
||||
<tr>
|
||||
<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 readonly type="text" value='${activite}' name="lesActivites"class="ztVentil ${sessionScope.lesCouleurs[activite]}"/>
|
||||
</td>
|
||||
</c:forEach>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</form><!-- comment -->
|
@ -126,7 +126,56 @@
|
||||
value="${lePompier.getCommentaire()}" />
|
||||
</div><!-- fin ligne observation -->
|
||||
</div> <!-- fin observation -->
|
||||
<br/>
|
||||
<!-- tab disp -->
|
||||
<div>
|
||||
<label for="tDisp">Disponibilitées</label>
|
||||
<table border="1" cellspacing="3" cellpadding="1" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<c:forEach items="${sessionScope.lesDatesEnString}" var="uneDate" varStatus="status">
|
||||
<th colspan="2" class="text-center">${uneDate}</th>
|
||||
</c:forEach>
|
||||
</tr>
|
||||
<tr>
|
||||
<c:forEach var="i" begin="0" end="4" step="1">
|
||||
<c:forEach items="${sessionScope.lesPeriodes}" var="uneP" varStatus="status">
|
||||
<td class="text-center">${uneP}</td>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:set var="oldId" value="-1" scope="page"/>
|
||||
<tr>
|
||||
<c:forEach items="${sessionScope.lesVentilInit}" var="ventil" varStatus="status">
|
||||
<c:set var="newId" value="${gardes.getPompier().getId()}" scope="page"/>
|
||||
<c:if test="${oldId != newId}" var="test" scope="page">
|
||||
</tr> <tr>
|
||||
<td>${ventil.getSalarie().getId()}</td>
|
||||
<td>${ventil.getSalarie().getNom()} ${ventil.getSalarie().getPrenom()}</td>
|
||||
<c:set var="oldId" value="${newId}" scope="page"/>
|
||||
</c:if>
|
||||
<c:set var="act" value="${gardes.getDisponibilite()}" scope="page"/>
|
||||
<td><input type="text" value="${act}" name="lesAct" class="ztVentil ${sessionScope.lesCouleurs[act]}" readonly/></td>
|
||||
|
||||
</c:forEach>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="legendCouleur">
|
||||
|
||||
<span style="background-color: white">Dispo</span>
|
||||
<span style="background-color: gray">Indispo</span>
|
||||
<span style="background-color: yellow">Au travail</span>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- fin tab disp -->
|
||||
<div class="danger mt-3">${message} </div>
|
||||
|
||||
<div class="text-center mt-3">
|
||||
@ -138,6 +187,22 @@
|
||||
<p><em>* zone obligatoire</em></p>
|
||||
|
||||
</section>
|
||||
<script>
|
||||
var couleurs = ["blanc", "gris", "jaune"];
|
||||
var lesAct = document.getElementsByClassName("ztVentil");
|
||||
for (var uneAct of lesAct) {
|
||||
uneAct.onclick = function () {
|
||||
var act = this.value;
|
||||
var newAct = (act + 1) % 3;
|
||||
var coul = couleurs[newAct];
|
||||
this.classList.remove(couleurs[act]);
|
||||
this.classList.add(coul);
|
||||
this.value = newAct;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</div> <!-- fin div contenant aside et section -->
|
||||
</form>
|
||||
|
||||
|
@ -90,18 +90,13 @@
|
||||
</c:choose>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<c:choose>
|
||||
<c:when test="${page eq 5}">
|
||||
<a class="nav-link active" href="pompier?pageDemandee=5">Gardes</a>
|
||||
</c:when>
|
||||
<c:when test="${sessionScope.lePompierConnecte.getLeStatut().getCode() eq 2}">
|
||||
<a class="nav-link" href="pompier?pageDemandee=5">Gardes</a>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
|
||||
</c:otherwise>
|
||||
|
||||
</c:choose>
|
||||
|
||||
<a class="nav-link" href="gardes">Gardes</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
Loading…
x
Reference in New Issue
Block a user