{% extends "forms.html" %}
{% load karaage_tags %}
{% load forms %}
{% load filters %}


{% block title %}Usage Search{% endblock %}


{% block breadcrumbs %}
<div class="breadcrumbs">
    <a href='{% url "index" %}'>Home</a>&nbsp;›
    <a href="{% url 'kg_usage' %}">Usage</a>&nbsp;›
    Usage Search
</div>
{% endblock %}


{% block content %}
<form method="post" action=".">{% csrf_token %}
    <fieldset class="aligned ()">
    {% form_as_div form %}
    </fieldset>

    <div class="submit-row">
        <input type="submit" value="Go" class="default" />
    </div>
</form>

{% if project_list %}
<div class="module">
    <h2>Projects Results</h2>
    <div class="table-container">
        <table>
            <thead>
                <tr>
                    <th>Project</th>
                    <th>CPU time</th>
                    <th>No. jobs</th>
                </tr>
            </thead>
            <tbody>
                {% for p in project_list|dictsortreversed:"time" %}
                <tr>
                    <td><a href="{% url 'kg_usage_project' p.obj.pk %}{% url_with_param start=start end=end %}">{{ p.obj }}</a></td>
                    <td class="right">{{ p.time|timeformat }}</td>
                    <td class="right">{{ p.jobs }}</td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endif %}

{% if institute_list %}
<div class="module">
    <h2>Institute Results</h2>
    <div class="table-container">
        <table>
            <thead>
                <tr>
                    <th>Institute</th>
                    <th>CPU time</th>
                    <th>No. jobs</th>
                </tr>
            </thead>
            <tbody>
                {% for i in institute_list|dictsortreversed:"time" %}
                <tr>
                    <td><a href="{% url 'kg_usage_institute' i.obj.pk %}{% url_with_param start=start end=end %}">{{ i.obj }}</a></td>
                    <td class="right">{{ i.time|timeformat }}</td>
                    <td class="right">{{ i.jobs }}</td>
                </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</div>
{% endif %}
{% endblock %}
