forked from ScoDoc/ScoDoc
Assiduité : fix bugs calendrier
This commit is contained in:
parent
20d4b4e1b3
commit
9dcaf70e18
@ -3,9 +3,9 @@
|
||||
Calendrier de l'assiduité
|
||||
{% endblock title %}
|
||||
{% block styles %}
|
||||
{{ super() }}
|
||||
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/minitimeline.css">
|
||||
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/assiduites.css">
|
||||
{{ super() }}
|
||||
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/minitimeline.css">
|
||||
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/assiduites.css">
|
||||
{% endblock styles %}
|
||||
|
||||
{% block app_content %}
|
||||
@ -15,379 +15,388 @@ Calendrier de l'assiduité
|
||||
<h2>Assiduité de {{sco.etud.html_link_fiche()|safe}}</h2>
|
||||
|
||||
<div class="options">
|
||||
<input type="checkbox" id="show_pres" name="show_pres" class="memo" {{'checked' if show_pres else ''}}><label for="show_pres">afficher les présences</label>
|
||||
<input type="checkbox" name="show_reta" id="show_reta" class="memo" {{'checked' if show_reta else ''}}><label for="show_reta">afficher les retards</label>
|
||||
<input type="checkbox" name="mode_demi" id="mode_demi" class="memo" {{'checked' if mode_demi else ''}}><label for="mode_demi">mode demi journée</label>
|
||||
<input type="checkbox" id="show_pres" name="show_pres" class="memo" {{'checked' if show_pres else '' }}><label
|
||||
for="show_pres">afficher les présences</label>
|
||||
<input type="checkbox" name="show_reta" id="show_reta" class="memo" {{'checked' if show_reta else '' }}><label
|
||||
for="show_reta">afficher les retards</label>
|
||||
<input type="checkbox" name="mode_demi" id="mode_demi" class="memo" {{'checked' if mode_demi else '' }}><label
|
||||
for="mode_demi">mode demi journée</label>
|
||||
</div>
|
||||
|
||||
<div class="calendrier">
|
||||
{% for mois,jours in calendrier.items() %}
|
||||
<div class="month">
|
||||
<h3>{{mois}}</h3>
|
||||
<div class="days {{'demi' if mode_demi else ''}}">
|
||||
{% for jour in jours %}
|
||||
{% if jour.is_non_work() %}
|
||||
<div class="day {{jour.get_class()}}">
|
||||
<span>{{jour.get_nom()}}</span>
|
||||
{% else %}
|
||||
<div class="day {{jour.get_class(show_pres, show_reta) if not mode_demi else ''}}">
|
||||
<div class="month">
|
||||
<h3>{{mois}}</h3>
|
||||
<div class="days {{'demi' if mode_demi else ''}}">
|
||||
{% for jour in jours %}
|
||||
{% if jour.is_non_work() %}
|
||||
<div class="day {{jour.get_class()}}">
|
||||
<span>{{jour.get_nom()}}</span>
|
||||
{% else %}
|
||||
<div class="day {{jour.get_class(show_pres, show_reta) if not mode_demi else ''}}">
|
||||
{% endif %}
|
||||
{% if mode_demi %}
|
||||
{% if not jour.is_non_work() %}
|
||||
<span>{{jour.get_nom()}}</span>
|
||||
<span class="{{jour.get_demi_class(True, show_pres,show_reta)}}"></span>
|
||||
<span class="{{jour.get_demi_class(False, show_pres,show_reta)}}"></span>
|
||||
{% endif %}
|
||||
{% if not jour.is_non_work() %}
|
||||
<span>{{jour.get_nom()}}</span>
|
||||
<span class="{{jour.get_demi_class(True, show_pres,show_reta)}}"></span>
|
||||
<span class="{{jour.get_demi_class(False, show_pres,show_reta)}}"></span>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if not jour.is_non_work() %}
|
||||
<span>{{jour.get_nom(False)}}</span>
|
||||
{% endif %}
|
||||
{% if not jour.is_non_work() %}
|
||||
<span>{{jour.get_nom(False)}}</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if not jour.is_non_work() and jour.has_assiduites()%}
|
||||
|
||||
<div class="dayline">
|
||||
<div class="dayline-title">
|
||||
<span>Assiduité du</span>
|
||||
<br>
|
||||
<span>{{jour.get_date()}}</span>
|
||||
{{jour.generate_minitimeline() | safe}}
|
||||
<span>Assiduité du</span>
|
||||
<br>
|
||||
<span>{{jour.get_date()}}</span>
|
||||
{{jour.generate_minitimeline() | safe}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="annee">
|
||||
<span id="label-annee">Année scolaire 2022-2023</span><span id="label-changer" style="margin-left: 5px;">Changer
|
||||
année: </span>
|
||||
<select name="" id="annee">
|
||||
</select>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<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>
|
||||
<span id="label-nom">Assiduité de {{sco.etud.nomprenom}}</span>
|
||||
</div>
|
||||
|
||||
<div class="help">
|
||||
<h3>Calendrier</h3>
|
||||
<p>Code couleur</p>
|
||||
<ul class="couleurs">
|
||||
<li><span title="Vert" class="present demo"></span> → présence de l'étudiant lors de la période
|
||||
</li>
|
||||
<li><span title="Bleu clair" class="nonwork demo"></span> → la période n'est pas travaillée
|
||||
</li>
|
||||
<li><span title="Rouge" class="absent demo"></span> → absence de l'étudiant lors de la période
|
||||
</li>
|
||||
<li><span title="Rose" class="demo color absent est_just"></span> → absence justifiée
|
||||
</li>
|
||||
<li><span title="Orange" class="retard demo"></span> → retard de l'étudiant lors de la période
|
||||
</li>
|
||||
<li><span title="Jaune clair" class="demo color retard est_just"></span> → retard justifié
|
||||
</li>
|
||||
<div class="help">
|
||||
<h3>Calendrier</h3>
|
||||
<p>Code couleur</p>
|
||||
<ul class="couleurs">
|
||||
<li><span title="Vert" class="present demo"></span> → présence de l'étudiant lors de la
|
||||
période
|
||||
</li>
|
||||
<li><span title="Bleu clair" class="nonwork demo"></span> → la période n'est pas travaillée
|
||||
</li>
|
||||
<li><span title="Rouge" class="absent demo"></span> → absence de l'étudiant lors de la
|
||||
période
|
||||
</li>
|
||||
<li><span title="Rose" class="demo color absent est_just"></span> → absence justifiée
|
||||
</li>
|
||||
<li><span title="Orange" class="retard demo"></span> → retard de l'étudiant lors de la
|
||||
période
|
||||
</li>
|
||||
<li><span title="Jaune clair" class="demo color retard est_just"></span> → retard justifié
|
||||
</li>
|
||||
|
||||
<li><span title="Quart Bleu" class="est_just demo"></span> → la période est couverte par un
|
||||
<li><span title="Quart Bleu" class="est_just demo"></span> → la période est couverte par un
|
||||
justificatif valide</li>
|
||||
<li><span title="Justif. non valide" class="invalide demo"></span> → la période est
|
||||
couverte par un justificatif non valide
|
||||
</li>
|
||||
<li><span title="Justif. en attente" class="attente demo"></span> → la période
|
||||
a un justificatif en attente de validation
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Vous pouvez passer le curseur sur les jours colorés afin de voir les informations supplémentaires</p>
|
||||
</div>
|
||||
<ul class="couleurs print">
|
||||
<li><span title="Vert" class="present demo"></span> présence
|
||||
</li>
|
||||
<li><span title="Bleu clair" class="nonwork demo"></span> non travaillé
|
||||
</li>
|
||||
<li><span title="Rouge" class="absent demo"></span> absence
|
||||
</li>
|
||||
<li><span title="Rose" class="demo color absent est_just"></span> absence justifiée
|
||||
</li>
|
||||
<li><span title="Orange" class="retard demo"></span> retard
|
||||
</li>
|
||||
<li><span title="Jaune clair" class="demo color retard est_just"></span>retard justifié
|
||||
</li>
|
||||
<li><span title="Quart Bleu" class="est_just demo"></span>
|
||||
justificatif valide</li>
|
||||
<li><span title="Justif. non valide" class="invalide demo"></span> → la période est
|
||||
couverte par un justificatif non valide
|
||||
</li>
|
||||
<li><span title="Justif. en attente" class="attente demo"></span> → la période
|
||||
a un justificatif en attente de validation
|
||||
<li><span title="Quart Violet" class="invalide demo"></span> justificatif non valide
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>Vous pouvez passer le curseur sur les jours colorés afin de voir les informations supplémentaires</p>
|
||||
</div>
|
||||
<ul class="couleurs print">
|
||||
<li><span title="Vert" class="present demo"></span> présence
|
||||
</li>
|
||||
<li><span title="Bleu clair" class="nonwork demo"></span> non travaillé
|
||||
</li>
|
||||
<li><span title="Rouge" class="absent demo"></span> absence
|
||||
</li>
|
||||
<li><span title="Rose" class="demo color absent est_just"></span> absence justifiée
|
||||
</li>
|
||||
<li><span title="Orange" class="retard demo"></span> retard
|
||||
</li>
|
||||
<li><span title="Jaune clair" class="demo color retard est_just"></span>retard justifié
|
||||
</li>
|
||||
<li><span title="Quart Bleu" class="est_just demo"></span>
|
||||
justificatif valide</li>
|
||||
<li><span title="Quart Violet" class="invalide demo"></span> justificatif non valide
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.help .couleurs {
|
||||
grid-template-columns: 2;
|
||||
grid-template-rows: auto;
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.couleurs.print {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.help .couleurs li:nth-child(odd) {
|
||||
grid-column: 1;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.help .couleurs li:nth-child(even) {
|
||||
grid-column: 2;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.color.present {
|
||||
background-color: var(--color-present) !important;
|
||||
}
|
||||
|
||||
.color.absent {
|
||||
background-color: var(--color-absent) !important;
|
||||
}
|
||||
|
||||
.color.absent.est_just {
|
||||
background-color: var(--color-absent-justi) !important;
|
||||
}
|
||||
.color.retard {
|
||||
background-color: var(--color-retard) !important;
|
||||
}
|
||||
|
||||
.color.retard.est_just {
|
||||
background-color: var(--color-retard-justi) !important;
|
||||
}
|
||||
|
||||
.color.nonwork {
|
||||
background-color: var(--color-nonwork) !important;
|
||||
}
|
||||
|
||||
.color {
|
||||
background-color: var(--color-defaut) !important;
|
||||
}
|
||||
|
||||
.pageContent {
|
||||
margin-top: 1vh;
|
||||
max-width: var(--sco-content-max-width);
|
||||
}
|
||||
|
||||
.calendrier {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
flex-wrap: wrap;
|
||||
border: 1px solid #444;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.month h3 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.day,
|
||||
.demi .day.color.nonwork {
|
||||
text-align: left;
|
||||
margin: 2px;
|
||||
cursor: default;
|
||||
font-size: 13px;
|
||||
position: relative;
|
||||
font-weight: normal;
|
||||
min-width: 6em;
|
||||
display: flex;
|
||||
justify-content: start;
|
||||
}
|
||||
|
||||
.color.est_just.sans_etat::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 25%;
|
||||
height: 100%;
|
||||
background-color: var(--color-justi) !important;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.color.invalide::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 25%;
|
||||
height: 100%;
|
||||
right: 0;
|
||||
background-color: var(--color-justi-invalide) !important;
|
||||
}
|
||||
.color.attente::before, .color.modifie::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 25%;
|
||||
height: 100%;
|
||||
right: 0;
|
||||
background: repeating-linear-gradient(
|
||||
to bottom,
|
||||
var(--color-justi-attente-stripe) 0px,
|
||||
var(--color-justi-attente-stripe) 4px,
|
||||
var(--color-justi-attente) 4px,
|
||||
var(--color-justi-attente) 7px
|
||||
)!important;
|
||||
}
|
||||
.demo.invalide {
|
||||
background-color: var(--color-justi-invalide) !important;
|
||||
}
|
||||
.demo.attente {
|
||||
background: repeating-linear-gradient(
|
||||
to bottom,
|
||||
var(--color-justi-attente-stripe) 0px,
|
||||
var(--color-justi-attente-stripe) 4px,
|
||||
var(--color-justi-attente) 4px,
|
||||
var(--color-justi-attente) 7px
|
||||
)!important;
|
||||
}
|
||||
|
||||
.demo.est_just {
|
||||
background-color: var(--color-justi) !important;
|
||||
}
|
||||
|
||||
|
||||
.demi .day.nonwork>span {
|
||||
flex: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.demi .day {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
|
||||
@media print {
|
||||
<style>
|
||||
.help .couleurs {
|
||||
grid-template-columns: 2;
|
||||
grid-template-rows: auto;
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.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;
|
||||
.help .couleurs li:nth-child(odd) {
|
||||
grid-column: 1;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#gtrcontent {
|
||||
margin: 5px;
|
||||
.help .couleurs li:nth-child(even) {
|
||||
grid-column: 2;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.annee {
|
||||
.color.present {
|
||||
background-color: var(--color-present) !important;
|
||||
}
|
||||
|
||||
.color.absent {
|
||||
background-color: var(--color-absent) !important;
|
||||
}
|
||||
|
||||
.color.absent.est_just {
|
||||
background-color: var(--color-absent-justi) !important;
|
||||
}
|
||||
|
||||
.color.retard {
|
||||
background-color: var(--color-retard) !important;
|
||||
}
|
||||
|
||||
.color.retard.est_just {
|
||||
background-color: var(--color-retard-justi) !important;
|
||||
}
|
||||
|
||||
.color.nonwork {
|
||||
background-color: var(--color-nonwork) !important;
|
||||
}
|
||||
|
||||
.color {
|
||||
background-color: var(--color-defaut) !important;
|
||||
}
|
||||
|
||||
.pageContent {
|
||||
margin-top: 1vh;
|
||||
max-width: var(--sco-content-max-width);
|
||||
}
|
||||
|
||||
.calendrier {
|
||||
display: flex;
|
||||
justify-content: space-evenly;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
border: 1px solid #444;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function getOptions() {
|
||||
return {
|
||||
"show_pres": document.getElementById("show_pres").checked,
|
||||
"show_reta": document.getElementById("show_reta").checked,
|
||||
"mode_demi": document.getElementById("mode_demi").checked,
|
||||
.month h3 {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function updatePage(){
|
||||
const url = new URL(location.href);
|
||||
const options = getOptions();
|
||||
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);
|
||||
|
||||
if (location.href != url.href){
|
||||
location.href = url.href
|
||||
.day,
|
||||
.demi .day.color.nonwork {
|
||||
text-align: left;
|
||||
margin: 2px;
|
||||
cursor: default;
|
||||
font-size: 13px;
|
||||
position: relative;
|
||||
font-weight: normal;
|
||||
min-width: 6em;
|
||||
display: flex;
|
||||
justify-content: start;
|
||||
}
|
||||
}
|
||||
|
||||
const defAnnee = {{ annee }}
|
||||
let annees = {{ annees | safe }}
|
||||
annees = annees.filter((x, i) => annees.indexOf(x) === i)
|
||||
const etudid = {{ sco.etud.id }};
|
||||
|
||||
const select = document.querySelector('#annee');
|
||||
annees.forEach((a) => {
|
||||
const opt = document.createElement("option");
|
||||
opt.value = a + "",
|
||||
opt.textContent = `${a} - ${a + 1}`;
|
||||
if (a === defAnnee) {
|
||||
opt.selected = true;
|
||||
document.querySelector('.annee #label-annee').textContent = `Année scolaire ${a}-${a + 1}`
|
||||
|
||||
.color.est_just.sans_etat::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 25%;
|
||||
height: 100%;
|
||||
background-color: var(--color-justi) !important;
|
||||
right: 0;
|
||||
}
|
||||
select.appendChild(opt)
|
||||
})
|
||||
|
||||
document.querySelectorAll('input[type="checkbox"].memo, #annee').forEach(el => {
|
||||
el.addEventListener('change', function() {
|
||||
updatePage();
|
||||
})});
|
||||
.color.invalide::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 25%;
|
||||
height: 100%;
|
||||
right: 0;
|
||||
background-color: var(--color-justi-invalide) !important;
|
||||
}
|
||||
|
||||
document.querySelectorAll('[assi_id]').forEach((el,i) => {
|
||||
el.addEventListener('click', ()=>{
|
||||
const assi_id = el.getAttribute('assi_id');
|
||||
window.open(`${SCO_URL}/Assiduites/tableau_assiduite_actions?type=assiduite&action=details&obj_id=${assi_id}`);
|
||||
.color.attente::before,
|
||||
.color.modifie::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 25%;
|
||||
height: 100%;
|
||||
right: 0;
|
||||
background: repeating-linear-gradient(to bottom,
|
||||
var(--color-justi-attente-stripe) 0px,
|
||||
var(--color-justi-attente-stripe) 4px,
|
||||
var(--color-justi-attente) 4px,
|
||||
var(--color-justi-attente) 7px) !important;
|
||||
}
|
||||
|
||||
.demo.invalide {
|
||||
background-color: var(--color-justi-invalide) !important;
|
||||
}
|
||||
|
||||
.demo.attente {
|
||||
background: repeating-linear-gradient(to bottom,
|
||||
var(--color-justi-attente-stripe) 0px,
|
||||
var(--color-justi-attente-stripe) 4px,
|
||||
var(--color-justi-attente) 4px,
|
||||
var(--color-justi-attente) 7px) !important;
|
||||
}
|
||||
|
||||
.demo.est_just {
|
||||
background-color: var(--color-justi) !important;
|
||||
}
|
||||
|
||||
|
||||
.demi .day.nonwork>span {
|
||||
flex: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.demi .day {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function getOptions() {
|
||||
return {
|
||||
"show_pres": document.getElementById("show_pres").checked,
|
||||
"show_reta": document.getElementById("show_reta").checked,
|
||||
"mode_demi": document.getElementById("mode_demi").checked,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function updatePage() {
|
||||
const url = new URL(location.href);
|
||||
const options = getOptions();
|
||||
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);
|
||||
|
||||
if (location.href != url.href) {
|
||||
location.href = url.href
|
||||
}
|
||||
}
|
||||
|
||||
const defAnnee = "{{ annee | safe}}"
|
||||
let annees = {{ annees | safe }}
|
||||
annees = annees.filter((x, i) => annees.indexOf(x) === i)
|
||||
const etudid = {{ sco.etud.id }};
|
||||
|
||||
const select = document.querySelector('#annee');
|
||||
annees.forEach((a) => {
|
||||
const opt = document.createElement("option");
|
||||
let a_1 = a.substring(0, 4)
|
||||
opt.value = a_1 + "",
|
||||
opt.textContent = a
|
||||
if (a_1 === defAnnee) {
|
||||
opt.selected = true;
|
||||
document.querySelector('.annee #label-annee').textContent = `Année scolaire ${a}`
|
||||
|
||||
}
|
||||
select.appendChild(opt)
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelectorAll('input[type="checkbox"].memo, #annee').forEach(el => {
|
||||
el.addEventListener('change', function () {
|
||||
updatePage();
|
||||
})
|
||||
});
|
||||
|
||||
document.querySelectorAll('[assi_id]').forEach((el, i) => {
|
||||
el.addEventListener('click', () => {
|
||||
const assi_id = el.getAttribute('assi_id');
|
||||
window.open(`${SCO_URL}/Assiduites/tableau_assiduite_actions?type=assiduite&action=details&obj_id=${assi_id}`);
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
{% endblock app_content %}
|
||||
</script>
|
||||
{% endblock app_content %}
|
@ -25,6 +25,7 @@
|
||||
##############################################################################
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import re
|
||||
from typing import Any
|
||||
|
||||
@ -825,17 +826,19 @@ def calendrier_assi_etud():
|
||||
# Récupération des années d'étude de l'étudiant
|
||||
annees: list[int] = []
|
||||
for ins in etud.formsemestre_inscriptions:
|
||||
date_deb = ins.formsemestre.date_debut
|
||||
date_fin = ins.formsemestre.date_fin
|
||||
annees.extend(
|
||||
(ins.formsemestre.date_debut.year, ins.formsemestre.date_fin.year)
|
||||
[
|
||||
scu.annee_scolaire_repr(date_deb.year, date_deb.month),
|
||||
scu.annee_scolaire_repr(date_fin.year, date_fin.month),
|
||||
]
|
||||
)
|
||||
annees = sorted(annees, reverse=True)
|
||||
|
||||
# Transformation en une liste "json"
|
||||
# (sera utilisé pour générer le selecteur d'année)
|
||||
annees_str: str = "["
|
||||
for ann in annees:
|
||||
annees_str += f"{ann},"
|
||||
annees_str += "]"
|
||||
annees_str: str = json.dumps(annees)
|
||||
|
||||
calendrier: dict[str, list["Jour"]] = generate_calendar(etud, annee)
|
||||
|
||||
@ -2355,12 +2358,16 @@ class Jour:
|
||||
assiduites_matin = [
|
||||
assi
|
||||
for assi in self.assiduites
|
||||
if scu.is_period_overlapping((assi.date_debut, assi.date_fin), matin)
|
||||
if scu.is_period_overlapping(
|
||||
(assi.date_debut, assi.date_fin), matin, bornes=False
|
||||
)
|
||||
]
|
||||
justificatifs_matin = [
|
||||
justi
|
||||
for justi in self.justificatifs
|
||||
if scu.is_period_overlapping((justi.date_debut, justi.date_fin), matin)
|
||||
if scu.is_period_overlapping(
|
||||
(justi.date_debut, justi.date_fin), matin, bornes=False
|
||||
)
|
||||
]
|
||||
|
||||
etat = self._get_color_assiduites_cascade(
|
||||
@ -2388,13 +2395,17 @@ class Jour:
|
||||
assiduites_aprem = [
|
||||
assi
|
||||
for assi in self.assiduites
|
||||
if scu.is_period_overlapping((assi.date_debut, assi.date_fin), aprem)
|
||||
if scu.is_period_overlapping(
|
||||
(assi.date_debut, assi.date_fin), aprem, bornes=False
|
||||
)
|
||||
]
|
||||
|
||||
justificatifs_aprem = [
|
||||
justi
|
||||
for justi in self.justificatifs
|
||||
if scu.is_period_overlapping((justi.date_debut, justi.date_fin), aprem)
|
||||
if scu.is_period_overlapping(
|
||||
(justi.date_debut, justi.date_fin), aprem, bornes=False
|
||||
)
|
||||
]
|
||||
|
||||
etat = self._get_color_assiduites_cascade(
|
||||
@ -2433,6 +2444,7 @@ class Jour:
|
||||
# chaque block d'assiduité est défini par:
|
||||
# longueur = ( (fin-deb) / longueur_timeline ) * 100
|
||||
# emplacement = ( (deb - heure_matin) / longueur_timeline ) * 100
|
||||
# longueur + emplacement = 100% sinon on réduit longueur
|
||||
|
||||
assiduite_blocks: list[dict[str, float | str]] = []
|
||||
|
||||
@ -2448,8 +2460,10 @@ class Jour:
|
||||
else heure_soir
|
||||
)
|
||||
|
||||
longueur: float = ((fin - deb) / longueur_timeline) * 100
|
||||
emplacement: float = ((deb - heure_matin) / longueur_timeline) * 100
|
||||
longueur: float = ((fin - deb) / longueur_timeline) * 100
|
||||
if longueur + emplacement > 100:
|
||||
longueur = 100 - emplacement
|
||||
etat: str = scu.EtatAssiduite(assi.etat).name.lower()
|
||||
est_just: str = "est_just" if assi.est_just else ""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user