Page assiduité: utilisation de templates partout. Fix #816

This commit is contained in:
Emmanuel Viennet 2024-01-21 22:21:10 +01:00
parent a12505e8df
commit ef63e27aed
11 changed files with 311 additions and 370 deletions

View File

@ -174,7 +174,7 @@
text-align: start; text-align: start;
top: -40px; top: -40px;
transform: translateX(-50%); transform: translateX(-50%);
z-index: 2; z-index: 1;
} }
@ -183,7 +183,7 @@
content: "|"; content: "|";
position: absolute; position: absolute;
bottom: -2px; bottom: -2px;
z-index: 2; z-index: 1;
} }
.mini-timeline-block.creneau { .mini-timeline-block.creneau {

View File

@ -39,7 +39,7 @@ $(function () {
"Avril", "Avril",
"May", "May",
"Juin", "Juin",
"Juilet", "Juillet",
"Août", "Août",
"Septembre", "Septembre",
"Octobre", "Octobre",

View File

@ -1,3 +1,70 @@
{% extends "sco_page.j2" %}
{% block title %}
Bilan assiduité de {{sco.etud.nomprenom}}
{% endblock title %}
{% block styles %}
{{ super() }}
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/assiduites.css">
<style>
.stats-values-item {
display: flex;
justify-content: space-evenly;
align-items: center;
flex-direction: column;
}
.stats {
border: 1px solid #333;
padding: 5px 2px;
width: fit-content;
}
.stats-values {
display: flex;
justify-content: flex-start;
gap: 15px;
}
.stats-values-item h5 {
font-weight: bold;
text-decoration-line: underline;
}
.stats-values-part {
display: flex;
flex-direction: column;
}
.alerte {
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
margin: 5px 0;
border-radius: 7px;
background-color: var(--color-error);
}
.alerte.invisible {
display: none;
}
.alerte p {
font-size: larger;
color: whitesmoke;
}
.suppr {
margin: 5px 0;
}
</style>
{% endblock styles %}
{% block app_content %} {% block app_content %}
{% include "assiduites/widgets/tableau_base.j2" %} {% include "assiduites/widgets/tableau_base.j2" %}
<div class="pageContent"> <div class="pageContent">
@ -12,9 +79,9 @@
<!-- Statistiques d'assiduité (nb pres, nb retard, nb absence) + nb justifié --> <!-- Statistiques d'assiduité (nb pres, nb retard, nb absence) + nb justifié -->
<h4>Statistiques d'assiduité</h4> <h4>Statistiques d'assiduité</h4>
<div class="stats-inputs"> <div class="stats-inputs">
<label class="stats-label"> Date de début<input type="text" class="datepicker" name="stats_date_debut" <label class="stats-label"> Date de début <input type="text" class="datepicker" name="stats_date_debut"
id="stats_date_debut" value="{{date_debut}}"></label> id="stats_date_debut" value="{{date_debut}}"></label>
<label class="stats-label"> Date de fin<input type="text" class="datepicker" name="stats_date_fin" <label class="stats-label"> Date de fin <input type="text" class="datepicker" name="stats_date_fin"
id="stats_date_fin" value="{{date_fin}}"></label> id="stats_date_fin" value="{{date_fin}}"></label>
<button onclick="stats()">Actualiser</button> <button onclick="stats()">Actualiser</button>
</div> </div>
@ -45,8 +112,13 @@
</div> </div>
{% endblock app_content %} {% endblock app_content %}
<script>
{% block scripts %}
{{ super() }}
<script src="{{scu.STATIC_DIR}}/js/assiduites.js"></script>
<script src="{{scu.STATIC_DIR}}/js/date_utils.js"></script>
<script>
function stats() { function stats() {
const dd_val = document.getElementById('stats_date_debut').value; const dd_val = document.getElementById('stats_date_debut').value;
const df_val = document.getElementById('stats_date_fin').value; const df_val = document.getElementById('stats_date_fin').value;
@ -109,7 +181,7 @@
} }
const heure = document.createElement('span'); const heure = document.createElement('span');
heure.textContent = `${counter[key].total.heure} heure(s)${withJusti(key, "heure")}`; heure.textContent = `${counter[key].total.heure.toFixed(2)} heure(s)${withJusti(key, "heure")}`;
const demi = document.createElement('span'); const demi = document.createElement('span');
demi.textContent = `${counter[key].total.demi} demi-journée(s)${withJusti(key, "demi")}`; demi.textContent = `${counter[key].total.demi} demi-journée(s)${withJusti(key, "demi")}`;
@ -238,59 +310,6 @@
}) })
</script> </script>
<style> {% endblock %}
.stats-values-item {
display: flex;
justify-content: space-evenly;
align-items: center;
flex-direction: column;
}
.stats {
border: 1px solid #333;
padding: 5px 2px;
width: fit-content;
}
.stats-values {
display: flex;
justify-content: flex-start;
gap: 15px;
}
.stats-values-item h5 {
font-weight: bold;
text-decoration-line: underline;
}
.stats-values-part {
display: flex;
flex-direction: column;
}
.alerte {
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
margin: 5px 0;
border-radius: 7px;
background-color: var(--color-error);
}
.alerte.invisible {
display: none;
}
.alerte p {
font-size: larger;
color: whitesmoke;
}
.suppr {
margin: 5px 0;
}
</style>

