Files
MatchLiveTv/backend/app/views/shared/_plan_cards.html.erb
Emiliano Frascaro 15e57cddee Card piani: un solo stile di bordo grigio per tutte e tre.
Rimuove featured con contorno rosso che creava 2 card rosse e 1 grigia.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 17:23:51 +02:00

81 lines
4.5 KiB
Plaintext

<%# 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? %>
<div class="plans">
<% @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 %>
<div class="plan-card">
<h3><%= plan.name %></h3>
<% if plan.slug == "free" %>
<div class="plan-price">€0</div>
<% 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") %>
<div class="plan-price" style="color:#e53935"><%= light_yearly %></div>
<p class="plan-price-alt">oppure <strong><%= light_monthly %></strong></p>
<% 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") %>
<div class="plan-price"><%= full_yearly %></div>
<p class="plan-price-alt">oppure <strong><%= full_monthly %></strong></p>
<% end %>
<ul>
<li>Responsabili trasmissione: <strong><%= plan.max_staff_transmission || "illimitato" %></strong> / anno per squadra</li>
<li>Partite: <strong><%= plan.concurrent_streams_limit || "illimitate" %></strong> in contemporanea (tutta la società)</li>
<li>Replay: <%= plan.recordings_enabled? ? "#{plan.recording_days} giorni" : "no" %></li>
<li>YouTube: <% if plan.slug == "premium_light" %>Match Live TV<% elsif plan.youtube_enabled? %>canale società<% else %>no<% end %></li>
</ul>
<% if billing_mode %>
<% action_kind = action[:kind] %>
<% if action_kind == :current %>
<span class="btn btn-secondary" style="opacity:0.7"><%= action[:label] %></span>
<% elsif action_kind == :contact || action_kind == :disabled %>
<p class="plan-action-hint"><%= action[:label] %></p>
<% elsif action_kind == :checkout_options || action_kind == :change_options || action_kind == :interval_switch %>
<% if billing_profile_blocks_premium?(club) %>
<p class="plan-action-hint" style="color:#e53935;margin-bottom:10px">
<%= billing_profile_incomplete_message(club) %>
</p>
<%= link_to "Completa dati di fatturazione",
public_club_billing_profile_path(club, plan: plan.slug),
class: "btn btn-primary" %>
<% else %>
<div class="plan-interval-actions">
<% 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 %>
</div>
<% end %>
<% if action_kind == :interval_switch && action[:current_interval].present? %>
<p class="plan-action-hint">Fatturazione attuale: <%= Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: action[:current_interval]) %></p>
<% end %>
<% end %>
<% elsif plan.slug == "free" %>
<%= link_to "Inizia gratis", public_signup_path, class: "btn btn-secondary" %>
<% else %>
<div class="plan-interval-actions">
<% 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 %>
</div>
<% end %>
</div>
<% end %>
</div>