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>
This commit is contained in:
2026-05-29 07:23:13 +02:00
parent 4083bc5dee
commit f4b7be0f80
156 changed files with 5033 additions and 2033 deletions

View File

@@ -0,0 +1,29 @@
module Public
module BillingHelper
def plan_billing_action(current_slug:, target_plan:, stripe_subscription_active:)
return { kind: :current, label: "Piano attuale" } if current_slug == target_plan.slug
if target_plan.slug == "free"
return { kind: :contact, label: "Contatta il supporto per downgrade." }
end
unless MatchLiveTv.stripe_enabled?
return { kind: :disabled, label: "Stripe non configurato" }
end
if current_slug == "free" || !stripe_subscription_active
return { kind: :checkout, label: "Attiva #{target_plan.name}" }
end
if Plan.tier(target_plan.slug) > Plan.tier(current_slug)
{ kind: :change, label: "Passa a #{target_plan.name}" }
else
{ kind: :change, label: "Passa a #{target_plan.name}" }
end
end
def stripe_subscription_active?(subscription)
subscription&.stripe_subscription_id.present? && subscription.active?
end
end
end

View File

@@ -33,6 +33,28 @@ module Public
end
end
def live_match_card_heading(match)
team = match.team
club_name = team.club&.name.presence || "Società"
content_tag(:h3, class: "live-card__title") do
safe_join([
content_tag(:span, club_name, class: "live-card__club"),
content_tag(:span, "#{team.name} vs #{match.opponent_name}", class: "live-card__matchup")
])
end
end
def live_match_page_heading(match)
team = match.team
club_name = team.club&.name.presence || "Società"
content_tag(:div, class: "live-page-heading") do
safe_join([
content_tag(:p, club_name, class: "live-page-heading__club"),
content_tag(:h1, "#{team.name} vs #{match.opponent_name}", class: "live-page-heading__matchup")
])
end
end
def live_score_points_label(match, score_state)
return "" unless score_state

View File

@@ -0,0 +1,32 @@
module RosterHelper
def roster_person_avatar(person, team, size: 96)
primary = team.effective_primary_color
secondary = team.effective_secondary_color
style = "--avatar-primary:#{primary};--avatar-secondary:#{secondary};width:#{size}px;height:#{size}px"
if person.photo_url.present?
image_tag person.photo_url, alt: person.full_name, class: "roster-avatar roster-avatar--photo",
style: style, width: size, height: size
else
tag.div(
person.initials,
class: "roster-avatar roster-avatar--placeholder",
style: "#{style};font-size:#{(size * 0.34).round}px",
aria: { label: person.full_name }
)
end
end
def roster_category_options
TeamRosterMember::DISPLAY_ORDER.map do |cat|
[TeamRosterMember::CATEGORY_LABELS[cat], cat]
end
end
def roster_player_role_options(selected = nil)
options_for_select(
[["— Seleziona ruolo —", ""]] + TeamRosterMember::VOLLEYBALL_PLAYER_ROLES.map { |r| [r, r] },
selected
)
end
end

View File

@@ -0,0 +1,9 @@
module StaffHelper
def staff_role_label(membership, team)
Teams::StaffCoverage.new(team).role_label_for(membership)
end
def staff_coverage_for(team)
Teams::StaffCoverage.new(team)
end
end