{% extends "layouts/base.kdl.j2" %}

{% set web_title="Invoices" %}
{% set header_title="Invoices: List" %}

{% block head_extra %}
link rel="stylesheet" href="/static/styles/invoices.css"
{% endblock %}

{% block content %}
table class="invoice-table" {
  tr {
    th "ID"
    th "Status"
    th "Debtor"
    th "Amount"
    th "Expiry"
    th "Comments"
  }

  {% for invoice in invoices %}
  {% set overdue = invoice.expiry | is_overdue %}
  tr class="{{ 'overdue' if overdue else 'pending' }}" {
    td "{{ invoice.id }}"
    td "{{ "Overdue" if overdue else "Pending" }}"
    td "{{ invoice.debtor }}"
    td "{{ invoice.amount }}"
    td "{{ invoice.expiry }}"
    td "{{ invoice.comment or 'None' }}"
  }
  {% endfor %}
}
{% endblock %}
