<%# locals: (club:, entitlements: nil, subscription: nil, on_billing_page: false) %>
<% current_plan = entitlements&.plan || subscription&.plan || Plan["free"] %>
<p style="color:#aaa;margin-bottom:8px">
  Società: <strong><%= club.name %></strong>
  · Piano attuale: <strong><%= current_plan.name %></strong>
  <% if subscription&.admin_comped? %>
    <span style="color:#ffb74d">(omaggio Match Live TV)</span>
  <% end %>
  (valido per tutte le squadre)
  <% unless local_assigns[:on_billing_page] %>
    · <%= link_to "Gestisci abbonamento", public_club_billing_path(club) %>
  <% end %>
</p>
<% if subscription&.stripe_subscription_id.present? %>
  <p style="color:#888;font-size:0.9rem;margin-top:0">
    <% if subscription.cancel_at_period_end? %>
      <span style="color:#e53935">
        Abbonamento valido fino al
        <strong><%= subscription.current_period_end.present? ? l_local(subscription.current_period_end.to_date) : "fine periodo" %></strong>,
        poi piano Free.
      </span>
    <% elsif subscription.plan_change_pending? && subscription.pending_plan.present? %>
      <span style="color:#ffb74d">
        Dal <strong><%= subscription.current_period_end.present? ? l_local(subscription.current_period_end) : "prossimo rinnovo" %></strong>
        passerai a <strong><%= subscription.pending_plan.name %></strong>
        <% if subscription.pending_billing_interval.present? %>
          (<%= Billing::Stripe::PriceCatalog.label(plan_slug: subscription.pending_plan.slug, interval: subscription.pending_billing_interval) %>)
        <% end %>.
        Fino ad allora resta attivo <strong><%= current_plan.name %></strong>.
      </span>
    <% elsif subscription.current_period_end.present? %>
      Prossimo rinnovo: <strong><%= l_local(subscription.current_period_end) %></strong>
      <% if subscription.billing_interval.present? %>
        · <%= Billing::Stripe::PriceCatalog.label(plan_slug: current_plan.slug, interval: subscription.billing_interval) %>
      <% end %>
    <% end %>
  </p>
<% end %>
