{% extends "timepiece/time-sheet/reports/base.html" %}
{% load timepiece_tags bootstrap_toolkit %}
{% load url from future %}

{% block title %}General Ledger Report{% endblock %}

{% block crumbs %}
    {{ block.super }}
    <li><span class="divider">/</span> <a href="{% url 'timepiece-summary' %}">General Ledger Report</a></li>
{% endblock crumbs %}

{% block report_nav %}
    {% with 'timepiece-summary' as active %}
        {{ block.super }}
    {% endwith %}
{% endblock report_nav %}

{% block report_content %}
    <div class="row-fluid">
        <div class="span12">
            <form class="form-inline" method="get" action="" id="date-filter" accept-charset="utf-8">
                {{ form|as_bootstrap:"inline" }}
                <input class="btn btn-primary" type="submit" name="submit" value="Update" id="id_date_form_submit_btn"/>
                <input class="btn" type="button" name="clear" value="Clear" id="id_date_form_clear_btn"/>
            </form>
        </div>
    </div>

    <div class="row-fluid">
        <div class="span6">
            <h3>Hours by Project</h3>
            <table class="table table-bordered table-striped table-condensed">
                <tbody>
                    {% for entry in project_totals %}
                        <tr>
                            <td><a href="{% timesheet_url 'project' entry.project__id from_date %}">{{ entry.project__name }}</a></td>
                            <td class="hours">{{ entry.total_hours|floatformat:2 }}</td>
                        </tr>
                    {% endfor %}
                    <tr>
                        <th colspan="2">&nbsp;</th>
                    </tr>
                    <tr>
                        <th>Total:</th>
                        <td class="hours">{{ total_hours|floatformat:2 }}</td>
                    </tr>
                </tbody>
            </table>
        </div>

        <div class="span6">
            <h3>Hours by People</h3>
            <table class="table table-striped table-bordered table-condensed">
                <tbody>
                    {% for entry in people_totals %}
                        <tr>
                            <td>
                                <a href="{% timesheet_url 'user' entry.user from_date %}">
                                    {{ entry.user__first_name}} {{ entry.user__last_name }}
                                </a>
                            </td>
                            <td class="hours">{{ entry.total_hours|floatformat:2 }}</td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
{% endblock report_content %}
