{% extends "main.html" %}
{% load karaage_tags %}
{% load humanize %}
{% load filters %}


{% block title %}Institute Users{% endblock %}


{% block breadcrumbs %}
<div class="breadcrumbs">
    <a href='{% url "index" %}'>Home</a>&nbsp;›
    <a href="{% url 'kg_usage' %}">Usage</a>&nbsp;›
    <a href="{% url 'kg_usage_institute' institute.pk %}">{{ institute }}</a>&nbsp;›
    Institute Users
</div>
{% endblock %}


{% block content %}
<div id="content-main">
    <h2>Usage {{ start|date }} - {{ end|date }}</h2>
    <p>{% date_filter start end %}</p>
    <h1><a href="{% url 'kg_usage_institute' institute.pk %}{% url_with_param start=start end=end %}">{{ institute }}</a></h1>
    {% if person_list %}
    <div class="module">
        <h2>All users</h2>
        <div class="table-container">
            <table>
                <thead>
                    <tr>
                        <th></th>
                        <th>User</th>
                        <th>Project</th>
                        <th>CPU Time</th>
                        <th>No. Jobs</th>
                        <th>% of total</th>
                    </tr>
                </thead>
                <tbody>
                    {% for u in person_list|dictsortreversed:"usage" %}
                    <tr>
                        <td>{{ forloop.counter }}</td>
                        <td><a href="{{ u.person.get_absolute_url }}">{{ u.person }}</a></td>
                        <td><a href="{% url 'kg_usage_project' u.project.pid %}{% url_with_param start=start end=end %}">{{ u.project|truncatewords:"6" }}</a></td>
                        <td class="right">{{ u.usage|timeformat }}</td>
                        <td class="right">{{ u.jobs|intcomma }}</td>
                        <td class="right">{{ u.percent|floatformat:"2" }}%</td>
                    </tr>
                    {% endfor %}
                </tbody>
                <tfoot>
                    <tr>
                        <td>Total</td>
                        <td></td>
                        <td></td>
                        <td class="right">{{ person_total|timeformat }}</td>
                        <td class="right">{{ person_total_jobs|intcomma }}</td>
                        <td class="right">{{ person_percent|floatformat:"2" }}%</td>
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>
    {% endif %}
</div>
{% endblock %}
