{% extends '@CadolesCore/base.html.twig' %}


{% block pagewrapper %}
    <h1>
        Gestion des Modèles de Page
    </h1>
    
    <p>
        <a href="{{ path('cadoles_portal_config_pagetemplate_submit') }}" class="btn btn-success">Ajouter un Modèle</a>
    </p>

    {% if app.session.flashbag.has('error') %}
        <div class='alert alert-danger' style='margin: 5px 0px'>
            <strong>Erreur</strong><br>
            {% for flashMessage in app.session.flashbag.get('error') %}
                {{ flashMessage }}<br>
            {% endfor %}
        </div>
    {% endif %}
    
    <div class="panel panel-primary">
        <div class="panel-heading">
            <i class="fa fa-table fa-fw"></i> Liste des Modèles
        </div>

        <div class="panel-body">
            <div class="dataTable_wrapper">
                <table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
                    <thead>
                        <tr>
                        <th width="120px" class="no-sort">Action</th>
                        <th>Ordre</th>
                        <th>Nom</th>
                        <th>Pour</th>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
{% endblock %}

{% block localjavascript %}
    $(document).ready(function() {
        $('#dataTables').DataTable({
            columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
            responsive: true,
            iDisplayLength: 100,
            order: [[ 1, "asc" ]],
            processing: true,
            serverSide: true,
        	ajax: "{{ path('cadoles_portal_config_pagetemplate_ajax_list') }}",
        });
    });
{% endblock %}
