Tutte le view marketing, legali, viewer, dashboard e admin usano t(); mailer utente-facing e flash localizzati; admin con LocaleResolver e selettore lingua. Co-authored-by: Cursor <cursoragent@cursor.com>
92 lines
4.7 KiB
ERB
92 lines
4.7 KiB
ERB
<%# 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,
|
|
subscription: subscription
|
|
) : nil %>
|
|
<div class="plan-card">
|
|
<%= render "shared/plan_title", plan: plan %>
|
|
<% 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"><%= raw t("pages.plans.price_alt_html", price: light_monthly) %></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"><%= raw t("pages.plans.price_alt_html", price: full_monthly) %></p>
|
|
<% end %>
|
|
<ul>
|
|
<li><%= raw t("pages.plans.staff_html", count: plan.max_staff_transmission || t("pages.plans.staff_unlimited")) %></li>
|
|
<li><%= raw t("pages.plans.matches_html", count: plan.concurrent_streams_limit || t("pages.plans.matches_unlimited")) %></li>
|
|
<li><%= raw t(
|
|
"pages.plans.replay_html",
|
|
value: plan.recordings_enabled? ? t("pages.plans.replay_days", count: plan.recording_days) : t("pages.plans.replay_none")
|
|
) %></li>
|
|
<li><%= raw t(
|
|
"pages.plans.youtube_html",
|
|
value: if plan.slug == "premium_light"
|
|
t("pages.plans.youtube_mltv")
|
|
elsif plan.youtube_enabled?
|
|
t("pages.plans.youtube_club")
|
|
else
|
|
t("pages.plans.youtube_none")
|
|
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 == :none %>
|
|
<% elsif action_kind.in?(%i[contact 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 t("pages.plans.complete_billing"),
|
|
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_options : action_kind %>
|
|
<%= 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 %>
|
|
<% end %>
|
|
<% elsif plan.slug == "free" %>
|
|
<%= link_to t("pages.plans.start_free"), 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 t("pages.plans.register_with_price", price: 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>
|
|
|