View File

@ -1,3 +1,21 @@
{% extends "sco_page.j2" %}
{% block title %}
Assiduité de {{etud.nomprenom}}
{% endblock title %}
{% block styles %}
{{ super() }}
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/assiduites.css">
{% endblock styles %}
{% block scripts %}
{{ super() }}
<script src="{{scu.STATIC_DIR}}/js/assiduites.js"></script>
<script src="{{scu.STATIC_DIR}}/js/date_utils.js"></script>
{% endblock %}
{% block app_content %} {% block app_content %}
<div class="pageContent"> <div class="pageContent">

View File

@ -3,6 +3,26 @@
- TODO : revoir le fonctionnement de cette page (trop lente / complexe) - TODO : revoir le fonctionnement de cette page (trop lente / complexe)
- Utiliser majoritairement du python - Utiliser majoritairement du python
#} #}
{% extends "sco_page.j2" %}
{% block styles %}
{{ super() }}
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/assiduites.css">
{% endblock styles %}
{% block title %}
{{title}}
{% endblock title %}
{% block app_content %}
{% include "assiduites/widgets/alert.j2" %}
{% include "assiduites/widgets/prompt.j2" %}
{% include "assiduites/widgets/conflict.j2" %}
{% include "assiduites/widgets/toast.j2" %}
<script src="{{scu.STATIC_DIR}}/js/date_utils.js"></script>
<h2>Signalement différé de l'assiduité {{gr |safe}}</h2> <h2>Signalement différé de l'assiduité {{gr |safe}}</h2>
<div class="ue_warning">Attention, cette page utilise des couleurs et conventions différentes <div class="ue_warning">Attention, cette page utilise des couleurs et conventions différentes
@ -27,8 +47,14 @@
<p>Vous pouvez supprimer une colonne en appuyant sur la croix qui se situe dans le coin haut droit de la colonne. <p>Vous pouvez supprimer une colonne en appuyant sur la croix qui se situe dans le coin haut droit de la colonne.
</p> </p>
</div> </div>
{% endblock app_content %}
<script>
{% block scripts %}
{{ super() }}
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
<script src="{{scu.STATIC_DIR}}/js/assiduites.js"></script>
<script>
const etudsDefDem = {{ defdem | safe }} const etudsDefDem = {{ defdem | safe }}
const timeMorning = "{{ timeMorning | safe}}"; const timeMorning = "{{ timeMorning | safe}}";
@ -71,14 +97,5 @@
createColumn(); createColumn();
} }
}) })
</script> </script>
{% endblock scripts %}
{% include "assiduites/widgets/alert.j2" %}
{% include "assiduites/widgets/prompt.j2" %}
{% include "assiduites/widgets/conflict.j2" %}
{% include "assiduites/widgets/toast.j2" %}

View File

