7 Commits

15 changed files with 574 additions and 172 deletions

View File

@ -0,0 +1,26 @@
<?php
class Class_gestionFiche
{
private $pdo = null;
public function __construct(PdoGsb $pDO)
{
$this->pdo = $pDO->getPdoGsb();
}
public function getLesUtilisateurs(): array
{
$req = 'SELECT "uId", "uNom", "uPrenom" FROM utilisateur WHERE "uStatut"!=0 ORDER BY "uNom" ASC;';
$result = $this->pdo->prepare($req);
$result ->execute();
return $result->fetchAll();
}
public function utilisateur(string $idUtilisateur): array
{
$req = '';
}
}

View File

@ -4,7 +4,6 @@ class Class_newFiche
{
private $pdo = null;
public function __construct(PdoGsb $pDO)
{
$this->pdo = $pDO->getPdoGsb();
@ -12,30 +11,60 @@ class Class_newFiche
public function listFraisForfaitaires(): array
{
$req = 'SELECT "fLibelle", round("fMontant", 2) AS "fMontant", "fId" FROM forfait';
$req = 'SELECT "fLibelle", NULL AS "lfQuantite", round("fMontant", 2) AS "fMontant", 0 AS "fTotal", "fId" FROM forfait';
$result = $this->pdo->prepare($req);
$result->execute();
return $result->fetchAll();
}
public function listFraisHF():array
public function listFraisForfaitForU(string $idUser, int $month): array
{
//
$req = 'SELECT "fLibelle", "lfQuantite", ROUND("fMontant", 2) AS "fMontant", ROUND("lfQuantite" * "fMontant", 2) AS "fTotal", "fId"
FROM remboursement
INNER JOIN "ligne_forfait" ON "rVisiteur" = "lfVisiteur" AND "rMois" = "lfMois"
INNER JOIN "forfait" ON "fId" = "lfForfait"
WHERE "rVisiteur" = :idUser AND "rMois" = :monthF;';
$result = $this->pdo->prepare($req);
$result->bindParam('idUser', $idUser);
$result->bindParam('monthF', $month);
$result->execute();
return $result->fetchAll();
}
public function endInter(string $id)
public function listFraisHF(string $idVisiteur, int $month): array
{
$req = "UPDATE intervention
SET iHeureFin = NOW()
WHERE iCis = :cis AND iId = :idInter AND iHeureFin IS NULL";
$req = 'SELECT to_char("lhDate", \'YYYY-mm-dd\') AS "lhDate",
"lhLibelle", ROUND("lhMontant",2) as "lhMontant",
"lhJustificatif", "lhRefus"
FROM remboursement
inner join "ligne_hors_forfait" on "rVisiteur" = "lhVisiteur"
AND "rMois" = "lhMois"
WHERE "rVisiteur" = :idVisiteur AND "rMois" = :mois
ORDER BY "lhDate";';
$cis = explode('-', $id)[0];
$idInter = explode('-', $id)[1];
$result = PdoBD::$monPdo->prepare($req);
$result->bindParam(':cis', $cis);
$result->bindParam(':idInter', $idInter);
$result = $this->pdo->prepare($req);
$result->bindParam(':idVisiteur', $idVisiteur);
$result->bindParam(':mois', $month);
$result->execute();
return $result->fetchAll();
}
public function getMontantValide(string $idVisiteur, int $month): float
{
$req = 'SELECT "rMontantValide"
FROM remboursement
WHERE "rVisiteur" = :idVisiteur AND "rMois" = :mois ;';
$result = $this->pdo->prepare($req);
$result->bindParam(':idVisiteur', $idVisiteur);
$result->bindParam(':mois', $month);
$result->execute();
return $result->fetchAll()[0]['rMontantValide'];
}
}

31
Class/class.user.php Normal file
View File

@ -0,0 +1,31 @@
<?php
/**
* AJOUT COMPTABLE
* INSERT INTO utilisateur
* VALUES('cpt1', 'Renaudot', 'Pierre', 'pr07', 'pr', 'rue saint éloi', 21110, 'Marliens', NOW(), 3, 3, 4, 27, NOW(), NOW(), '120cv', 'essence')
*/
class Class_user
{
private $pdo = null;
public function __construct(PdoGsb $pDO)
{
$this->pdo = $pDO->getPdoGsb();
}
public function connectUser(string $login, string $password): array
{
$req = 'SELECT "uId", "uNom", "uPrenom", "uAdresse", "uCp", "uVille", "uSecteur", "uLabo", "parametre"."pLibelle"
FROM utilisateur
INNER JOIN parametre ON "parametre"."pType" = \'statUti\'
AND "utilisateur"."uStatut" = "parametre"."pIndice"
WHERE "uLogin" = :login AND "uMdp" = :pwd ;';
$result = $this->pdo->prepare($req);
$result->bindParam('login', $login);
$result->bindParam('pwd', $password);
$result->execute();
return $result->fetch();
}
}

View File

@ -1,12 +1,35 @@
<?php
// ***************************************'
// Le CASTEL-BTS SIO/ PROJET PPE4 GSB '
// Programme: c_connexion.php v2.0 '
// Objet : gestion remboursements frais'
// Client : laboratoires GSB '
// Date : 03/05/2023 à 11H01 '
// Auteur : pascal-blain@wanadoo.fr '
//****************************************'
require_once(__DIR__ . '/../Class/class.user.php');
$userClass = new Class_user($pdo);
if (isset($_POST['login']) && isset($_POST['password'])) {
//Récupère les données de l'utilisateur
$data = $userClass->connectUser($_POST['login'], $_POST['password']);
//Si l'utilisateur existe ou pas
if (count($data) === 0) {
header('location: index.php?direction=connexion&msg=errorco');
} else {
$_SESSION['uId'] = $data['uId'];
$_SESSION['uNom'] = $data['uNom'];
$_SESSION['uPrenom'] = $data['uPrenom'];
$_SESSION['uAdresse'] = $data['uAdresse'];
$_SESSION['uCp'] = $data['uCp'];
$_SESSION['uVille'] = $data['uVille'];
$_SESSION['uSecteur'] = $data['uSecteur'];
$_SESSION['uLabo'] = $data['uLabo'];
$_SESSION['uType'] = $data['pLibelle'];
header('location: index.php?direction=home');
}
} else {
header('location: index.php');
}
die;
/*
header('location: index.php?direction=home');
if (!isset($_REQUEST['action'])) {
@ -44,7 +67,7 @@ switch ($action) {
$leMoisPrecedent = (date('Y') - 1) * 100 + 12;
}
//penser ici à faire la cloture du mois précédent !
if ($statut == 'V') /* si le remboursement pour le mois courant n'existe pas (=0) il faut le créer*/{
if ($statut == 'V') // si le remboursement pour le mois courant n'existe pas (=0) il faut le créer{
$leMois = date('Ym');
$leRemboursement = $pdo->existeRemboursement($id, $leMois);
if ($leRemboursement == 0) {
@ -61,4 +84,5 @@ switch ($action) {
break;
}
}
?>
?>
*/

View File

@ -0,0 +1,5 @@
<?php
session_start();
session_destroy();
header('location: ../index.php');

View File

@ -1,15 +1,9 @@
<?php
session_start();
$_SESSION['typeU'] = 'comptable';
$_SESSION ["typeU"] = "comptable";
require_once(__DIR__ . '/../Class/class.gestionFiche.php');
$gestionFiche = new Class_gestionFiche($pdo);
include("../vues/v_gestionFiches.php");
$LesUtilisateurs = $gestionFiche->getLesUtilisateurs(); //RENVOIE LISTE USERS
?>
include("vues/v_gestionFiches.php");

View File

@ -2,6 +2,61 @@
require_once(__DIR__ . '/../Class/class.newFiche.php');
$newFiche = new Class_newFiche($pdo);
$typesFraisForfaitaires = $newFiche->listFraisForfaitaires();
$_SESSION['userId'] = 'b34';
$_SESSION['typeU'] = 'visiteur';
$typeUser = $_SESSION['uType'];
$userId = $_SESSION['uId'];
$date = '202011';
/**
* Gestion de la date selon la vue à afficher
*/
if (isset($_GET['currentList'])) {
//Date des req SQL et function
$date = date('Ym');
//Date du header
try {
//sudo timedatectl set-local-rtc 1
$format = new IntlDateFormatter(
'fr_FR',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'Europe/Paris',
IntlDateFormatter::GREGORIAN,
'MMMM Y'
);
$dateHeader = $format->format(time());
} catch (\Throwable $th) {
$dateHeader = date('F Y');
}
//Date du formulaire HF
$dateFormHFMin = date('Y-m-\01');
$dateFormHFMax = date("Y-m-t", mktime(0, 0, 0, date('m'), 1, date('Y'))); // retourne le dernier jour du mois (30 ou 31)
} elseif (isset($_GET['dateListing'])) {
$date = $_GET['dateListing'];
}
/**
* Liste des frais forfaitaires du mois et de l'user :: sinon afficher les libelle
*/
$listeFraisForfaitaire = $newFiche->listFraisForfaitForU($userId, $date);
if (count($listeFraisForfaitaire) == 0) {
$listeFraisForfaitaire = $newFiche->listFraisForfaitaires();
}
/**
* Listes des frais HF
*/
$listeFraisHf = $newFiche->listFraisHF($userId, $date);
/**
* TOTAL DE LA FICHE
*/
$totalFraisFiche = $newFiche->getMontantValide($userId, $date);
include(__DIR__ . '/../vues/v_newFiche.php');

View File

@ -1,10 +1,12 @@
stocker le nom d'utilisateur et le mot de passe dans la classe n'est pas une très bonne idée pour le code mis en production ... Une bonne solution consiste a stocker les paramètres de connexion à la base de données dans un fichier .ini et à en restreindre l'accès. Par exemple de cette façon:
stocker le nom d'utilisateur et le mot de passe dans la classe n'est pas une très bonne idée pour le code mis en
production ... Une bonne solution consiste a stocker les paramètres de connexion à la base de données dans un fichier
.ini et à en restreindre l'accès. Par exemple de cette façon:
private static $serveur='mysql:host=localhost';
private static $bdd='dbname=gsb2021';
private static $user='root' ;
private static $mdp='root' ;
private static $bdd='dbname=gsb2021';
private static $user='root' ;
private static $mdp='root' ;
gsb.ini:
[database]
driver = mysql
@ -12,22 +14,23 @@ host = localhost
port = 3306
schema = gsb2021
username = root
password = root
password = root
Database connection:
<?php
class MyPDO extends PDO
{
public function __construct($file = 'gsb.ini')
{
if (!$settings = parse_ini_file($file, TRUE)) throw new exception('acces impossible ' . $file . '.');
if (!$settings = parse_ini_file($file, TRUE))
throw new exception('acces impossible ' . $file . '.');
$dns = $settings['database']['driver'] .
':host=' . $settings['database']['host'] .
((!empty($settings['database']['port'])) ? (';port=' . $settings['database']['port']) : '') .
';dbname=' . $settings['database']['schema'];
':host=' . $settings['database']['host'] .
((!empty($settings['database']['port'])) ? (';port=' . $settings['database']['port']) : '') .
';dbname=' . $settings['database']['schema'];
parent::__construct($dns, $settings['database']['username'], $settings['database']['password']);
}
}

View File

@ -25,7 +25,7 @@
</a>
</li>
<li>
<a href="index.php?direction=nouvelleFiche" class="nav-link px-0"> <span class="d-none d-sm-inline">Nouvelle Fiche</span>
<a href="index.php?direction=nouvelleFiche&currentList" class="nav-link px-0"> <span class="d-none d-sm-inline">Fiche du mois</span>
</a>
</li>
</ul>
@ -68,7 +68,7 @@
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="#">Sign out</a></li>
<li><a class="dropdown-item" href="controleurs/c_deconnexion.php">Sign out</a></li>
</ul>
</div>
</div>

139
include/newFiche.js Normal file
View File

@ -0,0 +1,139 @@
$(document).ready(function () {
calcPrixTotalFrsF();
calcPrixTotalFrsHorsF();
updatePrixTotal();
/**
* Partie enregistrement frais F
*/
$('.frsFrt').on('change', function (e) {
console.log($(this).val())
val = $(this).val();
val = val.replace(',', '.')
if ($.isNumeric(val)) {
/**
* Calcul le prix de la ligne
*/
id = $(this).attr('id')
formTotal = $('#totalFrs-' + id)
mttFrs = $('#mttFrs-' + id).attr('data-price')
formTotal.html((val * mttFrs).toFixed(2) + ' €');
calcPrixTotalFrsF();
updatePrixTotal();
}
})
/**
* Enregistrement frais HF
*/
$('.validFraisHF').on('click', function () {
let date = $('#dateHf')
let libelle = $('#libelleHf')
let montant = $('#mttHf')
let canAdd = true;
if (date.val() == "") {
canAdd = false;
date.css("border-color", "red")
} else {
date.css("border-color", "var(--bs-border-color)")
}
if (libelle.val() == "") {
canAdd = false;
libelle.css("border-color", "red")
} else {
libelle.css("border-color", "var(--bs-border-color)")
}
if (montant.val() == "") {
canAdd = false;
montant.css("border-color", "red")
} else {
montant.css("border-color", "var(--bs-border-color)")
}
if (canAdd == true) {
var line = $('tr.fraisHF:first').clone();
lastId = $('tr.fraisHF').length
line.find('.btn').attr('id', 'frsSup-' + lastId)
var line = $('<tr id="fraisHf-' + lastId + '" class="fraisHF"></tr>');
var tdDate = $('<th scope="row" id="dateFrsHF"></th>');
tdDate.html(date.val());
var tdLibelle = $('<td id="LibelleFrsHF"></td>');
tdLibelle.html(libelle.val());
var tdMtt = $('<td id="MttFrsHF"></td>');
tdMtt.html(parseFloat(montant.val().replace(',', '.')).toFixed(2) + ' €');
var tdJust = $('<td></td>');
var btn = $('<td><button type="button" class="btn btn-outline-primary btnSuprFraisHf" id="frsSup-' + lastId + '">Supprimer</button></td>')
$(line).append(tdDate)
$(line).append(tdLibelle)
$(line).append(tdMtt)
$(line).append(tdJust)
$(line).append(btn)
line.insertBefore('.newFraisForm')
date.val('')
libelle.val('')
montant.val('')
}
calcPrixTotalFrsHorsF();
updatePrixTotal();
})
})
/**
* Supprimer fraisHf
*/
$(document).on('click', '.btnSuprFraisHf', function () {
id = $(this).attr('id').split('-')[1]
console.log(id)
$('#fraisHf-' + id).remove()
calcPrixTotalFrsHorsF();
updatePrixTotal();
})
/**
* Calcul prix total frais forfaitaires
*/
function calcPrixTotalFrsF() {
var prixTotal = 0;
$('td[id^="totalFrs-"]').each(function () {
prixTotal += parseFloat($(this).html().replace('€', ''))
})
$('.prixTotalFrsF').html('<strong>TOTAL :</strong> ' + prixTotal.toFixed(2) + ' €')
$('.prixTotalFrsF').attr('data-prix', prixTotal.toFixed(2))
}
/**
* Calcul prix total frais hors forfait
*/
function calcPrixTotalFrsHorsF() {
var prixTotal = 0;
$('td#MttFrsHF').each(function () {
prixTotal += parseFloat($(this).html().replace('€', ''))
})
$('#total-frais-HF').html('<strong>TOTAL :</strong> ' + prixTotal.toFixed(2) + ' €')
$('#total-frais-HF').attr('data-prix', prixTotal.toFixed(2))
}
/**
* Calcul prix total de la fiche
*/
function updatePrixTotal() {
var total = parseFloat($('#total-frais-HF').attr('data-prix'))
total += parseFloat($('.prixTotalFrsF').attr('data-prix'))
$('#total-fiche').html('<strong>TOTAL :</strong> ' + total.toFixed(2) + ' €')
}

View File

@ -21,12 +21,15 @@ if (!isset($_SESSION['userId'])) {
$_REQUEST['direction'] = 'connexion';
}
*/
if (!isset($_REQUEST['direction'])) {
if (!isset($_REQUEST['direction']) && !isset($_SESSION['uId'])) {
$_REQUEST['direction'] = 'connexion';
} elseif (!isset($_REQUEST['direction']) && isset($_SESSION['uId'])) {
$_REQUEST['direction'] = 'home';
}
?>
<!DOCTYPE html>
<html lang="en">
<html lang="fr">
<head>
<meta charset="UTF-8">
@ -37,13 +40,19 @@ if (!isset($_REQUEST['direction'])) {
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.7.1.js"
integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script>
</head>
<body>
<div class="container-fluid">
<div class="row flex-nowrap">
<?php
include('include/menu.php');
if (!isset($_SESSION['uId'])) {
$_REQUEST['direction'] = 'connexion';
} else {
include('include/menu.php');
}
?>
<div class="col py-3">
<?php

View File

@ -1,4 +1,51 @@
<!-- 03/05/2023 à 11H01 -->
<section class="vh-100 gradient-custom">
<div class="container py-5 h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-12 col-md-8 col-lg-6 col-xl-5">
<div class="card bg-dark text-white" style="border-radius: 1rem;">
<div class="card-body p-5 text-center">
<div class="mb-md-5 mt-md-4 pb-5">
<h2 class="fw-bold mb-2 text-uppercase">GSB Laboratoire</h2>
<p class="text-white-50 mb-5">Entrez votre login et mot-de-passe</p>
<form action="index.php" method="POST">
<div class="form-outline form-white mb-4">
<input type="text" id="typeEmailX"
class="form-control form-control-lg" name="login"/>
<label class="form-label" for="typeEmailX">Login</label>
</div>
<div class="form-outline form-white mb-4">
<input type="password" id="typePasswordX"
class="form-control form-control-lg" name="password"/>
<label class="form-label" for="typePasswordX">Mot-de-passe</label>
</div>
<!-- <p class="small mb-5 pb-lg-2"><a class="text-white-50" href="#!">Forgot password?</a></p> -->
<button class="btn btn-outline-light btn-lg px-5"
type="submit">Connexion</button>
</form>
<div class="d-flex justify-content-center text-center mt-4 pt-1">
<a href="#!" class="text-white"><i
class="fab fa-facebook-f fa-lg"></i></a>
<a href="#!" class="text-white"><i
class="fab fa-twitter fa-lg mx-4 px-2"></i></a>
<a href="#!" class="text-white"><i class="fab fa-google fa-lg"></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!--
<div id="contenu">
<h2>Identification utilisateur</h2>
@ -6,13 +53,13 @@
<form method="POST" action="index.php?uc=connexion&action=valideConnexion">
<p>
<p>
<label for="nom">Login*</label>
<input id="login" type="text" name="login" size="30" maxlength="45">
</p>
<p>
<label for="mdp">Mot de passe*</label>
<input id="mdp" type="password" name="mdp" size="30" maxlength="45">
<p>
<label for="mdp">Mot de passe*</label>
<input id="mdp" type="password" name="mdp" size="30" maxlength="45">
</p>
<input type="submit" value="Valider" name="valider">
<input type="reset" value="Annuler" name="annuler">

View File

@ -1,95 +1,76 @@
<?php
var_dump($_SESSION['test']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page accueil</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
</head>
<body>
<div class="container-fluid">
<div class="row flex-nowrap">
<?php include('../include/menu.php') ?>
<div class="col py-3">
<center>
<div class="col-3 mb-4">
<h3>Gerer mes fiches de frais</h3>
<br>
<?php
if ($_SESSION['typeU'] == 'comptable') {
echo '<select class="form-select" name="selVisiteur" id="">
<option value="visiteur1">Visiteur 1</option></select>';
}
?>
</div>
</center>
<div class="col-11 d-flex mx-auto">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Mois</th>
<th scope="col">Total</th>
<th scope="col">Statut</th>
<th scope="col">Détails</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Novembre</th>
<td>351 €</td>
<td>en cours...</td>
<td><a href="#">voir</a></td>
</tr>
<tr>
<th scope="row">Octobre</th>
<td>1458 €</td>
<td>en cours...</td>
<td><a href="#">voir</a></td>
</tr>
<tr>
<th scope="row">Septembre</th>
<td>1112 €</td>
<td>classé</td>
<td><a href="#">voir</a></td>
</tr>
</tbody>
</table>
</div>
<div class="col-4 d-flex mx-auto">
<nav aria-label="...">
<ul class="pagination">
<li class="page-item disabled">
<a class="page-link">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item active" aria-current="page">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<center>
<div class="col-3 mb-4">
<br>
<?php
if ($_SESSION['typeU'] != 'comptable') {
echo '<h3>Gérer mes fiches de frais</h3>';
} else {
echo '<h3>Gérer les fiches de frais de :</h3>';
echo '<select class="form-select" name="selVisiteur" id="">';
foreach ($LesUtilisateurs as $key => $value) {
$id = $value['uId'];
$prenom = $value['uPrenom'];
$nom = $value['uNom'];
echo '<option value="' . $id . '">' . $nom . " " . $prenom . "</option>";
}
echo '</select>';
}
?>
</div>
</center>
</body>
<div class="col-11 d-flex mx-auto">
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Mois</th>
<th scope="col">Total</th>
<th scope="col">Statut</th>
<th scope="col">Détails</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Novembre</th>
<td>351 €</td>
<td>en cours...</td>
<td><a href="#">voir</a></td>
</tr>
<tr>
<th scope="row">Octobre</th>
<td>1458 €</td>
<td>en cours...</td>
<td><a href="#">voir</a></td>
</tr>
<tr>
<th scope="row">Septembre</th>
<td>1112 €</td>
<td>classé</td>
<td><a href="#">voir</a></td>
</tr>
</tbody>
</table>
</div>
</html>
<!--
PAGINATION:// NE PAS TOUCHER
-->
<div class="col-4 d-flex mx-auto">
<nav aria-label="...">
<ul class="pagination">
<li class="page-item disabled">
<a class="page-link">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item active" aria-current="page">
<a class="page-link" href="#">2</a>
</li>
<li class="page-item"><a class="page-link" href="#">3</a></li>
<li class="page-item">
<a class="page-link" href="#">Next</a>
</li>
</ul>
</nav>
</div>

View File

@ -1 +1,4 @@
<h4>BONJOUR VOUS ETES COMPTABLE</h4>
<h4>BONJOUR VOUS ETES <?= strtoupper($_SESSION['uType']) ?></h4>
<?php
var_dump($_SESSION);

View File

@ -1,7 +1,9 @@
<center>
<h1>Nouvelle Fiche de frais</h1>
<h1>Fiche de frais</h1>
<br>
<p>Mois de Novembre 2023</p>
<p>Mois de
<?= $dateHeader ?>
</p>
</center>
<br>
<!--
@ -20,23 +22,30 @@
</thead>
<tbody class="table-group-divider border-secondary-subtle">
<?php
foreach ($typesFraisForfaitaires as $key => $value):
foreach ($listeFraisForfaitaire as $key => $value):
?>
<tr>
<th scope="row">
<?= $value['fLibelle'] ?>
</th>
<td><input type="text" name="fraisForfait-<?= $value['fId'] ?>" class="form-control"></td>
<td>
<input type="text" name="fraisForfait-<?= $value['fId'] ?>" class="form-control frsFrt"
id="<?= $key ?>" value="<?= $value['lfQuantite'] ?>">
</td>
<td id="mttFrs-<?= $key ?>" data-price="<?= $value['fMontant'] ?>">
<?= $value['fMontant'] ?> €
</td>
<td>0€</td>
<td id="totalFrs-<?= $key ?>">
<?= $value['fTotal'] ?>€
</td>
</tr>
<?php
endforeach;
?>
<tr>
<td colspan="3" class="border-0"></td>
<td class="prixTotalFrsF table-primary"></td>
</tr>
</tbody>
</table>
</div>
@ -57,31 +66,78 @@
<th>Valider</th>
</tr>
</thead>
<tbody class="table-group-divider border-secondary-subtle">
<tr>
<td scope="row">23/12/2023</td>
<td>Salle de réunion</td>
<td>130 €</td>
<td>facture.pdf</td>
<td><button type="button" class="btn btn-outline-primary">Supprimer</button></td>
<tbody class="table-group-divider border-secondary-subtle fraisHFGroup">
<?php
foreach ($listeFraisHf as $key => $value):
?>
<tr id="fraisHf-<?= $key ?>" class="fraisHF <?= $value['lhRefus'] == 1 ? 'table-danger' : '' ?>">
<th scope="row" id="dateFrsHF">
<?= $value['lhDate'] ?>
</th>
<td id="LibelleFrsHF">
<?= $value['lhLibelle'] ?>
</td>
<td id="MttFrsHF">
<?= $value['lhMontant'] ?> €
</td>
<td>
<?= $value['lhJustificatif'] == 1 ? 'ok' : 'non fournis' ?>
</td>
<td>
<?php
if ($typeUser === 'comptable') { ?>
<button type="button" class="btn btn-outline-primary btnRefuseFraisHf" id="frsSup-<?= $key ?>">
Refuser
</button>
<?php } elseif ($typeUser === 'visiteur') { ?>
<button type="button" class="btn btn-outline-primary btnSuprFraisHf" id="frsSup-<?= $key ?>">
Supprimer
</button>
<?php } ?>
</td>
</tr>
<?php
endforeach;
?>
<!--
Formulaire d'ajout de frais HF
-->
<tr class="newFraisForm">
<td>
<!-- Date form -->
<input name="dateHf" class="form-control" id="dateHf" type="date" min="<?= $dateFormHFMin ?>"
max="<?= $dateFormHFMax ?>">
</td>
<td><input type="text" name="libelleHf" id="libelleHf" class="form-control"
placeholder="saisir un titre"></td>
<td><input type="text" name="mttHf" id="mttHf" class="form-control" placeholder="Saisir un Montant">
</td>
<td><input type="file" class="form-control"></td>
<td><button type="button" class="btn btn-outline-primary validFraisHF">Valider</button></td>
</tr>
<tr>
<td scope="row"><input class="form-control" type="date"></td>
<td><input type="text" class="form-control" placeholder="saisir un titre"></td>
<td><input type="text" class="form-control" placeholder="Saisir un Montant"></td>
<td><input type="file" class="form-control"></td>
<td><button type="button" class="btn btn-outline-primary">Valider</button></td>
<td colspan="2" class="border-0"></td>
<td class="table-primary" id="total-frais-HF">TOTAL: 0€</td> <!--COMPLETE HERE -->
</tr>
</tbody>
</table>
</div>
<span class="border-3 border-bottom border-black col-10 mx-auto my-5 d-flex"></span>
<!-- <span class="border-3 border-bottom border-black col-10 mx-auto my-5 d-flex"></span> -->
<!-- TOTAL -->
<div style="position:fixed; bottom:5px; right:5px; margin:0; padding:5px 3px;">
<button type="button" class="btn btn-primary" id="total-fiche">
<strong>TOTAL : </strong>
<?= $totalFraisFiche ?>
</button>
</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>
-->
<div class="col-3 d-flex mx-auto my-5 justify-content-center">
<button type="button" class="btn btn-outline-primary">Envoyer la Fiche</button>
</div>
<button type="button" class="btn btn-outline-primary btn-lg">Envoyer la Fiche</button>
</div>
<script src="../include/newFiche.js"></script>