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

{% block title %}Edit Invoice{% endblock title %}

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

{% block content %}
    <div class="row-fluid">
        <div class="span12">
            {% include "timepiece/invoice/_subnav.html" with invoice=invoice current="edit" %}
        </div>
    </div>

    <div class="row-fluid">
        <div class="span12">
            <form class="form-horizontal" method="post">{% csrf_token %}
                {{ invoice_form.as_p }}
                <input class="btn" type="submit" name="submit" value="Update Invoice" />
                <a class="btn btn-danger" href="{% url 'delete_invoice' invoice.pk %}">Delete Invoice</a>
            </form>
        </div>
    </div>

    <div class="row-fluid">
        <div class="span12">
            {% if billable_entries %}
                <h3>Selected Billable Entries</h3>
                {% with entries=billable_entries %}
                    {% include 'timepiece/invoice/_edit_entry_list.html' %}
                {% endwith %}
            {% else %}
                <p>No billable entries were found.</p>
            {% endif %}
            {% if nonbillable_entries %}
                <h3>Selected Non-billable Entries</h3>
                {% with entries=nonbillable_entries %}
                    {% include 'timepiece/invoice/_edit_entry_list.html' %}
                {% endwith %}
            {% else %}
                <p>No non-billable entries were found.</p>
            {% endif %}
        </div>
    </div>
{% endblock content %}
