{% extends 'base.html' %}
{% load paginator from filters %}

{% block title %}Invoices{% endblock %}

{% block content %}
    <div class="col-sm-12">
        <h2>Invoices</h2>
        {% if is_paginated %}
            <div class="col-md-6 col-md-offset-6 col-sm-12 text-right">
                {% paginator %}
            </div>
        {% endif %}
        <table class="table table-responsive table-hover">
            <thead>
            <tr>
                <th>#</th>
                <th>Event</th>
                <th>Invoice Date</th>
                <th>Balance</th>
                <th></th>
            </tr>
            </thead>
            <tbody>
            {% for object in object_list %}
                <tr class="{% if object.void %}danger{% elif object.balance == 0 %}success{% endif %}">
                    <td>{{ object.pk }}</td>
                    <td><a href="{% url 'event_detail' object.event.pk %}" target="_blank">N{{ object.event.pk|stringformat:"05d" }}</a>: {{ object.event.name }}</td>
                    <td>{{ object.invoice_date }}</td>
                    <td>{{ object.balance|floatformat:2 }}</td>
                    <td class="text-right">
                        <a href="{% url 'invoice_detail' object.pk %}" class="btn btn-default">
                            <span class="glyphicon glyphicon-pencil"></span>
                        </a>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
        {% if is_paginated %}
            <div class="col-md-6 col-md-offset-6 col-sm-12 text-right">
                {% paginator %}
            </div>
        {% endif %}
    </div>
{% endblock %}