Edition elts Apo semestre et annee
This commit is contained in:
parent
98c3a7f740
commit
a52bd6e7fe
@ -237,6 +237,8 @@ def _sem_table_gt(sems, showcodes=False):
|
||||
"titre_resp",
|
||||
"nb_inscrits",
|
||||
"etapes_apo_str",
|
||||
"elt_annee_apo",
|
||||
"elt_sem_apo",
|
||||
)
|
||||
if showcodes:
|
||||
columns_ids = ("formsemestre_id",) + columns_ids
|
||||
@ -253,6 +255,9 @@ def _sem_table_gt(sems, showcodes=False):
|
||||
"dash_mois_fin": "Année",
|
||||
"titre_resp": "Semestre",
|
||||
"nb_inscrits": "N",
|
||||
"etapes_apo_str": "Étape Apo.",
|
||||
"elt_annee_apo": "Elt. année Apo.",
|
||||
"elt_sem_apo": "Elt. sem. Apo.",
|
||||
},
|
||||
columns_ids=columns_ids,
|
||||
rows=sems,
|
||||
@ -260,7 +265,11 @@ def _sem_table_gt(sems, showcodes=False):
|
||||
html_class_ignore_default=True,
|
||||
html_class=html_class,
|
||||
html_sortable=True,
|
||||
html_table_attrs=f"""data-apo_save_url="{url_for('notes.formsemestre_set_apo_etapes', scodoc_dept=g.scodoc_dept)}" """,
|
||||
html_table_attrs=f"""
|
||||
data-apo_save_url="{url_for('notes.formsemestre_set_apo_etapes', scodoc_dept=g.scodoc_dept)}"
|
||||
data-elt_annee_apo_save_url="{url_for('notes.formsemestre_set_elt_annee_apo', scodoc_dept=g.scodoc_dept)}"
|
||||
data-elt_sem_apo_save_url="{url_for('notes.formsemestre_set_elt_sem_apo', scodoc_dept=g.scodoc_dept)}"
|
||||
""",
|
||||
html_with_td_classes=True,
|
||||
preferences=sco_preferences.SemPreferences(),
|
||||
)
|
||||
@ -298,6 +307,12 @@ def _style_sems(sems):
|
||||
sem[
|
||||
"_etapes_apo_str_td_attrs"
|
||||
] = f""" data-oid="{sem['formsemestre_id']}" data-value="{sem['etapes_apo_str']}" """
|
||||
sem[
|
||||
"_elt_annee_apo_td_attrs"
|
||||
] = f""" data-oid="{sem['formsemestre_id']}" data-value="{sem['elt_annee_apo']}" """
|
||||
sem[
|
||||
"_elt_sem_apo_td_attrs"
|
||||
] = f""" data-oid="{sem['formsemestre_id']}" data-value="{sem['elt_sem_apo']}" """
|
||||
|
||||
|
||||
def delete_dept(dept_id: int):
|
||||
|
@ -70,7 +70,7 @@ def formation_table_recap(formation_id, format="html"):
|
||||
"_apo_td_attrs": f""" data-oid="{ue.id}" data-value="{ue.code_apogee or ''}" """,
|
||||
"coef": ue.coefficient or "",
|
||||
"ects": ue.ects,
|
||||
"_css_row_class": f"ue ue_",
|
||||
"_css_row_class": "ue",
|
||||
}
|
||||
)
|
||||
li += 1
|
||||
|
@ -1,5 +1,7 @@
|
||||
/* Page accueil département */
|
||||
var apo_editor = null;
|
||||
var elt_annee_apo_editor = null;
|
||||
var elt_sem_apo_editor = null;
|
||||
|
||||
$(document).ready(function () {
|
||||
var table_options = {
|
||||
@ -17,8 +19,14 @@ $(document).ready(function () {
|
||||
$('table.semlist').DataTable(table_options);
|
||||
let table_editable = document.querySelector("table#semlist.apo_editable");
|
||||
if (table_editable) {
|
||||
let apo_save_url = document.querySelector("table#semlist.apo_editable").dataset.apo_save_url;
|
||||
apo_editor = new ScoFieldEditor(".etapes_apo_str", apo_save_url, false);
|
||||
let save_url = document.querySelector("table#semlist.apo_editable").dataset.apo_save_url;
|
||||
apo_editor = new ScoFieldEditor(".etapes_apo_str", save_url, false);
|
||||
|
||||
save_url = document.querySelector("table#semlist.apo_editable").dataset.elt_annee_apo_save_url;
|
||||
elt_annee_apo_editor = new ScoFieldEditor(".elt_annee_apo", save_url, false);
|
||||
|
||||
save_url = document.querySelector("table#semlist.apo_editable").dataset.elt_sem_apo_save_url;
|
||||
elt_sem_apo_editor = new ScoFieldEditor(".elt_sem_apo", save_url, false);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -2463,6 +2463,48 @@ def formsemestre_set_apo_etapes():
|
||||
return ("", 204)
|
||||
|
||||
|
||||
@bp.route("/formsemestre_set_elt_annee_apo", methods=["POST"])
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEditApo)
|
||||
def formsemestre_set_elt_annee_apo():
|
||||
"""Change les codes étapes du semestre indiqué.
|
||||
Args: oid=formsemestre_id, value=chaine "V3ONM, V3ONM1, V3ONM2", codes séparés par des virgules
|
||||
"""
|
||||
oid = int(request.form.get("oid"))
|
||||
value = (request.form.get("value") or "").strip()
|
||||
formsemestre: FormSemestre = FormSemestre.query.get_or_404(oid)
|
||||
if value != formsemestre.elt_annee_apo:
|
||||
formsemestre.elt_annee_apo = value
|
||||
db.session.add(formsemestre)
|
||||
db.session.commit()
|
||||
ScolarNews.add(
|
||||
typ=ScolarNews.NEWS_APO,
|
||||
text=f"Modification code Apogée du semestre {formsemestre.titre_annee()})",
|
||||
)
|
||||
return ("", 204)
|
||||
|
||||
|
||||
@bp.route("/formsemestre_set_elt_sem_apo", methods=["POST"])
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEditApo)
|
||||
def formsemestre_set_elt_sem_apo():
|
||||
"""Change les codes étapes du semestre indiqué.
|
||||
Args: oid=formsemestre_id, value=chaine "V3ONM, V3ONM1, V3ONM2", codes séparés par des virgules
|
||||
"""
|
||||
oid = int(request.form.get("oid"))
|
||||
value = (request.form.get("value") or "").strip()
|
||||
formsemestre: FormSemestre = FormSemestre.query.get_or_404(oid)
|
||||
if value != formsemestre.elt_sem_apo:
|
||||
formsemestre.elt_sem_apo = value
|
||||
db.session.add(formsemestre)
|
||||
db.session.commit()
|
||||
ScolarNews.add(
|
||||
typ=ScolarNews.NEWS_APO,
|
||||
text=f"Modification code Apogée du semestre {formsemestre.titre_annee()})",
|
||||
)
|
||||
return ("", 204)
|
||||
|
||||
|
||||
@bp.route("/ue_set_apo", methods=["POST"])
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEditApo)
|
||||
|
Loading…
Reference in New Issue
Block a user