{% load lucide ui %} {% comment %} What the platform bills this club: plan, periods, and the modals for changing plan, opening a period, and recording a payment. Included with `club`, `subscription`, `dues`, `today`, `subscription_form`, `open_period_form`, `open_period_blurb` already in context. {% endcomment %}

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

{% if subscription %} {% endif %}
{% if not subscription %}

This club is not billed for anything. Put it on a tier to start.

{% else %}

On plan {{ subscription.tier.name }}. {% if subscription.auto_renew %} Renews automatically 30 days before the period ends. {% else %} Auto-renew off — you must open each period by hand, or this club uses the platform for free. {% endif %} {% if subscription.auto_archive %} Archived automatically when a period goes unpaid past its grace period. {% else %} Auto-archive off — it will never be archived for non-payment. {% endif %}

{% for due in dues %} {% for payment in due.payments.all %} {% endfor %} {% empty %} {% endfor %}
Period Billed Paid Status
{{ due.period_start|date:"j M Y" }} — {{ due.period_end|date:"j M Y" }}
{{ due.tier.name }} · {{ due.invoice.number }} · grace to {{ due.grace_until|date:"j M Y" }}
€{{ due.amount|floatformat:2 }} €{{ due.amount_paid|floatformat:2 }} {% if due.status == "paid" %} {% lucide "check" size=12 %} Paid {% elif due.status == "waived" %} {% lucide "check" size=12 %} Waived {% elif 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 %} {% if due.is_owing %} {% if not due.payments.all %}
{% csrf_token %}
{% endif %} {% endif %} {% lucide "file-down" size=14 %} Download invoice
{% lucide "corner-down-right" size=12 %} {{ payment.paid_at|date:"j M Y" }} · {{ payment.get_method_display }}{% if payment.reference %} · {{ payment.reference }}{% endif %} €{{ payment.amount|floatformat:2 }}
No periods billed yet.
{% comment %} Dialogs live outside the table: may only contain elements. {% endcomment %} {% for due in dues %} {% if due.is_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" form=due.payment_form action_url=due_pay_url submit_label="Record payment" submit_icon="banknote" %} {% endif %} {% endfor %} {% endif %}
{% url 'controlpanel:club_subscribe' club.pk as subscribe_url %} {% include "controlpanel/_modal_form.html" with modal_id="subscription_modal" title=subscription|yesno:"Change plan,Start billing" form=subscription_form action_url=subscribe_url submit_label="Save plan" submit_icon="layers" blurb="Changing tier does not re-bill: the current period keeps the amount it was issued at, and the new rate applies from the next one." %} {% if subscription %} {% url 'controlpanel:club_open_period' club.pk as open_period_url %} {% include "controlpanel/_modal_form.html" with modal_id="open_period_modal" title=club.is_archived|yesno:"Reactivate,Open period" form=open_period_form action_url=open_period_url submit_label="Open period" submit_icon="calendar-plus" blurb=open_period_blurb %} {% endif %}