From fcf292e823323afb2735664aaafec9772d20ad39 Mon Sep 17 00:00:00 2001 From: Pierr0 Date: Sun, 7 Jan 2024 16:26:43 +0100 Subject: [PATCH] correction bugs page newFiche --- Class/class.newFiche.php | 5 ++--- controleurs/c_actionFiche.php | 16 +++++++++++----- controleurs/c_nouvelleFiche.php | 2 +- include/newFiche.js | 19 +++++++++++++++++-- vues/v_newFiche.php | 30 ++++++++++++------------------ 5 files changed, 43 insertions(+), 29 deletions(-) diff --git a/Class/class.newFiche.php b/Class/class.newFiche.php index 74014e1..54cfa49 100644 --- a/Class/class.newFiche.php +++ b/Class/class.newFiche.php @@ -175,12 +175,11 @@ class Class_newFiche { $req = 'UPDATE ligne_hors_forfait SET "lhRefus" = :stateF - WHERE "rVisiteur" = :userId AND "rMois" = :monthF AND "lhId" = :idFrais;'; + WHERE "lhId" = :idFrais;'; $result = $this->pdo->prepare($req); + $state = ($state) ? 'false' : 'true'; $result->bindParam(':stateF', $state); $result->bindParam(':idFrais', $idFrais); - $result->bindParam(':userId', $this->userId); - $result->bindParam(':monthF', $this->month); return $result->execute(); } diff --git a/controleurs/c_actionFiche.php b/controleurs/c_actionFiche.php index 85bf982..bf11f66 100644 --- a/controleurs/c_actionFiche.php +++ b/controleurs/c_actionFiche.php @@ -14,8 +14,8 @@ switch ($_GET['action']) { //FRAIS FORFAITAIRES foreach ($_REQUEST['fraisF'] as $value) { $pdoNewFiche->updateFraisF( - $value['quantité'], - intval($value['montant']), + $value['quantité'], + intval($value['montant']), $value['id'] ); } @@ -23,8 +23,8 @@ switch ($_GET['action']) { foreach ($_REQUEST['fraisHF'] as $value) { if ($value['id'] == NULL) { $pdoNewFiche->addFraisHF( - $value['libelle'], - $value['date'], + $value['libelle'], + $value['date'], $value['montant'] ); } @@ -33,7 +33,13 @@ switch ($_GET['action']) { case 'suprFraisHF': $pdoNewFiche->suprLigneHF($_GET['idFrais']); break; - + case 'refusFraisHF': + $pdoNewFiche->accceptFrais( + $_GET['idFrais'], + boolval($_GET['state']) + ); + break; + default: # code... break; diff --git a/controleurs/c_nouvelleFiche.php b/controleurs/c_nouvelleFiche.php index f63edb8..82496f8 100644 --- a/controleurs/c_nouvelleFiche.php +++ b/controleurs/c_nouvelleFiche.php @@ -37,7 +37,7 @@ if (isset($_GET['currentList'])) { $date = $_GET['dateListing']; } -$date = '202312'; //TESTVAR +//$date = '202312'; //TESTVAR //Instance de l'objet newFiche qui gère toute la partie bdd $newFiche = new Class_newFiche($pdo, $userId, $date); diff --git a/include/newFiche.js b/include/newFiche.js index 25078c2..a83db36 100644 --- a/include/newFiche.js +++ b/include/newFiche.js @@ -88,9 +88,24 @@ $(document).ready(function () { calcPrixTotalFrsHorsF(); updatePrixTotal(); }) - }) +/** + * Refus d'un frais HF pour un comptable + */ +$(document).on('click', '.btnRefuseFraisHf', function () { + idFrais = $(this).parent().parent().attr('data-id') + fiche = $('#idFiche').attr('data-id') + etatLigne = $(this).attr('data-status') + console.log(etatLigne) + //set on refus + $.ajax({ + url: "../controleurs/c_actionFiche.php?action=refusFraisHF&fiche=" + fiche + "&idFrais=" + idFrais + "&state=" + etatLigne, + method: "POST", + }).done(function () { + location.reload(); + }) +}) /** * Supprimer fraisHf */ @@ -113,7 +128,7 @@ $(document).on('click', '.btnSuprFraisHf', function () { * PARTIE ENVOIE DE LA FICHE */ $(document).on('click', '#sendFileBtn', function () { - + //FRAIS FORFAITAIRES var listeFraisF = [] $('tr.fraisForfaitaire').each(function () { diff --git a/vues/v_newFiche.php b/vues/v_newFiche.php index aa7793d..5e9b847 100644 --- a/vues/v_newFiche.php +++ b/vues/v_newFiche.php @@ -5,7 +5,8 @@

- ID: + ID: +


@@ -32,8 +33,8 @@ - > + > € @@ -73,8 +74,8 @@ $value): ?> - + @@ -90,9 +91,9 @@ - -
-