{% extends 'generic/object_detail.html' %}
{% load helpers %}

{% block extra_nav_tabs %}
        <li role="presentation"{% if request.GET.tab == 'members' %} class="active"{% endif %}>
            <a href="{{ object.get_absolute_url }}#members" onclick="switch_tab(this.href, reload=true)" aria-controls="members" role="tab" data-toggle="tab">
                Members {% badge object.count %}
            </a>
        </li>
{% endblock extra_nav_tabs %}

{% block extra_tab_content %}
        <div id="members" role="tabpanel" class="tab-pane {% if not active_tab and not request.GET.tab or request.GET.tab == "members" %}active{% else %}fade{% endif %}">
            <div class="row">
                <div class="col-md-12">
                    {% include 'utilities/obj_table.html' with table=members_table table_template='panel_table.html' heading='Dynamic Group members' %}
                </div>
            </div>
        </div>
{% endblock extra_tab_content %}

{% block content_left_page %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <strong>Dynamic Group</strong>
        </div>
        <table class="table table-hover panel-body attr-table">
            <tr>
                <td>Name</td>
                <td><span>{{ object.name }}</span></td>
            </tr>
            <tr>
                <td>Description</td>
                <td><span>{{ object.description }}</span></td>
            </tr>
            <tr>
                <td>Content Type</td>
                <td><span>{{ object.content_type }}</span></td>
            </tr>
        </table>
    </div>
{% endblock content_left_page %}

{% block content_right_page %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <strong>Filter</strong>
        </div>
        <div class="panel-body">
            <pre>{{ object.filter | render_json }}</pre>
        </div>
    </div>
{% endblock content_right_page %}

{% block content_full_width_page %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <strong>Filter Query Logic</strong>
        </div>
        <div class="panel-body">
            <span class="help-block">
                This is a raw representation of the underlying filter that is derived
                by aggregating the filters from all descendant groups.
            </span>
            <pre>{{ raw_query }}</pre>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">
            <strong>Related Groups</strong>
        </div>
        <div class="panel-body">
            {% include 'utilities/obj_table.html' with table=descendants_table table_template='panel_table.html' heading='Descendants' disable_pagination=True %}
           {% include 'utilities/obj_table.html' with table=ancestors_table table_template='panel_table.html' heading='Ancestors' disable_pagination=True %}
        </div>
    </div>

{% endblock content_full_width_page %}
