2023-12-22 15:31:30 +01:00
|
|
|
{# Formulaire ajout ou modification de justificatif
|
|
|
|
Si justif, edit #}
|
2024-09-02 10:35:24 +02:00
|
|
|
{% extends "sco_page_dept.j2" %}
|
2023-12-12 03:05:31 +01:00
|
|
|
{% import 'wtf.j2' as wtf %}
|
|
|
|
|
|
|
|
{% block styles %}
|
|
|
|
{{super()}}
|
|
|
|
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/css/assiduites.css">
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
|
|
|
|
{% block app_content %}
|
|
|
|
<style>
|
|
|
|
form#ajout-justificatif-etud {
|
|
|
|
margin-bottom: 24px;
|
|
|
|
}
|
|
|
|
form#ajout-justificatif-etud > div {
|
|
|
|
margin-bottom: 16px;
|
|
|
|
}
|
2024-01-21 18:07:56 +01:00
|
|
|
fieldset > div {
|
|
|
|
margin-bottom: 12px;
|
|
|
|
}
|
2023-12-22 15:59:24 +01:00
|
|
|
div.fichiers {
|
|
|
|
margin-top: 16px;
|
|
|
|
margin-bottom: 32px;
|
|
|
|
}
|
|
|
|
div.fichiers ul {
|
|
|
|
list-style-type: none;
|
|
|
|
}
|
|
|
|
span.suppr_fichier_just {
|
|
|
|
margin-right: 8px;
|
|
|
|
}
|
2023-12-12 03:05:31 +01:00
|
|
|
div.submit {
|
|
|
|
margin-top: 12px;
|
|
|
|
}
|
|
|
|
div.submit > input {
|
|
|
|
margin-right: 16px;
|
|
|
|
}
|
2024-01-21 18:07:56 +01:00
|
|
|
.info-saisie {
|
|
|
|
margin-top: 12px;
|
|
|
|
margin-bottom: 12px;
|
|
|
|
font-style: italic;
|
|
|
|
}
|
2023-12-12 03:05:31 +01:00
|
|
|
</style>
|
|
|
|
<div class="tab-content">
|
2024-01-21 18:07:56 +01:00
|
|
|
<h2>{{title|safe}}</h2>
|
2024-06-03 15:50:35 +02:00
|
|
|
{% if readonly %}
|
|
|
|
<h3 class="rouge">Vous n'avez pas la permission de modifier ce justificatif</h3>
|
|
|
|
{% endif %}
|
2024-01-21 18:07:56 +01:00
|
|
|
{% if justif %}
|
2024-06-03 15:50:35 +02:00
|
|
|
<div class="informations">
|
2024-09-02 10:35:24 +02:00
|
|
|
|
2024-01-21 18:07:56 +01:00
|
|
|
<div class="info-saisie">
|
2024-06-03 15:50:35 +02:00
|
|
|
<span>Saisie par {{justif.saisie_par}} le {{justif.entry_date}}</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="info-row">
|
|
|
|
<span class="info-label">Assiduités concernées: </span>
|
|
|
|
{% if justif.justification.assiduites %}
|
|
|
|
<ul>
|
|
|
|
{% for assi in justif.justification.assiduites %}
|
|
|
|
<li><a href="{{url_for('assiduites.edit_assiduite_etud',
|
|
|
|
assiduite_id=assi.assiduite_id, scodoc_dept=g.scodoc_dept)
|
|
|
|
}}" target="_blank">{{assi.etat}} du {{assi.date_debut}} au
|
|
|
|
{{assi.date_fin}}</a>
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
{% else %}
|
|
|
|
<span class="text">Aucune</span>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2024-09-02 10:35:24 +02:00
|
|
|
|
2024-01-21 18:07:56 +01:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
2023-12-12 03:05:31 +01:00
|
|
|
|
|
|
|
<section class="justi-form page">
|
|
|
|
|
2023-12-14 20:50:27 +01:00
|
|
|
{% for err_msg in form.error_messages %}
|
|
|
|
<div class="wtf-error-messages">
|
|
|
|
{{ err_msg }}
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
|
2023-12-16 22:53:02 +01:00
|
|
|
<form id="ajout-justificatif-etud" method="post" enctype="multipart/form-data">
|
2023-12-12 03:05:31 +01:00
|
|
|
<fieldset>
|
|
|
|
{{ form.hidden_tag() }}
|
|
|
|
{# Dates et heures #}
|
|
|
|
<div class="dates-heures">
|
|
|
|
{{ form.date_debut.label }} : {{ form.date_debut }}
|
|
|
|
de {{ form.heure_debut }} à {{ form.heure_fin }}
|
|
|
|
<span class="help">laisser les heures vides pour indiquer la journée entière</span>
|
|
|
|
{{ render_field_errors(form, 'date_debut') }}
|
|
|
|
{{ render_field_errors(form, 'heure_debut') }}
|
|
|
|
{{ render_field_errors(form, 'heure_fin') }}
|
|
|
|
|
|
|
|
<div>
|
|
|
|
{{ form.date_fin.label }} : {{ form.date_fin }}
|
|
|
|
{{ render_field_errors(form, 'date_fin') }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{# Etat #}
|
|
|
|
<div>
|
|
|
|
<div>{{ form.etat.label }}</div>
|
|
|
|
{{ form.etat() }}
|
|
|
|
{{ render_field_errors(form, 'etat') }}
|
|
|
|
</div>
|
|
|
|
{# Raison #}
|
2024-08-20 15:04:09 +02:00
|
|
|
<div class="raison">
|
2024-01-21 18:07:56 +01:00
|
|
|
{% if (not justif) or can_view_justif_detail %}
|
|
|
|
<div>{{ form.raison.label }}</div>
|
|
|
|
{{ form.raison() }}
|
|
|
|
{{ render_field_errors(form, 'raison') }}
|
|
|
|
<div class="help">La raison sera visible aux utilisateurs ayant le droit
|
|
|
|
<tt>AbsJustifView</tt> et à celui ayant déposé le justificatif
|
2024-01-31 14:27:08 +01:00
|
|
|
{%- if justif and justif.user %} (<b>{{justif.user.get_prenomnom()}}</b>){%- endif -%}.
|
2024-01-21 18:07:56 +01:00
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<div class="unauthorized">raison confidentielle</div>
|
|
|
|
{% endif %}
|
2023-12-12 03:05:31 +01:00
|
|
|
</div>
|
2023-12-22 15:59:24 +01:00
|
|
|
<div class="fichiers">
|
|
|
|
{# Liste des fichiers existants #}
|
|
|
|
{% if justif and nb_files > 0 %}
|
|
|
|
<div><b>{{nb_files}} fichiers justificatifs déposés
|
|
|
|
{% if filenames|length < nb_files %}
|
2024-01-21 18:07:56 +01:00
|
|
|
, dont {{filenames|length}} vous {{'sont accessibles' if filenames|length > 1 else 'est accessible'}}
|
2023-12-22 15:59:24 +01:00
|
|
|
{% endif %}
|
|
|
|
</b>
|
|
|
|
</div>
|
2023-12-22 15:31:30 +01:00
|
|
|
<ul>
|
|
|
|
{% for filename in filenames %}
|
2024-06-10 13:23:15 +02:00
|
|
|
<li><span data-justif_id="{{justif.id}}" data-filename="{{filename}}" class="suppr_fichier_just"
|
2023-12-22 15:31:30 +01:00
|
|
|
>{{scu.icontag("delete_img", alt="supprimer", title="Supprimer")|safe}}</span>
|
2024-06-03 15:50:35 +02:00
|
|
|
<a href="{{url_for('apiweb.justif_export',justif_id=justif.justif_id,
|
|
|
|
filename=filename, scodoc_dept=g.scodoc_dept)}}">{{filename}}</a>
|
|
|
|
</li>
|
2023-12-22 15:31:30 +01:00
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
2023-12-22 15:59:24 +01:00
|
|
|
{% endif %}
|
|
|
|
{# Ajout fichier(s) justificatif(s) #}
|
|
|
|
<div>
|
|
|
|
<div>{{ form.fichiers.label }}</div>
|
|
|
|
{{ form.fichiers() }}
|
|
|
|
{{ render_field_errors(form, 'fichiers') }}
|
|
|
|
</div>
|
2023-12-12 03:05:31 +01:00
|
|
|
</div>
|
2024-01-30 11:47:57 +01:00
|
|
|
{# Date dépôt #}
|
|
|
|
{{ form.entry_date.label }} : {{ form.entry_date }} à {{ form.entry_time }}
|
|
|
|
<span class="help" style="margin-left: 12px;">laisser vide pour date courante</span>
|
2023-12-12 03:05:31 +01:00
|
|
|
{{ render_field_errors(form, 'entry_date') }}
|
2024-01-21 18:07:56 +01:00
|
|
|
|
2024-06-05 09:27:18 +02:00
|
|
|
{% if not readonly %}
|
2023-12-12 03:05:31 +01:00
|
|
|
{# Submit #}
|
|
|
|
<div class="submit">
|
|
|
|
{{ form.submit }} {{ form.cancel }}
|
|
|
|
</div>
|
|
|
|
|
2024-06-05 09:27:18 +02:00
|
|
|
{% if justif %}
|
2024-06-03 15:50:35 +02:00
|
|
|
<div class="info-row">
|
|
|
|
<a
|
|
|
|
style="color:red;"
|
|
|
|
href="{{url_for(
|
|
|
|
'assiduites.tableau_assiduite_actions',
|
|
|
|
type='justificatif',
|
|
|
|
action='supprimer',
|
|
|
|
obj_id=justif.justif_id,
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
)}}"
|
|
|
|
>Supprimer le justificatif</a>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2024-06-05 09:27:18 +02:00
|
|
|
{% endif %}
|
2024-06-03 15:50:35 +02:00
|
|
|
|
2024-09-02 10:35:24 +02:00
|
|
|
|
2024-06-03 15:50:35 +02:00
|
|
|
|
2023-12-12 03:05:31 +01:00
|
|
|
</fieldset>
|
|
|
|
</form>
|
|
|
|
</section>
|
2023-12-22 15:31:30 +01:00
|
|
|
{% if tableau %}
|
2024-03-20 18:13:19 +01:00
|
|
|
<div class="scobox assi-liste">
|
2023-12-12 03:05:31 +01:00
|
|
|
{{tableau | safe }}
|
2024-03-20 18:13:19 +01:00
|
|
|
</div>
|
2023-12-22 15:31:30 +01:00
|
|
|
{% endif %}
|
2023-12-12 03:05:31 +01:00
|
|
|
</div>
|
|
|
|
|
2023-12-23 13:53:02 +01:00
|
|
|
{% include "assiduites/explication_etats_justifs.j2" %}
|
|
|
|
|
2023-12-12 03:05:31 +01:00
|
|
|
{% endblock app_content %}
|
|
|
|
|
|
|
|
{% block scripts %}
|
|
|
|
{{ super() }}
|
|
|
|
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
|
2024-01-16 12:36:20 +01:00
|
|
|
{% include "sco_timepicker.j2" %}
|
2023-12-22 15:31:30 +01:00
|
|
|
<script>
|
|
|
|
document.addEventListener("DOMContentLoaded", function() {
|
2024-06-10 13:23:15 +02:00
|
|
|
// On récupère les boutons de suppression de fichiers
|
|
|
|
const deleteButtons = document.querySelectorAll('.suppr_fichier_just');
|
|
|
|
// On récupère le formulaire
|
2024-03-01 16:35:39 +01:00
|
|
|
const form = document.getElementById('ajout-justificatif-etud');
|
2024-06-10 13:23:15 +02:00
|
|
|
// Pour chaque bouton, on ajoute une fonction de suppression
|
|
|
|
deleteButtons.forEach((btn)=>{
|
|
|
|
// Quand le bouton est cliqué, on récupère les infos
|
|
|
|
// et on ajoute un input hidden au formulaire
|
|
|
|
// et enfin on supprime l'élement <li> du DOM.
|
|
|
|
btn.addEventListener("click",()=>{
|
|
|
|
const filename = btn.getAttribute('data-filename');
|
|
|
|
const justif_id = btn.getAttribute('data-justif_id');
|
|
|
|
|
|
|
|
const input = document.createElement('input');
|
2024-03-01 16:35:39 +01:00
|
|
|
input.type = 'hidden';
|
|
|
|
input.name = 'suppr_fichier_just';
|
2024-06-10 13:23:15 +02:00
|
|
|
input.value = filename;
|
2024-03-01 16:35:39 +01:00
|
|
|
form.appendChild(input);
|
|
|
|
|
2024-06-10 13:23:15 +02:00
|
|
|
btn.parentNode.remove();
|
|
|
|
})
|
|
|
|
})
|
2023-12-22 15:31:30 +01:00
|
|
|
});
|
|
|
|
</script>
|
2023-12-12 03:05:31 +01:00
|
|
|
{% endblock scripts %}
|