Compare commits
3 Commits
v0.0.2.b-p
...
v2.0.1-pr
Author | SHA1 | Date | |
---|---|---|---|
062e417a9c | |||
591b6a0d41 | |||
443c0225ae |
@ -3,8 +3,6 @@ session_start();
|
||||
|
||||
include (__DIR__ . '/../include/class.pdo.php');
|
||||
|
||||
var_dump($_POST);
|
||||
|
||||
$pdo = PdoBD::getPdoBD();
|
||||
|
||||
if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'garde') {
|
||||
|
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
|
||||
$pdo
|
@ -9,44 +9,67 @@
|
||||
// Auteur : pascal-blain@wanadoo.fr '
|
||||
//*****************************************'
|
||||
$action = $_REQUEST['action'];
|
||||
switch($action)
|
||||
{
|
||||
case 'voir':
|
||||
{
|
||||
include("vues/v_entete.php");
|
||||
if(!isset($_REQUEST['zSemaine'])){$_REQUEST['zSemaine'] = date('W');}
|
||||
$semaine = $_REQUEST['zSemaine'];
|
||||
if(!isset($_REQUEST['zAnnee'])){$_REQUEST['zAnnee'] = date('Y');}
|
||||
$annee = $_REQUEST['zAnnee'];
|
||||
$premierJour = strtotime("+$semaine weeks",mktime(0,0,0,1,1,$annee));
|
||||
if (date('w',$premierJour) != 1){$premierJour = strtotime("last monday",$premierJour);}
|
||||
$lesTranches = $pdo->getParametre("tranche");
|
||||
$lesTypesDispos = $pdo->getParametre("dispo");
|
||||
$titre="CIS"; //Centre d'incendie et de secours :";
|
||||
$lesCasernes = $pdo->getLesCasernes($_SESSION["adr1"]);
|
||||
include("vues/v_choixCaserne.php");
|
||||
$lesPompiers = $pdo->getLesPompiers($choix);
|
||||
$lesInterventions=$pdo->getLesInterventions($choix);
|
||||
$intervention=1;
|
||||
$lesParticipants= $pdo->getLesParticipants($choix, $intervention);
|
||||
include("vues/v_Intervention.php");
|
||||
break;
|
||||
}
|
||||
switch ($action) {
|
||||
case 'voir': {
|
||||
include("vues/v_entete.php");
|
||||
|
||||
//-----------------------------------------
|
||||
case 'majGarde':
|
||||
{
|
||||
$pdo->majGarde($_REQUEST["ztLaDate"], $_REQUEST["ztLaTranche"], $_REQUEST["ztExGarde"], $_REQUEST["ztPompier"]);
|
||||
header ('location: index.php?choixTraitement=gardes&action=voir&zSemaine='.$_REQUEST["zSemaine"].'&zAnnee='.$_REQUEST["zAnnee"]);
|
||||
break;
|
||||
}
|
||||
if (!isset($_REQUEST['zSemaine'])) {
|
||||
$_REQUEST['zSemaine'] = date('W');
|
||||
}
|
||||
$semaine = $_REQUEST['zSemaine'];
|
||||
|
||||
if (!isset($_REQUEST['zAnnee'])) {
|
||||
$_REQUEST['zAnnee'] = date('Y');
|
||||
}
|
||||
$annee = $_REQUEST['zAnnee'];
|
||||
$premierJour = strtotime("+$semaine weeks", mktime(0, 0, 0, 1, 1, $annee));
|
||||
|
||||
if (date('w', $premierJour) != 1) {
|
||||
$premierJour = strtotime("last monday", $premierJour);
|
||||
}
|
||||
$lesTranches = $pdo->getParametre("tranche");
|
||||
$lesTypesDispos = $pdo->getParametre("dispo");
|
||||
$titre = "CIS"; //Centre d'incendie et de secours :";
|
||||
//include("vues/v_choixCaserne.php");
|
||||
//$lesPompiers = $pdo->getLesPompiers($choix);
|
||||
//$lesInterventions = $pdo->getLesInterventions($choix);
|
||||
//$intervention = 1;
|
||||
//$lesParticipants = $pdo->getLesParticipants($choix, $intervention);
|
||||
include("vues/v_Intervention.php");
|
||||
break;
|
||||
}
|
||||
case 'nouvelle': {
|
||||
include("vues/v_entete.php");
|
||||
$lesCasernes = $pdo->getLesCasernes($_SESSION["adr1"]);
|
||||
$lesMotifs = $pdo->motifIntervention();
|
||||
$lesPompiers = $pdo->getPompiersDispo('2023-09-23', 2, 2924);
|
||||
|
||||
include("vues/v_nouvelleIntervention.php");
|
||||
|
||||
break;
|
||||
}
|
||||
case 'listePompier':
|
||||
require_once ("../include/class.pdo.php");
|
||||
|
||||
$pdo = PdoBD::getPdoBD();
|
||||
|
||||
$lesPompiers = $pdo->getPompiersDispo('2023-09-23', 2, $_GET['cis']);
|
||||
|
||||
echo(json_encode($lesPompiers));
|
||||
|
||||
//-----------------------------------------
|
||||
default :
|
||||
{
|
||||
echo 'erreur d\'aiguillage !'.$action;
|
||||
break;
|
||||
}
|
||||
//-----------------------------------------
|
||||
case 'majGarde': {
|
||||
$pdo->majGarde($_REQUEST["ztLaDate"], $_REQUEST["ztLaTranche"], $_REQUEST["ztExGarde"], $_REQUEST["ztPompier"]);
|
||||
header('location: index.php?choixTraitement=gardes&action=voir&zSemaine=' . $_REQUEST["zSemaine"] . '&zAnnee=' . $_REQUEST["zAnnee"]);
|
||||
break;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
default: {
|
||||
echo 'erreur d\'aiguillage !' . $action;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
table equipe:
|
||||
@ -64,4 +87,4 @@ iTranche tinyint(3)
|
||||
iHeureDebut datetime
|
||||
iHeureFin datetime
|
||||
*/
|
||||
?>
|
||||
?>
|
@ -65,14 +65,13 @@ switch ($action) {
|
||||
break;
|
||||
case 'validerAjouter':
|
||||
case 'validerModifier': {
|
||||
var_dump($_REQUEST);
|
||||
|
||||
if (!isset($pdo)) {
|
||||
require_once ("../include/class.pdo.php");
|
||||
$pdo = PdoBD::getPdoBD();
|
||||
}
|
||||
|
||||
$pId = $_REQUEST['pId'];
|
||||
$pId = isset($_REQUEST['pId']) ? $_REQUEST['pId'] : $pdo->getLastId($_REQUEST['zCis']);
|
||||
$nom = addslashes($_REQUEST['ztNom']);
|
||||
$prenom = addslashes($_REQUEST['ztPrenom']);
|
||||
$type = $_REQUEST['lstType'];
|
||||
@ -80,7 +79,8 @@ switch ($action) {
|
||||
$statut = $_REQUEST['lstStatut'];
|
||||
$cis = $_REQUEST['zCis'];
|
||||
$mail = $_REQUEST['ztMail'];
|
||||
$login = strtolower($_REQUEST['ztPrenom'][0]) . strtoupper($_REQUEST['ztNom']);
|
||||
// $login = strtolower($_REQUEST['ztPrenom'][0]) . strtoupper($_REQUEST['ztNom']);
|
||||
$login = $_REQUEST['ztLogin'];
|
||||
$mdp = md5($login);
|
||||
//$mdp = md5($_REQUEST['ztMdp']);
|
||||
// if ($_REQUEST['brMdp'] == 0 and $action === "validerModifier") {
|
||||
@ -104,10 +104,19 @@ switch ($action) {
|
||||
}
|
||||
$commentaire = addslashes($_REQUEST['ztObservation']);
|
||||
|
||||
if ($action === "validerAjouter") {
|
||||
$pdo->ajoutPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire);
|
||||
if (
|
||||
$action === "validerAjouter"
|
||||
&& $pdo->verifDataAjoutPompier($nom, $prenom, $tel, $mail, $login) === true
|
||||
) {
|
||||
//$pdo->ajoutPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire);
|
||||
echo(json_encode(array("success"=> "Ajout effectuée")));
|
||||
|
||||
} elseif ($action === "validerModifier") {
|
||||
$pdo->majPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire);
|
||||
echo(json_encode(array("success"=> "Modification effectuée")));
|
||||
|
||||
} else {
|
||||
echo(json_encode(array("error"=> "Merci de remplir tous les champs")));
|
||||
}
|
||||
//header('location: index.php?choixTraitement=pompiers&action=voir&lstPompiers=' . $valeur);
|
||||
break;
|
||||
|
@ -63,7 +63,7 @@ class PdoBD
|
||||
{
|
||||
$req = "SELECT pCis, pId, pNom, pPrenom, pStatut
|
||||
FROM pompier
|
||||
WHERE pCis=" . $cis . "
|
||||
WHERE pCis = " . $cis . "
|
||||
ORDER BY pNom;";
|
||||
$rs = PdoBD::$monPdo->query($req);
|
||||
if ($rs === false) {
|
||||
@ -79,10 +79,10 @@ class PdoBD
|
||||
public function getInfosPompier($login, $mdp)
|
||||
{
|
||||
/*
|
||||
$req = "SELECT pCis, pId as id, pNom as nom, pPrenom as prenom, pStatut, pMail, pLogin, pMdp, pGrade, pAdresse, pCp, pVille, pBip, pCommentaire,
|
||||
'la caserne' as cNom, 'adresse' as cAdresse, 'telephone' as cTel, 'le groupement' as cGroupement, 'le grade' as wGrade, 'le statut' as wStatut, 'le type' as wType
|
||||
FROM pompier";
|
||||
*/
|
||||
$req = "SELECT pCis, pId as id, pNom as nom, pPrenom as prenom, pStatut, pMail, pLogin, pMdp, pGrade, pAdresse, pCp, pVille, pBip, pCommentaire,
|
||||
'la caserne' as cNom, 'adresse' as cAdresse, 'telephone' as cTel, 'le groupement' as cGroupement, 'le grade' as wGrade, 'le statut' as wStatut, 'le type' as wType
|
||||
FROM pompier";
|
||||
*/
|
||||
$req = "SELECT
|
||||
pCis,
|
||||
pId as id,
|
||||
@ -125,7 +125,6 @@ class PdoBD
|
||||
$existedTranche = 'SELECT aDisponibilite FROM activite
|
||||
WHERE aCis = ' . $cis . ' AND aDateGarde = "' . $jour . '" AND aTranche = ' . $tranche . ' AND aPompier = ' . $idUser . ';';
|
||||
$rs = PdoBD::$monPdo->query($existedTranche);
|
||||
var_dump($rs);
|
||||
|
||||
if ($rs === false) {
|
||||
afficherErreurSQL("Probleme lors de la mise à jour de l'activité dans la base de données.", $existedTranche, PdoBD::$monPdo->errorInfo());
|
||||
@ -146,7 +145,6 @@ class PdoBD
|
||||
AND aDateGarde = "' . $jour . '"
|
||||
AND aTranche = ' . $tranche . ';';
|
||||
}
|
||||
var_dump($req);
|
||||
$rs = PdoBD::$monPdo->exec($req);
|
||||
|
||||
if ($rs === false) {
|
||||
@ -195,8 +193,6 @@ class PdoBD
|
||||
pCommentaire ='$commentaire', pDateModif ='$dateUpdate'
|
||||
WHERE pCis='$cis' AND pId = '$pId'
|
||||
;";
|
||||
var_dump($req);
|
||||
die;
|
||||
$rs = PdoBD::$monPdo->exec($req);
|
||||
if ($rs === false) {
|
||||
afficherErreurSQL("Probleme lors de la mise à jour du pompier dans la base de données.", $req, PdoBD::$monPdo->errorInfo());
|
||||
@ -220,12 +216,19 @@ class PdoBD
|
||||
/**
|
||||
* ajoute une ligne dans la table pompier
|
||||
*/
|
||||
public function ajoutPompier($cis, $valeur, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire)
|
||||
public function ajoutPompier($cis, $id, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire)
|
||||
{
|
||||
$req = "INSERT INTO pompier
|
||||
(pCis,pId,pNom,pPrenom,pStatut,pMail,pLogin,pMdp,pGrade,pType, pAdresse,pCp,pVille,pBip,pCommentaire,pDateEnreg,pDateModif)
|
||||
(pCis,pId,pNom,pPrenom,pStatut,pMail,pLogin,pMdp,pGrade,pType, pAdresse,pCp,pVille,pBip,pCommentaire, pNbGardes, pDateEnreg, pDateModif)
|
||||
VALUES
|
||||
(
|
||||
(" . $cis . ", " . $id . ",
|
||||
'" . $nom . "', '" . $prenom . "',
|
||||
" . $statut . ", '" . $mail . "',
|
||||
'" . $login . "', '" . $mdp . "',
|
||||
" . $grade . ", " . $type . ",
|
||||
'" . $adresse . "', " . $cp . ",
|
||||
'" . $ville . "', '" . $tel . "',
|
||||
'" . $commentaire . "',0 ,CURRENT_DATE, CURRENT_DATE
|
||||
);";
|
||||
$rs = PdoBD::$monPdo->exec($req);
|
||||
if ($rs === false) {
|
||||
@ -355,8 +358,8 @@ class PdoBD
|
||||
$lesDispos[$pompier][$laDate][$couleur] = $uneLigne['dCouleur'];
|
||||
}
|
||||
/* echo "<PRE>";
|
||||
print_r($lesDispos);
|
||||
echo "</PRE>";*/
|
||||
print_r($lesDispos);
|
||||
echo "</PRE>";*/
|
||||
return $lesDispos;
|
||||
}
|
||||
|
||||
@ -540,6 +543,137 @@ class PdoBD
|
||||
return $lesLignes;
|
||||
}
|
||||
|
||||
public function getLastId($pCis): int
|
||||
{
|
||||
$req = "SELECT MAX(pId) + 1 as id FROM pompier WHERE pCis =" . $pCis . ";";
|
||||
$rs = PdoBD::$monPdo->query($req);
|
||||
if ($rs === false) {
|
||||
afficherErreurSQL("Erreur de lma requete pour l'id ajouter", $req, PdoBD::$monPdo->errorInfo());
|
||||
}
|
||||
$id = $rs->fetch();
|
||||
return $id["id"];
|
||||
}
|
||||
|
||||
public function verifDataAjoutPompier(
|
||||
string $nom,
|
||||
string $prenom,
|
||||
string $tel,
|
||||
string $mail,
|
||||
string $login
|
||||
): bool {
|
||||
|
||||
if (empty($nom) || empty($prenom) || empty($tel) || empty($mail) || empty($login)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PARTIE INTERVENTION
|
||||
*/
|
||||
public function motifIntervention()
|
||||
{
|
||||
$req = "SELECT pIndice, pLibelle
|
||||
FROM `parametre`
|
||||
WHERE pType = 'cateInt'
|
||||
ORDER BY pLibelle;";
|
||||
$cat = PdoBD::$monPdo->query($req);
|
||||
$cat = $cat->fetchAll();
|
||||
|
||||
//Valeur : nbUtil
|
||||
//Plancher : Time
|
||||
//Plafond: nbPompier estimé
|
||||
$reqType = "SELECT pIndice, pLibelle, pValeur, pPlancher, pPlafond
|
||||
FROM parametre
|
||||
WHERE pType = 'typeInt'
|
||||
ORDER BY pLibelle;";
|
||||
$type = PdoBD::$monPdo->query($reqType);
|
||||
$type = $type->fetchAll();
|
||||
|
||||
$response = [];
|
||||
|
||||
foreach ($cat as $uneCat) {
|
||||
$table = [];
|
||||
foreach ($type as $row) {
|
||||
if (substr($row['pIndice'], -3, 1) === $uneCat['pIndice']) {
|
||||
array_push($table, $row);
|
||||
}
|
||||
}
|
||||
$response[$uneCat['pLibelle']] = $table;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function getPompiersDispo(string $date, int $tranche, int $caserne)
|
||||
{
|
||||
$req = "SELECT pompier.pId, pompier.pNom, pompier.pPrenom, g.pLibelle AS statut, 0 AS enIntervention, p.pLibelle, p.pValeur
|
||||
FROM `pompier`
|
||||
INNER JOIN activite ON pompier.pId = activite.aPompier
|
||||
AND activite.aCis = pompier.pCis
|
||||
INNER JOIN parametre p ON p.pType = 'dispo' AND p.pIndice = activite.aDisponibilite
|
||||
INNER JOIN parametre g ON g.pType = 'grade' AND g.pIndice = pompier.pGrade
|
||||
WHERE activite.aGarde = 1
|
||||
AND pCis = :caserne
|
||||
AND activite.aDateGarde = :date
|
||||
AND activite.aTranche = :tranche
|
||||
AND pompier.pId NOT IN(SELECT ePompier
|
||||
FROM equipe
|
||||
INNER JOIN intervention on intervention.iId = equipe.eIntervention AND intervention.iCis = equipe.eCis
|
||||
WHERE intervention.iHeureFin is null
|
||||
AND intervention.iDate = :date
|
||||
AND intervention.iTranche = :tranche
|
||||
AND intervention.iCis = :caserne
|
||||
)
|
||||
|
||||
UNION
|
||||
|
||||
SELECT pompier.pId, pompier.pNom, pompier.pPrenom, g.pLibelle AS statut, 1 AS enIntervention, p.pLibelle, 'grey'
|
||||
FROM equipe
|
||||
INNER JOIN pompier on equipe.ePompier = pompier.pId
|
||||
AND equipe.eCis = pompier.pCis
|
||||
INNER JOIN intervention on intervention.iId = equipe.eIntervention
|
||||
AND intervention.iCis = equipe.eCis
|
||||
INNER JOIN activite on pompier.pId = activite.aPompier
|
||||
AND activite.aCis = pompier.pCis
|
||||
AND activite.aDateGarde = intervention.iDate
|
||||
AND activite.aTranche = intervention.iTranche
|
||||
INNER JOIN parametre p ON p.pType = 'dispo' AND p.pIndice = activite.aDisponibilite
|
||||
INNER JOIN parametre g ON g.pType = 'grade' AND g.pIndice = pompier.pGrade
|
||||
WHERE intervention.iHeureFin is null
|
||||
AND intervention.iTranche = :tranche
|
||||
AND intervention.iDate = :date
|
||||
AND equipe.eCis = :caserne;";
|
||||
|
||||
$result = PdoBD::$monPdo->prepare($req);
|
||||
$result->bindParam(':date', $date); // 2023-09-23
|
||||
$result->bindParam(':tranche', $tranche); //2
|
||||
$result->bindParam(':caserne', $caserne); //2924
|
||||
|
||||
$result->execute();
|
||||
return $result->fetchAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
SELECT pompier.*, 0 AS enIntervention, activite.aDisponibilite
|
||||
FROM `pompier`
|
||||
INNER JOIN activite ON pompier.pId = activite.aPompier AND activite.aCis = pompier.pCis
|
||||
WHERE pCis = 2924 AND activite.aDateGarde = '2023-09-23' AND activite.aTranche = 2 AND activite.aGarde = 1
|
||||
AND pompier.pId NOT IN(SELECT ePompier
|
||||
FROM equipe
|
||||
INNER JOIN intervention on intervention.iId = equipe.eIntervention AND intervention.iCis = equipe.eCis
|
||||
WHERE intervention.iDate = '2023-09-23' AND intervention.iTranche = 2 AND intervention.iHeureFin is null)
|
||||
|
||||
UNION
|
||||
|
||||
SELECT pompier.*, 1 AS enIntervention, activite.aDisponibilite
|
||||
FROM equipe
|
||||
INNER JOIN pompier on equipe.ePompier = pompier.pId AND equipe.eCis = pompier.pCis
|
||||
INNER JOIN activite on pompier.pId = activite.aPompier AND activite.aCis = pompier.pCis
|
||||
INNER JOIN intervention on intervention.iId = equipe.eIntervention AND intervention.iCis = equipe.eCis
|
||||
WHERE intervention.iDate = '2023-09-23' AND intervention.iTranche = 2 AND intervention.iHeureFin is null;
|
||||
*/
|
||||
?>
|
73
include/gestionInterventions.js
Normal file
73
include/gestionInterventions.js
Normal file
@ -0,0 +1,73 @@
|
||||
formulaire = $('.formulaire')
|
||||
date = Date.now()
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
// $.ajax({
|
||||
// url: "/controleurs/c_interventions.php?action=infoFormulaire",
|
||||
// method: "POST", // Méthode HTTP (GET, POST, etc.)
|
||||
// dataType: "json", // Type de données attendu
|
||||
// error: function(status, error) {
|
||||
// // Gérer les erreurs de la requête AJAX
|
||||
// console.error("Erreur lors de la requête AJAX :", status, error);
|
||||
// },
|
||||
// success: function(result) {
|
||||
|
||||
// }
|
||||
// });
|
||||
|
||||
$('#caserneInter').change(function () {
|
||||
console.log($(this).val());
|
||||
caserne = $(this).val()
|
||||
//cis
|
||||
$.ajax({
|
||||
url: "./../controleurs/c_interventions.php?action=listePompier&cis=" + caserne,
|
||||
method: "POST", // Méthode HTTP (GET, POST, etc.)
|
||||
dataType: "json", // Type de données attendu
|
||||
error: function (status, error) {
|
||||
// Gérer les erreurs de la requête AJAX
|
||||
console.error("Erreur lors de la requête AJAX :", status, error);
|
||||
},
|
||||
success: function (result) {
|
||||
$('#pompierDispo').html(' ');
|
||||
result.forEach(element => {
|
||||
var ligne = '<div id='
|
||||
+ element['pId']
|
||||
+ ' class="' + element['pLibelle']
|
||||
+ '" style = "background-color: ' + element['pValeur'] + ';" draggable = "true" ondragstart = "dragstartHandler(event)" >'
|
||||
+ element['pPrenom'] + ' ' + element['pNom']
|
||||
+ ' (' + element['statut'] + ')'
|
||||
+ '</div> ';
|
||||
|
||||
$('#pompierDispo').append(ligne)
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function dragstartHandler(ev) {
|
||||
// Add the target element's id to the data transfer object
|
||||
ev.dataTransfer.setData("application/my-app", ev.target.id);
|
||||
ev.dataTransfer.effectAllowed = "move";
|
||||
}
|
||||
function dragoverHandler(ev) {
|
||||
ev.preventDefault();
|
||||
ev.dataTransfer.dropEffect = "move";
|
||||
}
|
||||
function dropHandler(ev) {
|
||||
ev.preventDefault();
|
||||
// Get the id of the target and add the moved element to the target's DOM
|
||||
const data = ev.dataTransfer.getData("application/my-app");
|
||||
if (ev.target.id === "target" || ev.target.parentNode.id === "target") {
|
||||
trgt = document.getElementById('target');
|
||||
} else if (ev.target.id === "pompierDispo" || ev.target.parentNode.id === "pompierDispo") {
|
||||
trgt = document.getElementById('pompierDispo');
|
||||
}
|
||||
trgt.appendChild(document.getElementById(data));
|
||||
}
|
||||
|
||||
|
@ -397,12 +397,13 @@ $(document).on('click', '.btn-valid-modif', function (e) {
|
||||
/**
|
||||
* Ajout d'un pompier
|
||||
*/
|
||||
$(document).on('click', '.validerAjout', function (e) {
|
||||
$(document).on('submit', '.dataPompierAjout', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
console.log('toto');
|
||||
$('#inputDisabled').attr('disabled', false);
|
||||
|
||||
data = $('.dataPompierAjout').serialize()
|
||||
$('#inputDisabled').attr('disabled', true);
|
||||
|
||||
$.ajax({
|
||||
url: "/controleurs/c_pompiers.php?action=validerAjouter",
|
||||
method: "POST", // Méthode HTTP (GET, POST, etc.)
|
||||
@ -411,6 +412,27 @@ $(document).on('click', '.validerAjout', function (e) {
|
||||
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);
|
||||
}
|
||||
},
|
||||
success: function(result) {
|
||||
$('.dataPompierAjout').trigger("reset"); ;
|
||||
$('.notif-ajout').html(result['success'])
|
||||
}
|
||||
});
|
||||
});
|
||||
$(document).on('click', '.btAnnulerAjout', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
window.location.href = "http://sdis29-1/index.php?choixTraitement=pompiers&action=voir&type=a";
|
||||
})
|
||||
$(document).ready(function(){
|
||||
$('#newName, #newUsername').change(function() {
|
||||
newUserName = $('#newUsername').val()[0].toLowerCase();
|
||||
if (newUserName == undefined) {
|
||||
newUserName = '';
|
||||
}
|
||||
newName = $('#newName').val().toUpperCase();
|
||||
|
||||
$('#newLogin').val(newUserName+newName)
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -17,7 +17,9 @@ $pdo = PdoBD::getPdoBD();
|
||||
$estConnecte = estConnecte();
|
||||
|
||||
// on vérifie que le pompier est authentifié
|
||||
if(!isset($_REQUEST['choixTraitement']) || !$estConnecte){$_REQUEST['choixTraitement'] = 'connexion';}
|
||||
if(!isset($_REQUEST['choixTraitement']) || !$estConnecte){
|
||||
$_REQUEST['choixTraitement'] = 'connexion';
|
||||
}
|
||||
|
||||
// on analyse le cas d'utilisation en cours ...
|
||||
$choixTraitement= $_REQUEST['choixTraitement'];
|
||||
@ -33,7 +35,5 @@ switch($choixTraitement)
|
||||
break;
|
||||
}
|
||||
}
|
||||
include("vues/v_pied.php") ;
|
||||
|
||||
var_dump($_SESSION);
|
||||
?>
|
||||
include("vues/v_pied.php") ;
|
||||
|
@ -44,7 +44,7 @@
|
||||
}
|
||||
#sommaire ul li a:hover
|
||||
{
|
||||
color: purple; /*rgb(0,85,227);*/
|
||||
color: #881600; /*rgb(0,85,227);*/
|
||||
font-size: 16px;
|
||||
/*background-color:#D3D3D3;
|
||||
border-color: #696969 #DCDCDC #DCDCDC #696969; */
|
||||
@ -70,32 +70,31 @@
|
||||
font-size:0.75em;
|
||||
}
|
||||
body{
|
||||
background-color: #77AADD;
|
||||
background-color: white;
|
||||
/* //background-image: url(imgs/FONDGLOBAL.jpg); */
|
||||
background-repeat: repeat-x;
|
||||
margin:0% 0%;
|
||||
padding : 0.6em;
|
||||
font-family:"Trebuchet MS",Verdana,Geneva,Arial,Helvetica,sans-serif;
|
||||
font-size:0.8em;
|
||||
}
|
||||
#page {
|
||||
background-color:white;
|
||||
width : 65%;
|
||||
width : 95%;
|
||||
margin : auto ;
|
||||
border : 0.2em solid black;
|
||||
padding : 0.1em;
|
||||
border : 1px solid black;
|
||||
}
|
||||
#entete{
|
||||
background-color:rgb(72,198,236);
|
||||
color : #980101;
|
||||
border: solid 0.1em #980101;
|
||||
background-color: #8B93A7;
|
||||
color : #881600;
|
||||
border: solid 2px #881600;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
height: 100px;
|
||||
padding: 0em;
|
||||
border-collapse: separate;
|
||||
padding: 0 100px;
|
||||
}
|
||||
#pied{
|
||||
clear : both;
|
||||
border : solid 0.2em #980101;
|
||||
border : solid 0.2em #881600;
|
||||
margin-left : 18%;
|
||||
margin-top : 1em;
|
||||
padding:0.4em;
|
||||
@ -118,7 +117,7 @@ body{
|
||||
border: none;
|
||||
padding: 1.1em;
|
||||
background-color: white;
|
||||
border-left : groove 0.8em #980101;
|
||||
border-left : groove 0.8em #881600;
|
||||
margin-top : 1.1em;
|
||||
margin-left: 82px; /*162px; /*18%; */
|
||||
/* permet de fixer une hauteur mini sur les navigateurs modernes */
|
||||
@ -126,6 +125,11 @@ body{
|
||||
/* pour obtenir le même effet sur IE, sachant que si le contenu dépasse, il "poussera" la hauteur en ne respectant pas la norme. On se joue de ses lacunes */
|
||||
height:27em;
|
||||
}
|
||||
a, a:visited,
|
||||
a:hover{
|
||||
color: #881600;
|
||||
}
|
||||
|
||||
|
||||
/* pour rétablir le mauvais effet sur les nav. modernes */
|
||||
html>body #contenu{
|
||||
@ -636,3 +640,60 @@ table.listeLegere td {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*
|
||||
PARTIE DES INTERVENTIONS
|
||||
*/
|
||||
.nouvelleInter{
|
||||
margin: 0 20px;
|
||||
overflow:auto;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
.formulaire{
|
||||
width: 50%;
|
||||
border-right: solid 1px black;
|
||||
float: left;
|
||||
}
|
||||
.nouvelleInter .formulaire{
|
||||
/* float: right; */
|
||||
}
|
||||
.selectionPompier{
|
||||
margin: 0 30px;
|
||||
overflow:auto;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.pompierDispo{
|
||||
background-color: #8B93A7;
|
||||
width: 40%;
|
||||
height: 80%;
|
||||
margin: 0 20px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
.pompierDispo div,
|
||||
.pompierIntervenant div{
|
||||
text-decoration: none;
|
||||
background-color: #FFFFFF;
|
||||
padding: 3px;
|
||||
margin: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.pompierDispo .1{
|
||||
|
||||
}
|
||||
.pompierIntervenant{
|
||||
background-color: red;
|
||||
width: 40%;
|
||||
height: 200px;
|
||||
margin: 0 20px;
|
||||
padding: 5px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
#sendInter{
|
||||
width: auto;
|
||||
text-align: center;
|
||||
margin: 10px;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
<head>
|
||||
<title>SDIS29</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
|
||||
<link href="./styles/styles.css" rel="stylesheet" type="text/css" />
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="./images/favicon.ico" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!-- affichage de la feuille de gardes / Derniere modification le 18/09/2023 à 16h50 par Pascal Blain -->
|
||||
<div style='display: block;' class='unOnglet' id='contenuOnglet1'>
|
||||
<fieldset>
|
||||
<fieldset style='width:80%; margin: 0 auto;'>
|
||||
<legend>Feuille de gardes</legend>
|
||||
<form name="frmDispos" action="index.php?choixTraitement=gardes&action=voir" method="post">
|
||||
<input type="hidden" name="zSemaine" value='<?php echo $semaine; ?>'>
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
<!-- affichage d'une intervention / Derniere modification le 23 mai 2019 par Pascal Blain -->
|
||||
<?php
|
||||
$nbi=count($lesInterventions);
|
||||
|
||||
//$nbi = count($lesInterventions);
|
||||
/*
|
||||
$titre="Ajout";
|
||||
echo ('
|
||||
<div id="fiche">
|
||||
@ -13,6 +13,7 @@ echo ('
|
||||
</ul>');
|
||||
|
||||
/*================================================================================================== nouvelle intervention (1) */
|
||||
/*
|
||||
echo("
|
||||
<div style='display: block;' class='unOnglet' id='contenuOnglet1'>
|
||||
<fieldset><legend>Nouvelle intervention</legend>
|
||||
@ -71,7 +72,7 @@ echo(" </table>
|
||||
</fieldset>
|
||||
</div>");
|
||||
/*================================================================================================== Onglet (2) */
|
||||
|
||||
/*
|
||||
echo ("
|
||||
<div style='display: none;' class='unOnglet' id='contenuOnglet2'>
|
||||
<fieldset><legend>XXXX</legend>
|
||||
@ -83,6 +84,7 @@ echo ("
|
||||
</div>");
|
||||
|
||||
/*================================================================================================== Onglet 3 */
|
||||
/*
|
||||
echo ("
|
||||
<div style='display: none;' class='unOnglet' id='contenuOnglet3'>
|
||||
<fieldset><legend>XXXX</legend>
|
||||
@ -94,5 +96,11 @@ echo ("
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>");
|
||||
?>
|
||||
</div>");
|
||||
*/
|
||||
?>
|
||||
|
||||
<div class="lesInterventions" style="height: 200px;">
|
||||
<!-- Liste des interventions -->
|
||||
</div>
|
||||
|
||||
|
70
vues/v_nouvelleIntervention.php
Normal file
70
vues/v_nouvelleIntervention.php
Normal file
@ -0,0 +1,70 @@
|
||||
<script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
|
||||
crossorigin="anonymous"></script>
|
||||
|
||||
<div class="nouvelleInter">
|
||||
<h1>Nouvelle intervention</h1>
|
||||
<div class="formulaire">
|
||||
<form action="">
|
||||
|
||||
<label for="motif">Motif de l'intervention : </label>
|
||||
<select name="motif" id="motifInter">
|
||||
<?php
|
||||
foreach ($lesMotifs as $key => $type) {
|
||||
echo '<optgroup label="' . $key . '">';
|
||||
foreach ($type as $motif) {
|
||||
echo ' <option value="' . $motif['pIndice'] . '">' . $motif['pLibelle'] . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<label for="adresse">Adresse de l'intervention : </label>
|
||||
<input type="text" id="adresse" name="adresse">
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<label for="caserne">Caserne la plus proche : </label>
|
||||
<select name="caserne" id="caserneInter">
|
||||
<?php
|
||||
foreach ($lesCasernes as $uneCaserne) {
|
||||
echo '<option value="' . $uneCaserne['cId'] . '">' . $uneCaserne['cNom'] . ' - ' . $uneCaserne['cAdresse'] . '</option>\n';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<label for="commentaire">Commentaire sur l'intervention : </label>
|
||||
<textarea name="commentaire" id="" cols="auto" rows="5"></textarea>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="selectionPompier">
|
||||
<div id="pompierDispo" class="pompierDispo" ondrop="dropHandler(event)" ondragover="dragoverHandler(event)">
|
||||
<!-- Liste des pompiers appelable -->
|
||||
<?php
|
||||
$pCis = isset($_GET['caserne']) ? $_GET['caserne'] : 2904;
|
||||
foreach ($lesPompiers as $key => $pompier):
|
||||
?>
|
||||
<div id="<?= $pompier['pId'] ?>" class="<?= $pompier['pLibelle'] ?>"
|
||||
style="background-color: <?= $pompier['pValeur'] ?>" draggable="true"
|
||||
ondragstart="dragstartHandler(event)">
|
||||
<?= $pompier['pPrenom'] ?>
|
||||
<?= $pompier['pNom'] ?>
|
||||
(<?= $pompier['statut'] ?>)
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
|
||||
</div>
|
||||
<div id="target" ondrop="dropHandler(event)" ondragover="dragoverHandler(event)"
|
||||
ondragstart="dragstartHandler(event)" class="pompierIntervenant">
|
||||
<p>Nombre de pompiers conseillé: 4</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<center><button type="submit" id="sendInter">Envoyer l'intervention</button></center>
|
||||
|
||||
<script src="include/gestionInterventions.js" type="text/javascript"></script>
|
@ -1,9 +1,16 @@
|
||||
<!-- Derniere modification le 18/09/2023 par Pascal Blain -->
|
||||
<!-- Division pour le pied de page -->
|
||||
<a href="index.php?choixTraitement=interventions&action=nouvelle">
|
||||
<button type="button" style="margin: 0 auto; display: block; width: auto; background-color: green;"> Nouvelle
|
||||
intervention</button>
|
||||
</a>
|
||||
<div>
|
||||
<hr /><p style="text-align:center;">
|
||||
<img src="images/castel.png" style="vertical-align: middle;">
|
||||
<?php echo "Lycée Le Castel à Dijon - BTS SIO - <img src='images/copyleft.png' style='text-align: center; vertical-align: middle;'> 2023 Pierre Renaudot";?></p>
|
||||
<hr />
|
||||
<p style="text-align:center;">
|
||||
<img src="images/castel.png" style="vertical-align: middle;">
|
||||
<?php echo "Lycée Le Castel à Dijon - BTS SIO - <img src='images/copyleft.png' style='text-align: center; vertical-align: middle;'> 2023 Pierre Renaudot"; ?>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -15,7 +15,6 @@
|
||||
. '" method="post">');
|
||||
}
|
||||
if ($_REQUEST['action'] == "modifier") {
|
||||
var_dump($lesInfosPompier);
|
||||
echo ('
|
||||
<h2>MODIFICATION DU POMPIER '
|
||||
. $lesInfosPompier['nom'] . ' '
|
||||
@ -64,18 +63,18 @@
|
||||
");
|
||||
}
|
||||
if ($_REQUEST['action'] == "ajouter") {
|
||||
// <input name='pId' class='infoPompier' value='" . $lesInfosPompier['id'] . "' >
|
||||
|
||||
echo ("
|
||||
<tr><th style='width:130px;'>Nom</th> <td style='width:130px;'><input name='ztNom' type='text' class='infoPompier' ></td> </tr>
|
||||
<tr><th>Prénom</th> <td> <input name='ztPrenom' type='text' class='infoPompier infoPompier-chef' ></td> </tr>
|
||||
<tr><th>Adresse</th> <td> <input name='ztAdresse' type='text' class='infoPompier infoPompier-chef' ></td> </tr>
|
||||
<tr><th>Code postal</th> <td> <input name='ztCodePostal' type='text' class='infoPompier infoPompier-chef' ></td> </tr>
|
||||
<tr><th style='width:130px;'>Nom*</th> <td style='width:130px;'><input name='ztNom' id='newName' type='text' class='infoPompier' required></td> </tr>
|
||||
<tr><th>Prénom*</th> <td> <input name='ztPrenom' id='newUsername' type='text' class='infoPompier infoPompier-chef' required></td> </tr>
|
||||
<tr><th>Adresse</th> <td> <input name='ztAdresse' type='text' class='infoPompier infoPompier-chef' ></td> </tr>
|
||||
<tr><th>Code postal</th> <td> <input name='ztCodePostal' type='text' class='infoPompier infoPompier-chef' ></td> </tr>
|
||||
<tr><th>Ville</th> <td> <input name='ztVille' type='text' class='infoPompier infoPompier-chef' ></td> </tr>
|
||||
<tr><th>Téléphone</th> <td> <input name='ztTel' type='text' class='infoPompier-chef' ></td> </tr>
|
||||
<tr><th>Adresse électronique</th> <td> <input name='ztMail' type='text' class='infoPompier infoPompier-chef' ></td> </tr>
|
||||
<tr><th>Nom de compte</th> <td><input name='ztMail' type='text' class='infoPompier infoPompier-chef' ></td></tr>
|
||||
<input name='pId' type='hidden' class='infoPompier' value='" . $lesInfosPompier['id'] . "' >
|
||||
<tr><th style='width:130px;'>Code</th> <td><input name='zCis' type='text' class='infoPompier-chef' value='" . $lesInfosPompier['pCis'] . "' ></td> </tr>
|
||||
<tr><th>Téléphone*</th> <td> <input name='ztTel' type='text' class='infoPompier-chef' required></td> </tr>
|
||||
<tr><th>Adresse électronique*</th> <td> <input name='ztMail' type='text' class='infoPompier infoPompier-chef' required></td> </tr>
|
||||
<tr><th>Nom de compte*</th> <td><input name='ztLogin' id='newLogin' type='text' class='infoPompier infoPompier-chef' required></td></tr>
|
||||
<tr><th style='width:130px;'>Code</th> <td><input name='zCis' id='inputDisabled' type='text' class='infoPompier-chef' value='" . $lesInfosPompier['pCis'] . "' disabled></td> </tr>
|
||||
<tr><th>Nom</th> <td>" . $lesInfosPompier['cNom'] . "</td> </tr>
|
||||
<tr><th>Adresse</th> <td>" . $lesInfosPompier['cAdresse'] . "</td> </tr>
|
||||
<tr><th>Téléphone</th> <td>" . $lesInfosPompier['cTel'] . "</td> </tr>
|
||||
@ -121,8 +120,9 @@
|
||||
</table>
|
||||
</fieldset>
|
||||
<div style='text-align:center; '>
|
||||
<input type= 'image' class='validerAjout' alt='Valider' src= 'images/Valider.jpg'>
|
||||
<p class='notif-ajout' style:'margin: 10px'></p>
|
||||
<input type= 'image' class='btAnnulerAjout' alt='Annuler' src= 'images/Annuler.jpg'>
|
||||
<input type= 'image' class='validerAjout' alt='Valider' src= 'images/Valider.jpg'>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -135,7 +135,8 @@
|
||||
<tr>
|
||||
<td style='border: 0px solid white; witdh:130px; text-align:right;'>
|
||||
<input type="hidden" name="zTypeAdm"
|
||||
value="<? php // if ($type=="adm") {echo ("true");} else {echo ("false");} ?>">
|
||||
value="">
|
||||
<? // if ($type=="adm") {echo ("true");} else {echo ("false");} ?>
|
||||
<input type="hidden" name="zOk" value="OK">
|
||||
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user