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(
|
+ render_template(
|
||||||
"scodoc/help/evaluations.j2", is_apc=is_apc, modimpl=modimpl
|
"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)
|
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:
|
else:
|
||||||
# form submission
|
# création d'une evaluation
|
||||||
args = tf[2]
|
evaluation = Evaluation.create(moduleimpl=modimpl, **args)
|
||||||
# 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}"])
|
|
||||||
db.session.add(evaluation)
|
db.session.add(evaluation)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
sco_cache.invalidate_formsemestre(evaluation.moduleimpl.formsemestre.id)
|
evaluation_id = evaluation.id
|
||||||
return flask.redirect(dest_url)
|
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 %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
||||||
{% include "sco_timepicker.j2" %}
|
|
||||||
{% endblock scripts %}
|
{% endblock scripts %}
|
||||||
|
@ -191,7 +191,6 @@ div.submit > input {
|
|||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
||||||
{% include "sco_timepicker.j2" %}
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
// On récupère les boutons de suppression de fichiers
|
// On récupère les boutons de suppression de fichiers
|
||||||
|
@ -151,7 +151,7 @@
|
|||||||
{{ form.submit }} {{ form.cancel }}
|
{{ form.submit }} {{ form.cancel }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<div class="info-row">
|
<div class="info-row">
|
||||||
<a
|
<a
|
||||||
@ -176,5 +176,4 @@
|
|||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
||||||
{% include "sco_timepicker.j2" %}
|
|
||||||
{% endblock scripts %}
|
{% endblock scripts %}
|
@ -12,7 +12,6 @@
|
|||||||
<script src="{{scu.STATIC_DIR}}/js/groups_view.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/date_utils.js"></script>
|
||||||
<script src="{{scu.STATIC_DIR}}/js/assiduites.js"></script>
|
<script src="{{scu.STATIC_DIR}}/js/assiduites.js"></script>
|
||||||
{% include "sco_timepicker.j2" %}
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
th {
|
th {
|
||||||
z-index: 1;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.premier th {
|
.premier th {
|
||||||
@ -205,7 +205,6 @@
|
|||||||
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
<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/assiduites.js"></script>
|
||||||
<script src="{{scu.STATIC_DIR}}/js/date_utils.js"></script>
|
<script src="{{scu.STATIC_DIR}}/js/date_utils.js"></script>
|
||||||
{% include "sco_timepicker.j2" %}
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -369,7 +368,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
html += `<li>
|
html += `<li>
|
||||||
<a
|
<a
|
||||||
href="edit_assiduite_etud/${a.assiduite_id}"
|
href="edit_assiduite_etud/${a.assiduite_id}"
|
||||||
title="Cliquez pour voir/éditer l'assiduité"
|
title="Cliquez pour voir/éditer l'assiduité"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
@ -860,7 +859,7 @@ document.addEventListener("DOMContentLoaded", ()=>{
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -103,6 +103,8 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{% include "sco_timepicker.j2" %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% macro render_field_errors(form, field_name) %}
|
{% macro render_field_errors(form, field_name) %}
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
{% endblock app_content %}
|
{% endblock app_content %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{super()}}
|
{{super()}}
|
||||||
{% include "sco_timepicker.j2" %}
|
|
||||||
<script src="{{scu.STATIC_DIR}}/js/groups_view.js"></script>
|
<script src="{{scu.STATIC_DIR}}/js/groups_view.js"></script>
|
||||||
<script src="{{scu.STATIC_DIR}}/libjs/purl.js"></script>
|
<script src="{{scu.STATIC_DIR}}/libjs/purl.js"></script>
|
||||||
{% endblock scripts %}
|
{% endblock scripts %}
|
||||||
|
Loading…
Reference in New Issue
Block a user