diff --git a/app/static/js/date_utils.js b/app/static/js/date_utils.js index 0db9d3b0f..efdc120e7 100644 --- a/app/static/js/date_utils.js +++ b/app/static/js/date_utils.js @@ -430,3 +430,23 @@ class Duration { function hasTimeConflict(period, interval) { return period.deb.isBefore(interval.fin) && period.fin.isAfter(interval.deb); } + +// Fonction auxiliaire pour obtenir le numéro de semaine ISO d'une date donnée +function getISOWeek(date) { + const target = new Date(date.valueOf()); + const dayNr = (date.getUTCDay() + 6) % 7; + target.setUTCDate(target.getUTCDate() - dayNr + 3); + const firstThursday = target.valueOf(); + target.setUTCMonth(0, 1); + if (target.getUTCDay() !== 4) { + target.setUTCMonth(0, 1 + ((4 - target.getUTCDay() + 7) % 7)); + } + return 1 + Math.ceil((firstThursday - target) / 604800000); +} + +// Fonction auxiliaire pour obtenir le nombre de semaines ISO dans une année donnée +function getISOWeeksInYear(year) { + const date = new Date(year, 11, 31); + const week = getISOWeek(date); + return week === 1 ? getISOWeek(new Date(year, 11, 24)) : week; +} diff --git a/app/templates/assiduites/pages/signal_assiduites_hebdo.j2 b/app/templates/assiduites/pages/signal_assiduites_hebdo.j2 index 874f463b4..5b2a7f28f 100644 --- a/app/templates/assiduites/pages/signal_assiduites_hebdo.j2 +++ b/app/templates/assiduites/pages/signal_assiduites_hebdo.j2 @@ -7,8 +7,9 @@ @@ -159,6 +168,10 @@ #confirmButton:hover { background-color: var(--color-secondary); } + +.etudinfo{ + text-align: left; +} {% endblock styles %} @@ -172,37 +185,359 @@ + + + + {% endblock scripts %} {% block title %} @@ -298,48 +642,63 @@ document.addEventListener("DOMContentLoaded", ()=>{

Signalement hebdomadaire de l'assiduité {{ gr | safe }}


- + - +

Le matin 9h à 12h et l'après-midi de 13h à 17h

- +
- - - - - + + {% for jour in hebdo_jours %} + + {% if not jour[0] or jour[1][0] not in ['Samedi', 'Dimanche'] %} + + {% endif %} + + {% endfor %} - - - - - - - - - - + {% for jour in hebdo_jours %} + + {% if not jour[0] or jour[1][0] not in ['Samedi', 'Dimanche'] %} + + + {% endif %} + {% endfor %} + + + {# Ne pas afficher si preference "non presences" #} + + {% for jour in hebdo_jours %} + {% if not jour[0] or jour[1][0] not in ['Samedi', 'Dimanche'] %} + + + {% endif %} + {% endfor %} + {% for etud in etudiants %} - + - {# à changer par jour travaillés (sco pref) #} - {% for day in ['lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi'] %} - - {% endfor %} + #} {% endfor %} @@ -373,4 +731,5 @@ document.addEventListener("DOMContentLoaded", ()=>{ {% include "assiduites/widgets/alert.j2" %} +{% include "assiduites/widgets/toast.j2" %} {% endblock app_content %} \ No newline at end of file diff --git a/app/views/assiduites.py b/app/views/assiduites.py index 2dcfec2ef..f84330b64 100644 --- a/app/views/assiduites.py +++ b/app/views/assiduites.py @@ -2072,6 +2072,45 @@ def signal_assiduites_hebdo(): # TODO vérif perm AbsChange -> readonly + # Gestion des jours + jours: dict[str, list[str]] = { + "lun": [ + "Lundi", + datetime.datetime.strptime(week + "-1", "%G-W%V-%u").strftime("%d/%m/%Y"), + ], + "mar": [ + "Mardi", + datetime.datetime.strptime(week + "-2", "%G-W%V-%u").strftime("%d/%m/%Y"), + ], + "mer": [ + "Mercredi", + datetime.datetime.strptime(week + "-3", "%G-W%V-%u").strftime("%d/%m/%Y"), + ], + "jeu": [ + "Jeudi", + datetime.datetime.strptime(week + "-4", "%G-W%V-%u").strftime("%d/%m/%Y"), + ], + "ven": [ + "Vendredi", + datetime.datetime.strptime(week + "-5", "%G-W%V-%u").strftime("%d/%m/%Y"), + ], + "sam": [ + "Samedi", + datetime.datetime.strptime(week + "-6", "%G-W%V-%u").strftime("%d/%m/%Y"), + ], + "dim": [ + "Dimanche", + datetime.datetime.strptime(week + "-7", "%G-W%V-%u").strftime("%d/%m/%Y"), + ], + } + + non_travail = sco_preferences.get_preference("non_travail") + non_travail = non_travail.replace(" ", "").split(",") + + hebdo_jours: list[tuple[bool, str]] = [] + for key, val in jours.items(): + hebdo_jours.append((key in non_travail, val)) + return render_template( "assiduites/pages/signal_assiduites_hebdo.j2", gr=gr_tit, @@ -2079,6 +2118,7 @@ def signal_assiduites_hebdo(): moduleimpl_select=_module_selector( formsemestre=formsemestre, moduleimpl_id=moduleimpl_id ), + hebdo_jours=hebdo_jours, )
ÉtudiantsLundiMardiMercrediJeudiVendredi{{ jour[1][0] }} {{jour[1][1] }}
MatinAprès-midiMatinAprès-midiMatinAprès-midiMatinAprès-midiMatinAprès-midiMatinAprès-midi
+ + + +
{{ etud.nomprenom }} + {# Sera rempli en JS #} + {# Ne pas afficher bouton présent si pref "non présences" #} + {# @@ -348,8 +707,7 @@ document.addEventListener("DOMContentLoaded", ()=>{ -