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

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

    {# Formulaire de recherche #}
    <form action="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) }}" class="search-admin" method="get">
        <fieldset>
            <div class="search-fields">
                <p>
                    <label for="form_search_title">{{ 'form.sms.model.title.label'|trans({}, 'form') }}</label>
                    <input id="form_search_title" name="title" type="text" value="{{ search_title }}">
                </p>
            </div>
        </fieldset>
        <p>
            <input class="btn" type="submit" value="{{ 'action.search'|trans({}, 'action') }}" />
        </p>
    </form>

    <table class="tableBo">
        <thead>
            <tr>
                   <th>{{ 'form.sms.model.title.label'|trans({}, 'form') }}</th>     
                   <th>{{ 'form.sms.model.description.label'|trans({}, 'form') }}</th>     
                   <th colspan="3">{{ 'word.actions'|trans({}, 'word') }}</th>
            </tr>     
        </thead>
        <tbody>
            {% for model in models %}
               <tr class="delete-element-container">
                   <td><strong>{{ model.title }}</strong></td>
                   <td>{{ model.description }}</td>
                   <td>
                        <a class="edit" href="{{ path('admin_sms_model_edit', {'id':model.id}) }}">
                            <span>{{ 'action.edit'|trans({}, 'action') }}</span>
                        </a>
                   </td>
                   <td>
                        <input
                            {% if true == model.isActive %} checked="checked"{% endif %}
                            class="input-active"
                            data-type="SMSModel"
                            data-url="{{ path('element_actif')}}"
                            type="checkbox"
                            value="{{ model.id }}"
                        />
                        <span class="checkbox"></span>
                   </td>
                   <td>
                        <a class="delete-element" href="{{ path('admin_sms_model_delete', {'id':model.id}) }}">
                            <span>{{ 'action.delete.label'|trans({}, 'action') }}</span>
                        </a>
                   </td>
               </tr>
            {% else %}
                <tr>
                    <td colspan="5">
                        Aucune demande ne correspond à votre recherche.
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>

    {{ include('Admin/Paginator/pagination.html.twig', {pages:pagination|length}) }}
{% endblock %}