Compare commits
4 Commits
332960f92d
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
5287b5ff74 | ||
|
623728d3e3 | ||
|
ad612c663c | ||
|
3162d0eeb3 |
@@ -61,8 +61,10 @@ public class GardeMySQL {
|
||||
/* b) Maj de la collection lesVentil
|
||||
*/
|
||||
readAll(lesDispo, lesDates[0], lesDates[indiceDateFin]);
|
||||
//System.out.println("lesDispo : " + lesDispo);
|
||||
System.out.println("lesDispo : " + lesDispo);
|
||||
|
||||
return lesDispo;
|
||||
|
||||
}
|
||||
public void readAll(ArrayList<Gardes> lesDispo, Calendar d1, Calendar d2) {
|
||||
Pompier lePompier;
|
||||
@@ -107,21 +109,21 @@ public class GardeMySQL {
|
||||
/**
|
||||
* Suppression de la garde passé en paramètre
|
||||
*
|
||||
* @param v ventilation à supprimer
|
||||
* @param g ventilation à supprimer
|
||||
* @return nb ligne a supprimer
|
||||
*/
|
||||
public int delete(Gardes g) {
|
||||
int nbMaj = -1;
|
||||
String sql = "DELETE * FROM gardes "
|
||||
String sql = "DELETE FROM gardes "
|
||||
+ "WHERE idPompier=?"
|
||||
+ "AND periode=?"
|
||||
+ "AND jourGarde= ?;";
|
||||
+ " AND periode=?"
|
||||
+ " AND jourGarde= ?;";
|
||||
try {
|
||||
PreparedStatement prepStmt = theConnection.prepareStatement(sql);
|
||||
prepStmt.setInt(1, g.getPompier().getId());
|
||||
prepStmt.setInt(2, g.getPeriode());
|
||||
prepStmt.setInt(3, g.getPeriode());
|
||||
prepStmt.setDate(3, TrmtDate.getSQLDate(g.getJourGarde()));
|
||||
|
||||
nbMaj = prepStmt.executeUpdate();
|
||||
|
||||
} catch (SQLException ex) {
|
||||
@@ -140,16 +142,18 @@ public class GardeMySQL {
|
||||
int idCree = -1;
|
||||
String sql = "INSERT into gardes "
|
||||
+ "(jourGarde, periode, idPompier, disponibilite, deGarde) "
|
||||
+ "VALUES (?, ?, ?,?,?)";
|
||||
+ "VALUES (?, ?, ?,?,?);";
|
||||
|
||||
try {
|
||||
PreparedStatement prepStmt = null;
|
||||
prepStmt = theConnection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
||||
// PreparedStatement prepStmt = null;
|
||||
// prepStmt = theConnection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
||||
PreparedStatement prepStmt = theConnection.prepareStatement(sql);
|
||||
prepStmt.setDate(1, TrmtDate.getSQLDate(g.getJourGarde()));
|
||||
prepStmt.setInt(2, g.getPeriode());
|
||||
prepStmt.setInt(3, g.getPompier().getId());
|
||||
prepStmt.setInt(4, g.getDisponibilite());
|
||||
|
||||
prepStmt.setBoolean(5, g.isDeGarde());
|
||||
|
||||
System.out.println(prepStmt);
|
||||
int nbLigne = prepStmt.executeUpdate();
|
||||
|
||||
@@ -180,18 +184,18 @@ public class GardeMySQL {
|
||||
|
||||
int nbMAJ = -1;
|
||||
String sql = "UPDATE gardes "
|
||||
+ "SET disponibilite = ? "
|
||||
+ "SET disponibilite = ?, deGarde = ? "
|
||||
+ "WHERE idPompier = ? "
|
||||
+ "AND jourGarde = ? "
|
||||
+ "AND periode = ?"
|
||||
+ "AND deGarde = ?"
|
||||
;
|
||||
+ "AND periode = ?;";
|
||||
try {
|
||||
PreparedStatement prepStmt = theConnection.prepareStatement(sql);
|
||||
prepStmt.setInt(1, g.getDisponibilite());
|
||||
prepStmt.setInt(2, g.getPompier().getId());
|
||||
prepStmt.setDate(3, TrmtDate.getSQLDate(g.getJourGarde()));
|
||||
prepStmt.setInt(4, g.getPeriode());
|
||||
prepStmt.setBoolean(2, g.isDeGarde());
|
||||
prepStmt.setInt(3, g.getPompier().getId());
|
||||
prepStmt.setDate(4, TrmtDate.getSQLDate(g.getJourGarde()));
|
||||
prepStmt.setInt(5, g.getPeriode());
|
||||
|
||||
System.out.println("update : " + prepStmt);
|
||||
nbMAJ = prepStmt.executeUpdate();
|
||||
} catch (SQLException ex) {
|
||||
|
@@ -18,21 +18,33 @@ public class Gardes {
|
||||
Pompier pompier;
|
||||
int disponibilite;
|
||||
boolean isInBDD;
|
||||
boolean deGarde;
|
||||
|
||||
public Gardes(Calendar jourGarde, int periode, Pompier pompier, int disponibilite, boolean isInBDD) {
|
||||
public Gardes(Calendar jourGarde, int periode, Pompier pompier, int disponibilite, boolean isInBDD, boolean deGarde) {
|
||||
this.jourGarde = jourGarde;
|
||||
this.periode = periode;
|
||||
this.pompier = pompier;
|
||||
this.disponibilite = disponibilite;
|
||||
this.isInBDD = isInBDD;
|
||||
this.deGarde = deGarde;
|
||||
}
|
||||
|
||||
public Gardes(Calendar jourGarde, int periode, Pompier pompier, boolean deGarde) {
|
||||
this.jourGarde = jourGarde;
|
||||
this.periode = periode;
|
||||
this.pompier = pompier;
|
||||
this.deGarde = deGarde;
|
||||
}
|
||||
|
||||
|
||||
public Gardes(Calendar jourGarde, int periode, Pompier pompier) {
|
||||
this.jourGarde = jourGarde;
|
||||
this.periode = periode;
|
||||
this.pompier = pompier;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Calendar getJourGarde() {
|
||||
return jourGarde;
|
||||
}
|
||||
@@ -73,14 +85,23 @@ public class Gardes {
|
||||
this.isInBDD = isInBDD;
|
||||
}
|
||||
|
||||
public boolean isDeGarde() {
|
||||
return deGarde;
|
||||
}
|
||||
|
||||
public void setDeGarde(boolean deGarde) {
|
||||
this.deGarde = deGarde;
|
||||
}
|
||||
|
||||
@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);
|
||||
int hash = 5;
|
||||
hash = 37 * hash + Objects.hashCode(this.jourGarde);
|
||||
hash = 37 * hash + this.periode;
|
||||
hash = 37 * hash + Objects.hashCode(this.pompier);
|
||||
hash = 37 * hash + this.disponibilite;
|
||||
hash = 37 * hash + (this.isInBDD ? 1 : 0);
|
||||
hash = 37 * hash + (this.deGarde ? 1 : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@@ -105,6 +126,9 @@ public class Gardes {
|
||||
if (this.isInBDD != other.isInBDD) {
|
||||
return false;
|
||||
}
|
||||
if (this.deGarde != other.deGarde) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(this.jourGarde, other.jourGarde)) {
|
||||
return false;
|
||||
}
|
||||
@@ -116,8 +140,9 @@ public class Gardes {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Gardes{" + "jourGarde=" + jourGarde + ", periode=" + periode + ", pompier=" + pompier + ", disponibilite=" + disponibilite + ", isInBDD=" + isInBDD + '}';
|
||||
return "\nGardes{" + "jourGarde=" + jourGarde.getTime() + ", periode=" + periode + ", pompier=" + pompier + ", disponibilite=" + disponibilite + ", isInBDD=" + isInBDD + ", deGarde=" + deGarde + '}';
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -12,30 +12,41 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clementine.desrucques
|
||||
*/
|
||||
public class DispoForm {
|
||||
|
||||
HttpServletRequest request;
|
||||
|
||||
public void verifDispo(HttpServletRequest request){
|
||||
|
||||
public void verifDispo(HttpServletRequest request) {
|
||||
HttpSession maS = request.getSession();
|
||||
ArrayList <Gardes> lesG = (ArrayList<Gardes>) maS.getAttribute("lesVentilInit");
|
||||
|
||||
ArrayList<Gardes> lesG = (ArrayList<Gardes>) maS.getAttribute("lesVentilInit");
|
||||
|
||||
GardeMySQL vm = new GardeMySQL();
|
||||
Map<String, String[]> map = request.getParameterMap();
|
||||
String[] lesNvVentil = map.get("lesActivites");
|
||||
String[] lesNvGardes = map.get("cbGarde");
|
||||
ArrayList<Integer> lesNvGardesN = new ArrayList<>();
|
||||
if(lesNvGardes != null){
|
||||
for(String uneGarde : lesNvGardes){
|
||||
lesNvGardesN.add(Integer.parseInt(uneGarde));
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
for(Gardes uneGarde : lesG){
|
||||
for (Gardes uneGarde : lesG) {
|
||||
int oldAct = uneGarde.getDisponibilite();
|
||||
int newAct = Integer.parseInt(lesNvVentil[i]);
|
||||
if(oldAct != newAct){
|
||||
if(uneGarde.isIsInBDD()){
|
||||
if(newAct == 0){
|
||||
if (oldAct != newAct) {
|
||||
if (uneGarde.isIsInBDD()) {
|
||||
|
||||
if (newAct == 0) {
|
||||
vm.delete(uneGarde);
|
||||
uneGarde.setIsInBDD(false);
|
||||
uneGarde.setDisponibilite(newAct);
|
||||
} else {
|
||||
uneGarde.setDisponibilite(newAct);
|
||||
vm.update(uneGarde);
|
||||
@@ -45,6 +56,65 @@ public class DispoForm {
|
||||
vm.create(uneGarde);
|
||||
uneGarde.setIsInBDD(true);
|
||||
}
|
||||
|
||||
}
|
||||
boolean oldGarde = uneGarde.isDeGarde();
|
||||
boolean newGarde = lesNvGardesN.contains(i)?true:false;
|
||||
System.out.println("1: "+oldGarde +" "+ newGarde);
|
||||
if(oldGarde!= newGarde){
|
||||
uneGarde.setDeGarde(newGarde);
|
||||
System.out.println("2: "+oldGarde +" "+ newGarde);
|
||||
if (uneGarde.isIsInBDD()) {
|
||||
vm.update(uneGarde);
|
||||
}else{
|
||||
vm.create(uneGarde);
|
||||
uneGarde.setIsInBDD(true);
|
||||
System.out.println("3: "+oldGarde +" "+ newGarde);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public void verifGarde(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("cbGarde");
|
||||
// JCheckBox garde = new JCheckBox();
|
||||
int i = 0;
|
||||
for (Gardes uneGarde : lesG) {
|
||||
boolean oldAct = uneGarde.isDeGarde();
|
||||
int newAct = Integer.parseInt(lesNvVentil[i]);
|
||||
boolean newActO = (newAct==Integer.parseInt(lesNvVentil[i]));
|
||||
|
||||
if (oldAct != newActO) {
|
||||
if (uneGarde.isIsInBDD()) {
|
||||
|
||||
if (newActO == false) {
|
||||
vm.delete(uneGarde);
|
||||
uneGarde.setIsInBDD(false);
|
||||
uneGarde.isDeGarde();
|
||||
} else {
|
||||
uneGarde.isDeGarde();
|
||||
vm.update(uneGarde);
|
||||
}
|
||||
} else {
|
||||
uneGarde.isDeGarde();
|
||||
vm.create(uneGarde);
|
||||
uneGarde.setIsInBDD(true);
|
||||
}
|
||||
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
@@ -1,132 +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 servlet;
|
||||
|
||||
import bdd.GardeMySQL;
|
||||
import bean.Gardes;
|
||||
import bean.Pompier;
|
||||
import form.DispoForm;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import util.TrmtDate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author clementine.desrucques
|
||||
*/
|
||||
public class GPServlet extends HttpServlet {
|
||||
|
||||
/**
|
||||
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
|
||||
* methods.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
response.setContentType("text/html;charset=UTF-8");
|
||||
try ( PrintWriter out = response.getWriter()) {
|
||||
/* TODO output your page here. You may use following sample code. */
|
||||
out.println("<!DOCTYPE html>");
|
||||
out.println("<html>");
|
||||
out.println("<head>");
|
||||
out.println("<title>Servlet GPServlet</title>");
|
||||
out.println("</head>");
|
||||
out.println("<body>");
|
||||
out.println("<h1>Servlet GPServlet at " + request.getContextPath() + "</h1>");
|
||||
out.println("</body>");
|
||||
out.println("</html>");
|
||||
}
|
||||
}
|
||||
|
||||
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
|
||||
/**
|
||||
* Handles the HTTP <code>GET</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
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,request);
|
||||
//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/gardeJSP.jsp").forward(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the HTTP <code>POST</code> method.
|
||||
*
|
||||
* @param request servlet request
|
||||
* @param response servlet response
|
||||
* @throws ServletException if a servlet-specific error occurs
|
||||
* @throws IOException if an I/O error occurs
|
||||
*/
|
||||
@Override
|
||||
protected void doPost(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
// processRequest(request, response);
|
||||
DispoForm vf = new DispoForm();
|
||||
vf.verifDispo(request);
|
||||
getServletContext().getRequestDispatcher("/WEB-INF/pompierJSP.jsp").forward(request, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a short description of the servlet.
|
||||
*
|
||||
* @return a String containing servlet description
|
||||
*/
|
||||
@Override
|
||||
public String getServletInfo() {
|
||||
return "Short description";
|
||||
}// </editor-fold>
|
||||
|
||||
}
|
@@ -94,6 +94,10 @@ public class GardesServlet extends HttpServlet {
|
||||
//System.out.println("lesVentilInit : " + lesVentilInit);
|
||||
maSession.setAttribute("lesVentilInit", lesVentilInit);
|
||||
|
||||
// GardeMySQL dg = new GardeMySQL();
|
||||
// ArrayList<Gardes> lesgardes = dg.();
|
||||
// //System.out.println("lesVentilInit : " + lesVentilInit);
|
||||
// maSession.setAttribute("lesVentilInit", lesVentilInit);
|
||||
|
||||
/* Initialisation des couleurs */
|
||||
String[] lesCouleurs = {"blanc", "gris", "jaune"};
|
||||
@@ -117,6 +121,7 @@ public class GardesServlet extends HttpServlet {
|
||||
// processRequest(request, response);
|
||||
DispoForm vf = new DispoForm();
|
||||
vf.verifDispo(request);
|
||||
|
||||
getServletContext().getRequestDispatcher("/WEB-INF/pompierJSP.jsp").forward(request, response);
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<body>
|
||||
<%@include file= "jspf/header.jspf" %>
|
||||
<div class="container">
|
||||
<section id="contenueAffiche" class="row">
|
||||
<section id="contenuAffiche" class="row">
|
||||
|
||||
|
||||
|
||||
@@ -31,65 +31,88 @@
|
||||
<tr>
|
||||
<c:forEach var="i" begin="0" end="6" step="1">
|
||||
<c:forEach items='${sessionScope.lesPeriodes}' var="unePeriode" varStatus="status">
|
||||
|
||||
|
||||
<td class="text-center">${unePeriode.getCode()}</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>
|
||||
<tbody>
|
||||
|
||||
<c:set var="oldId" value='${newId}' scope="page"/>
|
||||
</c:if>
|
||||
|
||||
<c:set var="activite" value='${uneVentil.getDisponibilite()}' scope="page"/>
|
||||
<td>
|
||||
<input readonly type="text" value='${activite}' name="lesActivites"class="ztVentil ${sessionScope.lesCouleurs[activite]}"/>
|
||||
</td>
|
||||
</c:forEach>
|
||||
</tr>
|
||||
<c:set var="oldId" value="-1" scope="page"/>
|
||||
<tr>
|
||||
|
||||
</tbody>
|
||||
<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.getDisponibilite()}' scope="page"/>
|
||||
<c:set var="check" value="" scope="page"/>
|
||||
<c:if test="${uneVentil.isDeGarde() == true}" var="test" scope="page">
|
||||
<c:set var="check" value="checked" scope="page"/>
|
||||
</c:if>
|
||||
|
||||
<c:choose>
|
||||
<c:when test="${sessionScope.lePompierConnecte.getLeStatut().getCode() eq 2}">
|
||||
<td>
|
||||
<input readonly type="text" value='${activite}' name="lesActivites" class="ztVentil ${sessionScope.lesCouleurs[activite]}"/>
|
||||
<input type="checkbox" ${check} name="cbGarde" value="${status.count +1}">
|
||||
</td>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<td>
|
||||
<input readonly type="text" value='${activite}' name="lesActivites" class="ztVentil ${sessionScope.lesCouleurs[activite]}"/>
|
||||
<input type="checkbox" ${check} name="cbGarde" value="${status.count +1}" onclick="return false">
|
||||
</td>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
|
||||
</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>
|
||||
<span>De garde : X</span>
|
||||
<span>De garde : ☑</span>
|
||||
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button type="submit" value="Valider" class="btn btn-danger"><i class="bi bi-check2"></i> Valider</button>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button type="submit" value="Valider" class="btn btn-danger"><i class="bi bi-check2"></i> Valider</button>
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
||||
</section>
|
||||
</div>
|
||||
</body>
|
||||
<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;
|
||||
var st = (document.getElementById("statut").textContent).trim();
|
||||
if (st != "chef de centre") {
|
||||
|
||||
|
||||
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>
|
||||
|
@@ -1,93 +0,0 @@
|
||||
<%--
|
||||
Document : gardeJSP
|
||||
Created on : 14 déc. 2021, 08:20:45
|
||||
Author : clementine.desrucques
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<%@include file= "jspf/debutJSP.jspf" %>
|
||||
<body>
|
||||
<%@include file= "jspf/header.jspf" %>
|
||||
<div class="container">
|
||||
<section id="contenueAffiche" class="row">
|
||||
|
||||
|
||||
|
||||
<fieldset class="row mt-1 mb-10">
|
||||
|
||||
<legend>
|
||||
Feuille de gardes
|
||||
</legend>
|
||||
<form action="gardes" method="POST">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2">No</th>
|
||||
<th rowspan="2">Nom Prenom</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">
|
||||
|
||||
<td class="text-center">${unePeriode.getCode()}</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.getDisponibilite()}' scope="page"/>
|
||||
<td>
|
||||
<input readonly type="text" value='${activite}' name="lesActivites"class="ztVentil ${sessionScope.lesCouleurs[activite]}"/>
|
||||
</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>
|
||||
<span>De garde : X</span>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</fieldset>
|
||||
</section>
|
||||
</div>
|
||||
</body>
|
||||
<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>
|
@@ -14,7 +14,10 @@
|
||||
<c:otherwise>
|
||||
<h4>Bienvenue ${sessionScope.lePompierConnecte.getPrenom()}
|
||||
${sessionScope.lePompierConnecte.getNom()} (
|
||||
${sessionScope.lePompierConnecte.getLeStatut().getValeur()})
|
||||
<span id="statut">
|
||||
${sessionScope.lePompierConnecte.getLeStatut().getValeur()}
|
||||
</span>
|
||||
)
|
||||
</h4>
|
||||
|
||||
<button type="button" class="btn btn-warning fs-4" title="Déconnexion">
|
||||
|
@@ -103,8 +103,9 @@ select[readonly] {
|
||||
}
|
||||
|
||||
.ztVentil {
|
||||
width : 15px;
|
||||
border-color: black;
|
||||
height: 20px;
|
||||
width : 18px;
|
||||
border-color: black;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user