diff --git a/app/scodoc/html_sidebar.py b/app/scodoc/html_sidebar.py index 6d09becc2..3c8da9c31 100755 --- a/app/scodoc/html_sidebar.py +++ b/app/scodoc/html_sidebar.py @@ -127,8 +127,7 @@ def sidebar(etudid: int = None): H.append( f"""
  • Ajouter
  • -
  • Justifier
  • -
  • Supprimer
  • +
  • Justifier
  • """ ) if sco_preferences.get_preference("handle_billets_abs"): diff --git a/app/static/js/assiduites.js b/app/static/js/assiduites.js index 2bafa4cd7..7451b84c2 100644 --- a/app/static/js/assiduites.js +++ b/app/static/js/assiduites.js @@ -1536,22 +1536,12 @@ function justifyAssiduite(assiduite_id, justified) { return bool; } -function createJustificatif(justif) { +function createJustificatif(justif, success = () => {}) { const path = getUrl() + `/api/justificatif/${etudid}/create`; - sync_post( - path, - [justif], - (data, status) => { - //success - if (data.success.length > 0) { - console.table(data[0]); - } - }, - (data, status) => { - //error - console.error(data, status); - } - ); + sync_post(path, [justif], success, (data, status) => { + //error + console.error(data, status); + }); } function getAllJustificatifsFromEtud(etudid, action) { diff --git a/app/templates/assiduites/pages/ajout_justificatif.j2 b/app/templates/assiduites/pages/ajout_justificatif.j2 new file mode 100644 index 000000000..e10efcaf8 --- /dev/null +++ b/app/templates/assiduites/pages/ajout_justificatif.j2 @@ -0,0 +1,206 @@ +{% block pageContent %} + +
    +

    Justifier

    + {% include "assiduites/widgets/tableau_base.j2" %} +
    + + {% include "assiduites/widgets/tableau_justi.j2" %} +
    + +
    + +
    +
    + + +
    +
    +
    + Date de début + +
    +
    + Date de fin + +
    +
    + +
    +
    + Etat du justificatif + +
    +
    + +
    +
    + Raison + +
    +
    +
    +
    + +
    +
    + Importer un fichier + +
    +
    + + + +
    + +
    + +
    +
    + +
    + + + +{% endblock pageContent %} \ No newline at end of file diff --git a/app/templates/assiduites/pages/liste_assiduites.j2 b/app/templates/assiduites/pages/liste_assiduites.j2 index 87353a559..1e5943387 100644 --- a/app/templates/assiduites/pages/liste_assiduites.j2 +++ b/app/templates/assiduites/pages/liste_assiduites.j2 @@ -1,89 +1,14 @@ -{% include "assiduites/widgets/alert.j2" %} -{% include "assiduites/prompt.j2" %} {% block app_content %} -

    Liste de l'assiduité et des justificatifs de {{sco.etud.nomprenom}}

    - + {% include "assiduites/widgets/tableau_base.j2" %}

    Assiduités :

    - - - - - - - - - - - - -
    -
    - Début - -
    -
    -
    - Fin - -
    -
    -
    - État - -
    -
    -
    - Module - -
    -
    -
    - Justifiée - -
    -
    -
    -
    + {% include "assiduites/widgets/tableau_assi.j2" %}

    Justificatifs :

    - - - - - - - - - - - -
    -
    - Début - -
    -
    -
    - Fin - -
    -
    -
    - État - -
    -
    -
    - Raison - -
    -
    -
    -
    + {% include "assiduites/widgets/tableau_justi.j2" %}
    {% endblock app_content %} - - \ No newline at end of file diff --git a/app/templates/assiduites/widgets/tableau_base.j2 b/app/templates/assiduites/widgets/tableau_base.j2 new file mode 100644 index 000000000..9912a42ce --- /dev/null +++ b/app/templates/assiduites/widgets/tableau_base.j2 @@ -0,0 +1,724 @@ + + +{% include "assiduites/widgets/alert.j2" %} +{% include "assiduites/widgets/prompt.j2" %} + + + + \ No newline at end of file diff --git a/app/templates/assiduites/widgets/tableau_justi.j2 b/app/templates/assiduites/widgets/tableau_justi.j2 new file mode 100644 index 000000000..27dd12e2a --- /dev/null +++ b/app/templates/assiduites/widgets/tableau_justi.j2 @@ -0,0 +1,111 @@ + + + + + + + + + + + + +
    +
    + Début + +
    +
    +
    + Fin + +
    +
    +
    + État + +
    +
    +
    + Raison + +
    +
    +
    + Fichier + +
    +
    +
    +
    + + \ No newline at end of file diff --git a/app/templates/sidebar.j2 b/app/templates/sidebar.j2 index 19c2199ff..5db4039d3 100755 --- a/app/templates/sidebar.j2 +++ b/app/templates/sidebar.j2 @@ -62,10 +62,8 @@ {% if current_user.has_permission(sco.Permission.ScoAbsChange) %}
  • Ajouter
  • -
  • Justifier
  • -
  • Supprimer
  • {% if sco.prefs["handle_billets_abs"] %}
  • Billets
  • diff --git a/app/views/assiduites.py b/app/views/assiduites.py index e312f7f71..8efad887d 100644 --- a/app/views/assiduites.py +++ b/app/views/assiduites.py @@ -269,6 +269,47 @@ def liste_assiduites_etud(): ).build() +@bp.route("/AjoutJustificatifEtud") +@scodoc +@permission_required(Permission.ScoAbsChange) +def ajout_justificatif_etud(): + """ + ajout_justificatif_etud : Affichage et création/modification des justificatifs de l'étudiant + Args: + etudid (int): l'identifiant de l'étudiant + + Returns: + str: l'html généré + """ + + etudid = request.args.get("etudid", -1) + etud: Identite = Identite.query.get_or_404(etudid) + if etud.dept_id != g.scodoc_dept_id: + abort(404, "étudiant inexistant dans ce département") + + header: str = html_sco_header.sco_header( + page_title="Justificatifs", + init_qtip=True, + javascripts=[ + "js/assiduites.js", + "libjs/moment.new.min.js", + "libjs/moment-timezone.js", + ], + cssstyles=CSSSTYLES + + [ + "css/assiduites.css", + ], + ) + + return HTMLBuilder( + header, + render_template( + "assiduites/pages/ajout_justificatif.j2", + sco=ScoData(etud), + ), + ).build() + + @bp.route("/SignalAssiduiteGr") @scodoc @permission_required(Permission.ScoAbsChange) diff --git a/migrations/versions/c701224fa255_validation_niveaux_inferieurs.py b/migrations/versions/c701224fa255_validation_niveaux_inferieurs.py index 08f275091..148c010fe 100644 --- a/migrations/versions/c701224fa255_validation_niveaux_inferieurs.py +++ b/migrations/versions/c701224fa255_validation_niveaux_inferieurs.py @@ -11,7 +11,7 @@ from sqlalchemy.orm import sessionmaker # added by ev # revision identifiers, used by Alembic. revision = "c701224fa255" -down_revision = "d84bc592584e" +down_revision = "b555390780b2" branch_labels = None depends_on = None diff --git a/migrations/versions/dbcf2175e87f_modèles_assiduites_justificatifs.py b/migrations/versions/dbcf2175e87f_modèles_assiduites_justificatifs.py index 08514497d..d281add58 100755 --- a/migrations/versions/dbcf2175e87f_modèles_assiduites_justificatifs.py +++ b/migrations/versions/dbcf2175e87f_modèles_assiduites_justificatifs.py @@ -11,7 +11,7 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "dbcf2175e87f" -down_revision = "c701224fa255" +down_revision = "d84bc592584e" branch_labels = None depends_on = None