Ops può correggere dati clienti errati (es. email titolare) dalla scheda società senza interventi manuali sul DB. Co-authored-by: Cursor <cursoragent@cursor.com>
140 lines
5.8 KiB
ERB
140 lines
5.8 KiB
ERB
<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 %>
|