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

{% block box_title %}
{% if not come_from_admin %}
    {% if data.title %}
        <h1>{{data.title}}</h1>
    {% else %}
        <h1>My {{data.document}}s</h1>
    {% endif %}
{% endif %}
{% endblock %}


{% block box_tools %}
{% if data.create_workspace %}
<a class="btn btn-default create-workspace-btn">
    <i class="fa fa-file-text-o"></i> Create workspace
</a>
{% endif %}

{% if data.title %}
    <a href="#" class="btn btn-default back-to-previous">
         <i class="fa fa-arrow-left"></i> Previous page
    </a>
{% endif %}
{% endblock %}


{% block box_body %}

    {% if data.menu and not data.title %}
        <div class="dropdown" id="id_actions" style="display:none">
            <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                Choose action
                <span class="caret"></span>
            </button>
            <ul class="dropdown-menu">
                {% for value, text in data.action_form.fields.actions.choices %}
                    <li style="cursor:  pointer;" onclick="action_dashboard({{value}});">{{text}}</li>
                {% endfor %}
            </ul>
        </div>
    {% endif %}

    <div class="tab-content">
            {% if data.user_data %}
                {% include data.template with objects=data.user_data group='user' %}
            {% else %}
                {% if data.other_users_data %}
                        {% include data.template with objects=data.other_users_data group='other' %}
                {%else%}
                    No {{data.document}}s found.
                {% endif %}
            {% endif %}
    </div>
{% endblock %}

