forked from ScoDoc/ScoDoc
Timepicker sur toutes les pages.
This commit is contained in:
parent
9e7b169998
commit
0b5b0f8079
@ -375,65 +375,64 @@ def evaluation_create_form(
|
||||
+ render_template(
|
||||
"scodoc/help/evaluations.j2", is_apc=is_apc, modimpl=modimpl
|
||||
)
|
||||
+ render_template("sco_timepicker.j2")
|
||||
),
|
||||
)
|
||||
elif tf[0] == -1:
|
||||
if tf[0] == -1:
|
||||
return flask.redirect(dest_url)
|
||||
|
||||
# form submission
|
||||
args = tf[2]
|
||||
# modifie le codage des dates
|
||||
# (nb: ce formulaire ne permet de créer que des évaluation sur la même journée)
|
||||
date_debut = scu.convert_fr_date(args["jour"]) if args.get("jour") else None
|
||||
args["date_debut"] = date_debut
|
||||
args["date_fin"] = date_debut # même jour
|
||||
args.pop("jour", None)
|
||||
if date_debut and args.get("heure_debut"):
|
||||
try:
|
||||
heure_debut = heure_to_time(args["heure_debut"])
|
||||
except ValueError as exc:
|
||||
raise ScoValueError("Heure début invalide") from exc
|
||||
args["date_debut"] = datetime.datetime.combine(date_debut, heure_debut)
|
||||
args.pop("heure_debut", None)
|
||||
# note: ce formulaire ne permet de créer que des évaluations
|
||||
# avec debut et fin sur le même jour.
|
||||
if date_debut and args.get("heure_fin"):
|
||||
try:
|
||||
heure_fin = heure_to_time(args["heure_fin"])
|
||||
except ValueError as exc:
|
||||
raise ScoValueError("Heure fin invalide") from exc
|
||||
args["date_fin"] = datetime.datetime.combine(date_debut, heure_fin)
|
||||
args.pop("heure_fin", None)
|
||||
# Blocage:
|
||||
if args.get("blocked"):
|
||||
if args.get("blocked_until"):
|
||||
try:
|
||||
args["blocked_until"] = datetime.datetime.strptime(
|
||||
args["blocked_until"], scu.DATE_FMT
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise ScoValueError("Date déblocage (j/m/a) invalide") from exc
|
||||
else: # bloquage coché sans date
|
||||
args["blocked_until"] = Evaluation.BLOCKED_FOREVER
|
||||
else: # si pas coché, efface date déblocage
|
||||
args["blocked_until"] = None
|
||||
#
|
||||
if edit:
|
||||
check_and_convert_evaluation_args(args, modimpl)
|
||||
evaluation.from_dict(args)
|
||||
else:
|
||||
# form submission
|
||||
args = tf[2]
|
||||
# modifie le codage des dates
|
||||
# (nb: ce formulaire ne permet de créer que des évaluation sur la même journée)
|
||||
date_debut = scu.convert_fr_date(args["jour"]) if args.get("jour") else None
|
||||
args["date_debut"] = date_debut
|
||||
args["date_fin"] = date_debut # même jour
|
||||
args.pop("jour", None)
|
||||
if date_debut and args.get("heure_debut"):
|
||||
try:
|
||||
heure_debut = heure_to_time(args["heure_debut"])
|
||||
except ValueError as exc:
|
||||
raise ScoValueError("Heure début invalide") from exc
|
||||
args["date_debut"] = datetime.datetime.combine(date_debut, heure_debut)
|
||||
args.pop("heure_debut", None)
|
||||
# note: ce formulaire ne permet de créer que des évaluations
|
||||
# avec debut et fin sur le même jour.
|
||||
if date_debut and args.get("heure_fin"):
|
||||
try:
|
||||
heure_fin = heure_to_time(args["heure_fin"])
|
||||
except ValueError as exc:
|
||||
raise ScoValueError("Heure fin invalide") from exc
|
||||
args["date_fin"] = datetime.datetime.combine(date_debut, heure_fin)
|
||||
args.pop("heure_fin", None)
|
||||
# Blocage:
|
||||
if args.get("blocked"):
|
||||
if args.get("blocked_until"):
|
||||
try:
|
||||
args["blocked_until"] = datetime.datetime.strptime(
|
||||
args["blocked_until"], scu.DATE_FMT
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise ScoValueError("Date déblocage (j/m/a) invalide") from exc
|
||||
else: # bloquage coché sans date
|
||||
args["blocked_until"] = Evaluation.BLOCKED_FOREVER
|
||||
else: # si pas coché, efface date déblocage
|
||||
args["blocked_until"] = None
|
||||
#
|
||||
if edit:
|
||||
check_and_convert_evaluation_args(args, modimpl)
|
||||
evaluation.from_dict(args)
|
||||
else:
|
||||
# création d'une evaluation
|
||||
evaluation = Evaluation.create(moduleimpl=modimpl, **args)
|
||||
db.session.add(evaluation)
|
||||
db.session.commit()
|
||||
evaluation_id = evaluation.id
|
||||
if is_apc:
|
||||
# Set poids
|
||||
evaluation = db.session.get(Evaluation, evaluation_id)
|
||||
for ue in sem_ues:
|
||||
evaluation.set_ue_poids(ue, tf[2][f"poids_{ue.id}"])
|
||||
# création d'une evaluation
|
||||
evaluation = Evaluation.create(moduleimpl=modimpl, **args)
|
||||
db.session.add(evaluation)
|
||||
db.session.commit()
|
||||
sco_cache.invalidate_formsemestre(evaluation.moduleimpl.formsemestre.id)
|
||||
return flask.redirect(dest_url)
|
||||
evaluation_id = evaluation.id
|
||||
if is_apc:
|
||||
# Set poids
|
||||
evaluation = db.session.get(Evaluation, evaluation_id)
|
||||
for ue in sem_ues:
|
||||
evaluation.set_ue_poids(ue, tf[2][f"poids_{ue.id}"])
|
||||
db.session.add(evaluation)
|
||||
db.session.commit()
|
||||
sco_cache.invalidate_formsemestre(evaluation.moduleimpl.formsemestre.id)
|
||||
return flask.redirect(dest_url)
|
||||
|
@ -121,5 +121,4 @@ div.submit > input {
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
||||
{% include "sco_timepicker.j2" %}
|
||||
{% endblock scripts %}
|
||||
|
@ -191,7 +191,6 @@ div.submit > input {
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
||||
{% include "sco_timepicker.j2" %}
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
// On récupère les boutons de suppression de fichiers
|
||||
|
@ -176,5 +176,4 @@
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
||||
{% include "sco_timepicker.j2" %}
|
||||
{% endblock scripts %}
|
@ -12,7 +12,6 @@
|
||||
<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>
|
||||
{% include "sco_timepicker.j2" %}
|
||||
|
||||
<script>
|
||||
|
||||
|
@ -75,7 +75,7 @@
|
||||
}
|
||||
|
||||
th {
|
||||
z-index: 1;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.premier th {
|
||||
@ -205,7 +205,6 @@
|
||||
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
||||
<script src="{{scu.STATIC_DIR}}/js/assiduites.js"></script>
|
||||
<script src="{{scu.STATIC_DIR}}/js/date_utils.js"></script>
|
||||
{% include "sco_timepicker.j2" %}
|
||||
|
||||
|
||||
<script>
|
||||
|
@ -103,6 +103,8 @@
|
||||
|
||||
</script>
|
||||
|
||||
{% include "sco_timepicker.j2" %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% macro render_field_errors(form, field_name) %}
|
||||
|
@ -51,7 +51,6 @@
|
||||
{% endblock app_content %}
|
||||
{% block scripts %}
|
||||
{{super()}}
|
||||
{% include "sco_timepicker.j2" %}
|
||||
<script src="{{scu.STATIC_DIR}}/js/groups_view.js"></script>
|
||||
<script src="{{scu.STATIC_DIR}}/libjs/purl.js"></script>
|
||||
{% endblock scripts %}
|
||||
|
Loading…
Reference in New Issue
Block a user