Choix dates début/fin sur EtatAbsencesGr

This commit is contained in:
Emmanuel Viennet 2022-05-03 02:24:09 +02:00
parent a62d8a6f22
commit ae3a59172e

View File

@ -922,9 +922,36 @@ def EtatAbsencesGr(
h = groups_infos.groups_titles
gr_tit = p + h
title = "État des absences %s" % gr_tit
title = f"État des absences {gr_tit}"
if format == "xls" or format == "xml" or format == "json":
columns_ids = ["etudid"] + columns_ids
# --- Formulaire choix dates début / fin
form_date = (
f"""
<form action="{groups_infos.base_url}" method="get">
<input type="hidden" name="group_ids" value="{group_ids}">
<span style="font-size: 120%"><b>Période du
<input type="text" name="debut" size="10" value="{debut}" class="datepicker"
onchange="validate_date(this);">
&nbsp;au&nbsp;
<input type="text" name="fin" size="10" value="{fin}" class="datepicker"
onchange="validate_date(this);">
</b></span>
&nbsp;
(nombre de <em>demi-journées</em>)
</form>"""
+ """
<script>
function validate_date(el) {
const regex = /^[0-3]?[0-9]\/[0-9]{1,2}\/[0-9]{1,4}$/;
if (regex.test(el.value)) {
return el.form.submit();
}
return false;
}
</script>
"""
)
tab = GenTable(
columns_ids=columns_ids,
rows=T,
@ -945,8 +972,9 @@ def EtatAbsencesGr(
init_qtip=True,
javascripts=["js/etud_info.js"],
),
html_title=html_sco_header.html_sem_header("%s" % title, with_page_header=False)
+ "<p>Période du %s au %s (nombre de <b>demi-journées</b>)<br/>" % (debut, fin),
html_title=html_sco_header.html_sem_header(title, with_page_header=False)
+ form_date,
# "<p>Période du %s au %s (nombre de <b>demi-journées</b>)<br/>" % (debut, fin),
base_url="%s&formsemestre_id=%s&debut=%s&fin=%s"
% (groups_infos.base_url, formsemestre_id, debut, fin),
filename="etat_abs_"