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

{% block title %}{% trans %}title_group_list{% endtrans %}{% endblock %}
{% block subtitle %}{% trans %}title_group_list{% endtrans %} <a href="{{ path('admin_group_add') }}"><span class="badge rounded-pill bg-success"><i class="fa fa-plus"></i> {% trans %}button_create{% endtrans %}</span></a>{% endblock %}

{% block body %}
<div class="row">
    <div class="col-5">{{ form(searchForm) }}</div>   
  </div>
<div class="row">
    <div class="col-md-8">
        <table class="table table-dark table-striped">
            <thead>
                <tr>
                    <th scope="col">#</th>
                    <th scope="col">{% trans %}title_icon{% endtrans %}</th>
                    <th scope="col">{% trans %}title_name{% endtrans %}</th>
                    <th scope="col">{% trans %}title_created_at{% endtrans %}</th>
                    <th scope="col">{% trans %}title_actions{% endtrans %}</th>
                </tr>
            </thead>
            <tbody>
                {% for i in pagination %}
                {% set groupLogo = 'img/nologo.png' %}
                {% if i.imageSize != 0 %} {% set groupLogo = 'uploads/groups/' ~ i.imageName %} {% endif %}
                    <tr>
                        <th scope="row">{{i.id}}</th>
                        <td><img src="{{ asset(groupLogo) }}" alt="{{i.shortname}}" class="img-icon"></td>
                        <td>{{ i.name }}</td>
                        <td>{{i.createdAt |date('_datetime.format'|trans)}}</td>
                        <td>
                        {% include '_cells/adminGroupActions.html.twig' with {'group': i} %}
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>

<div class="row">{{ knp_pagination_render(pagination) }}</div>
{% endblock %}
