From aa49401a470ca0941d525dfbd3d557ef98c60ee0 Mon Sep 17 00:00:00 2001
From: pierre renaudot <pierrerenaudot@gmail.Com>
Date: Tue, 9 Jan 2024 10:52:03 +0100
Subject: [PATCH] bug correction

---
 controleurs/c_nouvelleFiche.php |  2 +-
 include/newFiche.js             | 11 +++++++----
 vues/v_newFiche.php             |  5 +++--
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/controleurs/c_nouvelleFiche.php b/controleurs/c_nouvelleFiche.php
index 82496f8..90417bf 100644
--- a/controleurs/c_nouvelleFiche.php
+++ b/controleurs/c_nouvelleFiche.php
@@ -2,7 +2,7 @@
 require_once(__DIR__ . '/../Class/class.newFiche.php');
 
 $typeUser = $_SESSION['uType']; //visiteur ou comptable
-//$typeUser = 'comptable';//$_SESSION['uType']; //visiteur ou comptable
+// $typeUser = 'comptable';//$_SESSION['uType']; //visiteur ou comptable
 $userId = $_SESSION['uId']; //exemple: 'b34'
 
 /**
diff --git a/include/newFiche.js b/include/newFiche.js
index a83db36..e53a6c3 100644
--- a/include/newFiche.js
+++ b/include/newFiche.js
@@ -100,7 +100,8 @@ $(document).on('click', '.btnRefuseFraisHf', function () {
     console.log(etatLigne)
     //set on refus
     $.ajax({
-        url: "../controleurs/c_actionFiche.php?action=refusFraisHF&fiche=" + fiche + "&idFrais=" + idFrais + "&state=" + etatLigne,
+        // url: "../controleurs/c_actionFiche.php?action=refusFraisHF&fiche=" + fiche + "&idFrais=" + idFrais + "&state=" + etatLigne,
+        url: "controleurs/c_actionFiche.php?action=refusFraisHF&fiche=" + fiche + "&idFrais=" + idFrais + "&state=" + etatLigne,
         method: "POST",
     }).done(function () {
         location.reload();
@@ -115,7 +116,8 @@ $(document).on('click', '.btnSuprFraisHf', function () {
     idFrais = $(this).parent().parent().attr('data-id')
     //SUPPRIME DE LA BD
     $.ajax({
-        url: "../controleurs/c_actionFiche.php?action=suprFraisHF&fiche=" + fiche + "&idFrais=" + idFrais,
+        url: "controleurs/c_actionFiche.php?action=suprFraisHF&fiche=" + fiche + "&idFrais=" + idFrais,
+        // url: "../controleurs/c_actionFiche.php?action=suprFraisHF&fiche=" + fiche + "&idFrais=" + idFrais,
         method: "POST",
     })
 
@@ -167,7 +169,8 @@ $(document).on('click', '#sendFileBtn', function () {
     fiche = $('#idFiche').attr('data-id')
 
     $.ajax({
-        url: "../controleurs/c_actionFiche.php?action=update&fiche=" + fiche,
+        url: "controleurs/c_actionFiche.php?action=update&fiche=" + fiche,
+        // url: "../controleurs/c_actionFiche.php?action=update&fiche=" + fiche,
         method: "POST",
         data: data,
     }).done(function () {
@@ -181,7 +184,7 @@ $(document).on('click', '#sendFileBtn', function () {
 function calcPrixTotalFrsF() {
 
     var prixTotal = 0;
-    $('td[id^="totalFrs-"]').each(function () {
+    $('td.mttFrsTotal').each(function () {
         prixTotal += parseFloat($(this).html().replace('€', ''))
     })
     $('.prixTotalFrsF').html('<strong>TOTAL :</strong> ' + prixTotal.toFixed(2) + ' €')
diff --git a/vues/v_newFiche.php b/vues/v_newFiche.php
index 5e9b847..1e04c02 100644
--- a/vues/v_newFiche.php
+++ b/vues/v_newFiche.php
@@ -110,7 +110,7 @@
                 Formulaire d'ajout de frais HF
              -->
             <?php
-            if ($disabled !== 'disabled'):
+            if ($disabled !== 'disabled' && $typeUser !== 'comptable'):
                 ?>
                 <tr class="newFraisForm">
                     <td>
@@ -152,4 +152,5 @@ if ($status === 'CR'):
         </button>
     </div>
 <?php endif ?>
-<script src="../include/newFiche.js"></script>
\ No newline at end of file
+<script src="include/newFiche.js"></script>
+<!-- <script src="../include/newFiche.js"></script> -->
\ No newline at end of file