Merge origin/master
Conflicts: web/WEB-INF/feuilleGardes.jsp web/css/mycss.css
This commit is contained in:
parent
623728d3e3
commit
5287b5ff74
@ -29,6 +29,14 @@ public class Gardes {
|
||||
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;
|
||||
|
@ -12,6 +12,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import javax.swing.JCheckBox;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -28,6 +29,13 @@ public class DispoForm {
|
||||
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) {
|
||||
int oldAct = uneGarde.getDisponibilite();
|
||||
@ -49,6 +57,64 @@ public class DispoForm {
|
||||
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++;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -53,11 +53,27 @@
|
||||
</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" id="cbGarde"/>
|
||||
|
||||
<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>
|
||||
|
||||
@ -80,6 +96,10 @@
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
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) {
|
||||
@ -92,6 +112,7 @@
|
||||
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">
|
||||
|
Loading…
x
Reference in New Issue
Block a user