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 @@ -
');"> +