2024-01-16 16:15:48 +01:00
|
|
|
{% extends "sco_page.j2" %}
|
|
|
|
{% block title %}
|
|
|
|
Calendrier de l'assiduité
|
|
|
|
{% endblock title %}
|
|
|
|
{% block styles %}
|
2024-02-27 08:58:09 +01:00
|
|
|
{{ super() }}
|
|
|
|
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/minitimeline.css">
|
|
|
|
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/assiduites.css">
|
2024-01-16 16:15:48 +01:00
|
|
|
{% endblock styles %}
|
|
|
|
|
|
|
|
{% block app_content %}
|
2024-01-11 17:19:56 +01:00
|
|
|
{% include "assiduites/widgets/alert.j2" %}
|
|
|
|
|
|
|
|
<div class="pageContent">
|
|
|
|
<h2>Assiduité de {{sco.etud.html_link_fiche()|safe}}</h2>
|
|
|
|
|
|
|
|
<div class="options">
|
2024-08-20 14:50:36 +02:00
|
|
|
<label for="show_pres">afficher les présences
|
|
|
|
<input type="checkbox" id="show_pres" name="show_pres" class="memo" {{'checked' if show_pres else '' }}>
|
|
|
|
</label>
|
|
|
|
<label for="show_reta">afficher les retards
|
|
|
|
<input type="checkbox" name="show_reta" id="show_reta" class="memo" {{'checked' if show_reta else '' }}>
|
|
|
|
</label>
|
|
|
|
<label for="mode_demi">mode demi journée
|
|
|
|
<input type="checkbox" name="mode_demi" id="mode_demi" class="memo"{{'checked' if mode_demi else '' }}>
|
|
|
|
</label>
|
2024-01-11 17:19:56 +01:00
|
|
|
</div>
|
|
|
|
|
2024-05-07 15:16:40 +02:00
|
|
|
<div class="cal">
|
|
|
|
{{calendrier|safe}}
|
2024-02-27 08:58:09 +01:00
|
|
|
<div class="annee">
|
|
|
|
<span id="label-annee">Année scolaire</span><span id="label-changer" style="margin-left: 5px;">Changer
|
|
|
|
année: </span>
|
|
|
|
<select name="" id="annee">
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<span id="label-nom">Assiduité de {{sco.etud.nomprenom}}</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="help">
|
|
|
|
<h3>Calendrier</h3>
|
2024-04-22 08:39:00 +02:00
|
|
|
{% include "assiduites/widgets/legende_couleur.j2" %}
|
2024-02-27 08:58:09 +01:00
|
|
|
</div>
|
|
|
|
<ul class="couleurs print">
|
|
|
|
<li><span title="Vert" class="present demo"></span> présence
|
2024-01-11 17:19:56 +01:00
|
|
|
</li>
|
2024-02-27 08:58:09 +01:00
|
|
|
<li><span title="Bleu clair" class="nonwork demo"></span> non travaillé
|
2024-01-11 17:19:56 +01:00
|
|
|
</li>
|
2024-02-27 08:58:09 +01:00
|
|
|
<li><span title="Rouge" class="absent demo"></span> absence
|
2024-01-11 17:19:56 +01:00
|
|
|
</li>
|
2024-02-27 08:58:09 +01:00
|
|
|
<li><span title="Rose" class="demo color absent est_just"></span> absence justifiée
|
2024-01-11 17:19:56 +01:00
|
|
|
</li>
|
2024-02-27 08:58:09 +01:00
|
|
|
<li><span title="Orange" class="retard demo"></span> retard
|
2024-01-11 17:19:56 +01:00
|
|
|
</li>
|
2024-02-27 08:58:09 +01:00
|
|
|
<li><span title="Jaune clair" class="demo color retard est_just"></span>retard justifié
|
2024-01-11 17:19:56 +01:00
|
|
|
</li>
|
2024-02-27 08:58:09 +01:00
|
|
|
<li><span title="Quart Bleu" class="est_just demo"></span>
|
2024-01-11 17:19:56 +01:00
|
|
|
justificatif valide</li>
|
2024-02-27 08:58:09 +01:00
|
|
|
<li><span title="Quart Violet" class="invalide demo"></span> justificatif non valide
|
2024-01-11 17:19:56 +01:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2024-02-27 08:58:09 +01:00
|
|
|
|
|
|
|
<style>
|
|
|
|
.help .couleurs {
|
|
|
|
grid-template-columns: 2;
|
|
|
|
grid-template-rows: auto;
|
|
|
|
display: grid;
|
|
|
|
}
|
2024-01-11 17:19:56 +01:00
|
|
|
|
|
|
|
.couleurs.print {
|
2024-02-27 08:58:09 +01:00
|
|
|
display: none;
|
2024-01-11 17:19:56 +01:00
|
|
|
}
|
|
|
|
|
2024-02-27 08:58:09 +01:00
|
|
|
.help .couleurs li:nth-child(odd) {
|
|
|
|
grid-column: 1;
|
|
|
|
list-style-type: none;
|
2024-01-11 17:19:56 +01:00
|
|
|
}
|
|
|
|
|
2024-02-27 08:58:09 +01:00
|
|
|
.help .couleurs li:nth-child(even) {
|
|
|
|
grid-column: 2;
|
|
|
|
list-style-type: none;
|
2024-01-11 17:19:56 +01:00
|
|
|
}
|
|
|
|
|
2024-04-10 18:40:32 +02:00
|
|
|
|
2024-01-11 17:19:56 +01:00
|
|
|
|
2024-02-27 08:58:09 +01:00
|
|
|
.pageContent {
|
|
|
|
margin-top: 1vh;
|
|
|
|
max-width: var(--sco-content-max-width);
|
2024-01-11 17:19:56 +01:00
|
|
|
}
|
|
|
|
|
2024-05-07 15:16:40 +02:00
|
|
|
.assi_case {
|
2024-01-11 17:19:56 +01:00
|
|
|
display: flex;
|
2024-05-07 15:16:40 +02:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2024-02-27 08:58:09 +01:00
|
|
|
}
|
|
|
|
|
2024-05-07 15:16:40 +02:00
|
|
|
.assi_case > span {
|
|
|
|
flex: 1;
|
2024-01-11 17:19:56 +01:00
|
|
|
}
|
2024-02-27 08:58:09 +01:00
|
|
|
|
2024-05-07 15:16:40 +02:00
|
|
|
.assi_case>span:last-of-type {
|
|
|
|
border-left: #d5d5d5 solid 1px;
|
|
|
|
}
|
|
|
|
.assi_case>span:first-of-type {
|
|
|
|
border-right: #d5d5d5 solid 1px;
|
2024-01-11 17:19:56 +01:00
|
|
|
}
|
|
|
|
|
2024-05-07 15:16:40 +02:00
|
|
|
.dayline{
|
|
|
|
display: none;
|
|
|
|
}
|
2024-02-27 08:58:09 +01:00
|
|
|
|
|
|
|
@media print {
|
|
|
|
|
|
|
|
.couleurs.print {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-evenly;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.couleurs.print li {
|
|
|
|
list-style-type: none !important;
|
|
|
|
-webkit-print-color-adjust: exact !important;
|
|
|
|
print-color-adjust: exact !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.day,
|
|
|
|
.demi .day.color.color.nonwork {
|
|
|
|
min-width: 5em;
|
|
|
|
font-size: 11px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.demi .day>span:first-of-type {
|
|
|
|
width: 2.5em;
|
|
|
|
min-width: 2.5em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.color {
|
|
|
|
-webkit-print-color-adjust: exact !important;
|
|
|
|
print-color-adjust: exact !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.day.est_just,
|
|
|
|
.demi .day span.est_just {
|
|
|
|
background-image: none;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.day.invalide,
|
|
|
|
.demi .day span.invalide {
|
|
|
|
background-image: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.demi .day span.est_just::before {
|
|
|
|
content: "J";
|
|
|
|
}
|
|
|
|
|
|
|
|
.demi .day span.invalide::before {
|
|
|
|
content: "JI";
|
|
|
|
}
|
|
|
|
|
|
|
|
#sidebar,
|
|
|
|
.help,
|
|
|
|
h2,
|
|
|
|
#annee,
|
|
|
|
#label-changer,
|
|
|
|
.options {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
#label-nom,
|
|
|
|
#label-justi {
|
|
|
|
display: inline;
|
|
|
|
}
|
|
|
|
|
|
|
|
#gtrcontent {
|
|
|
|
margin: 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.annee {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-evenly;
|
|
|
|
align-items: center;
|
|
|
|
}
|
2024-01-11 17:19:56 +01:00
|
|
|
}
|
2024-02-27 08:58:09 +01:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
2024-06-11 14:50:30 +02:00
|
|
|
// Retourne un object {show_pres: bool, show_reta: bool, mode_demi: bool}
|
|
|
|
// Correspondant aux options cochées. (voir les checkbox dans le html)
|
2024-02-27 08:58:09 +01:00
|
|
|
function getOptions() {
|
|
|
|
return {
|
|
|
|
"show_pres": document.getElementById("show_pres").checked,
|
|
|
|
"show_reta": document.getElementById("show_reta").checked,
|
|
|
|
"mode_demi": document.getElementById("mode_demi").checked,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-11 14:50:30 +02:00
|
|
|
// Fonction qui recharge la page en fonction des options cochées
|
2024-02-27 08:58:09 +01:00
|
|
|
function updatePage() {
|
2024-06-11 14:50:30 +02:00
|
|
|
// On génère un Objet URL à partir de l'url actuelle
|
2024-02-27 08:58:09 +01:00
|
|
|
const url = new URL(location.href);
|
|
|
|
const options = getOptions();
|
2024-06-11 14:50:30 +02:00
|
|
|
// grace à l'objet URL on peut modifier les paramètres de l'url
|
|
|
|
// sans devoir parser l'url et la reconstruire
|
2024-02-27 08:58:09 +01:00
|
|
|
url.searchParams.set("annee", document.getElementById('annee').value);
|
|
|
|
url.searchParams.set("mode_demi", options.mode_demi);
|
|
|
|
url.searchParams.set("show_pres", options.show_pres);
|
|
|
|
url.searchParams.set("show_reta", options.show_reta);
|
2024-06-11 14:50:30 +02:00
|
|
|
// On change l'url de la page si elle est différente de l'url actuelle
|
2024-02-27 08:58:09 +01:00
|
|
|
if (location.href != url.href) {
|
|
|
|
location.href = url.href
|
|
|
|
}
|
|
|
|
}
|
2024-06-11 14:50:30 +02:00
|
|
|
// L'année scolaire par défaut
|
2024-02-27 08:58:09 +01:00
|
|
|
const defAnnee = "{{ annee | safe}}"
|
2024-06-11 14:50:30 +02:00
|
|
|
// Les années disponibles pour l'étudiant (["2022-2023", "2021-2022", ...])
|
2024-02-27 08:58:09 +01:00
|
|
|
let annees = {{ annees | safe }}
|
2024-06-11 14:50:30 +02:00
|
|
|
// On retire les doublons
|
2024-02-27 08:58:09 +01:00
|
|
|
annees = annees.filter((x, i) => annees.indexOf(x) === i)
|
|
|
|
const etudid = {{ sco.etud.id }};
|
2024-06-11 14:50:30 +02:00
|
|
|
// Peuplement du sélecteur d'année scolaire avec les années disponibles
|
2024-02-27 08:58:09 +01:00
|
|
|
const select = document.querySelector('#annee');
|
|
|
|
annees.forEach((a) => {
|
2024-06-11 14:50:30 +02:00
|
|
|
// <option value="2022">2022-2023</option>
|
2024-02-27 08:58:09 +01:00
|
|
|
const opt = document.createElement("option");
|
|
|
|
let a_1 = a.substring(0, 4)
|
|
|
|
opt.value = a_1 + "",
|
2024-06-11 14:50:30 +02:00
|
|
|
opt.textContent = a
|
2024-02-27 08:58:09 +01:00
|
|
|
if (a_1 === defAnnee) {
|
|
|
|
opt.selected = true;
|
|
|
|
document.querySelector('.annee #label-annee').textContent = `Année scolaire ${a}`
|
|
|
|
|
|
|
|
}
|
|
|
|
select.appendChild(opt)
|
2024-01-11 17:19:56 +01:00
|
|
|
})
|
2024-06-11 14:50:30 +02:00
|
|
|
// On ajoute un écouteur d'événement pour le rechargement de la page
|
|
|
|
// donc effectué sur le sélecteur d'année scolaire et les checkbox
|
2024-02-27 08:58:09 +01:00
|
|
|
document.querySelectorAll('input[type="checkbox"].memo, #annee').forEach(el => {
|
|
|
|
el.addEventListener('change', function () {
|
|
|
|
updatePage();
|
|
|
|
})
|
|
|
|
});
|
2024-06-11 14:50:30 +02:00
|
|
|
// On ajoute un click event pour chaque case d'assiduité afin de rediriger
|
|
|
|
// Sur la page d'édition de l'assiduité
|
2024-02-27 08:58:09 +01:00
|
|
|
document.querySelectorAll('[assi_id]').forEach((el, i) => {
|
|
|
|
el.addEventListener('click', () => {
|
|
|
|
const assi_id = el.getAttribute('assi_id');
|
2024-06-03 15:50:35 +02:00
|
|
|
window.open(`${SCO_URL}Assiduites/edit_assiduite_etud/${assi_id}`);
|
2024-02-27 08:58:09 +01:00
|
|
|
})
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{% endblock app_content %}
|