Billing Stripe, link regia mobile e staff solo trasmissione.

Aggiunge fatturazione club, pagina regia condivisibile senza account, roster squadre e rimuove la modalità controller dall'app (v1.1.0).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-29 07:23:13 +02:00
parent 4083bc5dee
commit f4b7be0f80
156 changed files with 5033 additions and 2033 deletions

View File

@@ -0,0 +1,50 @@
module Admin
class BillingInvoicesController < BaseController
before_action :set_club
def index
@invoices = @club.billing_invoices.recent
end
def new
@invoice = @club.billing_invoices.build(issued_on: Date.current, currency: "eur", source: "aruba")
end
def create
@invoice = @club.billing_invoices.build(invoice_params)
@invoice.source = "aruba"
if @invoice.save
redirect_to admin_club_billing_invoices_path(@club), notice: "Fattura #{@invoice.number} registrata."
else
flash.now[:alert] = @invoice.errors.full_messages.join(", ")
render :new, status: :unprocessable_entity
end
end
private
def set_club
@club = Club.find(params[:club_id])
end
def invoice_params
params.require(:billing_invoice).permit(
:number,
:issued_on,
:amount_cents,
:amount_euros,
:currency,
:status,
:aruba_document_id,
:billing_payment_id,
:notes,
:pdf
).tap do |p|
if p[:amount_euros].present?
p[:amount_cents] = (p.delete(:amount_euros).to_f * 100).round
end
end
end
end
end