@ -1,4 +1,86 @@
{% extends "sco_page.j2" %}
{% block title %}
{{title}}
{% endblock title %}
{% block scripts %}
{{ super() }}
<script src="{{scu.STATIC_DIR}}/libjs/bootstrap-multiselect-1.1.2/bootstrap-multiselect.min.js"></script>
<script src="{{scu.STATIC_DIR}}/libjs/purl.js"></script>
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
<script src="{{scu.STATIC_DIR}}/js/groups_view.js"></script>
<script src="{{scu.STATIC_DIR}}/js/date_utils.js"></script>
<script src="{{scu.STATIC_DIR}}/js/assiduites.js"></script>
<script>
{% if readonly != "false" %}
function getPeriodValues(){
return [0, 23]
}
{% endif %}
const nonWorkDays = [{{ nonworkdays| safe }}];
const readOnly = {{ readonly }};
setupDate();
updateDate();
if (!readOnly){
setupTimeLine(()=>{
generateAllEtudRow();
});
}
window.forceModule = "{{ forcer_module }}"
window.forceModule = window.forceModule == "True" ? true : false
const etudsDefDem = {{ defdem | safe }}
const select = document.getElementById("moduleimpl_select");
select?.addEventListener('change', (e) => {
generateAllEtudRow();
});
if (window.forceModule) {
const btn = document.getElementById("validate_selectors");
if (!readOnly && select.value == "") {
document.getElementById('forcemodule').style.display = "block";
}
select?.addEventListener('change', (e) => {
if (e.target.value != "") {
document.getElementById('forcemodule').style.display = "none";
} else {
document.getElementById('forcemodule').style.display = "block";
}
});
}
</script>
{% endblock scripts %}
{% block styles %}
{{ super() }}
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/libjs/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/libjs/bootstrap/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/libjs/bootstrap-multiselect-1.1.2/bootstrap-multiselect.min.css">
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/assiduites.css">
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/minitimeline.css">
{% endblock styles %}
{% block app_content %}
{% include "assiduites/widgets/toast.j2" %} {% include "assiduites/widgets/toast.j2" %}
{{ minitimeline|safe }}
<section id="content"> <section id="content">
<div class="no-display"> <div class="no-display">
@ -78,55 +160,6 @@
{% include "assiduites/widgets/prompt.j2" %} {% include "assiduites/widgets/prompt.j2" %}
{% include "assiduites/widgets/conflict.j2" %} {% include "assiduites/widgets/conflict.j2" %}
<script> </section>
{% if readonly != "false" %} {% endblock app_content %}
function getPeriodValues(){
return [0, 23]
}
{% endif %}
const nonWorkDays = [{{ nonworkdays| safe }}];
const readOnly = {{ readonly }};
setupDate();
updateDate();
if (!readOnly){
setupTimeLine(()=>{
generateAllEtudRow();
});
}
window.forceModule = "{{ forcer_module }}"
window.forceModule = window.forceModule == "True" ? true : false
const etudsDefDem = {{ defdem | safe }}
const select = document.getElementById("moduleimpl_select");
select?.addEventListener('change', (e) => {
generateAllEtudRow();
});
if (window.forceModule) {
const btn = document.getElementById("validate_selectors");
if (!readOnly && select.value == "") {
document.getElementById('forcemodule').style.display = "block";
}
select?.addEventListener('change', (e) => {
if (e.target.value != "") {
document.getElementById('forcemodule').style.display = "none";
} else {
document.getElementById('forcemodule').style.display = "block";
}
});
}
</script>
</section>

View File

@ -270,6 +270,10 @@
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
border: 10px solid white; border: 10px solid white;
} }
.mini-form {
color: black;
}
</style> </style>
<script> <script>
@ -315,7 +319,7 @@
<input disabled="" type="radio" class="rbtn retard" name="mass_action_${col_id}" value="retard" onclick="massCol(this)"> <input disabled="" type="radio" class="rbtn retard" name="mass_action_${col_id}" value="retard" onclick="massCol(this)">
<input disabled="" type="radio" class="rbtn absent" name="mass_action_${col_id}" value="absent" onclick="massCol(this)"> <input disabled="" type="radio" class="rbtn absent" name="mass_action_${col_id}" value="absent" onclick="massCol(this)">
<input disabled="" type="radio" class="rbtn aucun" name="mass_action_${col_id}" value="remove" onclick="massCol(this)"> <input disabled="" type="radio" class="rbtn aucun" name="mass_action_${col_id}" value="remove" onclick="massCol(this)">
</div> </div>
</div> </div>
`; `;

View File

