Files
MatchLiveTv/backend/app/views/shared/_plan_cards.html.erb
Emiliano Frascaro f4b7be0f80 Billing Stripe, link regia mobile e staff solo trasmissione.
Aggiunge fatturazione club, pagina regia condivisibile senza account, roster squadre e rimuove la modalità controller dall'app (v1.1.0).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 07:23:13 +02:00

56 lines
3.1 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" %>
<% 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)
) : nil %>
<div class="plan-card <%= "featured" if plan.slug == current_slug || (!billing_mode && plan.slug == "premium_light") %>">
<h3><%= plan.name %></h3>
<% if plan.slug == "free" %>
<div class="plan-price">€0</div>
<% elsif plan.slug == "premium_light" %>
<div class="plan-price" style="color:#e53935">€40<span style="font-size:1rem;font-weight:400">/anno</span></div>
<p style="color:#aaa;font-size:0.9rem;margin:-8px 0 12px">oppure <strong>€5</strong>/mese</p>
<% else %>
<div class="plan-price">€200<span style="font-size:1rem;font-weight:400">/anno</span></div>
<p style="color:#aaa;font-size:0.9rem;margin:-8px 0 12px">oppure <strong>€20</strong>/mese</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 TV Light<% elsif plan.youtube_enabled? %>canale società<% else %>no<% end %></li>
</ul>
<% if billing_mode %>
<% case action[:kind] %>
<% when :current %>
<span class="btn btn-secondary" style="opacity:0.7"><%= action[:label] %></span>
<% when :contact, :disabled %>
<p style="color:#888;font-size:0.85rem"><%= action[:label] %></p>
<% when :checkout, :change %>
<%= link_to action[:label], public_club_checkout_path(club, plan: plan.slug), class: "btn btn-primary" %>
<% end %>
<% elsif plan.slug == "free" %>
<%= link_to "Inizia gratis", public_signup_path, class: "btn btn-secondary" %>
<% else %>
<%= link_to "Registrati", public_signup_path(plan: plan.slug), class: "btn btn-primary" %>
<% end %>
</div>
<% end %>
</div>
<% if show_stripe_portal && billing_mode && subscription&.premium? && MatchLiveTv.stripe_enabled? && subscription&.stripe_customer_id.present? %>
<p style="margin-top:20px">
<%= button_to "Gestisci fatturazione su Stripe", public_club_portal_path(club), class: "btn btn-secondary" %>
<span style="color:#888;font-size:0.85rem;display:block;margin-top:8px">Cambia metodo di pagamento, scarica fatture o disdici l'abbonamento.</span>
</p>
<% end %>