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>
72 lines
3.1 KiB
ERB
72 lines
3.1 KiB
ERB
<%# 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>
|