{% extends "projector/project/details.html" %}

{% load i18n %}
{% load pagination_tags %}
{% load sorting_tags %}

{% block col_main_extra %}

{% autosort task_list %}
{% autopaginate task_list %}

<div class="richtemplates-panel">
    <h5>Project's task list</h5>
    <div class="richtemplates-panel-content">
        {# Task list: {{ task_list }} #}
    <h1>{{ project.name }}</h1>
    <h2>Task List</h2>
    <ul class="nav-inline">
        <li><a class="button-link" href="{{ project.get_create_task_url }}">{% trans "Create new task" %}</a></li>
    </ul>
    {% if invalid_page %}
        <div class="messages">
            <p class="error">{% trans "There is no such page!" %}</p>
        </div>
    {% else %}
    <table class="datatable">
        <thead class="datatable-thead">
            <tr class="datatable-thead-subheader">
                <th>{% anchor id "Task" %}</th>
                <th>{% anchor summary "Summary" %}</th>
                <th>{% anchor milestone "Milestone" %}</th>
                <th>{% anchor created_at "Created at" %}</th>
                <th>{% anchor edited_at "Last update" %}</th>
                <th>{% anchor deadline "Deadline" %}</th>
                <th>{% anchor priority "Priority" %}</th>
                <th>{% anchor type "Type" %}</th>
                <th>{% anchor status "Status" %}</th>
                <th>{% anchor author "Reported by" %}</th>
                <th>{% anchor owner "Owner" %}</th>
            </tr>
        </thead>
        <tbody class="datatable-tbody">
            {% for task in task_list %}
            <tr class="{% cycle "odd" "even" %} hoverable">
                <td>{{ task.id }}</td>
                <td><a class="block-link" href="{{ task.get_absolute_url }}">{{ task.summary }}</a></td>
                <td>{{ task.milestone }}</td>
                <td>{{ task.created_at|date:"Y-m-d" }}</td>
                <td>{{ task.edited_at|date:"Y-m-d" }}</td>
                <td>{{ task.deadline|date:"Y-m-d" }}</td>
                <td>{{ task.priority.name }}</td>
                <td>{{ task.type }}</td>
                <td>
                    <span class="{% if task.status.is_resolved %}task-closed{% else %}task-open{% endif %}">
                        {{ task.status }}
                    </span>
                </td>
                <td>{{ task.author }}</td>
                <td>{{ task.owner }}</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
    {% paginate %}
    {% endif %}
</div>
</div>
{% endblock %}

