From e61ec5e04ee9471012b8480e8b0930cfe09a331e Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 9 Jan 2024 18:48:44 +0100 Subject: [PATCH] EDT: avertissement si dates hors semestre --- app/static/css/edt.css | 12 ++++++++++++ app/templates/formsemestre/edt.j2 | 17 ++++++++++++++--- sco_version.py | 2 +- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/app/static/css/edt.css b/app/static/css/edt.css index 94a9a42f..cfbf9ef7 100644 --- a/app/static/css/edt.css +++ b/app/static/css/edt.css @@ -65,6 +65,18 @@ span.ens-non-reconnu { display: block; } + +#cal_warning { + display: inline-block; + color: red; + background-color: yellow; + font-size: 120%; + border: 1px solid red; + border-radius: 8px; + padding: 8px; + margin-left: 8px; + margin-bottom: 4px; +} .toastui-calendar-template-time { padding: 4px; word-break: break-all; diff --git a/app/templates/formsemestre/edt.j2 b/app/templates/formsemestre/edt.j2 index d828f24a..7a72890a 100644 --- a/app/templates/formsemestre/edt.j2 +++ b/app/templates/formsemestre/edt.j2 @@ -52,6 +52,7 @@ + Attention: dates en dehors de ce semestre !
@@ -240,9 +241,19 @@ document.addEventListener('DOMContentLoaded', function() { function changeCalendarDate() { setRenderRangeText(); // current calendar date, ISO, without time - const iso_date = calendar.getDateRangeStart().toDate().toISOString().split('T')[0]; - updateParametersInUrl( { current_date: iso_date } ); - calendar_control_form.current_date.value = iso_date; + const iso_date_start = calendar.getDateRangeStart().toDate().toISOString().split('T')[0]; + const iso_date_end = calendar.getDateRangeEnd().toDate().toISOString().split('T')[0]; + const cal_warning = document.querySelector('#cal_warning'); + updateParametersInUrl( { current_date: iso_date_start } ); + calendar_control_form.current_date.value = iso_date_start; + if ((iso_date_start > "{{ formsemestre.date_fin.isoformat() }}") + || (iso_date_end < "{{ formsemestre.date_debut.isoformat() }}")) { + cal_warning.style.display = 'inline-block'; + console.log("OUTSIDE"); + } else { + cal_warning.style.display = 'none'; + console.log("INSIDE"); + } } // View menu const dropdown = document.querySelector('.dropdown'); diff --git a/sco_version.py b/sco_version.py index 5349b3d3..53da13f9 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.6.76" +SCOVERSION = "9.6.77" SCONAME = "ScoDoc"