@ -1,3 +1,4 @@
{# Base de toutes les pages ScoDoc #}
{% block doc -%} {% block doc -%}
<!DOCTYPE html> <!DOCTYPE html>
<html{% block html_attribs %}{% endblock html_attribs %}> <html{% block html_attribs %}{% endblock html_attribs %}>
@ -25,7 +26,10 @@
{% block scripts %} {% block scripts %}
<script src="{{scu.STATIC_DIR}}/jQuery/jquery.js"></script> <script src="{{scu.STATIC_DIR}}/jQuery/jquery.js"></script>
<script src="{{scu.STATIC_DIR}}/libjs/bootstrap/js/bootstrap.js"></script> <script src="{{scu.STATIC_DIR}}/libjs/bootstrap/js/bootstrap.min.js"></script>
<script>
const SCO_TIMEZONE = "{{ scu.TIME_ZONE }}";
</script>
{%- endblock scripts %} {%- endblock scripts %}
{%- endblock body %} {%- endblock body %}
</body> </body>

View File

@ -1,4 +1,4 @@
{# -*- mode: jinja-html -*- #} {# base des pages hors départements (accueil, configuration, ...) #}
{% extends 'babase.j2' %} {% extends 'babase.j2' %}
{% block styles %} {% block styles %}
@ -103,6 +103,5 @@
<script> <script>
const SCO_URL = "{% if g.scodoc_dept %}{{ const SCO_URL = "{% if g.scodoc_dept %}{{
url_for('scolar.index_html', scodoc_dept=g.scodoc_dept)[:-11] }}{% endif %}"; url_for('scolar.index_html', scodoc_dept=g.scodoc_dept)[:-11] }}{% endif %}";
const SCO_TIMEZONE = "{{ scu.TIME_ZONE }}";
</script> </script>
{% endblock %} {% endblock %}

View File

@ -1,4 +1,4 @@
{# -*- mode: jinja-html -*- #} {# -*- Base des pages ordinaires, dans départements -*- #}
{% extends 'babase.j2' %} {% extends 'babase.j2' %}
{% block styles %} {% block styles %}

View File

@ -85,85 +85,6 @@ from app.scodoc.sco_archives_justificatifs import JustificatifArchiver
CSSSTYLES = html_sco_header.BOOTSTRAP_MULTISELECT_CSS CSSSTYLES = html_sco_header.BOOTSTRAP_MULTISELECT_CSS
# --- UTILS ---
class HTMLElement:
"""Représentation d'un HTMLElement version Python"""
def __init__(self, tag: str, *attr, **kattr) -> None:
self.tag: str = tag
self.children: list["HTMLElement"] = []
self.self_close: bool = kattr.get("self_close", False)
self.text_content: str = kattr.get("text_content", "")
self.key_attributes: dict[str, Any] = kattr
self.attributes: list[str] = list(attr)
def add(self, *child: "HTMLElement") -> None:
"""add child element to self"""
for kid in child:
self.children.append(kid)
def remove(self, child: "HTMLElement") -> None:
"""Remove child element from self"""
if child in self.children:
self.children.remove(child)
def __str__(self) -> str:
attr: list[str] = self.attributes
for att, val in self.key_attributes.items():
if att in ("self_close", "text_content"):
continue
if att != "cls":
attr.append(f'{att}="{val}"')
else:
attr.append(f'class="{val}"')
if not self.self_close:
head: str = f"<{self.tag} {' '.join(attr)}>{self.text_content}"
body: str = "\n".join(map(str, self.children))
foot: str = f"</{self.tag}>"
return head + body + foot
return f"<{self.tag} {' '.join(attr)}/>"
def __add__(self, other: str):
return str(self) + other
def __radd__(self, other: str):
return other + str(self)
class HTMLStringElement(HTMLElement):
"""Utilisation d'une chaine de caracètres pour représenter un element"""
def __init__(self, text: str) -> None:
self.text: str = text
HTMLElement.__init__(self, "textnode")
def __str__(self) -> str:
return self.text
class HTMLBuilder:
def __init__(self, *content: HTMLElement | str) -> None:
self.content: list[HTMLElement | str] = list(content)
def add(self, *element: HTMLElement | str):
self.content.extend(element)
def remove(self, element: HTMLElement | str):
if element in self.content:
self.content.remove(element)
def __str__(self) -> str:
return "\n".join(map(str, self.content))
def build(self) -> str:
return self.__str__()
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# #
# Assiduité (/ScoDoc/<dept>/Scolarite/Assiduites/...) # Assiduité (/ScoDoc/<dept>/Scolarite/Assiduites/...)
@ -539,18 +460,6 @@ def liste_assiduites_etud():
assiduite_id: int = request.args.get("assiduite_id", -1) assiduite_id: int = request.args.get("assiduite_id", -1)
# Préparation de la page # Préparation de la page
header: str = html_sco_header.sco_header(
page_title=f"Assiduité de {etud.nomprenom}",
init_qtip=True,
javascripts=[
"js/assiduites.js",
"js/date_utils.js",
],
cssstyles=CSSSTYLES
+ [
"css/assiduites.css",
],
)
tableau = _prepare_tableau( tableau = _prepare_tableau(
liste_assi.AssiJustifData.from_etudiants( liste_assi.AssiJustifData.from_etudiants(
etud, etud,
@ -563,16 +472,14 @@ def liste_assiduites_etud():
) )
if not tableau[0]: if not tableau[0]:
return tableau[1] return tableau[1]
# Peuplement du template jinja # Page HTML:
return HTMLBuilder( return render_template(
header, "assiduites/pages/liste_assiduites.j2",
render_template( assi_id=assiduite_id,
"assiduites/pages/liste_assiduites.j2", etud=etud,
sco=ScoData(etud), tableau=tableau[1],
assi_id=assiduite_id, sco=ScoData(etud),
tableau=tableau[1], )
),
).build()
@bp.route("/bilan_etud") @bp.route("/bilan_etud")
@ -593,20 +500,6 @@ def bilan_etud():
if etud.dept_id != g.scodoc_dept_id: if etud.dept_id != g.scodoc_dept_id:
abort(404, "étudiant inexistant dans ce département") abort(404, "étudiant inexistant dans ce département")
# Préparation de la page (header)
header: str = html_sco_header.sco_header(
page_title=f"Bilan de l'assiduité de {etud.nomprenom}",
init_qtip=True,
javascripts=[
"js/assiduites.js",
"js/date_utils.js",
],
cssstyles=CSSSTYLES
+ [
"css/assiduites.css",
],
)
# Gestion des dates du bilan (par défaut l'année scolaire) # Gestion des dates du bilan (par défaut l'année scolaire)
date_debut = scu.date_debut_annee_scolaire().strftime("%d/%m/%Y") date_debut = scu.date_debut_annee_scolaire().strftime("%d/%m/%Y")
date_fin: str = scu.date_fin_annee_scolaire().strftime("%d/%m/%Y") date_fin: str = scu.date_fin_annee_scolaire().strftime("%d/%m/%Y")
@ -639,23 +532,20 @@ def bilan_etud():
if not table[0]: if not table[0]:
return table[1] return table[1]
# Génération de la page # Génération de la page HTML
return HTMLBuilder( return render_template(
header, "assiduites/pages/bilan_etud.j2",
render_template( assi_limit_annee=sco_preferences.get_preference(
"assiduites/pages/bilan_etud.j2", "assi_limit_annee",
sco=ScoData(etud), dept_id=g.scodoc_dept_id,
date_debut=date_debut,
date_fin=date_fin,
assi_metric=assi_metric,
assi_seuil=_get_seuil(),
assi_limit_annee=sco_preferences.get_preference(
"assi_limit_annee",
dept_id=g.scodoc_dept_id,
),
tableau=table[1],
), ),
).build() assi_metric=assi_metric,
assi_seuil=_get_seuil(),
date_debut=date_debut,
date_fin=date_fin,
sco=ScoData(etud),
tableau=table[1],
)
@bp.route("/edit_justificatif_etud/<int:justif_id>", methods=["GET", "POST"]) @bp.route("/edit_justificatif_etud/<int:justif_id>", methods=["GET", "POST"])
@ -1105,55 +995,33 @@ def signal_assiduites_group():
grp + ' <span class="fontred">' + groups_infos.groups_titles + "</span>" grp + ' <span class="fontred">' + groups_infos.groups_titles + "</span>"
) )
# --- Génération de l'HTML ---
header: str = html_sco_header.sco_header(
page_title="Saisie journalière des assiduités",
init_qtip=True,
javascripts=html_sco_header.BOOTSTRAP_MULTISELECT_JS
+ [
# Voir fonctionnement JS
"js/etud_info.js",
"js/groups_view.js",
"js/assiduites.js",
"js/date_utils.js",
],
cssstyles=CSSSTYLES
+ [
"css/assiduites.css",
"css/minitimeline.css",
],
)
# Récupération du semestre en dictionnaire # Récupération du semestre en dictionnaire
sem = formsemestre.to_dict() sem = formsemestre.to_dict()
# Peuplement du template jinja # Page HTML
return HTMLBuilder( return render_template(
header, "assiduites/pages/signal_assiduites_group.j2",
_mini_timeline(), date=_dateiso_to_datefr(date),
render_template( defdem=_get_etuds_dem_def(formsemestre),
"assiduites/pages/signal_assiduites_group.j2", forcer_module=sco_preferences.get_preference(
gr_tit=gr_tit, "forcer_module",
sem=sem["titre_num"],
date=_dateiso_to_datefr(date),
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
grp=sco_groups_view.menu_groups_choice(groups_infos), dept_id=g.scodoc_dept_id,
moduleimpl_select=_module_selector(formsemestre, moduleimpl_id),
timeline=_timeline(heures=",".join([f"'{s}'" for s in heures])),
nonworkdays=_non_work_days(),
formsemestre_date_debut=str(formsemestre.date_debut),
formsemestre_date_fin=str(formsemestre.date_fin),
forcer_module=sco_preferences.get_preference(
"forcer_module",
formsemestre_id=formsemestre_id,
dept_id=g.scodoc_dept_id,
),
defdem=_get_etuds_dem_def(formsemestre),
readonly="false",
), ),
html_sco_header.sco_footer(), formsemestre_date_debut=str(formsemestre.date_debut),
).build() formsemestre_date_fin=str(formsemestre.date_fin),
formsemestre_id=formsemestre_id,
gr_tit=gr_tit,
grp=sco_groups_view.menu_groups_choice(groups_infos),
minitimeline=_mini_timeline(),
moduleimpl_select=_module_selector(formsemestre, moduleimpl_id),
nonworkdays=_non_work_days(),
readonly="false",
sco=ScoData(formsemestre=formsemestre),
sem=sem["titre_num"],
timeline=_timeline(heures=",".join([f"'{s}'" for s in heures])),
title="Saisie journalière des assiduités",
)
@bp.route("/visu_assiduites_group") @bp.route("/visu_assiduites_group")
@ -1248,7 +1116,7 @@ def visu_assiduites_group():
# Si aucun etudiant n'est inscrit au module choisi... # Si aucun etudiant n'est inscrit au module choisi...
moduleimpl_id = None moduleimpl_id = None
# --- Génération de l'HTML --- # --- Génération du HTML ---
if groups_infos.tous_les_etuds_du_sem: if groups_infos.tous_les_etuds_du_sem:
gr_tit = "en" gr_tit = "en"
@ -1261,52 +1129,32 @@ def visu_assiduites_group():
grp + ' <span class="fontred">' + groups_infos.groups_titles + "</span>" grp + ' <span class="fontred">' + groups_infos.groups_titles + "</span>"
) )
header: str = html_sco_header.sco_header(
page_title="Saisie journalière de l'assiduité",
init_qtip=True,
javascripts=html_sco_header.BOOTSTRAP_MULTISELECT_JS
+ [
# Voir fonctionnement JS
"js/etud_info.js",
"js/groups_view.js",
"js/assiduites.js",
"js/date_utils.js",
],
cssstyles=CSSSTYLES
+ [
"css/assiduites.css",
"css/minitimeline.css",
],
)
# Récupération du semestre en dictionnaire # Récupération du semestre en dictionnaire
sem = formsemestre.to_dict() sem = formsemestre.to_dict()
return HTMLBuilder( return render_template(
header, "assiduites/pages/signal_assiduites_group.j2",
_mini_timeline(), date=_dateiso_to_datefr(date),
render_template( defdem=_get_etuds_dem_def(formsemestre),
"assiduites/pages/signal_assiduites_group.j2", forcer_module=sco_preferences.get_preference(
gr_tit=gr_tit, "forcer_module",
sem=sem["titre_num"],
date=_dateiso_to_datefr(date),
formsemestre_id=formsemestre_id, formsemestre_id=formsemestre_id,
grp=sco_groups_view.menu_groups_choice(groups_infos), dept_id=g.scodoc_dept_id,
moduleimpl_select=_module_selector(formsemestre, moduleimpl_id),
timeline=_timeline(),
nonworkdays=_non_work_days(),
formsemestre_date_debut=str(formsemestre.date_debut),
formsemestre_date_fin=str(formsemestre.date_fin),
forcer_module=sco_preferences.get_preference(
"forcer_module",
formsemestre_id=formsemestre_id,
dept_id=g.scodoc_dept_id,
),
defdem=_get_etuds_dem_def(formsemestre),
readonly="true",
), ),
html_sco_header.sco_footer(), formsemestre_date_debut=str(formsemestre.date_debut),
).build() formsemestre_date_fin=str(formsemestre.date_fin),
formsemestre_id=formsemestre_id,
gr_tit=gr_tit,
grp=sco_groups_view.menu_groups_choice(groups_infos),
minitimeline=_mini_timeline(),
moduleimpl_select=_module_selector(formsemestre, moduleimpl_id),
nonworkdays=_non_work_days(),
sem=sem["titre_num"],
timeline=_timeline(),
readonly="true",
sco=ScoData(formsemestre=formsemestre),
title="Saisie journalière de l'assiduité",
)
class RowEtudWithAssi(RowEtud): class RowEtudWithAssi(RowEtud):
@ -1828,7 +1676,9 @@ def _preparer_objet(
@scodoc @scodoc
@permission_required(Permission.AbsChange) @permission_required(Permission.AbsChange)
def signal_assiduites_diff(): def signal_assiduites_diff():
"""TODO documenter""" """TODO documenter
Utilisé notamment par "Saisie différée" sur tableau de bord semetstre"
"""
# Récupération des paramètres de la requête # Récupération des paramètres de la requête
group_ids: list[int] = request.args.get("group_ids", None) group_ids: list[int] = request.args.get("group_ids", None)
formsemestre_id: int = request.args.get("formsemestre_id", -1) formsemestre_id: int = request.args.get("formsemestre_id", -1)
@ -1910,32 +1760,29 @@ def signal_assiduites_diff():
grp + ' <span class="fontred">' + groups_infos.groups_titles + "</span>" grp + ' <span class="fontred">' + groups_infos.groups_titles + "</span>"
) )
return HTMLBuilder( return render_template(
header, "assiduites/pages/signal_assiduites_diff.j2",
render_template( defaultDates=_get_days_between_dates(date_deb, date_fin),
"assiduites/pages/signal_assiduites_diff.j2", defdem=_get_etuds_dem_def(formsemestre),
diff=_differee( diff=_differee(
etudiants=etudiants, etudiants=etudiants,
moduleimpl_select=_module_selector( moduleimpl_select=_module_selector(
formsemestre, request.args.get("moduleimpl_id", None) formsemestre, request.args.get("moduleimpl_id", None)
),
date=date,
periode={
"deb": formsemestre.date_debut.isoformat(),
"fin": formsemestre.date_fin.isoformat(),
},
), ),
gr=gr_tit, date=date,
sem=formsemestre.titre_num(), periode={
defdem=_get_etuds_dem_def(formsemestre), "deb": formsemestre.date_debut.isoformat(),
timeMorning=ScoDocSiteConfig.get("assi_morning_time", "08:00:00"), "fin": formsemestre.date_fin.isoformat(),
timeNoon=ScoDocSiteConfig.get("assi_lunch_time", "13:00:00"), },
timeEvening=ScoDocSiteConfig.get("assi_afternoon_time", "18:00:00"),
defaultDates=_get_days_between_dates(date_deb, date_fin),
nonworkdays=_non_work_days(),
), ),
html_sco_header.sco_footer(), gr=gr_tit,
).build() nonworkdays=_non_work_days(),
sco=ScoData(formsemestre=formsemestre),
sem=formsemestre.titre_num(),
timeEvening=ScoDocSiteConfig.get("assi_afternoon_time", "18:00:00"),
timeMorning=ScoDocSiteConfig.get("assi_morning_time", "08:00:00"),
timeNoon=ScoDocSiteConfig.get("assi_lunch_time", "13:00:00"),
)
@bp.route("/signale_evaluation_abs/<int:evaluation_id>/<int:etudid>") @bp.route("/signale_evaluation_abs/<int:evaluation_id>/<int:etudid>")