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

{% block box_title %} Custom Queries{% endblock %}

{% block box_body %}
<div class="custom-toolbar pull-right">
    <a href="{% url 'admin:core_custom_queries_app_query_builder' %}" class="btn btn-success">
        <i class="fa fa-plus"></i> Create New Query
    </a>
</div>

<table class="table table-bordered" id="queries-list">
    <thead>
        <tr>
            <th>Name</th>
            <th>Group</th>
            <th>Schema</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
        {% for query in data.queries %}
            <tr>
                <td>{{ query.name }}</td>
                <td>{{ query.group }}</td>
                <td>{{ query.schema }}</td>
                <td>
                    <a href="{% url 'admin:core_custom_queries_app_edit_query' query.id %}" class="btn btn-default">
                        <i class="fa fa-edit"></i> Edit Query
                    </a>
                </td>
            </tr>
        {% empty %}
            <tr>
                <td class="empty" colspan="4">No queries have been created yet.</td>
            </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}

