Fiche de dispo->done AND début de la selection des gardes pour le chef

This commit is contained in:
pierre renaudot
2023-09-28 12:02:07 +02:00
parent 5d06dc1486
commit 22149c3f1f
6 changed files with 99 additions and 79 deletions

View File

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

View File

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