{% extends "admin.html.twig" %}

{% block adminContent %}
    <div class="row">
        <div class="col-8">
            <h1>
                {{ 'admin.departments.title'|trans }}
                <small>
                    {{ 'admin.departments.subtitle'|trans }}
                </small>
            </h1>
        </div>
        <div class="col-4 text-right">
            <a href="{{ path('admin_departamentos_new') }}" class="btn btn-primary">
                <i class="fa fa-plus"></i>
                {{ 'admin.departments.button.new'|trans }}
            </a>
        </div>
    </div>

    <hr>

    {% include "flashMessages.html.twig" %}

    <table class="table table-bordered">
        <thead class="thead-light">
            <tr>
                <th>#</th>
                <th>{{ 'label.name'|trans }}</th>
                <th>{{ 'label.status'|trans }}</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            {% for departamento in departamentos %}
                <tr>
                    <td>
                        {{ departamento.id }}
                    </td>
                    <td>
                        {{ departamento.nome }}
                    </td>
                    <td>
                        {% if departamento.ativo %}
                            <span class="text-success">{{ 'label.enabled'|trans }}</span>
                        {% else %}
                            <span class="text-danger">{{ 'label.disabled'|trans }}</span>
                        {% endif %}
                    </td>
                    <td class="text-center">
                        <a href="{{ path('admin_departamentos_edit', { id: departamento.id }) }}" class="btn btn-secondary">
                            <i class="fa fa-edit"></i>
                        </a>
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
{% endblock %}
