{% extends 'report/base.html' %}
{% load i18n report_filters %}

{% block title %}
    {% trans 'Template Columns' %}
{% endblock %}

{% block content %}
<div class="btn-group">
    <a href="{% url 'report:column:create' %}">{% trans 'New Column' %}</a>
</div>
<div class="m-5"></div>
<table class="table table-striped table-hover">
    <thead>
        <th scope="col">
            #
        </th>
        <th scope="col">
            {% trans 'Name' %}
        </th>
        <th scope="col">
            {% trans 'Model' %}
        </th>
        <th scope="col">
            {% trans 'Searchable' %}
        </th>
        <th scope="col">
            {% trans 'Manage' %}
        </th>
    </thead>
    <tbody>
        {% for object in object_list %}
        <tr>
            <th scope="row">
                {{ forloop.counter }}
            </th>
            <td>
                {{ object.title }}
            </td>
            <td>
                {{ object.model }}
            </td>
            <td>
                <input type="checkbox" class="form-check-input" {% if object.searchable %}checked{% endif %} disabled>
            </td>
            <td>
                <div class="btn-group">
                    {% if user|is_editor %}
                        <a class="btn btn-yellow btn-sm" href="{% url 'report:column:edit' object.pk %}" title="{% trans 'edit' %}">
                            <i class="material-icons-outlined">edit</i>
                        </a>
                    {% endif %}
                    <form method="post" action="{% url 'report:column:delete' object.pk %}">
                        {% csrf_token %}
                        <button class="btn btn-danger btn-sm" type="submit" title="{% trans 'delete' %}">
                            <i class="material-icons-outlined">delete</i>
                        </button>
                    </form>
                </div>
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}