Aggiunge pagamento con bonifico e importo concordato per società.
Il piano si attiva solo dopo la conferma admin; Stripe resta a listino se non c'è un prezzo commerciale. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -18,6 +18,52 @@
|
||||
club: @filter_club,
|
||||
subscription: @filter_club.subscription,
|
||||
return_to: admin_billing_path(club_id: @filter_club.id) %>
|
||||
<%= render "admin/clubs/quote_form",
|
||||
club: @filter_club,
|
||||
quote: @filter_club.active_billing_quote,
|
||||
return_to: admin_billing_path(club_id: @filter_club.id) %>
|
||||
<% end %>
|
||||
|
||||
<h2 style="margin-top:8px;font-size:1.15rem"><%= t("admin.billing.index.transfers_title") %></h2>
|
||||
<p style="color:#666;margin-bottom:16px"><%= t("admin.billing.index.transfers_description") %></p>
|
||||
|
||||
<% if @pending_transfers.any? %>
|
||||
<div class="billing-pending-list" style="margin-bottom:32px">
|
||||
<% @pending_transfers.each do |order| %>
|
||||
<article id="transfer-<%= order.id %>" class="billing-pending-card">
|
||||
<header class="billing-pending-card__head">
|
||||
<div>
|
||||
<strong><%= order.club.name %></strong>
|
||||
· <%= order.plan.name %>
|
||||
· <%= t("admin.billing.index.kind_#{order.quoted? ? 'quote' : 'list'}") %>
|
||||
· <strong><%= order.formatted_amount %></strong>
|
||||
· <%= order.created_at.to_date.strftime("%d/%m/%Y") %>
|
||||
</div>
|
||||
</header>
|
||||
<div class="billing-pending-card__body">
|
||||
<p style="margin:0 0 12px">
|
||||
<%= t("admin.billing.index.transfers_table.causal") %>:
|
||||
<strong><%= order.payment_causal %></strong>
|
||||
</p>
|
||||
<%= form_with url: admin_billing_transfer_confirm_path(order),
|
||||
method: :post, multipart: true, local: true, class: "billing-upload-form" do %>
|
||||
<label class="billing-upload-form__label">
|
||||
<%= t("admin.billing.index.pdf_optional") %>
|
||||
<%= file_field_tag :pdf, accept: "application/pdf" %>
|
||||
</label>
|
||||
<%= submit_tag t("admin.billing.index.confirm_button"), class: "admin-btn admin-btn--primary" %>
|
||||
<% end %>
|
||||
<%= button_to t("admin.billing.index.cancel_button"),
|
||||
admin_billing_transfer_cancel_path(order),
|
||||
method: :post,
|
||||
class: "admin-btn admin-btn--secondary",
|
||||
form: { style: "margin-top:8px", data: { turbo_confirm: t("admin.billing.index.cancel_confirm") } } %>
|
||||
</div>
|
||||
</article>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="muted" style="margin-bottom:28px"><%= t("admin.billing.index.transfers_none") %></p>
|
||||
<% end %>
|
||||
|
||||
<% if @pending_payments.any? %>
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<%# locals: (club:, quote:, return_to: nil) %>
|
||||
<section class="admin-comped-card" style="margin-bottom:24px;padding:16px;border:1px solid #2e5a3c;border-radius:8px;background:#142018">
|
||||
<h2 style="margin:0 0 8px;font-size:1.1rem"><%= t("admin.quote.title") %></h2>
|
||||
<p style="color:#bbb;font-size:0.9rem;margin:0 0 14px">
|
||||
<%= t("admin.quote.description") %>
|
||||
</p>
|
||||
|
||||
<% if quote %>
|
||||
<p style="margin:0 0 12px">
|
||||
<%= raw t("admin.quote.active_html",
|
||||
plan: quote.plan.name,
|
||||
interval: t("admin.quote.interval_#{quote.billing_interval}"),
|
||||
amount: quote.formatted_amount) %>
|
||||
<% if quote.note.present? %>
|
||||
<br><span style="color:#888;font-size:0.85rem"><%= t("admin.quote.note_label") %> <%= quote.note %></span>
|
||||
<% end %>
|
||||
</p>
|
||||
<% else %>
|
||||
<p style="margin:0 0 12px;color:#888"><%= t("admin.quote.none") %></p>
|
||||
<% end %>
|
||||
|
||||
<%= form_with url: set_quote_admin_club_path(club), method: :post, local: true do %>
|
||||
<%= hidden_field_tag :return_to, return_to if return_to.present? %>
|
||||
<div style="display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end">
|
||||
<label style="display:flex;flex-direction:column;gap:4px;font-size:0.85rem">
|
||||
<%= t("admin.quote.plan_label") %>
|
||||
<%= select_tag :plan_slug,
|
||||
options_for_select(
|
||||
[["Premium Light", "premium_light"], ["Premium Full", "premium_full"]],
|
||||
quote&.plan_slug
|
||||
),
|
||||
required: true,
|
||||
class: "admin-input" %>
|
||||
</label>
|
||||
<label style="display:flex;flex-direction:column;gap:4px;font-size:0.85rem">
|
||||
<%= t("admin.quote.interval_label") %>
|
||||
<%= select_tag :interval,
|
||||
options_for_select(
|
||||
[[t("admin.quote.interval_yearly"), "yearly"], [t("admin.quote.interval_monthly"), "monthly"]],
|
||||
quote&.billing_interval || "yearly"
|
||||
),
|
||||
required: true,
|
||||
class: "admin-input" %>
|
||||
</label>
|
||||
<label style="display:flex;flex-direction:column;gap:4px;font-size:0.85rem">
|
||||
<%= t("admin.quote.amount_label") %>
|
||||
<%= text_field_tag :amount_euros,
|
||||
quote ? format("%.2f", quote.amount_cents / 100.0) : nil,
|
||||
placeholder: t("admin.quote.amount_placeholder"),
|
||||
required: true,
|
||||
class: "admin-input",
|
||||
inputmode: "decimal" %>
|
||||
</label>
|
||||
<label style="display:flex;flex-direction:column;gap:4px;font-size:0.85rem;flex:1;min-width:200px">
|
||||
<%= t("admin.quote.commercial_note_label") %>
|
||||
<%= text_field_tag :note, quote&.note, class: "admin-input", style: "width:100%" %>
|
||||
</label>
|
||||
<%= submit_tag t("admin.quote.save_button"), class: "admin-btn admin-btn--primary" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if quote %>
|
||||
<div style="margin-top:12px">
|
||||
<%= button_to t("admin.quote.revoke_button"),
|
||||
revoke_quote_admin_club_path(club, return_to: return_to),
|
||||
method: :delete,
|
||||
class: "admin-btn admin-btn--secondary",
|
||||
form: { data: { turbo_confirm: t("admin.quote.revoke_confirm", club: club.name) } } %>
|
||||
</div>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -11,6 +11,7 @@
|
||||
<th><%= t("admin.clubs.index.table.teams") %></th>
|
||||
<th><%= t("admin.clubs.index.table.comped") %></th>
|
||||
<th><%= t("admin.clubs.index.table.stripe") %></th>
|
||||
<th><%= t("admin.clubs.index.table.quote") %></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -30,6 +31,14 @@
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= sub&.stripe_subscription_id.present? ? t("admin.common.yes") : t("admin.common.dash") %></td>
|
||||
<td>
|
||||
<% quote = club.billing_quote %>
|
||||
<% if quote %>
|
||||
<%= quote.plan.name %> · <%= quote.formatted_amount %>
|
||||
<% else %>
|
||||
<%= t("admin.common.dash") %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to t("admin.clubs.index.manage"), admin_club_path(club) %>
|
||||
· <%= link_to t("admin.clubs.index.invoices"), admin_billing_path(club_id: club.id) %>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
</p>
|
||||
|
||||
<%= render "admin/clubs/comped_form", club: @club, subscription: @subscription, return_to: admin_club_path(@club) %>
|
||||
<%= render "admin/clubs/quote_form", club: @club, quote: @quote, return_to: admin_club_path(@club) %>
|
||||
|
||||
<% cred = @club.youtube_credential %>
|
||||
<p style="margin-top:16px">
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<p><%= t("mailers.bank_transfer.instructions.hello") %></p>
|
||||
|
||||
<p><%= raw t("mailers.bank_transfer.instructions.intro_html",
|
||||
club: @club.billing_legal_name.presence || @club.name,
|
||||
plan: @order.plan.name,
|
||||
price: @order.price_label) %></p>
|
||||
|
||||
<p><%= t("mailers.bank_transfer.instructions.not_active_yet") %></p>
|
||||
|
||||
<p>
|
||||
<strong><%= t("mailers.bank_transfer.instructions.iban_label") %></strong> <%= @iban %><br>
|
||||
<strong><%= t("mailers.bank_transfer.instructions.holder_label") %></strong> <%= @holder %><br>
|
||||
<% if @bank_name.present? %>
|
||||
<strong><%= t("mailers.bank_transfer.instructions.bank_label") %></strong> <%= @bank_name %><br>
|
||||
<% end %>
|
||||
<% if @bic.present? %>
|
||||
<strong><%= t("mailers.bank_transfer.instructions.bic_label") %></strong> <%= @bic %><br>
|
||||
<% end %>
|
||||
<strong><%= t("mailers.bank_transfer.instructions.amount_label") %></strong> <%= @order.formatted_amount %><br>
|
||||
<strong><%= t("mailers.bank_transfer.instructions.causal_label") %></strong> <%= @order.payment_causal %>
|
||||
</p>
|
||||
|
||||
<p><%= raw t("mailers.bank_transfer.instructions.proof_html", email: @proof_email) %></p>
|
||||
|
||||
<p><%= t("mailers.bank_transfer.thanks") %><br><%= t("mailers.bank_transfer.signoff") %></p>
|
||||
@@ -0,0 +1,20 @@
|
||||
<%= t("mailers.bank_transfer.instructions.hello") %>
|
||||
|
||||
<%= t("mailers.bank_transfer.instructions.intro_text",
|
||||
club: @club.billing_legal_name.presence || @club.name,
|
||||
plan: @order.plan.name,
|
||||
price: @order.price_label) %>
|
||||
|
||||
<%= t("mailers.bank_transfer.instructions.not_active_yet") %>
|
||||
|
||||
<%= t("mailers.bank_transfer.instructions.iban_label") %> <%= @iban %>
|
||||
<%= t("mailers.bank_transfer.instructions.holder_label") %> <%= @holder %>
|
||||
<% if @bank_name.present? %><%= t("mailers.bank_transfer.instructions.bank_label") %> <%= @bank_name %>
|
||||
<% end %><% if @bic.present? %><%= t("mailers.bank_transfer.instructions.bic_label") %> <%= @bic %>
|
||||
<% end %><%= t("mailers.bank_transfer.instructions.amount_label") %> <%= @order.formatted_amount %>
|
||||
<%= t("mailers.bank_transfer.instructions.causal_label") %> <%= @order.payment_causal %>
|
||||
|
||||
<%= t("mailers.bank_transfer.instructions.proof_text", email: @proof_email) %>
|
||||
|
||||
<%= t("mailers.bank_transfer.thanks") %>
|
||||
<%= t("mailers.bank_transfer.signoff") %>
|
||||
@@ -0,0 +1,10 @@
|
||||
<p><%= t("mailers.bank_transfer.plan_activated.hello") %></p>
|
||||
|
||||
<p><%= raw t("mailers.bank_transfer.plan_activated.body_html",
|
||||
plan: @order.plan.name,
|
||||
club: @club.billing_legal_name.presence || @club.name,
|
||||
until_date: @subscription&.current_period_end ? l(@subscription.current_period_end.to_date, format: :long) : t("mailers.bank_transfer.plan_activated.period_fallback")) %></p>
|
||||
|
||||
<p><%= t("mailers.bank_transfer.plan_activated.invoice_later") %></p>
|
||||
|
||||
<p><%= t("mailers.bank_transfer.thanks") %><br><%= t("mailers.bank_transfer.signoff") %></p>
|
||||
@@ -0,0 +1,11 @@
|
||||
<%= t("mailers.bank_transfer.plan_activated.hello") %>
|
||||
|
||||
<%= t("mailers.bank_transfer.plan_activated.body_text",
|
||||
plan: @order.plan.name,
|
||||
club: @club.billing_legal_name.presence || @club.name,
|
||||
until_date: @subscription&.current_period_end ? l(@subscription.current_period_end.to_date, format: :long) : t("mailers.bank_transfer.plan_activated.period_fallback")) %>
|
||||
|
||||
<%= t("mailers.bank_transfer.plan_activated.invoice_later") %>
|
||||
|
||||
<%= t("mailers.bank_transfer.thanks") %>
|
||||
<%= t("mailers.bank_transfer.signoff") %>
|
||||
@@ -0,0 +1,12 @@
|
||||
<p><%= t("mailers.invoice_activated.hello") %></p>
|
||||
|
||||
<p><%= raw t("mailers.invoice_activated.body_html",
|
||||
plan: @invoice.club.subscription&.plan&.name || @invoice.billing_payment&.plan_slug.to_s.humanize,
|
||||
club: @club.billing_legal_name.presence || @club.name,
|
||||
until_date: @invoice.club.subscription&.current_period_end ? l(@invoice.club.subscription.current_period_end.to_date, format: :long) : t("mailers.invoice_activated.period_fallback"),
|
||||
number: @invoice.display_number,
|
||||
amount: @invoice.formatted_amount) %></p>
|
||||
|
||||
<p><%= raw t("mailers.invoice.also_html") %></p>
|
||||
|
||||
<p><%= t("mailers.invoice.thanks") %><br><%= t("mailers.invoice.signoff") %></p>
|
||||
@@ -0,0 +1,13 @@
|
||||
<%= t("mailers.invoice_activated.hello") %>
|
||||
|
||||
<%= t("mailers.invoice_activated.body_text",
|
||||
plan: @invoice.club.subscription&.plan&.name || @invoice.billing_payment&.plan_slug.to_s.humanize,
|
||||
club: @club.billing_legal_name.presence || @club.name,
|
||||
until_date: @invoice.club.subscription&.current_period_end ? l(@invoice.club.subscription.current_period_end.to_date, format: :long) : t("mailers.invoice_activated.period_fallback"),
|
||||
number: @invoice.display_number,
|
||||
amount: @invoice.formatted_amount) %>
|
||||
|
||||
<%= t("mailers.invoice.also_text") %>
|
||||
|
||||
<%= t("mailers.invoice.thanks") %>
|
||||
<%= t("mailers.invoice.signoff") %>
|
||||
@@ -17,11 +17,19 @@
|
||||
</p>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render "shared/stripe_secure_payment" %>
|
||||
<% if MatchLiveTv.stripe_enabled? %>
|
||||
<% if @quote %>
|
||||
<%= render "shared/quoted_price_banner", quote: @quote %>
|
||||
<% elsif MatchLiveTv.stripe_enabled? %>
|
||||
<%= render "shared/stripe_secure_payment" %>
|
||||
<% end %>
|
||||
<%= render "shared/pending_bank_transfer", order: @pending_transfer %>
|
||||
<% if MatchLiveTv.stripe_enabled? && @quote.blank? %>
|
||||
<%= render "shared/plan_change_info", subscription: @subscription %>
|
||||
<% end %>
|
||||
<%= render "shared/plan_cards", show_stripe_portal: false %>
|
||||
<% if @subscription&.bank_transfer? %>
|
||||
<p class="muted" style="margin-top:16px"><%= raw t("billing.bank_transfer.renewal_html") %></p>
|
||||
<% end %>
|
||||
<%= render "shared/subscription_cancel", club: @club, subscription: @subscription %>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -33,4 +33,8 @@
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
<% elsif subscription&.bank_transfer? %>
|
||||
<p style="color:#888;font-size:0.9rem;margin-top:0">
|
||||
<%= raw t("billing.subscription_status.bank_transfer_until_html", date: l_local(subscription.current_period_end.to_date)) %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<%# locals: (order:) %>
|
||||
<% return if order.blank? %>
|
||||
<div class="card" style="margin-top:16px;border-color:#3d3520;background:#1a1810">
|
||||
<p style="margin:0 0 8px;color:#ddd">
|
||||
<strong><%= t("billing.bank_transfer.pending_title") %></strong>
|
||||
<%= raw t("billing.bank_transfer.pending_body_html",
|
||||
plan: order.plan.name,
|
||||
price: order.price_label,
|
||||
causal: order.payment_causal) %>
|
||||
</p>
|
||||
<p style="margin:0;color:#aaa;font-size:0.9rem">
|
||||
<%= raw t("billing.bank_transfer.pending_proof_html",
|
||||
email_link: mail_to(MatchLiveTv.bank_transfer_proof_email, MatchLiveTv.bank_transfer_proof_email)) %>
|
||||
</p>
|
||||
</div>
|
||||
@@ -13,7 +13,8 @@
|
||||
target_plan: plan,
|
||||
stripe_subscription_active: stripe_subscription_active?(subscription),
|
||||
current_interval: current_interval,
|
||||
subscription: subscription
|
||||
subscription: subscription,
|
||||
club: club
|
||||
) : nil %>
|
||||
<% featured = plan.slug == "premium_full" %>
|
||||
<div class="plan-card<%= " plan-card--featured" if featured %>">
|
||||
@@ -23,6 +24,13 @@
|
||||
<%= render "shared/plan_title", plan: plan %>
|
||||
<% if plan.slug == "free" %>
|
||||
<div class="plan-price">€0</div>
|
||||
<% elsif billing_mode && club&.active_billing_quote&.plan_slug == plan.slug %>
|
||||
<% quote = club.active_billing_quote %>
|
||||
<div class="plan-price-block">
|
||||
<div class="plan-price<%= " plan-price--featured" if featured %>"><%= quote.formatted_amount %></div>
|
||||
<span class="plan-price-badge"><%= t("billing.bank_transfer.quoted_badge") %></span>
|
||||
<p class="plan-price-equiv"><%= t("billing.bank_transfer.quoted_interval.#{quote.billing_interval}") %></p>
|
||||
</div>
|
||||
<% else %>
|
||||
<% yearly = Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: "yearly") %>
|
||||
<% monthly = Billing::Stripe::PriceCatalog.label(plan_slug: plan.slug, interval: "monthly") %>
|
||||
@@ -63,12 +71,14 @@
|
||||
<% end %>
|
||||
<% if billing_mode %>
|
||||
<% action_kind = action[:kind] %>
|
||||
<% quote = club&.active_billing_quote %>
|
||||
<% pending_transfer = club&.pending_transfer_order %>
|
||||
<% 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]) %>
|
||||
<% elsif action_kind.in?(%i[contact disabled quoted_other]) %>
|
||||
<p class="plan-action-hint"><%= action[:label] %></p>
|
||||
<% elsif action_kind == :checkout_options || action_kind == :change_options || action_kind == :interval_switch %>
|
||||
<% elsif action_kind.in?(%i[checkout_options change_options interval_switch quoted bank_only]) %>
|
||||
<% if billing_profile_blocks_premium?(club) %>
|
||||
<p class="plan-action-hint" style="color:#e53935;margin-bottom:10px">
|
||||
<%= billing_profile_incomplete_message(club) %>
|
||||
@@ -77,14 +87,33 @@
|
||||
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) %>
|
||||
<% unless action_kind.in?(%i[quoted bank_only]) %>
|
||||
<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 %>
|
||||
<% transfer_intervals = action_kind == :quoted ? action[:intervals] : (action[:intervals].presence || bank_transfer_intervals_for(plan)) %>
|
||||
<% if MatchLiveTv.bank_transfer_configured? && transfer_intervals.any? %>
|
||||
<% unless action_kind.in?(%i[quoted bank_only]) %>
|
||||
<p class="plan-action-hint" style="margin:10px 0 6px"><%= t("billing.bank_transfer.or_label") %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="plan-interval-actions">
|
||||
<% plan_intervals_for_display(transfer_intervals).each do |interval| %>
|
||||
<% next unless show_bank_transfer_for?(club: club, plan: plan, interval: interval, quote: quote, pending_transfer: pending_transfer) %>
|
||||
<%= button_to t("billing.bank_transfer.pay_button_with_price", price: bank_transfer_price_label(plan, interval, quote: quote)),
|
||||
public_club_billing_bank_transfer_path(club, plan: plan.slug, interval: interval),
|
||||
method: :post,
|
||||
class: "btn btn-outline plan-interval-btn",
|
||||
form: { data: { turbo_confirm: t("billing.bank_transfer.hint") } } %>
|
||||
<% end %>
|
||||
</div>
|
||||
<p class="plan-action-hint" style="margin-top:8px"><%= t("billing.bank_transfer.hint") %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% elsif plan.slug == "free" %>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<%# locals: (quote:) %>
|
||||
<% return if quote.blank? %>
|
||||
<div class="card" style="margin-top:16px;border-color:#2e5a3c;background:#142018">
|
||||
<p style="margin:0;color:#ddd">
|
||||
<strong><%= t("billing.bank_transfer.quote_banner_title") %></strong>
|
||||
<%= raw t("billing.bank_transfer.quote_banner_body_html", plan: quote.plan.name, price: quote.price_label) %>
|
||||
</p>
|
||||
<% if quote.note.present? %>
|
||||
<p style="margin:8px 0 0;color:#aaa;font-size:0.9rem"><%= t("billing.bank_transfer.quote_note", note: quote.note) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -1,5 +1,5 @@
|
||||
<%# locals: (club:, subscription:) %>
|
||||
<% return unless subscription&.premium? && subscription.stripe_subscription_id.present? && MatchLiveTv.stripe_enabled? %>
|
||||
<% return unless subscription&.premium? && MatchLiveTv.stripe_enabled? && subscription.stripe_subscription_id.present? %>
|
||||
|
||||
<section id="subscription-cancel" class="subscription-cancel" style="margin-top:24px;padding:16px;border:1px solid #333;border-radius:8px">
|
||||
<% if subscription.cancel_at_period_end? %>
|
||||
|
||||
Reference in New Issue
Block a user