{% extends "controlpanel/base.html" %} {% load lucide ui %} {% block heading %}Billing{% endblock heading %} {% block actions %} {% endblock actions %} {% block panel %} {% url 'controlpanel:tier_create' as tier_create_url %} {% include "controlpanel/_modal_form.html" with modal_id="tier_create_modal" title="New plan" form=tier_form action_url=tier_create_url submit_label="Create plan" submit_icon="plus" %}

{% lucide "layers" size=18 %} Plans

{% comment %} Prices are dated, not edited. A rate change is a new row with a future active_from; every period already opened keeps the amount it was billed at, so raising the price cannot rewrite an invoice you have already sent. {% endcomment %}

A rate change only takes effect as of a certain date. Periods already billed keep the amount they were issued at.

{% for tier in tiers %} {% empty %} {% endfor %}
Plan Clubs Prices
{{ tier.name }}
{% if not tier.is_active %}Retired{% endif %} {% if tier.description %}
{{ tier.description }}
{% endif %}
{{ tier.club_count }} {% for price in tier.prices.all %}
€{{ price.amount|floatformat:2 }} from {{ price.active_from|date:"j M Y" }} {% if price.active_from > today %}Scheduled{% endif %}
{% empty %} No price — cannot be billed {% endfor %}
No plans yet.
{% comment %} Dialogs live outside the table: may only contain elements. {% endcomment %} {% for tier in tiers %} {% url 'controlpanel:tier_price_create' tier.pk as tier_price_url %} {% include "controlpanel/_modal_form.html" with modal_id=tier.pk|dom_id:"tier_price_modal" title="New price — "|add:tier.name form=tier.price_form action_url=tier_price_url submit_label="Add price" submit_icon="euro" %} {% url 'controlpanel:tier_update' tier.pk as tier_update_url %} {% include "controlpanel/_modal_form.html" with modal_id=tier.pk|dom_id:"tier_edit_modal" title="Edit "|add:tier.name form=tier.edit_form action_url=tier_update_url submit_label="Save" submit_icon="check" %} {% endfor %}

{% lucide "receipt-euro" size=18 %} Owed

{% for due in owing %} {% empty %} {% endfor %}
Club Period Owed Status
{{ due.club.name }}
{{ due.tier.name }}
{{ due.period_start|date:"j M Y" }} — {{ due.period_end|date:"j M Y" }}
Grace to {{ due.grace_until|date:"j M Y" }}
€{{ due.balance|floatformat:2 }} {% if due.grace_until < today %} {% lucide "triangle-alert" size=12 %} Overdue {% elif due.period_end < today %} {% lucide "hourglass" size=12 %} In grace {% else %} {{ due.get_status_display }} {% endif %} {% lucide "file-down" size=14 %} Download invoice
Nothing outstanding.
{% comment %} Dialogs live outside the table: may only contain elements. {% endcomment %} {% for due in owing %} {% url 'controlpanel:due_pay' due.pk as due_pay_url %} {% include "controlpanel/_modal_form.html" with modal_id=due.pk|dom_id:"due_pay_modal" title="Record payment — "|add:due.club.name form=due.payment_form action_url=due_pay_url submit_label="Record payment" submit_icon="banknote" %} {% endfor %} {% endblock panel %}