Nuova fattura — <%= @club.name %>

<% if @payment %>

Collegata al pagamento del <%= @payment.paid_at&.to_date || @payment.created_at.to_date %> (<%= @payment.formatted_amount %>).

<% end %>
<%= form_with model: @invoice, url: admin_club_billing_invoices_path(@club) do |f| %> <%= f.hidden_field :billing_payment_id if @payment %> <%= f.label :number, "Numero fattura" %> <%= f.text_field :number, required: true %> <%= f.label :issued_on, "Data emissione" %> <%= f.date_field :issued_on, required: true %> <%= label_tag :amount_euros, "Importo (€)" %> <%= number_field_tag "billing_invoice[amount_euros]", (@invoice.amount_cents ? @invoice.amount_cents / 100.0 : nil), step: 0.01, min: 0.01, required: true %> <%= f.label :notes, "Note interne (opzionale)" %> <%= f.text_area :notes, rows: 2 %>

Salva la bozza, poi carica il PDF e inviala al cliente dalla schermata successiva.

<%= f.submit "Crea bozza fattura", class: "btn btn-primary" %> <% end %>

<%= link_to "← Pagamenti e fatture", admin_club_billing_invoices_path(@club) %>