{% extends "main.html" %}
{% load karaage_tags %}
{% load render_table from django_tables2 %}


{% block title %}Institute{% endblock %}


{% block breadcrumbs %}
<div class="breadcrumbs">
    <a href='{% url "index" %}'>Home</a>&nbsp;›
    <a href='{% url 'kg_institute_list' %}'>Institutes</a>&nbsp;›
    {{ institute }}
</div>
{% endblock %}


{% block content %}
<div id="content-main">
    <div class="module">
        <h2>Institute Details</h2>
        <h3>{{ institute }}</h3>
        <div class="table-container">
            <table class="keyvalue">
                <tr>
                    <th>Active:</th>
                    <td>
                        {% if not institute.is_active %}
                        <span class="no">Deleted</span>
                        {% else %}
                        <span class="yes">Yes</span>
                        {% endif %}
                    </td>
                </tr>
                <tr><th>Delegate(s):</th><td>{% for delegate in institute.delegates.all %}<a href="{{ delegate.get_absolute_url }}">{{ delegate }}</a>, {% endfor %}</td></tr>
                {% if is_admin %}
                <tr><th>Group:</th><td><a href="{{ institute.group.get_absolute_url }}">{{ institute.group }}</a></td></tr>
                {% endif %}
                {% if institute.saml_entityid %}
                <tr><th>SAML entityID:</th><td>{{ institute.saml_entityid }}</td></tr>
                {% endif %}
            </table>
        </div>

        {% is_for_each_app_include_empty "project_detail_tools.html" as is_empty %}
        {% if is_admin or not is_empty %}
        <div class="object-tools">
            <ul>
                {% if is_admin %}
                <li><a href="{% url 'kg_institute_edit' institute.pk %}" class="changelink">Edit</a></li>
                <li><a href="{% url 'kg_institute_logs' institute.pk %}">View logs</a></li>
                <li><a href="{% url 'kg_institute_verbose' institute.pk %}">Verbose</a></li>
                {% endif %}
                {% for_each_app_include "institute_detail_tools.html" %}
            </ul>
        </div>
        {% endif %}
    </div>

    <div class="module">
        <h2>Projects</h2>
        {% render_table project_list %}
    </div>

    <div class="module">
    <h2>People</h2>
        {% render_table person_list %}
    </div>

    {% for_each_app_include "institute_detail_extra.html" %}

    {% if is_admin %}
    <div class="module">
        <h2>Comments</h2>
        {% comments institute %}
        {% if is_admin %}
        <div class="object-tools">
            <ul>
                <li><a href="{% url 'kg_institute_add_comment' institute.pk %}" class="addlink">Add comment</a></li>
            </ul>
        </div>
        {% endif %}
    </div>
    {% endif %}
</div>
{% endblock %}


{% block object-tools %}
{% endblock %}
