{% extends 'layout/backEndLayout.html.twig' %}
{% block content %}
<div class="row mt-4">
<div class="col-1">
<a class="btn btn-info" href="{{ path('admin_students_new') }}">
<i class="fa fa-plus"></i>
</a>
</div>
<div class="col-11 jumbotron">
<div class="m-1 box-shadow">
<div class="card-header row">
<div class="form-check d-inline-block col-3">
<input class="form-check-input" type="radio" value="new_students_not_yet_registered_checkbox" name="list_type" id="new_students_not_yet_registered_checkbox">
<label class="form-check-label" for="check1">
<h4 class="my-0 font-weight-normal text-left text-justify text-uppercase">
Liste des nouveaux eleves non encore inscrits
</h4>
</label>
</div>
<div class="form-check d-inline-block col-3">
<input class="form-check-input" type="radio" value="new_registered_students_checkbox" name="list_type" id="new_registered_students_checkbox">
<label class="form-check-label" for="check2">
<h4 class="my-0 font-weight-normal text-center text-justify text-uppercase">
Liste des nouveaux eleves inscrits
</h4>
</label>
</div>
<div class="form-check d-inline-block col-3">
<input class="form-check-input" type="radio" value="registered_former_students_checkbox" name="list_type" id="registered_former_students_checkbox">
<label class="form-check-label" for="check3">
<h4 class="my-0 font-weight-normal text-center tex t-justify text-uppercase">
Liste des anciens eleves inscrits
</h4>
</label>
</div>
<div class="form-check d-inline-block col-3">
<input class="form-check-input" type="radio" value="complete_registered_students_checkbox" name="list_type" id="complete_registered_students_checkbox">
<label class="form-check-label" for="check4">
<h4 class="my-0 font-weight-normal text-right text-justify text-uppercase">
Liste complete des eleves inscrits
</h4>
</label
</div>
</div>
<table width="100%" class="table table-striped">
<thead>
<tr>
<th style="width:10%;" scope="col">
Matricule/Id
</th>
<th style="width:15%;" scope="col">
Nom
</th>
<th style="width:10%;" scope="col">
Prénom
</th>
<th style="width:5%;" scope="col">
Sexe
</th>
<th style="width:10%;" scope="col">
Date de naissance
</th>
<th style="width:10%;" scope="col">
Lieu de naissance
</th>
<th style="width:10%;" scope="col">
RĂ©sidence
</th>
<th style="width:5%;" scope="col">
Inscription
</th>
<th style="width:15%;" scope="col">
Action
</th>
</tr>
</thead>
<tbody>
{% for user in students %}
<tr>
<td>
<a href="{{ path('admin_students_show', {id: user.id}) }}">
{% if user.matricule %}
{{ user.matricule }}
{% else %}
{{ user.id }}
{% endif %}
</a>
</td>
<td>
{{ user.lastName }}
</td>
<td>
{{ user.firstName }}
</td>
<td>
{% if user.gender == 0 %}
M
{% else %}
F
{% endif %}
</td>
<td>
{% if user.birthday %}
{{ user.birthday|date('Y-m-d') }}
{% endif %}
</td>
<td>
{{ user.birthplace }}
</td>
<td>
{{ user.residence }}
</td>
<td>
{% if user.enrolled %}
Inscrit
{% endif %}
</td>
<td>
<div class="btn-group">
<a class="btn btn-warning " href="{{ path('admin_students_edit', {id: user.id}) }}">
<i class="fa fa-edit"></i>
</a>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
{% block javascripts %}
{{parent()}}
<script type="text/javascript">
/*var newStudentsNotYetRegisteredCb = document.getElementById("new_students_not_yet_registered_checkbox");
var newRegisteredStudentsCb = document.getElementById("new_registered_students_checkbox");
var registeredFormerStudentsCb = document.getElementById("registered_former_students_checkbox");
var completeRegisteredStudentsCb = document.getElementById("complete_registered_students_checkbox");*/
$(document).ready(function() {
$('input[type="radio"]').on('change', function() {
const selectedValue = $('input[name="list_type"]:checked').val();
const url = '{{ path('admin_students', { 'type': 'PLACEHOLDER' }) }}'.replace('PLACEHOLDER', selectedValue);
$.ajax({
type: "GET",
url: url,
datatype: "json",
success: function (data) {
window.location.href = url;
console.log(selectedValue);
},
error: function (e) {
console.log(e.message);
}
});
});
});
</script>
{% endblock javascripts %}