Dopo la conferma admin la card restava su «Paga con bonifico»; la società parte da Free, l'owner è staff trasmissione e le mail non bloccano se manca SMTP. Co-authored-by: Cursor <cursoragent@cursor.com>
150 lines
6.4 KiB
ERB
150 lines
6.4 KiB
ERB
<h2><%= t("admin.billing.index.title") %></h2>
|
|
<p style="color:#666;margin-bottom:16px">
|
|
<%= t("admin.billing.index.description") %>
|
|
</p>
|
|
|
|
<% if @clubs.many? %>
|
|
<p style="margin-bottom:16px">
|
|
<%= t("admin.billing.index.filter_label") %>
|
|
<%= link_to t("admin.billing.index.filter_all"), admin_billing_path, class: (@filter_club ? nil : "admin-nav-active") %>
|
|
<% @clubs.each do |club| %>
|
|
· <%= link_to club.name, admin_billing_path(club_id: club.id), class: (@filter_club&.id == club.id ? "admin-nav-active" : nil) %>
|
|
<% end %>
|
|
</p>
|
|
<% end %>
|
|
|
|
<% if @filter_club %>
|
|
<%= render "admin/clubs/comped_form",
|
|
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.holder") %>:
|
|
<strong><%= MatchLiveTv.bank_transfer_account_holder %></strong><br>
|
|
<%= t("admin.billing.index.transfers_table.iban") %>:
|
|
<strong><%= MatchLiveTv.bank_transfer_iban %></strong><br>
|
|
<%= 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? %>
|
|
<div class="billing-pending-list">
|
|
<% @pending_payments.each do |payment| %>
|
|
<% club = payment.club %>
|
|
<article id="payment-<%= payment.id %>" class="billing-pending-card">
|
|
<header class="billing-pending-card__head">
|
|
<div>
|
|
<strong><%= club.name %></strong>
|
|
· <%= (payment.paid_at || payment.created_at).to_date.strftime("%d/%m/%Y") %>
|
|
· <%= payment.display_description %>
|
|
· <strong><%= payment.formatted_amount %></strong>
|
|
</div>
|
|
<% unless club.billing_profile_complete? %>
|
|
<span class="billing-pending-card__warn"><%= t("admin.billing.index.incomplete_profile_warning") %></span>
|
|
<% end %>
|
|
</header>
|
|
|
|
<div class="billing-pending-card__body">
|
|
<% if club.billing_profile_invoice_lines.any? %>
|
|
<dl class="billing-profile-dl">
|
|
<% club.billing_profile_invoice_lines.each do |label, value| %>
|
|
<dt><%= label %></dt>
|
|
<dd><%= value %></dd>
|
|
<% end %>
|
|
</dl>
|
|
<% else %>
|
|
<p class="billing-pending-card__warn"><%= t("admin.billing.index.no_billing_data") %></p>
|
|
<% end %>
|
|
|
|
<%= form_with url: admin_billing_payment_attach_pdf_path(payment),
|
|
method: :post, multipart: true, local: true, class: "billing-upload-form" do %>
|
|
<label class="billing-upload-form__label">
|
|
<%= t("admin.billing.index.pdf_label") %>
|
|
<%= file_field_tag :pdf, accept: "application/pdf", required: true %>
|
|
</label>
|
|
<%= submit_tag t("admin.billing.index.upload_button"), class: "admin-btn admin-btn--primary" %>
|
|
<% end %>
|
|
</div>
|
|
</article>
|
|
<% end %>
|
|
</div>
|
|
<% else %>
|
|
<p class="admin-flash" style="background:#1b3d1b;border-color:#2e7d32">
|
|
<%= t("admin.billing.index.none_pending", club: (@filter_club ? t("admin.billing.index.none_pending_for_club", club: @filter_club.name) : "")) %>
|
|
</p>
|
|
<% end %>
|
|
|
|
<% if @completed_payments.any? %>
|
|
<h2 style="margin-top:40px;font-size:1.15rem"><%= t("admin.billing.index.uploaded_title") %></h2>
|
|
<table class="admin-table">
|
|
<thead>
|
|
<tr>
|
|
<th><%= t("admin.billing.index.table.date") %></th>
|
|
<th><%= t("admin.billing.index.table.club") %></th>
|
|
<th><%= t("admin.billing.index.table.description") %></th>
|
|
<th><%= t("admin.billing.index.table.amount") %></th>
|
|
<th><%= t("admin.billing.index.table.invoice") %></th>
|
|
<th><%= t("admin.billing.index.table.status") %></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @completed_payments.each do |payment| %>
|
|
<% inv = payment.invoice %>
|
|
<tr>
|
|
<td><%= payment.paid_at&.to_date || payment.created_at.to_date %></td>
|
|
<td><%= payment.club.name %></td>
|
|
<td><%= payment.display_description %></td>
|
|
<td><%= payment.formatted_amount %></td>
|
|
<td><%= inv&.display_number %></td>
|
|
<td><%= inv&.display_status %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% end %>
|
|
|
|
<p style="margin-top:24px"><%= link_to t("admin.billing.index.back_dashboard"), admin_root_path %></p>
|