correction bugs page newFiche

This commit is contained in:
Pierr0 2024-01-07 16:26:43 +01:00
parent df7599ab9b
commit fcf292e823
5 changed files with 43 additions and 29 deletions

View File

@ -175,12 +175,11 @@ class Class_newFiche
{ {
$req = 'UPDATE ligne_hors_forfait $req = 'UPDATE ligne_hors_forfait
SET "lhRefus" = :stateF SET "lhRefus" = :stateF
WHERE "rVisiteur" = :userId AND "rMois" = :monthF AND "lhId" = :idFrais;'; WHERE "lhId" = :idFrais;';
$result = $this->pdo->prepare($req); $result = $this->pdo->prepare($req);
$state = ($state) ? 'false' : 'true';
$result->bindParam(':stateF', $state); $result->bindParam(':stateF', $state);
$result->bindParam(':idFrais', $idFrais); $result->bindParam(':idFrais', $idFrais);
$result->bindParam(':userId', $this->userId);
$result->bindParam(':monthF', $this->month);
return $result->execute(); return $result->execute();
} }

View File

@ -33,6 +33,12 @@ switch ($_GET['action']) {
case 'suprFraisHF': case 'suprFraisHF':
$pdoNewFiche->suprLigneHF($_GET['idFrais']); $pdoNewFiche->suprLigneHF($_GET['idFrais']);
break; break;
case 'refusFraisHF':
$pdoNewFiche->accceptFrais(
$_GET['idFrais'],
boolval($_GET['state'])
);
break;
default: default:
# code... # code...

View File

@ -37,7 +37,7 @@ if (isset($_GET['currentList'])) {
$date = $_GET['dateListing']; $date = $_GET['dateListing'];
} }
$date = '202312'; //TESTVAR //$date = '202312'; //TESTVAR
//Instance de l'objet newFiche qui gère toute la partie bdd //Instance de l'objet newFiche qui gère toute la partie bdd
$newFiche = new Class_newFiche($pdo, $userId, $date); $newFiche = new Class_newFiche($pdo, $userId, $date);

View File

@ -88,9 +88,24 @@ $(document).ready(function () {
calcPrixTotalFrsHorsF(); calcPrixTotalFrsHorsF();
updatePrixTotal(); 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 * Supprimer fraisHf
*/ */

View File

@ -5,7 +5,8 @@
<?= $dateHeader ?> <?= $dateHeader ?>
</p> </p>
<p class="color-grey" id='idFiche' data-id="<?= $userId . '-' . $date ?>"> <p class="color-grey" id='idFiche' data-id="<?= $userId . '-' . $date ?>">
ID: <?= $userId . '-' . $date ?> ID:
<?= $userId . '-' . $date ?>
</p> </p>
</center> </center>
<br> <br>
@ -32,8 +33,8 @@
<?= $value['fLibelle'] ?> <?= $value['fLibelle'] ?>
</th> </th>
<td> <td>
<input type="text" name="fraisForfait" class="form-control frsFrt" <input type="text" name="fraisForfait" class="form-control frsFrt" id="<?= $key ?>"
id="<?= $key ?>" value="<?= $value['lfQuantite'] ?>" <?= $disabled ?>> value="<?= $value['lfQuantite'] ?>" <?= $disabled ?>>
</td> </td>
<td id="mttFrs-<?= $key ?>" data-price="<?= $value['fMontant'] ?>"> <td id="mttFrs-<?= $key ?>" data-price="<?= $value['fMontant'] ?>">
<?= $value['fMontant'] ?> <?= $value['fMontant'] ?>
@ -73,8 +74,8 @@
<?php <?php
foreach ($listeFraisHf as $key => $value): foreach ($listeFraisHf as $key => $value):
?> ?>
<tr id="fraisHf-<?= $key ?>" data-id="<?= $value['lhId'] ?>" class="fraisHF <?= $value['lhRefus'] == 1 ? 'table-danger' : '' ?>" <tr id="fraisHf-<?= $key ?>" data-id="<?= $value['lhId'] ?>"
data-id="<?= $value['lhId'] ?>"> class="fraisHF <?= $value['lhRefus'] == 1 ? 'table-danger' : '' ?>" data-id="<?= $value['lhId'] ?>">
<th scope="row" id="dateFrsHF"> <th scope="row" id="dateFrsHF">
<?= $value['lhDate'] ?> <?= $value['lhDate'] ?>
</th> </th>
@ -90,9 +91,9 @@
<td> <td>
<?php <?php
if ($typeUser === 'comptable') { ?> if ($typeUser === 'comptable') { ?>
<button type="button" class="btn btn-outline-primary btnRefuseFraisHf" id="frsSup-<?= $key ?>" <button type="button" class="btn btn-outline-primary btnRefuseFraisHf"
<?= $disabled ?>> data-status="<?= $value['lhRefus'] | 0 ?>" id="frsSup-<?= $key ?>" <?= $disabled ?>>
Refuser <?= ($value['lhRefus']) ? 'Accepter' : 'Refuser' ?>
</button> </button>
<?php } elseif ($typeUser === 'visiteur') { ?> <?php } elseif ($typeUser === 'visiteur') { ?>
<button type="button" class="btn btn-outline-primary btnSuprFraisHf" id="frsSup-<?= $key ?>" <button type="button" class="btn btn-outline-primary btnSuprFraisHf" id="frsSup-<?= $key ?>"
@ -127,12 +128,11 @@
<?php endif ?> <?php endif ?>
<tr> <tr>
<td colspan="2" class="border-0"></td> <td colspan="2" class="border-0"></td>
<td class="table-primary" id="total-frais-HF">TOTAL: 0</td> <!--COMPLETE HERE --> <td class="table-primary" id="total-frais-HF">TOTAL: 0</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<!-- <span class="border-3 border-bottom border-black col-10 mx-auto my-5 d-flex"></span> -->
<!-- TOTAL --> <!-- TOTAL -->
<div style="position:fixed; bottom:5px; right:5px; margin:0; padding:5px 3px;"> <div style="position:fixed; bottom:5px; right:5px; margin:0; padding:5px 3px;">
<button type="button" class="btn btn-primary" id="total-fiche"> <button type="button" class="btn btn-primary" id="total-fiche">
@ -140,13 +140,6 @@
<?= $totalFraisFiche ?> <?= $totalFraisFiche ?>
</button> </button>
</div> </div>
<!--
<h3 class="fw-bold offset-1">Commentaire (facultatif)</h3>
<div class="col-8 d-flex mx-auto">
<textarea name="commentaireFiche" id="commentaireFiche" class="form-control border-black"></textarea>
</div>
-->
<?php <?php
/** /**
* Affiche le bouton si fiche non cloturé * Affiche le bouton si fiche non cloturé
@ -154,7 +147,8 @@
if ($status === 'CR'): if ($status === 'CR'):
?> ?>
<div class="col-3 d-flex mx-auto my-5 justify-content-center"> <div class="col-3 d-flex mx-auto my-5 justify-content-center">
<button type="button" class="btn btn-outline-primary btn-lg" id="sendFileBtn" data-uType="<?= $typeUser ?>">Envoyer la Fiche <button type="button" class="btn btn-outline-primary btn-lg" id="sendFileBtn" data-uType="<?= $typeUser ?>">Envoyer
la Fiche
</button> </button>
</div> </div>
<?php endif ?> <?php endif ?>