From 22149c3f1fa019e7a95a416052861418ab7c219f Mon Sep 17 00:00:00 2001 From: pierre renaudot Date: Thu, 28 Sep 2023 12:02:07 +0200 Subject: [PATCH] =?UTF-8?q?Fiche=20de=20dispo->done=20AND=20d=C3=A9but=20d?= =?UTF-8?q?e=20la=20selection=20des=20gardes=20pour=20le=20chef?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/class.pdo.php | 24 ++++---- include/proceduresJava.js | 23 ++++++-- requeteUtile.txt | 3 + styles/styles.css | 2 +- vues/v_entete.php | 6 +- vues/v_ficheGardes.php | 120 +++++++++++++++++++------------------- 6 files changed, 99 insertions(+), 79 deletions(-) create mode 100644 requeteUtile.txt diff --git a/include/class.pdo.php b/include/class.pdo.php index 7e9e503..3fa4050 100644 --- a/include/class.pdo.php +++ b/include/class.pdo.php @@ -13,7 +13,7 @@ class PdoBD private static $serveur = 'mysql:host=localhost'; private static $bdd = 'dbname=sdis29'; private static $user = 'root'; - private static $mdp = ''; + private static $mdp = 'root'; private static $monPdo; private static $monPdoBD = null; @@ -109,11 +109,11 @@ class PdoBD afficherErreurSQL("Probleme lors de la mise à jour de l'activité dans la base de données.", $existedTranche, PdoBD::$monPdo->errorInfo()); } else { - if (count($rs->fetch()) !== 2) { + if ($rs->fetch() === false) { $req = 'INSERT INTO activite (aCis, aPompier, aDateGarde, aTranche, aDisponibilite, aGarde) - VALUES (' . $cis . ', + VALUES (' . $cis . ', ' . $idUser . ', - ' . $jour . ', + "' . $jour . '", ' . $tranche . ', ' . $newDispo . ', 0);'; } else { @@ -261,10 +261,10 @@ class PdoBD 'g2' => 0, 'g3' => 0, 'g4' => 0, - 'c1' => 'gray', - 'c2' => 'gray', - 'c3' => 'gray', - 'c4' => 'gray' + 'c1' => 'red', + 'c2' => 'red', + 'c3' => 'red', + 'c4' => 'red' ); } } else { @@ -293,10 +293,10 @@ class PdoBD 'g2' => 0, 'g3' => 0, 'g4' => 0, - 'c1' => 'gray', - 'c2' => 'gray', - 'c3' => 'gray', - 'c4' => 'gray' + 'c1' => 'red', + 'c2' => 'red', + 'c3' => 'red', + 'c4' => 'red' ); } } diff --git a/include/proceduresJava.js b/include/proceduresJava.js index 5202a4e..a126ea5 100644 --- a/include/proceduresJava.js +++ b/include/proceduresJava.js @@ -281,17 +281,17 @@ $(document).on('click', '.select-dispo', function () { dateDispo = $(this).attr('id').split('/')[0] tranche = $(this).attr('id').split('/')[1] - dispo = 1; + dispo = 0; if ($(this).css('background-color') == "rgb(255, 0, 0)") { //rgb(255, 0, 0) = red $(this).css('background-color', 'green'); - dispo = 2; + dispo = 1; } else if ($(this).css('background-color') == 'rgb(0, 128, 0)') { //rgb(0, 128, 0) = green $(this).css('background-color', 'yellow'); - dispo = 3; + dispo = 2; } else { $(this).css('background-color', 'red'); - dispo = 1; + dispo = 0; } var tableauDeDonnees = { @@ -309,4 +309,19 @@ $(document).on('click', '.select-dispo', function () { console.error("Erreur lors de la requête AJAX :", status, error); } }); +}) + +/** + * Gere l'ajout des gardes + */ +$(document).on('click', '.click-garde', function () { + //console.log($(this).css('background-color')) + console.log($(this).html); + if ($(this).html() == 'X') { + $(this).html() = ""; + } else if ($(this).html() == ""){ + $(this).html() = "X"; + } else { + $(this).html() = "X"; + } }) \ No newline at end of file diff --git a/requeteUtile.txt b/requeteUtile.txt new file mode 100644 index 0000000..96c0ed1 --- /dev/null +++ b/requeteUtile.txt @@ -0,0 +1,3 @@ +Garde de michel Rouat a tel date + +SELECT * FROM `activite` WHERE aCis = 2901 AND aPompier = 1 AND aDateGarde = "2023-09-22"; \ No newline at end of file diff --git a/styles/styles.css b/styles/styles.css index e3bd341..49cf64c 100644 --- a/styles/styles.css +++ b/styles/styles.css @@ -583,7 +583,7 @@ table.listeLegere td { padding: 1px; margin: 1px; border-spacing: 2px; - border-color: gray; + border-color: black; } .tableau td.semaine { diff --git a/vues/v_entete.php b/vues/v_entete.php index b5697b0..1e79b25 100644 --- a/vues/v_entete.php +++ b/vues/v_entete.php @@ -11,14 +11,16 @@ - ');"> +
diff --git a/vues/v_ficheGardes.php b/vues/v_ficheGardes.php index 6642f68..f8ff0d2 100644 --- a/vues/v_ficheGardes.php +++ b/vues/v_ficheGardes.php @@ -1,66 +1,66 @@
-
Feuille de gardes -
- - - - - - -
- - - - +
+ Feuille de gardes +
+ + + + + + + +
')" onmouseover="document.gauche.src='images/gauche_.gif'" onmouseout="document.gauche.src='images/gauche.gif'"type="image">
+ + + - ";?> + "; ?> - - - - '.$nomJour[$jour].' '.date('d/m',strtotime('+'.$jour.' day',$premierJour)).''); - } - - echo "".PHP_EOL." "; - for($jour=0; $jour<= 6; $jour++) - { - foreach ($lesTranches as $uneTranche) - {echo '';} - } - echo PHP_EOL." "; - - foreach ($lesPompiers as $unPompier) - { - echo ""; - - - - - - - - - - - - - - - - - - - - echo "".PHP_EOL." "; - } -?> - - -
')" + onmouseover="document.gauche.src='images/gauche_.gif'" + onmouseout="document.gauche.src='images/gauche.gif'" type="image">Semaine Semaine + ')" onmouseover="document.droite.src='images/droite_.gif'" onmouseout="document.droite.src='images/droite.gif'"type="image">
 
Volontaires'.$uneTranche["pIndice"].'
".$unPompier['pNom']." ".$unPompier['pPrenom']."
+ ')" + onmouseover="document.droite.src='images/droite_.gif'" + onmouseout="document.droite.src='images/droite.gif'" type="image"> + + +   + ' . $nomJour[$jour] . ' ' . date('d/m', strtotime('+' . $jour . ' day', $premierJour)) . ''); + } + + echo "" . PHP_EOL . " Volontaires"; + + for ($jour = 0; $jour <= 6; $jour++) { + foreach ($lesTranches as $uneTranche) { + echo '' . $uneTranche["pIndice"] . ''; + } + } + echo PHP_EOL . " "; + + foreach ($lesPompiers as $unPompier) { + echo " + + " . $unPompier['pNom'] . " " . $unPompier['pPrenom'] . ""; + + for ($jour = 0; $jour <= 6; $jour++) { + for ($tranche = 0; $tranche <= 3; $tranche++) { + echo ''; + } + } + + echo ("" . PHP_EOL . " "); + // TODO POUR AFFICHER LES GARDES + } + ?> + + +
\ No newline at end of file