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

{% block admin_content %}
    {% embed '@ChillMain/CRUD/_index.html.twig' %}
        {% block table_entities_thead_tr %}
            <th>{{ 'Title'|trans }}</th>
            <th>{{ 'news.startDate'|trans }}</th>
            <th>{{ 'news.endDate'|trans }}</th>
        {% endblock %}
        {% block table_entities_tbody %}
            {% for entity in entities %}
                <tr>
                    <td>{{ entity.title }}</td>
                    <td>{{ entity.startDate|format_date('long') }}</td>
                    {% if entity.endDate is not null %}
                        <td>{{ entity.endDate|format_date('long') }}</td>
                    {% else %}
                        <td>{{ 'news.noDate'|trans }}</td>
                    {% endif %}
                    <td>
                        <ul class="record_actions">
                            <li>
                                <a href="{{ path('chill_crud_news_item_view', { 'id': entity.id }) }}" class="btn btn-show" title="{{ 'show'|trans }}"></a>
                            </li>
                            <li>
                                <a href="{{ path('chill_crud_news_item_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
                            </li>
                            <li>
                                <a href="{{ path('chill_crud_news_item_delete', { 'id': entity.id }) }}" class="btn btn-delete" title="{{ 'delete'|trans }}"></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 %}
