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

{% load i18n %}

{% block col-left %}
    {{ block.super }}
    <div class="richtemplates-panel">
        <h5>{% trans "Projects statistics" %}</h5>
	    <div class="richtemplates-panel-content">
	        <table class="form-table">
                <tr>
                    <td><label>{% trans "All projects count" %}</label></td>
                    <td>{{ project_list.count }}</td>
                </tr>
            </table>
	    </div>
    </div>
{% endblock %}

{% block col-main-title %}{% trans "Projects List" %}{% endblock %}

{% block col-main-content %}

    <ul class="nav-inline">
        <li class="richbuttonset">
            <a class="button-link" href="{% url projector_project_create %}">{% trans "Create new project" %}</a>
        </li>
    </ul>

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

    {% autosort project_list %}
    {% autopaginate project_list %}

    <table class="datatable">
        <thead class="datatable-thead">
            <tr class="datatable-thead-subheader">
                <th>{% anchor name "Name" %}</th>
                <th>{% anchor category "Category" %}</th>
                <th>{% anchor author "Author" %}</th>
                <th>{% anchor created_at "Created at" %}</th>
                <th>{% anchor task__count "Task count" %}</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>{{ project.category|default:"-" }}</td>
                <td><a href="{% url projector_users_profile_detail project.author.username %}"
                       class="block-link">{{ project.author }}</a></td>
                <td>{{ project.created_at|date:"Y-m-d" }}</td>
                <td>{{ project.task__count }}</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

    {% paginate %}
{% endblock %}

