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

{% block admin_content %}
    <h1>{{ 'ActivityReason list'|trans }}</h1>

    <table class="table table-bordered border-dark align-middle">
        <thead>
            <tr>
                <th>{{ 'Name'|trans }}</th>
                <th>{{ 'Active'|trans }}</th>
                <th>{{ 'Actions'|trans }}</th>
            </tr>
        </thead>
        <tbody>
        {% for entity in entities %}
            <tr class="{% if entity.active %}active{% else %}inactive{% endif %}">
                <td>
                    {% if entity.category is not null -%}
                    {{  entity.category.name|localize_translatable_string }} >
                    {% endif -%}
                    {{ entity.name|localize_translatable_string }}
                </td>
                <td>
                    <i class="fa {% if entity.active %}fa-check-square-o{% else %}fa-square-o{% endif %}"></i>
                    {% if entity.active and not entity.isActiveAndParentActive %}
                    <span class="badge text-bg-danger text-white">{{ 'Associated activity reason category is inactive'|trans }}</span>
                    {% endif %}
                </td>
                <td>
                    <ul class="record_actions">
                        <li>
                            <a href="{{ path('chill_activity_activityreason_update', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
                        </li>
                    </ul>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>


    <ul class="record_actions sticky-form-buttons">
        <li class='cancel'>
            <a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
        </li>
        <li>
            <a href="{{ path('chill_activity_activityreason_new') }}" class="btn btn-new">
                {{ 'Create a new activity reason'|trans }}
            </a>
        </li>
    </ul>
    {% endblock %}
