{% extends "projector/home.html" %}


{% load i18n %}

{% block col-left %}
    {% if user.get_profile %}
    <div class="richtemplates-panel">
        <h5>{% trans "User" %}: {{ 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>
    {% endif %}
{% endblock %}

{% block col-main %}
{% if user.get_profile %}
<div class="richtemplates-panel">
    <h5>{% trans "Your homepage" %}</h5>
    <div class="richtemplates-panel-content">
        <div class="richblock">
            <table class="richblock-properties">
                <tbody>
                    <tr>
                        <th>{% trans "User" %}</th>
                        <td>{{ profile.user.username }}</td>
                    </tr>
                    <tr>
                        <th>{% trans "Full name" %}</th>
                        <td>{{ profile.user.get_full_name }}</td>
                    </tr>
                    <tr>
                        <th>E-mail</th>
                        <td>{{ profile.user.email }}</td>
                    </tr>
                </tbody>
            </table>
        </div>

        <h1>{% trans "Tasks to do" %}</h1>
        {% regroup owned_task_list by project as project_list %}
        {% for project in project_list %}
        <h2><a href="{{ project.grouper.get_absolute_url }}">{{ project.grouper }}</a></h2>
            <table class="datatable">
                <thead class="datatable-thead">
                    <tr class="datatable-thead-subheader lefted">
                        <th class="width-10">{% trans "Status" %}</th>
                        <th class="width-10">ID</th>
                        <th class="width-10">{% trans "Deadline" %}</th>
                        <th>{% trans "Summary" %}</th>
                    </tr>
                </thead>
                <tbody class="datatable-tbody">
                    {% for task in project.list %}
                    <tr class="{% cycle "odd" "even" %} hoverable">
                        <td>
                            <span class="{% if task.status.is_resolved %}task-closed{% else %}task-open{% endif %}">
                                {{ task.status }}
                            </span>
                        </td>
                        <td>{{ task.id }}</td>
                        <td>
                            {% if task.deadline %}
                            {{ task.deadline }}
                            {% else %}
                            <a href="{{ task.get_edit_url }}" class="show-tipsy" title="{% trans "Click to edit and set deadline" %}">{% trans "Not set" %}</a>
                            {% endif %}
                        </td>
                        <td><a class="block-link" href="{{ task.get_absolute_url }}">{{ task.summary }}</a></td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        {% endfor %}

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

