{% 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 %}

    {% if data.resources %}
        <div style='display: none' id="my_role" >
            <input type="checkbox" name="my_role" id="Organization" value="Organization">
            <input type="checkbox" name="my_role" id="DataCollection" value="DataCollection">
            <input type="checkbox" name="my_role" id="Dataset" value="Dataset">
            <input type="checkbox" name="my_role" id="ServiceAPI" value="ServiceAPI">
            <input type="checkbox" name="my_role" id="WebSite" value="WebSite">
            <input type="checkbox" name="my_role" id="Software" value="Software">
        </div>


        <table id="icons_table">
            <tr>
                <td id="td_all" align="center" onclick="click_role('all');get_url('{{data.ispublished}}', '');">
                    <i class="fa fa-globe fa-5x" aria-hidden="true" style="color: #557EB9"></i>
                    <div class="tick" align="right">
                         <i class="fa fa-check-circle-o fa-2x" aria-hidden="true"></i>
                    </div>
                    <br/>
                    All Resources
                </td>
                <td id="td_Organization" align="center" onclick="click_role('Organization');get_url('{{data.ispublished}}', '');" >
                    <i class="fa fa-university fa-5x" aria-hidden="true" style="color: #2CAAE2;"></i>
                    <div class="tick" align="right">
                         <i class="fa fa-check-circle-o fa-2x" aria-hidden="true"></i>
                    </div>
                    <br>
                    Organizations
                </td>
                <td id="td_DataCollection"  align="center" onclick="click_role('DataCollection');get_url('{{data.ispublished}}', '');" >
                    <i class="fa fa-table fa-5x" aria-hidden="true" style="color: #A1C057;"></i>
                    <div class="tick" align="right">
                         <i class="fa fa-check-circle-o fa-2x" aria-hidden="true"></i>
                    </div>
                    <div style="position:relative;top:15px;">Data Collections</div>
                </td>
                <td id="td_Dataset" align="center" onclick="click_role('Dataset');get_url('{{data.ispublished}}', '');">
                    <i class="fa fa-database fa-5x" aria-hidden="true" style="color: grey;"></i>
                    <div class="tick" align="right">
                         <i class="fa fa-check-circle-o fa-2x" aria-hidden="true"></i>
                    </div>
                    <br>
                    Datasets
                </td>
                <td id="td_ServiceAPI" align="center" onclick="click_role('ServiceAPI');get_url('{{data.ispublished}}', '');">
                    <i class="fa fa-cogs fa-5x" aria-hidden="true" style="color: #EBB057;"></i>
                    <div class="tick" align="right">
                         <i class="fa fa-check-circle-o fa-2x" aria-hidden="true"></i>
                    </div>
                    <br>
                    Services
                </td>
                <td id="td_WebSite" align="center" onclick="click_role('WebSite');get_url('{{data.ispublished}}', '');">
                    <i class="fa fa-laptop fa-5x" aria-hidden="true" style="color: #257ABC;"></i>
                    <div class="tick" align="right">
                         <i class="fa fa-check-circle-o fa-2x" aria-hidden="true"></i>
                    </div>
                    <br>
                    Informational Sites
                </td>
                <td id="td_Software" align="center" onclick="click_role('Software');get_url('{{data.ispublished}}', '');">
                    <i class="fa fa-tachometer fa-5x" aria-hidden="true" style="color: #79B320;"></i>
                    <div class="tick" align="right">
                         <i class="fa fa-check-circle-o fa-2x" aria-hidden="true"></i>
                    </div>
                    <br>
                    Software
                </td>
            </tr>
            </table>

        <br/>

            <ul class="nav nav-tabs">
                    {% if data.ispublished == None %} <li id="all" class="active"> {%else%} <li> {% endif%} <a onclick="get_url('None', '');">All</a></li>
                    {% if data.ispublished == 'true' %} <li id="published" class="active"> {%else%} <li> {% endif%} <a onclick="get_url('true', '');">Published</a></li>
                    {% if data.ispublished == 'false' %} <li id="notpublished" class="active"> {%else%} <li> {% endif%} <a onclick="get_url('false', '');">Not Published</a></li>
            </ul>

        <br/>
    {% 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 %}


