Tutte le view marketing, legali, viewer, dashboard e admin usano t(); mailer utente-facing e flash localizzati; admin con LocaleResolver e selettore lingua. Co-authored-by: Cursor <cursoragent@cursor.com>
100 lines
4.0 KiB
ERB
100 lines
4.0 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) %>
|
|
<% 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>
|