sauvegarde 05/10/2023

This commit is contained in:
pierre renaudot
2023-10-05 08:54:15 +02:00
parent 9aa3a1dbf4
commit 438ab2f077
6 changed files with 90 additions and 59 deletions

View File

@@ -202,7 +202,7 @@ class PdoBD
public function getInfosGardes($pompier)
{
$req = "SELECT aPompier, DATE_FORMAT(aDateGarde,'%d/%m/%Y') as wDate, aTranche, pLibelle as tLibelle
FROM activite INNER JOIN parametre ON pType='tranche' AND aTranche=pIndice
FROM activite INNER JOIN parametre ON pType = 'tranche' AND aTranche = pIndice
WHERE aCis=" . $_SESSION['cis'];
if ($pompier <> "*") {
$req .= " AND aPompier=" . $pompier;
@@ -232,9 +232,11 @@ class PdoBD
$fin = date('Y/m/d', strtotime("6 days", $premierJour));
$req = "SELECT pId, pNom, pPrenom, DATE_FORMAT(aDateGarde,'%d/%m/%Y') as wDate, aTranche, aDisponibilite, aGarde, d.pValeur as dCouleur
FROM (activite INNER JOIN parametre t ON t.pType='tranche'AND aTranche=t.pIndice
INNER JOIN parametre d ON d.pType='dispo' AND aDisponibilite=d.pIndice)
RIGHT OUTER JOIN pompier ON aCis=pCis AND aPompier=pId
FROM (activite
INNER JOIN parametre t ON t.pType='tranche'AND aTranche=t.pIndice
INNER JOIN parametre d ON d.pType='dispo' AND aDisponibilite=d.pIndice
)
RIGHT OUTER JOIN pompier ON aCis = pCis AND aPompier=pId
WHERE aCis=" . $_SESSION['cis'];
if ($pompier <> "*") {

View File

@@ -321,31 +321,33 @@ $(document).on('click', '.click-garde', function () {
idPompier = $(this).attr('id').split('/')[2]
garde = 0;
if ($(this).text() == 'X') {
$(this).text('');
garde = 0;
} else if ($(this).text() == ""){
$(this).text('X');
garde = 1;
} else {
$(this).text( "X");
garde = 0;
}
var tableauDeDonnees = {
"date" : date,
"tranche" : tranche,
"pompier" : idPompier,
"garde" : garde
}
$.ajax({
url: "/controleurs/c_disponibilitée.php?option=garde", // URL de l'API ou de la ressource
method: "POST", // Méthode HTTP (GET, POST, etc.)
dataType: "json", // Type de données attendu
data : tableauDeDonnees,
error: function(xhr, status, error) {
// Gérer les erreurs de la requête AJAX
console.error("Erreur lors de la requête AJAX :", status, error);
if ($(this).css('background-color') != "rgb(255, 0, 0)") {
if ($(this).text() == 'X') {
$(this).text('');
garde = 0;
} else if ($(this).text() == ""){
$(this).text('X');
garde = 1;
} else {
$(this).text( "X");
garde = 0;
}
});
var tableauDeDonnees = {
"date" : date,
"tranche" : tranche,
"pompier" : idPompier,
"garde" : garde
}
$.ajax({
url: "/controleurs/c_disponibilitée.php?option=garde", // URL de l'API ou de la ressource
method: "POST", // Méthode HTTP (GET, POST, etc.)
dataType: "json", // Type de données attendu
data : tableauDeDonnees,
error: function(xhr, status, error) {
// Gérer les erreurs de la requête AJAX
console.error("Erreur lors de la requête AJAX :", status, error);
}
});
}
})