{% extends 'layout/backEndLayout.html.twig' %}
{% form_theme searchForm 'bootstrap_4_layout.html.twig' %}
{% block content %}
<div class="row mt-2">
<div class="col-1 jumbotron mb-2" >
<a class="btn btn-info" href="{{ path('admin_evaluations_new') }}">
<i class="fa fa-plus"></i>
</a>
</div>
<div class="col-11 jumbotron mb-2" >
{{form_start(searchForm)}}
<div class="form-row row">
<div class="col-md-3">
{{form_row(searchForm.room)}}
</div>
<div class="col-md-3">
{{form_row(searchForm.sequence)}}
</div>
<div class="col-md-3">
{{form_row(searchForm.course)}}
</div>
<div class="col-md-3">
<button class="btn btn-primary" type="submit">
<b>Rechercher</b>
</button>
</div>
</div>
{{form_end(searchForm)}}
</div>
<div class="col-12 jumbotron" >
<div class="m-1 box-shadow">
<div class=" d-inline-flex">
<h4 class="my-0 card-header font-weight-normal text-center text-justify text-uppercase">                                       Liste des {{ pagination.getTotalItemCount }} évaluations </h4>
</div>
<table class="table table-striped">
<thead>
<tr>
<th style="width:15%;" class="text-center">SEQ</th>
<th style="width:15%;" {% if pagination.isSorted('e.classroom.name') %} class="sorted" {% endif %}>Classe
</th>
<th style="width:20%;" class="text-center">Matière</th>
<th style="width:15%;" class="text-center">Compétence</th>
<th style="width:15%;" class="text-center">Succ</th>
<th style="width:5%;" class="text-center">Echec</th>
<th style="width:5%;" class="text-center">Abs</th>
<th style="width:5%;" class="text-center">Moy Gen.</th>
<th style="width:15%;" class="text-center">Action</th>
</tr>
</thead>
<tbody>
{% for evaluation in pagination %}
<tr>
<td>{{ evaluation.sequence.code }}</td>
<td>
<a href="{{ path('admin_classrooms_show', {id: evaluation.classroom.id}) }}">{{ evaluation.classroom.name }}</a>
</td>
<td>{{ evaluation.course }}</td>
<td>{{ evaluation.competence|striptags|raw |slice(0,15) }}</td>
{% set success = evaluation.successH + evaluation.successF %}
<td>{{ success }}</td>
{% set faillure = evaluation.failluresH + evaluation.failluresF %}
<td>{{faillure}}</td>
<td>{{ evaluation.abscent }}</td>
<td>{{ evaluation.moyenne |round(2,'floor') }}</td>
<td>
<div class="btn-group">
<a target="_blank" class="btn btn-outline-info" href="{{ path('admin_evaluations_pdf', {id: evaluation.id}) }}">
<i class="fa fa-cloud-download">
</i>
</a>
{% if is_granted('ROLE_ADMIN') %}
<a target="_blank" class="btn btn-outline-warning" href="{{ path('admin_evaluations_edit', {id: evaluation.id|default('1')}) }}">
<i class="fa fa-edit">
</i>
</a>
<a class="btn btn-outline-danger" href="#" onclick= "event.preventDefault() ; confirm('Are you sure ?') && document.getElementById('js-evaluation-delete-form-{{evaluation.id}}').submit();"> <i class="fa fa-trash"></i> </a>
<form id="js-evaluation-delete-form-{{evaluation.id}}" action="{{path('admin_evaluations_delete', {id: evaluation.id})}}" method="post" style="display: none;">
<input type="hidden" name="csrf_token" value="{{ csrf_token('evaluations_deletion' ~ evaluation.id ) }}" id="">
<input type="hidden" name="_method" value="DELETE">
</form>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{# display navigation #}
<div class="navigation text-center">
{{ knp_pagination_render(pagination) }}
</div>
</div>
</div>
</div>
{% endblock %}