{% 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 not subscription %} {% endif %} {% if subscription %} {% endif %}
{% comment %} Paying up does not un-archive a club on its own -- restoring is a deliberate act, because a club can also be archived by hand for reasons that have nothing to do with money. This is the prompt that makes the deliberate act one click away instead of something you have to remember to go and check. {% endcomment %} {% if club.is_archived and dues_settled %}
{% lucide "circle-check" size=16 %} This club is archived but owes nothing. Reactivating will restore access and open its next period.
{% endif %} {% if not subscription %}

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

{% else %}

On plan {{ subscription.plan.name }}. {% if subscription.trial_ends_at %} {% lucide "hourglass" size=12 %} Trial On trial until {{ subscription.trial_ends_at|date:"j M Y" }}, then switches to {{ subscription.post_trial_plan.name }}. {% endif %} {{ subscription.plan.duration_months }}-month periods, archived {{ subscription.plan.grace_days }} days after a period starts if unpaid. {% if subscription.auto_renew %} Renews automatically {{ subscription.plan.renewal_lead_days }} 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.plan.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 plan does not re-bill: the current period keeps the amount it was issued at, and the new rate applies from the next one." %} {% if not subscription %} {% url 'controlpanel:club_trial_start' club.pk as trial_start_url %} {% include "controlpanel/_modal_form.html" with modal_id="trial_modal" title="Start trial" form=trial_form action_url=trial_start_url submit_label="Start trial" submit_icon="hourglass" blurb="The trial period is billed like any other, on the trial plan you pick. It switches to the plan you pick here automatically the next time a period is opened after it ends -- no follow-up needed." %} {% endif %} {% 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 %}