diff --git a/app/templates/assiduites/pages/signal_assiduites_diff.j2 b/app/templates/assiduites/pages/signal_assiduites_diff.j2 index ea11796e6..700b84f7f 100644 --- a/app/templates/assiduites/pages/signal_assiduites_diff.j2 +++ b/app/templates/assiduites/pages/signal_assiduites_diff.j2 @@ -20,6 +20,14 @@ diff --git a/app/templates/assiduites/pages/signal_assiduites_etud.j2 b/app/templates/assiduites/pages/signal_assiduites_etud.j2 index 44a37f247..2222cbe42 100644 --- a/app/templates/assiduites/pages/signal_assiduites_etud.j2 +++ b/app/templates/assiduites/pages/signal_assiduites_etud.j2 @@ -118,6 +118,8 @@ window.forceModule = "{{ forcer_module }}" window.forceModule = window.forceModule == "True" ? true : false + createColumn(); + diff --git a/app/templates/assiduites/widgets/differee.j2 b/app/templates/assiduites/widgets/differee.j2 index 0b267b8c1..aa42a3e5a 100644 --- a/app/templates/assiduites/widgets/differee.j2 +++ b/app/templates/assiduites/widgets/differee.j2 @@ -9,9 +9,8 @@ {% for etud in etudiants %}
-
+
{{etud.nomprenom}} - No Img
{% endfor %} @@ -40,6 +39,10 @@ gap: 15px; } + .tr[etudid] { + height: 50px; + } + .table-container { overflow: auto; position: relative; @@ -72,13 +75,13 @@ .th, .td { - padding: 20px; text-align: center; width: 225px; border: 1px solid #ddd; display: flex; justify-content: center; align-content: center; + min-height: 40px; } .tr { @@ -88,11 +91,17 @@ width: max-content; } + .td span { + align-items: center; + display: flex; + } + .sticky { position: sticky; left: 0; background-color: #fafafa; border-right: 1px solid #ddd; + z-index: 100; } .mini-form { @@ -120,7 +129,7 @@ border-radius: 50%; right: -60px; top: calc(50% - 50px /2); - background-color: #007BFF; + background-color: #09c; color: white; border: none; outline: none; @@ -133,13 +142,13 @@ } .th { - background-color: #007BFF; + background-color: #09c; color: white; position: relative; } .th.error { - background-color: crimson; + background-color: #d71111; } .tbody .tr:nth-child(even) { @@ -219,7 +228,7 @@ .th.error:hover .col-error { display: block; z-index: 2000; - background-color: crimson; + background-color: #d71111; width: 100%; min-height: 25%; bottom: -25%; @@ -269,7 +278,7 @@ currentDate = moment(currentDate).tz(TIMEZONE).format("YYYY-MM-DDTHH:mm"); } - function createColumn() { + function createColumn(dateStart = "", dateEnd = "") { let table = document.getElementById("studentTable"); let th = document.createElement("div"); th.classList.add("th", "error"); @@ -282,8 +291,8 @@
- - + + {{moduleimpl_select|safe}}
@@ -300,8 +309,10 @@ - const last = [...document.querySelectorAll("#dateStart")].pop(); - defaultDate(last); + if (dateStart == "") { + const last = [...document.querySelectorAll("#dateStart")].pop(); + defaultDate(last); + } try { const sl = th.querySelector('.dynaSelect'); @@ -614,7 +625,7 @@ function updateAllCol() { const colIds = [...document.querySelectorAll("[col]")].map((col) => { return col.getAttribute('col') }); colIds.forEach((colid) => { - updateAssiduitesCol(colid); + getAndUpdateCol(colid) }) } @@ -1009,7 +1020,6 @@ createColumn(); }); - createColumn(); setEtuds(); document.querySelectorAll('.pdp-hover').forEach((el) => { diff --git a/app/views/assiduites.py b/app/views/assiduites.py index 488a7842a..cd267a954 100644 --- a/app/views/assiduites.py +++ b/app/views/assiduites.py @@ -210,6 +210,7 @@ def signal_assiduites_etud(): "js/assiduites.js", "libjs/moment.new.min.js", "libjs/moment-timezone.js", + "js/etud_info.js", ], cssstyles=[ "css/assiduites.css", @@ -880,6 +881,21 @@ def signal_assiduites_diff(): group_ids: list[int] = request.args.get("group_ids", None) formsemestre_id: int = request.args.get("formsemestre_id", -1) date: str = request.args.get("jour", datetime.date.today().isoformat()) + + date_deb: str = request.args.get("date_deb") + date_fin: str = request.args.get("date_fin") + + semaine: str = request.args.get("semaine") + + if semaine is not None: + semaine = ( + f"{scu.annee_scolaire()}-W{semaine}" if "W" not in semaine else semaine + ) + date_deb: datetime.date = datetime.datetime.strptime( + semaine + "-1", "%Y-W%W-%w" + ) + date_fin: datetime.date = date_deb + datetime.timedelta(days=6) + etudiants: list[dict] = [] titre = None @@ -936,6 +952,7 @@ def signal_assiduites_diff(): "js/assiduites.js", "libjs/moment.new.min.js", "libjs/moment-timezone.js", + "js/etud_info.js", ], ) @@ -968,11 +985,35 @@ def signal_assiduites_diff(): gr=gr_tit, sem=sem["titre_num"], defdem=_get_etuds_dem_def(formsemestre), + timeMorning=ScoDocSiteConfig.get("assi_morning_time", "08:00:00"), + timeNoon=ScoDocSiteConfig.get("assi_lunch_time", "13:00:00"), + timeEvening=ScoDocSiteConfig.get("assi_evening_time", "18:00:00"), + defaultDates=_get_days_between_dates(date_deb, date_fin), + nonworkdays=_non_work_days(), ), html_sco_header.sco_footer(), ).build() +def _get_days_between_dates(deb: str, fin: str): + if deb is None or fin is None: + return "null" + try: + if isinstance(deb, str) and isinstance(fin, str): + date_deb: datetime.date = datetime.date.fromisoformat(deb) + date_fin: datetime.date = datetime.date.fromisoformat(fin) + else: + date_deb, date_fin = deb.date(), fin.date() + except ValueError: + return "null" + dates: list[str] = [] + while date_deb <= date_fin: + dates.append(f'"{date_deb.isoformat()}"') + date_deb = date_deb + datetime.timedelta(days=1) + + return f"[{','.join(dates)}]" + + def _differee( etudiants, moduleimpl_select, date=None, periode=None, formsemestre_id=None ):