ScoDoc/app/templates/scolar/formulaire_feuille_appel.j2

79 lines
2.0 KiB
Django/Jinja

{% extends "sco_page.j2" %}
{% import 'wtf.j2' as wtf %}
{% block styles %}
{{super()}}
<link rel="stylesheet" href="{{scu.STATIC_DIR}}/libjs/bootstrap/css/bootstrap.min.css">
<style>
div{
margin-bottom: 8px;
}
</style>
{% endblock %}
{% block app_content %}
<h2>Préparation de la feuille d'émargement : <span style="color:crimson">{{group_name}}</span></h2>
<div class="scobox">
<form
id="feuille_emargement"
action="{{request.base_url}}"
method="post"
onsubmit="serializeGroupIds(event)"
>
{{ form.hidden_tag() }}
<div class="infos-button">Groupes&nbsp;: {{grp|safe}}</div>
<div class="part">
{{ form.discipline.label }}
{{ form.discipline() }}
</div>
<div class="part">
{{ form.ens.label }}
{{ form.ens() }}
</div>
<div class="part">
{{ form.date.label }}
{{ form.date() }}
</div>
<div class="part">
{{ form.heure.label }}
{{ form.heure() }}
</div>
{{form.submit()}}
</form>
</div>
{% 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>
<script>
function serializeGroupIds(event) {
// Dealing with multiselect
event.preventDefault();
var form = document.getElementById("feuille_emargement");
var groupIdsField = form.elements["group_ids"];
// Check if the group_ids field exists and is an array
if (groupIdsField && Array.isArray(groupIdsField.value)) {
// Convert the array to a comma-separated string
var serializedValue = groupIdsField.value.join(',');
// Replace the field's value with the serialized string
groupIdsField.value = serializedValue;
}
// Now submit the form
form.submit();
}
</script>
{% endblock scripts %}