{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}

{% block admin_content %}
    {% embed '@ChillMain/CRUD/_index.html.twig' %}
        {% block table_entities_thead_tr %}
            <th>{{ 'Id'|trans }}</th>
            <th>{{ 'Title'|trans }}</th>
            <th>{{ 'goal.results'|trans }}</th>
            <th>{{ 'goal.desactivationDate'|trans }}</th>
            <th>&nbsp;</th>
        {% endblock %}

        {% block table_entities_tbody %}
        {% for entity in entities %}
            <tr>
                <td>{{ entity.id }}</td>
                <td>{{ entity.title|localize_translatable_string }}</td>
                <td>
                {% for sa in entity.results %}
                   {{ sa.title|localize_translatable_string }}{% if not loop.last %},{% else %}.{% endif %}
                {% endfor %}
                </td>
                <td>
                {% if entity.desactivationDate is not null %}
                    {{ entity.desactivationDate|date('Y-m-d') }}
                {% endif %}
                </td>
                <td>
                    <ul class="record_actions">
                        <li>
                            <a href="{{ chill_path_add_return_path('chill_crud_social_goal_edit', { 'id': entity.id }) }}" class="btn btn-edit"></a>
                        </li>
                    </ul>
                </td>
            </tr>
        {% endfor %}
        {% endblock %}

        {% block actions_before %}
            <li class='cancel'>
                <a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
            </li>
        {% endblock %}
    {% endembed %}
{% endblock %}
