EDT: avertissement si dates hors semestre

This commit is contained in:
Emmanuel Viennet 2024-01-09 18:48:44 +01:00
parent 1e33626b60
commit e61ec5e04e
3 changed files with 27 additions and 4 deletions

View File

@ -65,6 +65,18 @@ span.ens-non-reconnu {
display: block; 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 { .toastui-calendar-template-time {
padding: 4px; padding: 4px;
word-break: break-all; word-break: break-all;

View File

@ -52,6 +52,7 @@
</button> </button>
</span> </span>
<span id="renderRange" class="render-range"></span> <span id="renderRange" class="render-range"></span>
<span id="cal_warning">Attention: dates en dehors de ce semestre !</span>
</div> </div>
<div id="formsemestre-calendar" style="height: calc(100vh - 180px);"></div> <div id="formsemestre-calendar" style="height: calc(100vh - 180px);"></div>
@ -240,9 +241,19 @@ document.addEventListener('DOMContentLoaded', function() {
function changeCalendarDate() { function changeCalendarDate() {
setRenderRangeText(); setRenderRangeText();
// current calendar date, ISO, without time // current calendar date, ISO, without time
const iso_date = calendar.getDateRangeStart().toDate().toISOString().split('T')[0]; const iso_date_start = calendar.getDateRangeStart().toDate().toISOString().split('T')[0];
updateParametersInUrl( { current_date: iso_date } ); const iso_date_end = calendar.getDateRangeEnd().toDate().toISOString().split('T')[0];
calendar_control_form.current_date.value = iso_date; 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 // View menu
const dropdown = document.querySelector('.dropdown'); const dropdown = document.querySelector('.dropdown');

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.6.76" SCOVERSION = "9.6.77"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"