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

{% block box_title %}Available{% endblock %}

{% block box_tools %}
    <a href="{% url 'admin:core_user_registration_app_upload_template'%}" class="float-right btn btn-secondary">
        <i class="fas fa-upload"></i> Upload {{ data.object_name }}
    </a>
{% endblock %}

{% block box_body %}
<table class="table table-bordered table-striped table-hover">
    <tr>
        <th width="35%">{{ data.object_name }}</th>
        <th>Status</th>
        <th>Actions</th>
    </tr>

    {% for object in data.available %}
        <tr>
            <td>{{ object.title }}</td>
            {% if object.is_default  %}
                <td style='font-weight:bold;color:green'>Current</td>
            {% else %}
                <td style='font-weight:bold;color:orange'>Uploaded</td>
            {% endif %}
            <td>
                {% block box_actions %}
                <a class="btn btn-secondary"
                   href="{% url 'admin:core_user_registration_app_manage_template_versions' object.id %}">
                    <i class="fas fa-list"></i> Versions
                </a>

                {% endblock %}
            {% if object.is_default  %}
            {% else %}
                <span class='icon legend long current' objectid='{{ object.id }}'>
                    <a class="btn btn-default" href="#"><i class="fa fa-bookmark"></i> Set Current</a>
                </span>
            {% endif %}
            </td>


        </tr>
    {% empty %}
        <tr>
            <td class="empty" colspan="2">
                No {{ data.object_name }} uploaded.
            </td>
        </tr>
    {% endfor %}
</table>
{% endblock %}