diff --git a/backend/app/controllers/admin/billing_controller.rb b/backend/app/controllers/admin/billing_controller.rb new file mode 100644 index 0000000..d81a666 --- /dev/null +++ b/backend/app/controllers/admin/billing_controller.rb @@ -0,0 +1,7 @@ +module Admin + class BillingController < BaseController + def index + @clubs = Club.order(:name).includes(:billing_payments, :billing_invoices) + end + end +end diff --git a/backend/app/views/admin/billing/index.html.erb b/backend/app/views/admin/billing/index.html.erb new file mode 100644 index 0000000..6ba831a --- /dev/null +++ b/backend/app/views/admin/billing/index.html.erb @@ -0,0 +1,31 @@ +

Pagamenti e fatture

+

+ Elenco società: pagamenti da Stripe e fatture PDF da emettere o inviare al cliente. +

+ + + + + + + + + + + + <% @clubs.each do |club| %> + + + + + + + <% end %> + +
SocietàPagamentiFatture
<%= club.name %><%= club.billing_payments.size %><%= club.billing_invoices.size %><%= link_to "Apri", admin_club_billing_invoices_path(club), class: "admin-btn admin-btn--sm" %>
+ +<% if @clubs.empty? %> +

Nessuna società registrata.

+<% end %> + +

<%= link_to "← Dashboard", admin_root_path %>

diff --git a/backend/app/views/admin/teams/index.html.erb b/backend/app/views/admin/teams/index.html.erb index 41a8b65..68e15bd 100644 --- a/backend/app/views/admin/teams/index.html.erb +++ b/backend/app/views/admin/teams/index.html.erb @@ -1,12 +1,20 @@

Teams

- + <% @teams.each do |t| %> + + <% end %> diff --git a/backend/app/views/layouts/admin.html.erb b/backend/app/views/layouts/admin.html.erb index 2501d39..b45b46a 100644 --- a/backend/app/views/layouts/admin.html.erb +++ b/backend/app/views/layouts/admin.html.erb @@ -17,6 +17,7 @@ <% if admin_logged_in? %> <%= link_to "Dashboard", admin_root_path, class: ("active" if controller_name == "dashboard") %> <%= link_to "Teams", admin_teams_path, class: ("active" if controller_name == "teams") %> + <%= link_to "Fatturazione", admin_billing_path, class: ("active" if controller_name.in?(%w[billing billing_invoices])) %> <%= link_to "Sessions", admin_sessions_path, class: ("active" if controller_name == "sessions") %> <%= link_to "Password", edit_admin_password_path %> <%= button_to "Esci", admin_logout_path, method: :delete %> diff --git a/backend/config/routes.rb b/backend/config/routes.rb index 2e1fcda..baae948 100644 --- a/backend/config/routes.rb +++ b/backend/config/routes.rb @@ -62,6 +62,7 @@ Rails.application.routes.draw do root to: "dashboard#index" get "metrics", to: "dashboard#metrics" + get "billing", to: "billing#index", as: :billing resources :teams, only: %i[index show] resources :clubs, only: [] do resources :billing_invoices, only: %i[index new create edit update], controller: "billing_invoices"
NomeSportYouTube
NomeSocietàSportYouTubeFatture
<%= link_to t.name, admin_team_path(t) %><%= t.club&.name || "—" %> <%= t.sport %> <%= t.youtube_credential.present? ? "✓" : "—" %> + <% if t.club %> + <%= link_to "Pagamenti", admin_club_billing_invoices_path(t.club) %> + <% else %> + — + <% end %> +