677 lines
30 KiB
HTML
677 lines
30 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Suivi des Heures</title>
|
|
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
|
|
<link rel="icon" href="../../media/img/logoIcon.ico" type="image/x-icon" />
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
<link rel="stylesheet" href="../../css/PROF/mes-heures.css">
|
|
</head>
|
|
<body>
|
|
|
|
<div class="header w3-bar w3-card-4 w3-dark-blue">
|
|
<!-- Logo pour retourner à l'accueil -->
|
|
<div class="logo-container w3-bar-item">
|
|
<img src="../../media/img/logoWhite.png" alt="Logo Accueil" class="w3-image" style="width:150px; height:40px;">
|
|
</div>
|
|
|
|
<!-- Bouton burger pour petit écran -->
|
|
<a href="javascript:void(0)" class="w3-bar-item w3-button w3-hide-large w3-right w3-padding-16" onclick="toggleMenu()">☰</a>
|
|
|
|
<!-- Catégories dans le header -->
|
|
<div id="menu" class="categories w3-hide-small w3-hide-medium w3-bar-item">
|
|
<a href="./enseignant_permanent.html" class="w3-bar-item w3-button">Accueil</a>
|
|
<a href="./mes-heures.html" class="w3-bar-item w3-button">Heures</a>
|
|
<a href="./paiements.html" class="w3-bar-item w3-button">Paiements</a>
|
|
<a href="./mes-informations.html" class="w3-bar-item w3-button">Mes informations et documents</a>
|
|
</div>
|
|
|
|
<!-- Section utilisateur avec déconnexion -->
|
|
<div class="user-section w3-right w3-hide-small w3-hide-medium">
|
|
<div class="user-name">
|
|
Denis MONNERAT
|
|
</div>
|
|
<div class="logout-container w3-bar-item">
|
|
<a href="./notifications.html" title="Notifications">
|
|
<img src="../../media/img/notifs.png" alt="Logo notification" style="width:24px; height:24px;">
|
|
</a>
|
|
<a href="./settings.html" title="Paramètres">
|
|
<img src="../../media/img/settings.png" alt="Logo paramètres" style="width:24px; height:24px;">
|
|
</a>
|
|
<a href="../../index.html" title="Se déconnecter">
|
|
<img src="../../media/img/LogOutWhite.png" alt="Logo Déconnexion" style="width:24px; height:24px;">
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Menu mobile caché au départ -->
|
|
<div id="mobileMenu" class="w3-bar-block w3-hide w3-hide-large w3-dark-blue">
|
|
<a href="./enseignant_permanent.html" class="w3-bar-item w3-button">Accueil</a>
|
|
<a href="./mes-heures.html" class="w3-bar-item w3-button">Heures</a>
|
|
<a href="./paiements.html" class="w3-bar-item w3-button">Paiements</a>
|
|
<a href="./mes-informations.html" class="w3-bar-item w3-button">Mes informations et documents</a>
|
|
|
|
<!-- Section utilisateur pour mobile -->
|
|
<div class="w3-bar-item w3-border-top w3-margin-top">
|
|
<div class="user-name">Denis MONNERAT</div>
|
|
<a href="./notifications.html" title="Notifications">
|
|
<img src="../../media/img/notifs.png" alt="Logo notification" style="width:24px; height:24px;">
|
|
</a>
|
|
<a href="./settings.html" title="Paramètres">
|
|
<img src="../../media/img/settings.png" alt="Logo paramètres" style="width:24px; height:24px;">
|
|
</a>
|
|
<a href="../../index.html" title="Se déconnecter">
|
|
<img src="../../media/img/LogOutWhite.png" alt="Logo Déconnexion" style="width:24px; height:24px;">
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="w3-container dashboard-container">
|
|
<div class="section-header w3-border-bottom w3-padding">
|
|
<h2>Offres d'heures supplémentaires</h2>
|
|
</div>
|
|
<div class="proposition-container w3-responsive">
|
|
<table class="w3-table w3-bordered w3-striped proposition-table" id="proposalTable">
|
|
<thead>
|
|
<tr>
|
|
<th>Période</th>
|
|
<th>Formation</th>
|
|
<th>Nom du Cours</th>
|
|
<th>Semestre</th>
|
|
<th>Type d'intervention</th>
|
|
<th>Volume Prévisionnel</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>Décembre 2024</td>
|
|
<td>BUT1</td>
|
|
<td>Développement Web</td>
|
|
<td>1</td>
|
|
<td>CM, TD</td>
|
|
<td>8h</td>
|
|
<td>
|
|
<button class="w3-button w3-blue accept-button" onclick="acceptProposal(this)">Postuler</button>
|
|
<button class="w3-button w3-red refuse-button" onclick="confirmRefusal(this)">Refuser</button>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Janvier 2025</td>
|
|
<td>BUT2</td>
|
|
<td>SCR</td>
|
|
<td>3</td>
|
|
<td>TD, TP</td>
|
|
<td>6h</td>
|
|
<td>
|
|
<button class="w3-button w3-blue accept-button" onclick="acceptProposal(this)">Postuler</button>
|
|
<button class="w3-button w3-red refuse-button" onclick="confirmRefusal(this)">Refuser</button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Formulaire de déclaration d'heures supplémentaires -->
|
|
<div class="section-header w3-border-bottom w3-padding">
|
|
<h2>Déclarer des heures supplémentaires</h2>
|
|
</div>
|
|
<div class="w3-responsive w3-padding-16">
|
|
<form id="declarationForm" onsubmit="declareHours(event)" class="w3-container">
|
|
<div class="w3-margin-bottom">
|
|
<label for="periode">Période :</label>
|
|
<input type="text" id="periode" name="periode" placeholder="Ex: Janvier 2025" required class="w3-input w3-border">
|
|
</div>
|
|
|
|
<div class="w3-margin-bottom">
|
|
<label for="formation">Formation :</label>
|
|
<input type="text" id="formation" name="formation" placeholder="Ex: BUT1" required class="w3-input w3-border">
|
|
</div>
|
|
|
|
<div class="w3-margin-bottom">
|
|
<label for="cours">Nom du Cours :</label>
|
|
<input type="text" id="cours" name="cours" placeholder="Ex: Développement Web" required class="w3-input w3-border">
|
|
</div>
|
|
|
|
<div class="w3-margin-bottom">
|
|
<label for="semestre">Semestre :</label>
|
|
<input type="number" id="semestre" name="semestre" placeholder="Ex: 1" required class="w3-input w3-border">
|
|
</div>
|
|
|
|
<div class="w3-margin-bottom">
|
|
<label for="typeIntervention">Type d'intervention :</label>
|
|
<select id="typeIntervention" name="typeIntervention" required class="w3-select w3-border">
|
|
<option value="" disabled selected>Choisir un type</option>
|
|
<option value="CM">CM</option>
|
|
<option value="TD">TD</option>
|
|
<option value="TP">TP</option>
|
|
<option value="Suivi d'élève">Suivi d'élève</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="w3-margin-bottom">
|
|
<label for="volumeHoraire">Volume Horaire :</label>
|
|
<input type="text" id="volumeHoraire" name="volumeHoraire" placeholder="Ex: 4h" required class="w3-input w3-border">
|
|
</div>
|
|
|
|
<button type="submit" class="w3-button w3-text-white w3-round" style="background-color: #a17b12;" >Déclarer</button>
|
|
</form>
|
|
</div>
|
|
|
|
|
|
<!-- Section pour afficher les heures supplémentaires déclarées -->
|
|
<div id="declaredHoursSection" class="section-header w3-border-bottom w3-padding" style="display: none;">
|
|
<h2>Heures supplémentaires déclarées</h2>
|
|
</div>
|
|
<div class="proposition-container w3-responsive" id="declaredHoursContainer" style="display: none;">
|
|
<table class="w3-table w3-bordered w3-striped proposition-table" id="declaredHoursTable">
|
|
<thead>
|
|
<tr>
|
|
<th>Période</th>
|
|
<th>Formation</th>
|
|
<th>Nom du Cours</th>
|
|
<th>Semestre</th>
|
|
<th>Type d'intervention</th>
|
|
<th>Volume Horaire</th>
|
|
<th>Statut</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="declaredHoursBody">
|
|
<!-- Les heures déclarées seront ajoutées ici -->
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Popup pour la confirmation des heures supplémentaires -->
|
|
<div id="confirmationPopup" class="popup">
|
|
<h4>Confirmation de la déclaration des heures</h4>
|
|
<p>Votre demande d'heures supplémentaires a été transmise avec succès et est en attente de traitement.</p>
|
|
<button onclick="closeConfirmationPopup()">Fermer</button>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="w3-container dashboard-container">
|
|
<div class="section-header w3-border-bottom w3-padding">
|
|
<h2>Prochaines heures</h2>
|
|
</div>
|
|
<div class="validated-hours-container w3-responsive card">
|
|
<table class="w3-table w3-bordered w3-striped validated-hours-table" id="validatedTable">
|
|
<thead>
|
|
<tr>
|
|
<th>Période</th>
|
|
<th>Formation</th>
|
|
<th>Nom du Cours</th>
|
|
<th>Semestre</th>
|
|
<th>Type d'intervention</th>
|
|
<th>Volume Prévisionnel</th>
|
|
<th>Statut</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="validatedTableBody">
|
|
<tr>
|
|
<td>Décembre 2024</td>
|
|
<td>BUT1</td>
|
|
<td>Développement Web</td>
|
|
<td>1</td>
|
|
<td>CM, TD</td>
|
|
<td>8h</td>
|
|
<td class="status-valide">Validé</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Janvier 2025</td>
|
|
<td>BUT2</td>
|
|
<td>SCR</td>
|
|
<td>3</td>
|
|
<td>TD, TP</td>
|
|
<td>6h</td>
|
|
<td class="status-valide">Validé</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Février 2025</td>
|
|
<td>BUT3</td>
|
|
<td>Base de données</td>
|
|
<td>5</td>
|
|
<td>CM</td>
|
|
<td>10h</td>
|
|
<td class="status-valide">Validé</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Mars 2025</td>
|
|
<td>BUT3</td>
|
|
<td>IA et Machine Learning</td>
|
|
<td>6</td>
|
|
<td>TD, TP</td>
|
|
<td>12h</td>
|
|
<td class="status-valide">Validé</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Avril 2025</td>
|
|
<td>BUT2</td>
|
|
<td>Réseaux</td>
|
|
<td>4</td>
|
|
<td>CM, TD</td>
|
|
<td>4h</td>
|
|
<td class="status-valide">Validé</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="w3-container dashboard-container">
|
|
<div class="section-header w3-border-bottom w3-padding">
|
|
<h2>Historique des Heures Travaillées</h2>
|
|
</div>
|
|
|
|
<div class="card w3-responsive">
|
|
<div class="table-container">
|
|
<table id="hoursTable" class="w3-table w3-bordered w3-striped">
|
|
<thead>
|
|
<tr>
|
|
<th onclick="sortTable(0)">Date ▲</th> <!-- Triable -->
|
|
<th>Matière</th>
|
|
<th>Type d'Intervention</th>
|
|
<th onclick="sortTable(3)">Volume Horaire ▲</th> <!-- Triable -->
|
|
<th onclick="sortTable(4)">Heures Travaillées ▲</th> <!-- Triable -->
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="hoursTableBody">
|
|
<!-- Les lignes seront générées dynamiquement avec JavaScript -->
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Pagination Buttons -->
|
|
<div id="pagination" class="w3-center">
|
|
<button class="w3-button" style="background-color: #a17b12;" onclick="prevPage()">Précédent</button>
|
|
<span id="pageNumber"></span>
|
|
<button class="w3-button" style="background-color: #a17b12;" onclick="nextPage()">Suivant</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section-header dashboard-container">
|
|
<h2>Graphique des Heures Travaillées</h2>
|
|
</div>
|
|
<div class="dashboard-container">
|
|
<canvas id="hoursChart"></canvas>
|
|
</div>
|
|
|
|
|
|
<div class="section-header dashboard-container">
|
|
<h2>Signalement de problèmes d'heures</h2>
|
|
</div>
|
|
<div class="contact-form dashboard-container">
|
|
<form id="contactForm">
|
|
<label for="probleme">Type de problème :</label>
|
|
<select id="probleme" name="probleme" class="w3-select" required>
|
|
<option value="" disabled selected>Choisir un problème</option>
|
|
<option value="non_paye">Il manque des heures dans mon historique</option>
|
|
<option value="montant_incorrect">Il y a des heures en trop dans mon historique</option>
|
|
<option value="erreur_formation">Erreur dans la formation associée</option>
|
|
<option value="erreur_type_intervention">Erreur dans le type d'intervention</option>
|
|
<option value="autre">Autre</option>
|
|
</select>
|
|
|
|
<label for="mois">Mois concerné :</label>
|
|
<select id="mois" name="mois" class="w3-select" required>
|
|
<option value="" disabled selected>Choisir un mois</option>
|
|
<option value="janvier">Janvier</option>
|
|
<option value="fevrier">Février</option>
|
|
<option value="mars">Mars</option>
|
|
<option value="avril">Avril</option>
|
|
<option value="mai">Mai</option>
|
|
<option value="juin">Juin</option>
|
|
<option value="juillet">Juillet</option>
|
|
<option value="aout">Août</option>
|
|
<option value="septembre">Septembre</option>
|
|
<option value="octobre">Octobre</option>
|
|
<option value="novembre">Novembre</option>
|
|
<option value="decembre">Décembre</option>
|
|
</select>
|
|
|
|
<label for="heures">Heures concernées :</label>
|
|
<select id="heures" name="heures" class="w3-select" required>
|
|
<option value="" disabled selected>Choisir un nombre d'heures</option>
|
|
<option value="1">1 heure</option>
|
|
<option value="2">2 heures</option>
|
|
<option value="3">3 heures</option>
|
|
<option value="4">4 heures</option>
|
|
<option value="5">5 heures</option>
|
|
<option value="6">6 heures</option>
|
|
<option value="7">7 heures</option>
|
|
<option value="8">8 heures</option>
|
|
<option value="9">9 heures</option>
|
|
<option value="10">10 heures</option>
|
|
<option value="autre">Plus de 10 heures</option>
|
|
</select>
|
|
|
|
<label for="commentaire">Commentaires (facultatif) :</label>
|
|
<input type="text" id="commentaire" name="commentaire" placeholder="Ajoutez des détails supplémentaires" class="w3-input">
|
|
|
|
<button type="submit">Soumettre</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Popup pour les détails du cours -->
|
|
<div id="infoPopup" class="popup">
|
|
<h4>Détails du la journée</h4>
|
|
<p><strong>Promotion :</strong> <span id="promotion"></span></p>
|
|
<p><strong>Groupe(s) :</strong> <span id="groupe"></span></p>
|
|
<p><strong>Salle :</strong> <span id="salle"></span></p>
|
|
<button onclick="closeInfoPopup()">Fermer</button>
|
|
</div>
|
|
|
|
|
|
<!-- Popup pour succès de l'envoi du formulaire -->
|
|
<div id="popup" class="popup">
|
|
<img src="https://img.icons8.com/ios-filled/50/155724/checkmark.png" alt="Success Icon">
|
|
<h4>Signalement Envoyé !</h4>
|
|
<p>Merci pour votre signalement. Nous allons traiter votre demande dans les plus brefs délais.</p>
|
|
<button onclick="closePopup()">Fermer</button>
|
|
</div>
|
|
|
|
<!-- Popup de confirmation de refus -->
|
|
<div id="confirmationPopup" class="confirmation-popup">
|
|
<div class="confirmation-content">
|
|
<h4>Confirmer le Refus</h4>
|
|
<p>Êtes-vous sûr de vouloir refuser cette proposition d'heure ?</p>
|
|
<button id="confirmRefusalButton" onclick="confirmRefusalAction()">Confirmer</button>
|
|
<button onclick="closeConfirmationPopup()">Annuler</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="infoPopup" class="popup">
|
|
<h4>Détails de l'intervention</h4>
|
|
<p><strong>Promotion :</strong> <span id="popupPromotion"></span></p>
|
|
<p><strong>Type de Cours :</strong> <span id="popupTypeCours"></span></p>
|
|
<p><strong>ETD :</strong> <span id="popupETD"></span></p>
|
|
<p><strong>Montant :</strong> <span id="popupMontant"></span></p>
|
|
<p><strong>Matière :</strong> <span id="popupMatiere"></span></p>
|
|
<button onclick="closeInfoPopup()">Fermer</button>
|
|
</div>
|
|
|
|
<div class="footer">
|
|
<p>© 2024 IUT de Fontainebleau. Tous droits réservés | <a href="html/mentions_legales.html" style="color: white;">Mentions légales</a></p>
|
|
</div>
|
|
|
|
<script>
|
|
// Données du graphique
|
|
const ctx = document.getElementById('hoursChart').getContext('2d');
|
|
const hoursChart = new Chart(ctx, {
|
|
type: 'bar',
|
|
data: {
|
|
labels: ['Semestre 1 - 2023', 'Semestre 2 - 2023', 'Semestre 1 - 2024', 'Semestre 2 - 2024'],
|
|
datasets: [{
|
|
label: 'Heures Travaillées',
|
|
data: [480, 460, 490, 470],
|
|
backgroundColor: 'rgba(204, 153, 0, 1)', // Jaune très sombre, pas transparent
|
|
borderColor: 'rgba(178, 128, 0, 1)', // Jaune plus foncé pour la bordure
|
|
borderWidth: 1
|
|
}]
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
scales: {
|
|
y: {
|
|
beginAtZero: true,
|
|
title: {
|
|
display: true,
|
|
text: 'Heures'
|
|
}
|
|
},
|
|
x: {
|
|
title: {
|
|
display: true,
|
|
text: 'Semestres'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
let proposalToRemove; // Variable pour stocker la proposition à supprimer
|
|
|
|
// Fonctions pour gérer l'acceptation et le refus
|
|
function acceptProposal(button) {
|
|
document.getElementById("justificatifForm").style.display = "block";
|
|
proposalToRemove = button.closest('tr'); // Stocker la proposition à supprimer
|
|
}
|
|
|
|
function confirmRefusal(button) {
|
|
proposalToRemove = button.closest('tr');
|
|
document.getElementById("confirmationPopup").style.display = "flex";
|
|
}
|
|
|
|
function confirmRefusalAction() {
|
|
proposalToRemove.remove();
|
|
closeConfirmationPopup();
|
|
}
|
|
|
|
function closeConfirmationPopup() {
|
|
document.getElementById("confirmationPopup").style.display = "none";
|
|
}
|
|
|
|
function submitJustificatif() {
|
|
alert("Vos pièces justificatives ont été soumises avec succès.");
|
|
closeJustificatifPopup(); // Cacher le formulaire
|
|
|
|
// Ajouter l'heure validée à la section des heures validées
|
|
const validatedTableBody = document.getElementById("validatedTableBody");
|
|
const newRow = document.createElement("tr");
|
|
const periode = proposalToRemove.cells[0].innerText; // Récupérer la période
|
|
const formation = proposalToRemove.cells[1].innerText; // Récupérer la formation
|
|
const nomCours = proposalToRemove.cells[2].innerText; // Récupérer le nom du cours
|
|
const semestre = proposalToRemove.cells[3].innerText; // Récupérer le semestre
|
|
const typeIntervention = proposalToRemove.cells[4].innerText; // Récupérer le type d'intervention
|
|
const volumePrevisionnel = proposalToRemove.cells[5].innerText; // Récupérer le volume prévisionnel
|
|
|
|
newRow.innerHTML = `<td>${periode}</td><td>${formation}</td><td>${nomCours}</td><td>${semestre}</td><td>${typeIntervention}</td><td>${volumePrevisionnel}</td><td class="status-attente">En attente de traitement</td> `;
|
|
validatedTableBody.appendChild(newRow);
|
|
proposalToRemove.remove(); // Supprimer la proposition de l'affichage
|
|
}
|
|
|
|
function closeJustificatifPopup() {
|
|
document.getElementById("justificatifForm").style.display = "none";
|
|
}
|
|
|
|
function getRandomBUT() {
|
|
return "BUT" + Math.floor(Math.random() * 3 + 1); // Génère un nombre aléatoire entre 1 et 3
|
|
}
|
|
|
|
// Gestion des popups
|
|
function showDetails(promotion, groupes, salle) {
|
|
document.getElementById("promotion").innerText = promotion;
|
|
document.getElementById("groupe").innerText = groupes;
|
|
document.getElementById("salle").innerText = salle;
|
|
document.getElementById("infoPopup").style.display = "block";
|
|
}
|
|
|
|
function closeInfoPopup() {
|
|
document.getElementById("infoPopup").style.display = "none";
|
|
}
|
|
|
|
function closePopup() {
|
|
document.getElementById("popup").style.display = "none";
|
|
}
|
|
|
|
// Gestion de l'envoi du formulaire de contact
|
|
document.getElementById('contactForm').addEventListener('submit', function(event) {
|
|
event.preventDefault();
|
|
document.getElementById("popup").style.display = "block";
|
|
});
|
|
</script>
|
|
<script>
|
|
// Exemple d'un grand nombre d'heures pour l'historique
|
|
const hoursData = [
|
|
{ date: '01/02/2024', matiere: 'SCR', type: 'CM', volume: '3 ETD', worked: '4h' },
|
|
{ date: '05/02/2024', matiere: 'Web Dev', type: 'TP', volume: '2 ETD', worked: '3h' },
|
|
{ date: '10/02/2024', matiere: 'Mathématiques', type: 'TD', volume: '4 ETD', worked: '5h' },
|
|
{ date: '15/02/2024', matiere: 'IA', type: 'CM', volume: '2 ETD', worked: '2h' },
|
|
{ date: '20/02/2024', matiere: 'Python', type: 'TP', volume: '5 ETD', worked: '7h' },
|
|
// Ajoutez ici un grand nombre de données...
|
|
{ date: '01/03/2024', matiere: 'Réseaux', type: 'TD', volume: '3 ETD', worked: '4h' },
|
|
{ date: '10/03/2024', matiere: 'Big Data', type: 'CM', volume: '5 ETD', worked: '6h' },
|
|
// Plusieurs lignes (simulons jusqu'à 50 lignes ou plus)...
|
|
{ date: '01/04/2024', matiere: 'Dev Mobile', type: 'TP', volume: '2 ETD', worked: '3h' },
|
|
{ date: '10/04/2024', matiere: 'Sécurité', type: 'CM', volume: '3 ETD', worked: '5h' },
|
|
];
|
|
|
|
// Variables pour la pagination
|
|
const rowsPerPage = 5;
|
|
let currentPage = 1;
|
|
const totalRows = hoursData.length;
|
|
const totalPages = Math.ceil(totalRows / rowsPerPage);
|
|
|
|
// Fonction pour afficher la table avec pagination
|
|
function displayTable(page) {
|
|
const start = (page - 1) * rowsPerPage;
|
|
const end = start + rowsPerPage;
|
|
const tableBody = document.getElementById('hoursTableBody');
|
|
tableBody.innerHTML = ''; // Clear existing rows
|
|
|
|
const pageData = hoursData.slice(start, end);
|
|
pageData.forEach(row => {
|
|
const tr = document.createElement('tr');
|
|
tr.innerHTML = `<td>${row.date}</td>
|
|
<td>${row.matiere}</td>
|
|
<td>${row.type}</td>
|
|
<td>${row.volume}</td>
|
|
<td>${row.worked}</td>
|
|
<td><span class="details-button" onclick="showDetails('BUT2', '1,2,3', '140')">Plus d'infos</span></td>`;
|
|
tableBody.appendChild(tr);
|
|
});
|
|
|
|
document.getElementById('pageNumber').innerText = `Page ${page} sur ${totalPages}`;
|
|
}
|
|
|
|
// Fonctions pour naviguer dans la pagination
|
|
function nextPage() {
|
|
if (currentPage < totalPages) {
|
|
currentPage++;
|
|
displayTable(currentPage);
|
|
}
|
|
}
|
|
|
|
function prevPage() {
|
|
if (currentPage > 1) {
|
|
currentPage--;
|
|
displayTable(currentPage);
|
|
}
|
|
}
|
|
|
|
// Fonction de tri pour les colonnes
|
|
function sortTable(n) {
|
|
const table = document.getElementById('hoursTable');
|
|
let rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
|
|
switching = true;
|
|
dir = "asc"; // Set the sorting direction to ascending
|
|
while (switching) {
|
|
switching = false;
|
|
rows = table.rows;
|
|
for (i = 1; i < (rows.length - 1); i++) {
|
|
shouldSwitch = false;
|
|
x = rows[i].getElementsByTagName("TD")[n];
|
|
y = rows[i + 1].getElementsByTagName("TD")[n];
|
|
if (dir === "asc") {
|
|
if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
|
|
shouldSwitch = true;
|
|
break;
|
|
}
|
|
} else if (dir === "desc") {
|
|
if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
|
|
shouldSwitch = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (shouldSwitch) {
|
|
rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
|
|
switching = true;
|
|
switchcount++;
|
|
} else {
|
|
if (switchcount === 0 && dir === "asc") {
|
|
dir = "desc";
|
|
switching = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Initial load
|
|
displayTable(currentPage);
|
|
|
|
</script>
|
|
|
|
<script>
|
|
// Fonction pour déclarer des heures supplémentaires
|
|
function declareHours(event) {
|
|
event.preventDefault(); // Empêche l'envoi du formulaire
|
|
|
|
// Récupération des valeurs du formulaire
|
|
const periode = document.getElementById('periode').value;
|
|
const formation = document.getElementById('formation').value;
|
|
const cours = document.getElementById('cours').value;
|
|
const semestre = document.getElementById('semestre').value;
|
|
const typeIntervention = document.getElementById('typeIntervention').value;
|
|
const volumeHoraire = document.getElementById('volumeHoraire').value;
|
|
|
|
// Ajout d'une nouvelle ligne à la table des heures déclarées
|
|
const tableBody = document.getElementById('declaredHoursBody');
|
|
const newRow = tableBody.insertRow();
|
|
newRow.innerHTML = `
|
|
<td>${periode}</td>
|
|
<td>${formation}</td>
|
|
<td>${cours}</td>
|
|
<td>${semestre}</td>
|
|
<td>${typeIntervention}</td>
|
|
<td>${volumeHoraire}</td>
|
|
<td class="status-attente">En attente de traitement</td>
|
|
`;
|
|
|
|
// Affichage de la section si elle est vide
|
|
updateDeclaredHoursSectionVisibility();
|
|
|
|
// Affichage de la popup de confirmation
|
|
document.getElementById('confirmationPopup').style.display = 'block';
|
|
|
|
// Réinitialisation du formulaire
|
|
document.getElementById('declarationForm').reset();
|
|
}
|
|
|
|
// Fonction pour mettre à jour la visibilité de la section des heures déclarées
|
|
function updateDeclaredHoursSectionVisibility() {
|
|
const declaredHoursBody = document.getElementById('declaredHoursBody');
|
|
const declaredHoursSection = document.getElementById('declaredHoursSection');
|
|
const declaredHoursContainer = document.getElementById('declaredHoursContainer');
|
|
|
|
// Vérifiez si des heures déclarées existent
|
|
if (declaredHoursBody.rows.length > 0) {
|
|
declaredHoursSection.style.display = 'block';
|
|
declaredHoursContainer.style.display = 'block';
|
|
} else {
|
|
declaredHoursSection.style.display = 'none';
|
|
declaredHoursContainer.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
function toggleMenu() {
|
|
var x = document.getElementById("mobileMenu");
|
|
if (x.className.indexOf("w3-show") == -1) {
|
|
x.className += " w3-show";
|
|
} else {
|
|
x.className = x.className.replace(" w3-show", "");
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html> |