{% extends 'core_main_app/_render/admin/theme/tools/box.html' %}

{% block box_title %}List all template configurations{% endblock %}

{% block box_tools %}
<div class="btn-group float-right">
{% url 'core-admin:core_elasticsearch_app_templates_add' as add_url %}
{% include 'core_main_app/common/buttons/add.html' with label='Add Template Configuration' %}
</div>
{% endblock %}

{% block box_body %}

    <table class="table table-bordered table-striped table-hover">
        <tr>
            <th>Template Name</th>
            <th>Title</th>
            <th>Description</th>
            <th>Actions</th>
        </tr>

        {% for es_template in data.es_template_list %}
            {% cycle 'even' '' as rowcolors silent %}
            <tr class="{{ rowcolors }}">
                <td>{{ es_template.template.display_name }}</td>
                <td><code>{{ es_template.title_path }}</code></td>
                <td>
                    <ul>
                        {% for xpath in es_template.description_paths %}
                            <li><code>{{ xpath }}</code></li>
                        {% endfor %}
                    </ul>
                </td>
                <td>
                    {% block box_actions %}
                        {% url 'core-admin:core_elasticsearch_app_templates_edit' es_template.id as edit_url %}
                        {% include 'core_main_app/common/buttons/edit.html' %}
                        <button class="btn btn-secondary btn-check"
                                data-url="{% url 'core-admin:core_elasticsearch_app_templates_check' es_template.id %}">
                            <i class="fas fa-check" aria-hidden="true"></i> Check
                        </button>
                        <button class="btn btn-secondary btn-index"
                                data-url="{% url 'core-admin:core_elasticsearch_app_templates_index' es_template.id %}">
                            <i class="fas fa-database" aria-hidden="true"></i> Index
                        </button>
                        {% url 'core-admin:core_elasticsearch_app_templates_delete' es_template.id as delete_url %}
                        {% include 'core_main_app/common/buttons/delete.html' %}
                    {% endblock %}
                </td>
            </tr>
        {% empty %}
            <tr>
                <td class="empty" colspan="4">
                    There are currently no template configured.
                </td>
            </tr>
        {% endfor %}
    </table>

{% endblock %}

{% block box_footer %}
{% endblock %}