Merge origin/master

Conflicts:
	nbproject/project.properties
	src/java/bean/Pompier.java
	src/java/servlet/PompierServlet.java
	src/java/util/TrmtDate.java
	web/WEB-INF/jspf/formulairePompier.jspf
	web/WEB-INF/jspf/header.jspf
	web/WEB-INF/web.xml
This commit is contained in:
clementine.desrucques 2021-12-13 11:07:06 +01:00
commit 8c53a38e4b
14 changed files with 2048 additions and 2003 deletions

View File

@ -1,8 +1,8 @@
build.xml.data.CRC32=b54f128f build.xml.data.CRC32=b54f128f
build.xml.script.CRC32=111e10f7 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. # 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. # 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.data.CRC32=b54f128f
nbproject/build-impl.xml.script.CRC32=bc2b5756 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

View File

@ -5,8 +5,9 @@
*/ */
package bdd; package bdd;
import bean.Dispo; import bean.Gardes;
import bean.Pompier; import bean.Pompier;
import util.TrmtDate;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -15,49 +16,46 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import util.TrmtDate;
/** /**
* *
* @author clementine.desrucques * @author funcha.ahamadi
*/ */
public class DispoMySql { public class gardeMySQL {
private final Connection theConnection = Connexion.getConnect("localhost", private final Connection theConnection = Connexion.getConnect("localhost",
"sdis29", "sdis29",
"adminBDsdis", "adminBDsdis",
"mdpBDsdis"); "mdpBDsdis");
public ArrayList<Gardes> getLesDisponibilite(Calendar[] lesDates, int[] lesPeriodes) {
public ArrayList<Dispo> getLesDispo(Calendar[] lesDates, String[] lesPeriodes) { ArrayList<Gardes> lesDispo = new ArrayList<>();
ArrayList<Dispo> lesP = new ArrayList<>(); Gardes uneDispo;
Dispo uneDispo;
/* a. Initialisation de la collection lesVentil pour la période, /* a. Initialisation de la collection lesVentil pour la période,
création d'une ventil par salarié, par date et période création d'une ventil par salarié, par date et période
*/ */
int indiceDateFin = lesDates.length - 1; int indiceDateFin = lesDates.length - 1;
Pompier leP; Pompier lePompier;
PompierMySQL sm = new PompierMySQL(); PompierMySQL pm = new PompierMySQL();
ArrayList<Pompier> lesPom = sm.readAll(); ArrayList<Pompier> lesPompiers = pm.readLesPompiersCaserne(idCaserne);
for (Pompier unP : lesPom) { for (Pompier unPompier : lesPompiers) {
for (Calendar uneDate : lesDates) { for (Calendar uneDate : lesDates) {
for (String unePeriode : lesPeriodes) { for (int unePeriode : lesPeriodes) {
uneDispo = new Dispo(uneDate, unePeriode, unP); uneDispo = new Gardes(uneDate, unePeriode, unPompier);
lesP.add(uneDispo); lesDispo.add(uneDispo);
} }
} }
} }
/* b) Maj de la collection lesVentil /* b) Maj de la collection lesVentil
*/ */
readAll(lesPomp, lesDates[0], lesDates[indiceDateFin]); readAll(lesDispo, lesDates[0], lesDates[indiceDateFin]);
//System.out.println("lesVentil : " + lesVentil); //System.out.println("lesDispo : " + lesDispo);
return lesPomp; return lesDispo;
} }
public void readAll(ArrayList<Gardes> lesDispo, Calendar d1, Calendar d2) {
public void readAll(ArrayList<Pompier> lesPomp, Calendar d1, Calendar d2) { Pompier lePompier;
Pompier leP; Gardes uneDispo;
Dispo uneDispo; Gardes laDispoTrouvee;
Dispo laDispoTrouvee;
String sql = "SELECT * FROM gardes " String sql = "SELECT * FROM gardes "
+ "INNER JOIN pompier on idPompier = id " + "INNER JOIN pompier on idPompier = id "
+ "WHERE jourGarde BETWEEN ? and ?;"; + "WHERE jourGarde BETWEEN ? and ?;";
@ -66,35 +64,25 @@ public class DispoMySql {
prepStmt.setDate(1, TrmtDate.getSQLDate(d1)); prepStmt.setDate(1, TrmtDate.getSQLDate(d1));
prepStmt.setDate(2, TrmtDate.getSQLDate(d2)); prepStmt.setDate(2, TrmtDate.getSQLDate(d2));
ResultSet resultat = prepStmt.executeQuery(); ResultSet resultat = prepStmt.executeQuery();
while (resultat.next()) { while (resultat.next())
leP = new Pompier( // public Pompier(Caserne laCaserne, int id, String nom, String prenom) {
lePompier = new Pompier(
resultat.getCaserne("laCaserne"), resultat.getCaserne("laCaserne"),
resultat.getInt("id"), resultat.getInt("id"),
resultat.getString("nom"), resultat.getString("nom"),
resultat.getString("prenom"), resultat.getString("prenom")
resultat.getParametre("leStatut"),
resultat.getParametre("leType"),
resultat.getString("mail"),
resultat.getString("login"),
resultat.getString("mdp"),
resultat.getString("adresse"),
resultat.getString("cp"),
resultat.getString("ville"),
resultat.getString("bip"),
resultat.getParametre("leGrade"),
resultat.getString("commentaire")
); );
uneDispo = new Dispo(TrmtDate.getCalDate(resultat.getDate("jourVentil")), uneDispo = new Gardes(TrmtDate.getCalDate(resultat.getDate("jourGarde")),
resultat.getString("periode"), resultat.getInt("periode"),
leP); lePompier);
// Recherche si unpompier existe dans les Pompier // Recherche si uneDispo existe dans les Dispos
int indice = lesDispo.indexOf(uneDispo); int indice = lesDispo.indexOf(uneDispo);
if (indice > -1) { if (indice > -1) {
laDispoTrouvee = lesDispo.get(indice); laDispoTrouvee = lesDispo.get(indice);
laDispoTrouvee.setActivite(resultat.getInt("dispo")); laDispoTrouvee.setDisponibilite(resultat.getInt("disponibilite"));
laDispoTrouvee.setIsInBD(true); laDispoTrouvee.setIsInBDD(true);
} }
}
prepStmt.close(); prepStmt.close();
resultat.close(); resultat.close();
} catch (SQLException ex) { } catch (SQLException ex) {
@ -103,12 +91,12 @@ public class DispoMySql {
System.out.println("Code erreur : " + ex.getErrorCode()); System.out.println("Code erreur : " + ex.getErrorCode());
} }
} }
/** /**
* Suppression de la ventilation passé en param * Suppression de la ventilation passé en param
* @param v : ventilation * @param v : ventilation
* @return : nb lignes supprimées * @return : nb lignes supprimées
*/ */
public int delete(Dispo p) { public int delete(Gardes v) {
int nbMaj = -1; int nbMaj = -1;
String sql = "DELETE FROM gardes " String sql = "DELETE FROM gardes "
+ "WHERE idPompier = ? AND" + "WHERE idPompier = ? AND"
@ -116,9 +104,9 @@ public class DispoMySql {
+ "jourGarde = ?;"; + "jourGarde = ?;";
try { try {
PreparedStatement prepStmt = theConnection.prepareStatement(sql); PreparedStatement prepStmt = theConnection.prepareStatement(sql);
prepStmt.setInt(1, p.getPompier().getId()); prepStmt.setInt(1, v.getPompier().getId());
prepStmt.setString(2, p.getPeriode()); prepStmt.setInt(2, v.getPeriode());
prepStmt.setDate(3, TrmtDate.getSQLDate(p.getJourVentil())); prepStmt.setDate(3, TrmtDate.getSQLDate(v.getJourGarde()));
nbMaj= prepStmt.executeUpdate(); nbMaj= prepStmt.executeUpdate();
} catch (SQLException ex) { } catch (SQLException ex) {
@ -131,24 +119,24 @@ public class DispoMySql {
} }
public int update(Dispo v) { public int update(Gardes v) {
int nbMAJ = -1; int nbMAJ = -1;
String sql = "UPDATE gardes " String sql = "UPDATE gardes "
+ "SET ventil = ? " + "SET ventil = ? "
+ "WHERE idPompier = ? " + "WHERE idPompier= ? "
+ "AND jourGarde = ? " + "AND jourGarde = ? "
+ "AND periode = ?"; + "AND periode = ?";
try { try {
PreparedStatement prepStmt = theConnection.prepareStatement(sql); PreparedStatement prepStmt = theConnection.prepareStatement(sql);
prepStmt.setInt(1, v.getActivite()); prepStmt.setInt(1, v.getDisponibilite());
prepStmt.setInt(2, v.getPompier().getId()); prepStmt.setInt(2, v.getPompier().getId());
prepStmt.setDate(3, TrmtDate.getSQLDate(v.getJourVentil())); prepStmt.setDate(3, TrmtDate.getSQLDate(v.getJourGarde()));
prepStmt.setString(4, v.getPeriode()); prepStmt.setInt(4, v.getPeriode());
System.out.println("update : " + prepStmt); System.out.println("update : " + prepStmt);
nbMAJ = prepStmt.executeUpdate(); nbMAJ = prepStmt.executeUpdate();
} catch (SQLException ex) { } catch (SQLException ex) {
Logger.getLogger(DispoMySql.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(gardeMySQL.class.getName()).log(Level.SEVERE, null, ex);
} }
return nbMAJ; return nbMAJ;
} }
@ -157,17 +145,17 @@ public class DispoMySql {
* @param v : ventil à créer * @param v : ventil à créer
* @return : id du ventil * @return : id du ventil
*/ */
public int create(Dispo v) { public int create(Gardes v) {
int nbCre = -1; int nbCre = -1;
String sql = "INSERT INTO gardes " String sql = "INSERT INTO gardes "
+ "(jourGarde, idPompier, periode, ventil)" + "(jourGarde, periode, idPompier, ventil)"
+ "VALUES (?, ?, ?, ?);"; + "VALUES (?, ?, ?, ?);";
try { try {
PreparedStatement prepStmt = theConnection.prepareStatement(sql); PreparedStatement prepStmt = theConnection.prepareStatement(sql);
prepStmt.setDate(1, TrmtDate.getSQLDate(v.getJourVentil())); prepStmt.setDate(1, TrmtDate.getSQLDate(v.getJourGarde()));
prepStmt.setString(2, v.getPeriode()); prepStmt.setInt(2, v.getPeriode());
prepStmt.setInt(3, v.getPompier().getId()); prepStmt.setInt(3, v.getPompier().getId());
prepStmt.setInt(4, v.getActivite()); prepStmt.setInt(4, v.getDisponibilite());
int nbLigne= prepStmt.executeUpdate(); int nbLigne= prepStmt.executeUpdate();
if (nbLigne > 0) { if (nbLigne > 0) {
ResultSet result = prepStmt.getGeneratedKeys(); ResultSet result = prepStmt.getGeneratedKeys();
@ -184,4 +172,12 @@ public class DispoMySql {
return nbCre; return nbCre;
} }
} }

View File

@ -1,123 +0,0 @@
/*
* 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 bean;
import java.util.Calendar;
import java.util.Objects;
/**
*
* @author clementine.desrucques
*/
public class Dispo {
Calendar JourVentil;
String periode;
Pompier pompier;
int activite;
boolean isInBD;
public Dispo(Calendar JourVentil, String periode, Pompier pompier, int activite, boolean isInBD) {
this.JourVentil = JourVentil;
this.periode = periode;
this.pompier = pompier;
this.activite = activite;
this.isInBD = isInBD;
}
public Dispo(Calendar JourVentil, String periode, Pompier pompier) {
this.JourVentil = JourVentil;
this.periode = periode;
this.pompier = pompier;
}
public Calendar getJourVentil() {
return JourVentil;
}
public void setJourVentil(Calendar JourVentil) {
this.JourVentil = JourVentil;
}
public String getPeriode() {
return periode;
}
public void setPeriode(String periode) {
this.periode = periode;
}
public Pompier getPompier() {
return pompier;
}
public void setPompier(Pompier pompier) {
this.pompier = pompier;
}
public int getActivite() {
return activite;
}
public void setActivite(int activite) {
this.activite = activite;
}
public boolean isIsInBD() {
return isInBD;
}
public void setIsInBD(boolean isInBD) {
this.isInBD = isInBD;
}
@Override
public int hashCode() {
int hash = 7;
hash = 79 * hash + Objects.hashCode(this.JourVentil);
hash = 79 * hash + Objects.hashCode(this.periode);
hash = 79 * hash + Objects.hashCode(this.pompier);
hash = 79 * hash + this.activite;
hash = 79 * hash + (this.isInBD ? 1 : 0);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Dispo other = (Dispo) obj;
if (this.activite != other.activite) {
return false;
}
if (this.isInBD != other.isInBD) {
return false;
}
if (!Objects.equals(this.periode, other.periode)) {
return false;
}
if (!Objects.equals(this.JourVentil, other.JourVentil)) {
return false;
}
if (!Objects.equals(this.pompier, other.pompier)) {
return false;
}
return true;
}
@Override
public String toString() {
return "Dispo{" + "JourVentil=" + JourVentil + ", periode=" + periode + ", pompier=" + pompier + ", activite=" + activite + ", isInBD=" + isInBD + '}';
}
}

123
src/java/bean/Gardes.java Normal file
View File

@ -0,0 +1,123 @@
/*
* 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 bean;
import java.util.Calendar;
import java.util.Objects;
/**
*
* @author funcha.ahamadi
*/
public class Gardes {
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;
this.periode = periode;
this.pompier = pompier;
this.disponibilite = disponibilite;
this.isInBDD = isInBDD;
}
public Gardes(Calendar jourGarde, int periode, Pompier pompier) {
this.jourGarde = jourGarde;
this.periode = periode;
this.pompier = pompier;
}
public Calendar getJourGarde() {
return jourGarde;
}
public void setJourGarde(Calendar jourGarde) {
this.jourGarde = jourGarde;
}
public int getPeriode() {
return periode;
}
public void setPeriode(int periode) {
this.periode = periode;
}
public Pompier getPompier() {
return pompier;
}
public void setPompier(Pompier pompier) {
this.pompier = pompier;
}
public int getDisponibilite() {
return disponibilite;
}
public void setDisponibilite(int disponibilite) {
this.disponibilite = disponibilite;
}
public boolean isIsInBDD() {
return isInBDD;
}
public void setIsInBDD(boolean isInBDD) {
this.isInBDD = isInBDD;
}
@Override
public int hashCode() {
int hash = 7;
hash = 43 * hash + Objects.hashCode(this.jourGarde);
hash = 43 * hash + this.periode;
hash = 43 * hash + Objects.hashCode(this.pompier);
hash = 43 * hash + this.disponibilite;
hash = 43 * hash + (this.isInBDD ? 1 : 0);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Gardes other = (Gardes) obj;
if (this.periode != other.periode) {
return false;
}
if (this.disponibilite != other.disponibilite) {
return false;
}
if (this.isInBDD != other.isInBDD) {
return false;
}
if (!Objects.equals(this.jourGarde, other.jourGarde)) {
return false;
}
if (!Objects.equals(this.pompier, other.pompier)) {
return false;
}
return true;
}
@Override
public String toString() {
return "Gardes{" + "jourGarde=" + jourGarde + ", periode=" + periode + ", pompier=" + pompier + ", disponibilite=" + disponibilite + ", isInBDD=" + isInBDD + '}';
}
}

View File

@ -5,8 +5,8 @@
*/ */
package form; package form;
import bdd.DispoMySql; import bdd.gardeMySQL;
import bean.Dispo; import bean.Gardes;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession; import jakarta.servlet.http.HttpSession;
import java.util.ArrayList; import java.util.ArrayList;
@ -21,28 +21,28 @@ public class DispoForm {
public void verifDispo(HttpServletRequest request){ public void verifDispo(HttpServletRequest request){
HttpSession maS = request.getSession(); HttpSession maS = request.getSession();
ArrayList <Dispo> lesDispo = (ArrayList<Dispo>) maS.getAttribute("lesVentilInit"); ArrayList <Gardes> lesG = (ArrayList<Gardes>) maS.getAttribute("lesVentilInit");
DispoMySql vm = new DispoMySql(); gardeMySQL vm = new gardeMySQL();
Map<String, String[]> map = request.getParameterMap(); Map<String, String[]> map = request.getParameterMap();
String[] lesNvVentil = map.get("lesAct"); String[] lesNvVentil = map.get("lesAct");
int i = 0; int i = 0;
for(Dispo uneDispo : lesDispo){ for(Gardes uneGarde : lesG){
int oldAct = uneDispo.getActivite(); int oldAct = uneGarde.getDisponibilite();
int newAct = Integer.parseInt(lesNvVentil[i]); int newAct = Integer.parseInt(lesNvVentil[i]);
if(oldAct != newAct){ if(oldAct != newAct){
if(uneDispo.isIsInBD()){ if(uneGarde.isIsInBDD()){
if(newAct == 0){ if(newAct == 0){
vm.delete(uneDispo); vm.delete(uneGarde);
uneDispo.setIsInBD(false); uneGarde.setIsInBDD(false);
} else { } else {
uneDispo.setActivite(newAct); uneGarde.setDisponibilite(newAct);
vm.update(uneDispo); vm.update(uneGarde);
} }
} else { } else {
uneDispo.setActivite(newAct); uneGarde.setDisponibilite(newAct);
vm.create(uneDispo); vm.create(uneGarde);
uneDispo.setIsInBD(true); uneGarde.setIsInBDD(true);
} }
} }
i++; i++;

View File

@ -5,25 +5,26 @@
*/ */
package servlet; package servlet;
import bdd.DispoMySql; import bdd.gardeMySQL;
import bean.Dispo; import bean.Gardes;
import bean.Pompier;
import form.DispoForm; import form.DispoForm;
import jakarta.servlet.http.HttpServlet; import util.TrmtDate;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import jakarta.servlet.ServletException; import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession; import jakarta.servlet.http.HttpSession;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import util.TrmtDate;
/** /**
* *
* @author clementine.desrucques * @author funcha.ahamadi
*/ */
public class DispoServlet extends HttpServlet { public class GardesServlet extends HttpServlet {
/** /**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
@ -42,10 +43,10 @@ public class DispoServlet extends HttpServlet {
out.println("<!DOCTYPE html>"); out.println("<!DOCTYPE html>");
out.println("<html>"); out.println("<html>");
out.println("<head>"); out.println("<head>");
out.println("<title>Servlet DispoServlet</title>"); out.println("<title>Servlet feuilleGardes</title>");
out.println("</head>"); out.println("</head>");
out.println("<body>"); out.println("<body>");
out.println("<h1>Servlet DispoServlet at " + request.getContextPath() + "</h1>"); out.println("<h1>Servlet feuilleGardes at " + request.getContextPath() + "</h1>");
out.println("</body>"); out.println("</body>");
out.println("</html>"); out.println("</html>");
} }
@ -63,40 +64,34 @@ public class DispoServlet extends HttpServlet {
@Override @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { throws ServletException, IOException {
// processRequest(request, response); //processRequest(request, response);
HttpSession maSession = request.getSession(); 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]);
/* Initialisations des dates de la semaine */ for (int i = 1; i < lesDates.length; i++) {
Calendar[] lesDates = new Calendar[5]; lesDates[i] = TrmtDate.addDays(lesDates[0], i);
String[] lesDatesEnString = new String[5]; lesDatesEnString[i] = TrmtDate.getDateAAfficher(lesDates[i]);
lesDates[0] = TrmtDate.getDateDebutSemaine(); }
lesDatesEnString[0] = TrmtDate.getDateAAfficher(lesDates[0]); maSession.setAttribute("lesDates", lesDates);
for (int i = 1; i < lesDates.length; i++) { maSession.setAttribute("lesDatesEnString", lesDatesEnString);
lesDates[i] = TrmtDate.addDays(lesDates[0], i); /*Initialisation des periodes */
lesDatesEnString[i] = TrmtDate.getDateAAfficher(lesDates[i]); int[] lesPeriodes = {1,2,3,4};
} maSession.setAttribute("lesPeriodes", lesPeriodes);
/* Recherche des ventilations */
maSession.setAttribute("lesDates", lesDates); gardeMySQL vm = new gardeMySQL();
maSession.setAttribute("lesDatesEnString", lesDatesEnString); ArrayList<Gardes> lesVentilInit = vm.getLesDisponibilite(lesDates, lesPeriodes);
//System.out.println("lesDates "+ lesDates[4].getTime());
/* Initialisation des périodes */
String[] lesPeriodes = {"AM", "PM"};
maSession.setAttribute("lesPeriodes", lesPeriodes);
/* Recherche des ventilations */
DispoMySql vm = new DispoMySql();
ArrayList<Dispo> lesVentilInit = vm.getLesDispo(lesDates, lesPeriodes);
//System.out.println("lesVentilInit : " + lesVentilInit); //System.out.println("lesVentilInit : " + lesVentilInit);
maSession.setAttribute("lesVentilInit", lesVentilInit); maSession.setAttribute("lesVentilInit", lesVentilInit);
/* Initialisation des couleurs */ /* Initialisation des couleurs */
String[] lesCouleurs = {"blanc", "gris", "jaune"}; String[] lesCouleurs = {"blanc", "gris", "jaune"};
maSession.setAttribute("lesCouleurs", lesCouleurs); maSession.setAttribute("lesCouleurs", lesCouleurs);
}
/* Affichage de la page de ventilation */ /* Affichage de la page de ventilation */
getServletContext().getRequestDispatcher("/WEB-INF/gardeJSP.jsp").forward(request, response); getServletContext().getRequestDispatcher("/WEB-INF/feuilleGardesJSP.jsp").forward(request, response);
} }
/** /**

View File

@ -0,0 +1,54 @@
<%--
Document : feuilleGardes
Created on : 6 déc. 2021, 15:07:45
Author : funcha.ahamadi
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<legend>
Feuille de gardes
</legend>
<form action="gardes" method="POST">
<table class="table">
<thead>
<tr>
<th rowspan="2">N° de BIP</th>
<th rowspan="2">Nom Prenom</th>
<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="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><!-- comment -->

View File

@ -17,8 +17,8 @@
<servlet-class>servlet.PompierServlet</servlet-class> <servlet-class>servlet.PompierServlet</servlet-class>
</servlet> </servlet>
<servlet> <servlet>
<servlet-name>DispoServlet</servlet-name> <servlet-name>feuilleGardes</servlet-name>
<servlet-class>servlet.DispoServlet</servlet-class> <servlet-class>servlet.GardesServlet</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>AuthentifServlet</servlet-name> <servlet-name>AuthentifServlet</servlet-name>
@ -29,8 +29,8 @@
<url-pattern>/pompier</url-pattern> <url-pattern>/pompier</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet-mapping> <servlet-mapping>
<servlet-name>DispoServlet</servlet-name> <servlet-name>feuilleGardes</servlet-name>
<url-pattern>/DispoServlet</url-pattern> <url-pattern>/gardes</url-pattern>
</servlet-mapping> </servlet-mapping>
<session-config> <session-config>
<session-timeout> <session-timeout>