<%# locals: (club: nil, entitlements: nil, subscription: nil, current_plan_slug: nil, show_stripe_portal: false) %> <% club ||= @club %> <% entitlements ||= @entitlements %> <% subscription ||= @subscription %> <% current_slug = local_assigns.fetch(:current_plan_slug, nil).presence || entitlements&.plan&.slug || subscription&.plan&.slug || "free" %> <% current_interval = subscription&.billing_interval %> <% billing_mode = club.present? %>
<% @plans.each do |plan| %> <% action = billing_mode ? plan_billing_action( current_slug: current_slug, target_plan: plan, stripe_subscription_active: stripe_subscription_active?(subscription), current_interval: current_interval ) : nil %> <% featured = billing_mode ? (plan.slug == current_slug) : (plan.slug == "premium_light") %>
">

<%= plan.name %>

<% if plan.slug == "free" %>
€0
<% elsif plan.slug == "premium_light" %> <% light_yearly = Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: "yearly") %> <% light_monthly = Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: "monthly") %>
<%= light_yearly %>

oppure <%= light_monthly %>

<% else %> <% full_yearly = Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: "yearly") %> <% full_monthly = Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: "monthly") %>
<%= full_yearly %>

oppure <%= full_monthly %>

<% end %> <% if billing_mode %> <% action_kind = action[:kind] %> <% if action_kind == :current %> <%= action[:label] %> <% elsif action_kind == :contact || action_kind == :disabled %>

<%= action[:label] %>

<% elsif action_kind == :checkout_options || action_kind == :change_options || action_kind == :interval_switch %> <% if billing_profile_blocks_premium?(club) %>

<%= billing_profile_incomplete_message(club) %>

<%= link_to "Completa dati di fatturazione", public_club_billing_profile_path(club, plan: plan.slug), class: "btn btn-primary" %> <% else %>
<% plan_intervals_for_display(action[:intervals]).each do |interval| %> <% btn_kind = action_kind == :checkout_options ? :checkout : :change %> <%= link_to plan_interval_button_label(plan, interval, kind: btn_kind), plan_interval_checkout_path(club, plan, interval), class: plan_interval_button_class(interval) %> <% end %>
<% end %> <% if action_kind == :interval_switch && action[:current_interval].present? %>

Fatturazione attuale: <%= Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: action[:current_interval]) %>

<% end %> <% end %> <% elsif plan.slug == "free" %> <%= link_to "Inizia gratis", public_signup_path, class: "btn btn-secondary" %> <% else %>
<% plan_intervals_for_display(Billing::Stripe::PriceCatalog.available_intervals(plan_slug: plan.slug)).each do |interval| %> <%= link_to "Registrati — #{Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: interval)}", public_signup_path(plan: plan.slug, interval: interval), class: plan_interval_button_class(interval) %> <% end %>
<% end %>
<% end %>