<%# locals: (club:, payments:) %>

<%= t("billing.documents.heading") %>

<%= t("billing.documents.lead") %>

<% unless club.billing_profile_complete? %>
<%= t("billing.documents.incomplete_title") %> <%= t("billing.documents.incomplete_body") %> <%= link_to t("billing.documents.complete_now"), public_club_billing_profile_path(club), class: "btn btn-secondary", style: "margin-top:10px;display:inline-block" %>
<% else %>

<%= t("billing.documents.holder_label", summary: club.billing_profile_summary) %> · <%= link_to t("billing.documents.edit_data"), public_club_billing_profile_path(club) %>

<% end %>

<%= t("billing.documents.table_heading") %>

<% if payments.any? %>
<% payments.each do |payment| %> <% inv = payment.invoice_for_display %> <% end %>
<%= t("billing.documents.col_date") %> <%= t("billing.documents.col_description") %> <%= t("billing.documents.col_amount") %> <%= t("billing.documents.col_status") %> <%= t("billing.documents.col_invoice") %>
<%= payment.paid_at ? l_local(payment.paid_at, format: :short) : "—" %> <%= payment.display_description %> <%= payment.formatted_amount %> <%= payment.display_status %> <% if inv.present? %> <%= inv.display_number %> · <%= inv.display_status %> <% else %> — <% end %> <% if inv&.downloadable? %> <%= link_to t("billing.documents.download_pdf"), public_club_billing_invoice_path(club, inv) %> <% elsif inv&.draft? %> <%= t("billing.documents.pdf_preparing") %> <% else %> <% end %>
<% else %>

<%= t("billing.documents.no_payments") %>

<% end %>