<center>
    <div class="col-3 mb-4">
        <br>
        <?php
        if ($_SESSION['typeU'] != 'comptable') {
            echo '<h3>Gérer mes fiches de frais</h3>';
        } else { ?>

            <form action="index.php?direction=gestionFiche" method="POST">
                <?php
                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'];
                    
                    if ($id == $userId) {
                        echo '<option value="' . $id . '" selected>' . $nom . " " . $prenom . "</option>";
                    } else {
                        echo '<option value="' . $id . '">' . $nom . " " . $prenom . "</option>";
                    }
                }
                echo '</select>'; ?>
                <button type="submit" class="btn btn-dark m-2" >Selectionner</button>
                <!-- Fin du formulaire -->
            <?php }
        ?>

    </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>
            <?php foreach ($lesFiches as $uneFiche) { ?>
                <tr>
                    <th scope="row">
                        <?= $gestionFiche->dateComplete($uneFiche['rMois']) ?>
                    </th>
                    <td>
                        <?= $uneFiche['rMontantValide'] ?> €
                    </td>
                    <td>
                        <?= $uneFiche['eLibelle'] ?>
                    </td>
                    <td><a
                            href="index.php?direction=nouvelleFiche&userId=<?= $userId ?>&dateListing=<?= $uneFiche['rMois'] ?>">voir</a>
                    </td>
                </tr>
            <?php } ?>
        </tbody>
    </table>
</div>

<!-- 
    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>