Permette all’admin di forzare anagrafica, fiscali, owner, staff e inviti.

Ops può correggere dati clienti errati (es. email titolare) dalla scheda società senza interventi manuali sul DB.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-10 18:18:18 +02:00
co-authored by Cursor
parent d7dd744c32
commit cc95fcacbf
15 changed files with 739 additions and 8 deletions
@@ -22,6 +22,7 @@
<span class="admin-billing-status admin-billing-status--<%= status %>">
<%= t("admin.clubs.billing_status.#{status}") %>
</span>
<%= link_to t("admin.clubs.show.edit_link"), edit_admin_club_path(club), class: "admin-btn admin-btn--sm admin-btn--secondary" %>
</div>
<% if status == :absent || lines.empty? %>
+139
View File
@@ -0,0 +1,139 @@
<p style="margin-bottom:16px">
<%= link_to t("admin.clubs.edit.back"), admin_club_path(@club) %>
</p>
<h2><%= t("admin.clubs.edit.title", club: @club.name) %></h2>
<p class="muted" style="margin-bottom:20px"><%= t("admin.clubs.edit.lead") %></p>
<% if flash.now[:alert].present? %>
<p class="admin-flash" style="background:#3d1b1b;border-color:#c62828"><%= flash.now[:alert] %></p>
<% end %>
<%= form_with url: admin_club_path(@club), method: :patch, local: true, class: "admin-form admin-form--wide" do %>
<section class="panel">
<h3><%= t("admin.clubs.edit.sections.club") %></h3>
<div class="admin-form-row">
<div>
<label for="club_name"><%= t("admin.clubs.edit.fields.name") %></label>
<input type="text" name="club[name]" id="club_name" value="<%= @club.name %>" required>
</div>
<div>
<label for="club_sport"><%= t("admin.clubs.edit.fields.sport") %></label>
<select name="club[sport]" id="club_sport" required>
<% @sport_options.each do |label, key| %>
<option value="<%= key %>" <%= "selected" if @club.sport == key %>><%= label %></option>
<% end %>
</select>
</div>
</div>
<div class="admin-form-row">
<div>
<label for="club_primary_color"><%= t("admin.clubs.edit.fields.primary_color") %></label>
<input type="text" name="club[primary_color]" id="club_primary_color" value="<%= @club.primary_color %>" maxlength="7">
</div>
<div>
<label for="club_secondary_color"><%= t("admin.clubs.edit.fields.secondary_color") %></label>
<input type="text" name="club[secondary_color]" id="club_secondary_color" value="<%= @club.secondary_color %>" maxlength="7">
</div>
</div>
<div>
<label for="club_logo_url"><%= t("admin.clubs.edit.fields.logo_url") %></label>
<input type="url" name="club[logo_url]" id="club_logo_url" value="<%= @club.logo_url %>">
</div>
</section>
<section class="panel">
<h3><%= t("admin.clubs.edit.sections.billing") %></h3>
<p class="muted admin-form-hint"><%= t("admin.clubs.edit.billing_hint") %></p>
<%= render "shared/billing_profile_fields", record: @club, show_legend: false %>
</section>
<section class="panel">
<h3><%= t("admin.clubs.edit.sections.owner") %></h3>
<% if @owner %>
<div class="admin-form-row">
<div>
<label for="owner_name"><%= t("admin.clubs.edit.fields.owner_name") %></label>
<input type="text" name="owner[name]" id="owner_name" value="<%= @owner.name %>" required>
</div>
<div>
<label for="owner_email"><%= t("admin.clubs.edit.fields.owner_email") %></label>
<input type="email" name="owner[email]" id="owner_email" value="<%= @owner.email %>" required>
</div>
</div>
<% else %>
<p class="muted"><%= t("admin.clubs.show.owner_none") %></p>
<% end %>
</section>
<section class="panel">
<h3><%= t("admin.clubs.edit.sections.staff") %></h3>
<% if @staff_users.any? %>
<p class="muted admin-form-hint"><%= t("admin.clubs.edit.staff_hint") %></p>
<% @staff_users.each do |user| %>
<div class="admin-form-row" style="margin-bottom:0.75rem">
<div>
<label><%= t("admin.clubs.edit.fields.staff_name") %></label>
<input type="text" name="staff_users[<%= user.id %>][name]" value="<%= user.name %>">
</div>
<div>
<label><%= t("admin.clubs.edit.fields.staff_email") %></label>
<input type="email" name="staff_users[<%= user.id %>][email]" value="<%= user.email %>">
</div>
</div>
<% end %>
<% else %>
<p class="muted"><%= t("admin.clubs.edit.staff_none") %></p>
<% end %>
</section>
<section class="panel">
<h3><%= t("admin.clubs.edit.sections.invitations") %></h3>
<% if @pending_invitations.any? %>
<p class="muted admin-form-hint"><%= t("admin.clubs.edit.invitations_hint") %></p>
<% @pending_invitations.each do |invitation| %>
<div class="admin-form-row" style="margin-bottom:0.75rem">
<div>
<label><%= t("admin.clubs.edit.fields.invitation_team") %></label>
<input type="text" value="<%= invitation.team.name %>" disabled>
</div>
<div>
<label><%= t("admin.clubs.edit.fields.invitation_email") %></label>
<input type="email" name="invitations[<%= invitation.id %>][email]" value="<%= invitation.email %>" required>
</div>
</div>
<% end %>
<% else %>
<p class="muted"><%= t("admin.clubs.edit.invitations_none") %></p>
<% end %>
</section>
<section class="panel">
<h3><%= t("admin.clubs.edit.sections.teams") %></h3>
<% if @teams.any? %>
<% @teams.each do |team| %>
<div class="admin-form-row" style="margin-bottom:0.75rem">
<div>
<label><%= t("admin.clubs.edit.fields.team_name") %></label>
<input type="text" name="teams[<%= team.id %>][name]" value="<%= team.name %>" required>
</div>
<div>
<label><%= t("admin.clubs.edit.fields.team_sport") %></label>
<select name="teams[<%= team.id %>][sport]">
<% @sport_options.each do |label, key| %>
<option value="<%= key %>" <%= "selected" if team.sport == key %>><%= label %></option>
<% end %>
</select>
</div>
</div>
<% end %>
<% else %>
<p class="muted"><%= t("admin.clubs.show.no_teams") %></p>
<% end %>
</section>
<div class="admin-form-actions">
<%= link_to t("admin.clubs.edit.cancel"), admin_club_path(@club), class: "admin-btn admin-btn--secondary" %>
<button type="submit" class="admin-btn admin-btn--primary"><%= t("admin.clubs.edit.submit") %></button>
</div>
<% end %>
@@ -6,10 +6,12 @@
· <%= link_to t("admin.clubs.show.recordings_archive"), admin_club_recordings_path(@club) %>
· <%= link_to t("admin.clubs.show.billing_link"), admin_billing_path(club_id: @club.id) %>
· <%= link_to t("admin.clubs.show.youtube_platform_link"), admin_youtube_platform_path %>
· <%= link_to t("admin.clubs.show.edit_link"), edit_admin_club_path(@club) %>
</p>
<%= render "admin/clubs/billing_profile", club: @club %>
<%= render "admin/clubs/comped_form", club: @club, subscription: @subscription, return_to: admin_club_path(@club) %>
<%= render "admin/clubs/quote_form", club: @club, quote: @quote, return_to: admin_club_path(@club) %>
+1 -1
View File
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<%= csrf_meta_tags %>
<link rel="stylesheet" href="/admin.css?v=20">
<link rel="stylesheet" href="/admin.css?v=21">
<%= yield :head %>
<% if content_for?(:replay_archive_styles) %>
<link rel="stylesheet" href="/marketing.css?v=42">