{% extends "timepiece/person/base.html" %}
{% load url from future %}
{% load bootstrap_toolkit %}

{% block title %}People{% endblock %}

{% block content %}
    <div class="row">
        <div class="span12">
            <h2>People</h2>
            <ul class="unstyled subnav">
                {% if perms.auth.add_user %}
                    <li><a href='{% url 'create_person' %}'>Create Person</a></li>
                {% endif %}
            </ul>
        </div>
    </div>

    <div class="row">
        <div class="span12">
            <form class='form-inline' accept-charset='UTF-8' method='get' action=''>
                {{ form|as_bootstrap:"inline" }}
                <button type='submit' name='submit' class="btn">Search</button>
            </form>
        </div>
    </div>

    <div class="row">
        <div class="span12">
            {% load pagination_tags %}
            {% autopaginate people %}

            {% paginate %}
            <table class='table table-bordered table-striped table-condensed'>
                <thead>
                    <tr>
                        <th>Username</th>
                        <th>First Name</th>
                        <th>Last Name</th>
                        <th>Email</th>
                        <th>Timesheet</th>
                    </tr>
                </thead>
                <tbody>
                    {% for person in people %}
                        <tr>
                            <td><a href='{% url 'view_person' person.pk %}'>{{ person.username }}</a></td>
                            <td>{{ person.first_name }}</td>
                            <td>{{ person.last_name }}</td>
                            <td>{{ person.email }}</td>

                            <td><a href="{% url 'view_person_time_sheet' person.pk %}">View Timesheet</a></td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
            {% paginate %}
        </div>
    </div>
{% endblock %}
