{% extends 'base.html.twig' %}

{% block title %} = {{title}}{% endblock %}

{% block body %}
    <h1>{{title}}</h1>
    <a href="{{ path(routesubmit) }}" class="btn btn-success">Ajouter</a>

            <div class="dataTable_wrapper">
                <table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
                    <thead>
                    <tr>
                        <th width="70px" class="no-sort">Action</th>
                        <th>Début</th>
                        <th>Fin</th>
                    </tr>
                    </thead>
                    <tbody>
                        {% for year in years %}
                            <tr>
                                <td><a href="{{ path(routeupdate,{id:year.id}) }}"><i class="fas fa-file fa-2x"></i></a></td>
                                <td>{{year.dateStart|date('d/m/Y')}}</td>
                                <td>{{year.dateEnd|date('d/m/Y')}}</td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
{% endblock %}

{% block localscript %}
    <script>
        $(document).ready(function() {
            $('#dataTables').DataTable({
                columnDefs: [ { "targets": "no-sort", "orderable": false }, { "targets": "no-string", "type" : "num" } ],
                responsive: true,
                iDisplayLength: 100,
                order: [[ 1, "asc" ]]
            });
        });
    </script>
{% endblock %}