{% extends 'timepiece/time-sheet/invoice/base.html' %}
{% load timepiece_tags %}
{% load url from future %}

{% block title %}Invoice Detail{% endblock %}

{% block crumbs %}
    {{ block.super }}
    <li><span class="divider">/</span> <a href="{% url 'view_invoice' invoice.pk %}">Invoice Detail</a></li>
{% endblock crumbs %}

{% block content %}
    <div class="row">
        <div class="span12">
            {% invoice_subheaders 'detail' %}
        </div>
    </div>

    <div class="row">
        <div class="span6">
            {% include 'timepiece/time-sheet/invoice/_invoice_detail.html' %}
        </div>

        <div class="span6">
            {% if totals %}
                <h3>Totals</h3>
                <table class="table table-bordered">
                    <tr>
                        <th>Activity Type</th>
                        <th>Total Hours</th>
                    </tr>
                    {% for name, hours_activities in totals %}
                        <tr class="ledger_header">
                            <th>{{ name|title }}</th>
                            <td class="hours"> {{ hours_activities.0 }} </td>
                        </tr>
                        {% for name, hours in hours_activities.1 %}
                            <tr>
                                <td>{{ name|title }}</td>
                                <td class="hours">{{ hours }} </td>
                            </tr>
                        {% endfor %}
                    {% endfor %}
                </table>
            {% endif %}
        </div>
    </div>
{% endblock %}
