{% extends "richtemplates/examples/projects/project_detail.html" %}

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

{% block col_left %}

<div class="richtemplates-panel">
    <h5>Task search</h5>
    <div class="richtemplates-panel-content">
        <form action="." method="get">
            {% csrf_token %}
            <table class="filterform-table">
                {% for field in filter.form %}
                    {% include "richtemplates/forms/filter-field.html" %}
                {% endfor %}
            </table>
            <p>
                <input id="id_filter_task" type="submit" value="Search" />
            </p>
        </form>
    </div>
</div>
{% endblock %}

{% block col_main_extra %}
<div class="richtemplates-panel">    
    <h5>{% trans "Project details" %}</h5>
    <div class="richtemplates-panel-content">
        {% autosort filter.qs as task_list %}
        {% autopaginate task_list 10 %}

        <table class="datatable">
            <thead class="datatable-thead">
                <tr class="datatable-thead-header"><th colspan="8">Tasks</th></tr>
                <tr class="datatable-thead-subheader">
                    <th>ID</th>
                    <th>{% anchor summary "Summary" %}</th>
                    <th>{% anchor created_at "Created at" %}</th>
                    <th>Reported by</th>
                    <th>Modified at</th>
                    <th>Last editor</th>
                    <th>{% anchor status "Status" %}</th>
                    <th>{% anchor priority "Priority" %}</th>
                </tr>
            </thead>
            <tbody class="datatable-tbody">
                {% for task in task_list %}
                <tr class="{% cycle "odd" "even" %} hoverable">
                    <td>{{ task.id }}</td>
                    <td><a href="{% url richtemplates_examples_task_detail task.id %}">{{ task.summary }}</a></td>
                    <td>{{ task.created_at }}</td>
                    <td>{{ task.author }}</td>
                    <td>{{ task.edited_at }}</td>
                    <td>{{ task.editor }}</td>
                    <td>{{ task.status }}</td>
                    <td>{{ task.priority }}</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>

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