Aggiunge abbonamenti omaggio admin per sponsor e promozioni.
Gli admin possono concedere o revocare Premium Light/Full senza Stripe; il piano omaggio ha priorità sui webhook e la società vede un messaggio dedicato. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
56
backend/app/views/admin/clubs/_comped_form.html.erb
Normal file
56
backend/app/views/admin/clubs/_comped_form.html.erb
Normal file
@@ -0,0 +1,56 @@
|
||||
<%# locals: (club:, subscription:, return_to: nil) %>
|
||||
<section class="admin-comped-card" style="margin-bottom:24px;padding:16px;border:1px solid #3d3520;border-radius:8px;background:#2a2618">
|
||||
<h2 style="margin:0 0 8px;font-size:1.1rem">Abbonamento omaggio</h2>
|
||||
<p style="color:#bbb;font-size:0.9rem;margin:0 0 14px">
|
||||
Sponsor o promozione: assegna Premium Light/Full senza pagamento Stripe. Revocabile in qualsiasi momento.
|
||||
</p>
|
||||
|
||||
<% sub = subscription %>
|
||||
<% if sub&.admin_comped? %>
|
||||
<p style="margin:0 0 12px">
|
||||
<strong>Attivo:</strong> <%= sub.plan.name %>
|
||||
<% if sub.admin_comped_reason.present? %>
|
||||
· <%= sub.admin_comped_reason %>
|
||||
<% end %>
|
||||
<% if sub.admin_comped_at.present? %>
|
||||
<br><span style="color:#888;font-size:0.85rem">Dal <%= l(sub.admin_comped_at, format: :long) %>
|
||||
<% if sub.admin_comped_by.present? %> · admin <%= sub.admin_comped_by.username %><% end %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% if sub.stripe_subscription_id.present? %>
|
||||
<br><span style="color:#888;font-size:0.85rem">Nota: esiste anche un abbonamento Stripe collegato; l’omaggio ha priorità sul piano.</span>
|
||||
<% end %>
|
||||
</p>
|
||||
<%= button_to "Revoca omaggio (torna Free o ripristina Stripe)",
|
||||
revoke_comped_admin_club_path(club, return_to: return_to),
|
||||
method: :delete,
|
||||
class: "admin-btn admin-btn--secondary",
|
||||
form: { data: { turbo_confirm: "Revocare l’abbonamento omaggio per #{club.name}?" } } %>
|
||||
<% else %>
|
||||
<p style="margin:0 0 12px;color:#888">
|
||||
Piano attuale: <strong><%= sub&.plan&.name || "Free" %></strong>
|
||||
<% if sub&.stripe_subscription_id.present? %>
|
||||
· pagamento Stripe attivo
|
||||
<% end %>
|
||||
</p>
|
||||
<%= form_with url: grant_comped_admin_club_path(club), method: :post, local: true, class: "admin-comped-form" 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">
|
||||
Piano
|
||||
<%= select_tag :plan_slug,
|
||||
options_for_select(
|
||||
[["Premium Light", "premium_light"], ["Premium Full", "premium_full"]]
|
||||
),
|
||||
required: true,
|
||||
class: "admin-input" %>
|
||||
</label>
|
||||
<label style="display:flex;flex-direction:column;gap:4px;font-size:0.85rem;flex:1;min-width:200px">
|
||||
Motivo (es. sponsor 2026)
|
||||
<%= text_field_tag :reason, nil, placeholder: "Sponsor, promozione…", class: "admin-input", style: "width:100%" %>
|
||||
</label>
|
||||
<%= submit_tag "Concedi omaggio", class: "admin-btn admin-btn--primary" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</section>
|
||||
Reference in New Issue
Block a user