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

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

{% block content %}

<h2>
    Invoice details for {{ project.name }} hours
    {% if from_date %}
        from {{ from_date }} to {{ to_date }}
    {% else %}
        through {{ to_date }}{% endif %}
</h2>

<ul class='header-actions-left'>
    <li>
        <a href="{% url 'list_invoices' %}">Previous Invoices</a>
    </li>
    <li>
        View Invoice
    </li>
    <li>
        <a href="{% url 'edit_invoice' invoice.id %}">Edit Invoice</a>
    </li>
    <li>
        <a href="{% url 'view_invoice_csv' invoice.id %}">Download CSV</a>
    </li>
</ul>

{% include 'timepiece/time-sheet/invoice/_invoice_detail.html' %}

{% if totals %}
<h3>Totals</h3>
    <table>
        <tr>
            <th>Activity Type</th>
            <th>Total Hours</th>
        </tr>
        {% for type, hours in totals %}
            <tr>
                <th>{{ type }}</th>
                <td class="hours"> {{ hours }} </td>
            </tr>
        {% endfor %}
    </table>
<br />
{% endif %}

<h3>Selected Entries</h3>
{% include 'timepiece/time-sheet/_weekly_entry_list.html' %}

{% endblock %}
