{% extends 'Admin/layout.html.twig' %}

{% trans_default_domain 'form' %}

{% set constUserTypeTeacher = constant('AppBundle\\Enum\\UserType::TEACHER') %}
{% set constUserTypeEngineer = constant('AppBundle\\Enum\\UserType::ENGINEER') %}

{% block body %}
    {{ knp_menu_render('actions_stats_opes_itdlc') }}

    <form action="{{ path('admin_statistics_itdlc_operation') }}" class="search-admin" method="get">
        <fieldset>
            <legend>{{ 'form.date.visit.label'|trans }}</legend>
            <div class="search-fields">
                <p>
                    <label for="datemin">Début</label>
                    <input id="datemin" type="text" value="{{ datemin }}" class="date" name="datemin"/>
                </p>
                <p>
                    <label for="datemax">Fin</label>
                    <input id="datemax" type="text" value="{{ datemax }}" class="date" name="datemax"/>
                </p>
            </div>
        </fieldset>
        <fieldset>
            <legend>{{ 'form.itdlc.operation.label'|transchoice(2) }}</legend>
            <div class="search-fields">
                <p>
                    <label for="state">{{ 'form.state.label'|trans }}</label>
                    <select id="state" name="state">
                        <option value="all">- Tous -</option>
                        {% for key, state in states %}
                            <option value="{{ key }}"{% if key == search_state %} selected="selected"{% endif %}>{{ state }}</option>
                        {% endfor %}
                    </select>
                </p>
            </div>
        </fieldset>
        <p>
            <input class="btn" type="submit" value="{{ 'action.search'|trans({}, 'action') }}"/>
        </p>
    </form>
    
    <table class="tableBo">
        <thead>
            <tr>
                <td>{{ 'form.date.visit.label'|trans }}</td>
                <td>{{ 'form.teacher.label'|transchoice(1) }}</td>
                <td>{{ 'form.engineer.label'|transchoice(1) }}</td>
                <td>Classe</td>
                <td>Emploi de lʼenseignant</td>
                <td>Etablissement</td>
                <td>{{ 'form.academy.label'|trans }}</td>
                <td>Département</td>
            </tr>
        </thead>
        <tbody>
            {% for o in opes %}
                <tr>
                    <td>
                        {{- include('Admin/Ope/ITDLC/_component/availability.html.twig', {availabilities: o.availability}) -}}
                    </td>
                    <td>{% if o.prof != '' %}{{ o.prof.firstname }} {{ o.prof.lastname }}{% endif %}</td>
                    <td>{% if o.inge != '' %}{{ o.inge.firstname }} {{ o.inge.lastname }}{% endif %}</td>
                    <td>{{ o.classlevel }}</td>
                    <td>{% if o.prof != '' %}{% if o.prof.categoryJob is not empty %}{{ o.prof.categoryJob|transconst('AppBundle\\Enum\\UserJobTeacherCategory') }} / {% endif %}{% if o.prof.jobOther is not empty %}{{ o.prof.jobOther }}{% else %}{{ o.prof.job|transconst('AppBundle\\Enum\\UserJobTeacher') }}{% endif %}{% endif %}</td>
                    <td>{% if o.prof != '' %}{{ o.prof.establishmentName }}{{ o.prof.establishmentNameOther }}{% endif %}</td>
                    <td>{% if o.prof != '' %}{{ o.prof.academy }}{% endif %}</td>
                    <td>{% if o.prof != '' %}{{ o.prof.establishmentZipcode|slice(0,2) }}{% endif %}</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
    
    {{ include('Admin/Paginator/pagination.html.twig', {pages:nbPages}) }}
{% endblock %}