{% extends "base.html" %}

{% load i18n %}
{% load gravatar_tags %}

{% block col-left %}
    
    <div class="richtemplates-panel">
        <h5>{% if profile.is_team %}{% trans "Team" %}{% else %}{% trans "User" %}{% endif %}: {{ profile.user }}</h5>
	    <div class="richtemplates-panel-content">
            {% if user == profile.user %}
			<ul class="nav-vertical">
                <li><a href="{% url projector_users_profile_detail profile.user.username %}">{% trans "Show your public profile" %}</a></li>
            </ul>
            {% endif %}
	    </div>
	</div>

{% endblock %}

{% block col-main %}
<div class="richtemplates-panel">
    <h5>
    {% if profile.is_team %}
        {% trans "Team profile" %}
    {% else %}
        {% trans "User profile" %}
    {% endif %}
    </h5>
    <div class="richtemplates-panel-content">
        <div class="richblock">
            <div>
                <img src="{% gravatar_for_user profile.user 32 %}"
                     alt="{% trans "Avatar" %}"/>
            </div>
            <table class="richblock-properties">
                <tbody>
                    <tr>
                        <th>{% if profile.is_team %}{% trans "Team" %}{% else %}{% trans "User" %}{% endif %}</th>
                        <td>{{ profile.user.username }}</td>
                    </tr>
                    {% if not profile.is_team %}
                    <tr>
                        <th>{% trans "Full name" %}</th>
                        <td>{{ profile.user.get_full_name|default:"-" }}</td>
                    </tr>
                    {% endif %}
                </tbody>
            </table>
        </div>
        <div class="richtabs">
            <ul>
                <li><a href="#projects"><span>{% trans "Projects" %}</span></a></li>
                <li><a href="#teams">{% trans "Teams" %}</a></li>
                {% if profile.is_team %}<li><a href="#members">{% trans "Members" %}</a></li>{% endif %}
            </ul>
        
            <div id="projects">
                <h3>{% trans "Member of projects" %}</h3>
                <table class="datatable">
                    <thead class="datatable-thead">
                        <tr class="datatable-thead-subheader">
                            <th>{% trans "Project" %}</th>
                            <th>{% trans "Author" %}</th>
                            <th>{% trans "Category" %}</th>
                        </tr>
                    </thead>
                    <tbody class="datatable-tbody">
                        {% for project in project_list %}
                        <tr class="{% cycle "odd" "even" %} hoverable">
                            <td><a href="{{ project.get_absolute_url }}"
                                   class="block-link">{{ project.name }}</a></td>
                            <td><a href="{% url projector_users_profile_detail project.author.username %}"
                                   class="block-link">{{ project.author }}</a></td>
                            <td>{{ project.category|default:"-" }}</td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>

            <div id="teams">
                <h3>{% trans "Member of teams" %}</h3>
                <table class="datatable">
                    <thead class="datatable-thead">
                        <tr class="datatable-thead-subheader">
                            <th>{% trans "Team" %}</th>
                        </tr>
                    </thead>
                    <tbody class="datatable-tbody">
                        {% for group in groups %}
                        <tr class="{% cycle "odd" "even" %} hoverable">
                            <td><a class="block-link" href="{% url projector_users_profile_detail group.name %}">{{ group }}</a></td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>

            {% if profile.is_team %}
            <div id="members">
                <h3>{% trans "Members of this team" %}</h3>
                <table class="datatable">
                    <thead>
                        <tr class="datatable-thead">
                            <th>{% trans "User" %}</th>
                        </tr>
                    </thead>
                    <tbody class="datatable-tbody">
                        {% for user in profile.group.user_set.all %}
                        <tr class="{% cycle "odd" "even" %} hoverable">
                            <td><a href="{% url projector_users_profile_detail user.username %}"
                                   class="block-link">{{ user }}</a></td>
                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
            {% endif %}

        </div>

    </div>
</div>
{% endblock %}

