Introduce clubs con abbonamento, branding Active Storage e flusso registrazione società; corregge healthcheck MediaMTX (immagine distroless) e allinea dominio produzione matchlivetv.it. Co-authored-by: Cursor <cursoragent@cursor.com>
118 lines
5.7 KiB
Plaintext
118 lines
5.7 KiB
Plaintext
<% content_for :title, "#{@team.name} — Dashboard" %>
|
||
<% content_for :meta_description, "Dashboard squadra #{@team.name} su Match Live TV." %>
|
||
<% content_for :robots, "noindex, nofollow" %>
|
||
|
||
<div class="wrap" style="padding-top:20px">
|
||
<p style="color:#888;margin:0 0 8px"><%= link_to @club.name, public_club_path(@club) %> · <%= link_to "Modifica squadra", public_edit_team_path(@team) %></p>
|
||
<h1 style="display:flex;align-items:center;gap:12px">
|
||
<% if @team.effective_logo_url.present? %>
|
||
<%= image_tag @team.effective_logo_url, alt: "", width: 40, height: 40, style: "border-radius:8px" %>
|
||
<% end %>
|
||
<%= @team.name %>
|
||
</h1>
|
||
<p>
|
||
Piano: <strong><%= @entitlements.plan.name %></strong> (società)
|
||
· Staff trasmissione: <strong><%= @entitlements.staff_count_for("transmission") %> / <%= @entitlements.max_staff_transmission || "∞" %></strong>
|
||
· Staff regia: <strong><%= @entitlements.staff_count_for("regia") %> / <%= @entitlements.max_staff_regia || "∞" %></strong>
|
||
· Partite attive: <strong><%= @entitlements.concurrent_streams_used %><% if @entitlements.concurrent_streams_limit %> / <%= @entitlements.concurrent_streams_limit %><% else %> (illimitate)<% end %></strong>
|
||
</p>
|
||
|
||
<div style="display:flex;gap:12px;flex-wrap:wrap;margin:20px 0">
|
||
<%= link_to "Abbonamento società", public_club_billing_path(@club), class: "btn btn-primary" %>
|
||
<%= link_to "Aggiungi staff", public_team_invite_path(@team), class: "btn btn-secondary" %>
|
||
<%= link_to "Dirette live", public_live_index_path, class: "btn btn-secondary" %>
|
||
</div>
|
||
|
||
<% owner_staff = @owner_membership&.staff_kind %>
|
||
<% can_self_transmission = owner_staff != "transmission" && owner_staff != "regia" %>
|
||
<% can_self_regia = owner_staff != "regia" && owner_staff != "transmission" %>
|
||
<% if can_self_transmission || can_self_regia %>
|
||
<div class="card" style="margin-bottom:20px">
|
||
<h2 style="margin-top:0;font-size:1.1rem">Il tuo account (<%= current_user.email %>)</h2>
|
||
<p style="color:#aaa;font-size:0.92rem;margin-bottom:12px">
|
||
Puoi usare le stesse credenziali nell’app mobile. Trasmissione e regia devono essere <strong>email diverse</strong> — non puoi coprire entrambi i ruoli con questo account.
|
||
</p>
|
||
<div style="display:flex;gap:10px;flex-wrap:wrap">
|
||
<% if can_self_transmission %>
|
||
<%= button_to "Sono io — staff trasmissione", public_team_assign_self_staff_path(@team), method: :post, params: { staff_kind: "transmission" }, class: "btn btn-primary" %>
|
||
<% end %>
|
||
<% if can_self_regia %>
|
||
<%= button_to "Sono io — staff regia", public_team_assign_self_staff_path(@team), method: :post, params: { staff_kind: "regia" }, class: "btn btn-secondary" %>
|
||
<% end %>
|
||
</div>
|
||
</div>
|
||
<% end %>
|
||
|
||
<h2>Staff attivo</h2>
|
||
<div class="card">
|
||
<% if @staff_memberships.any? %>
|
||
<table class="data">
|
||
<thead><tr><th>Nome</th><th>Email</th><th>Ruolo</th><th></th></tr></thead>
|
||
<tbody>
|
||
<% @staff_memberships.each do |ut| %>
|
||
<tr>
|
||
<td>
|
||
<%= ut.user.name %>
|
||
<% if ut.role == "owner" %><span style="color:#888;font-size:0.85rem"> (tu)</span><% end %>
|
||
</td>
|
||
<td><%= ut.user.email %></td>
|
||
<td><%= ut.staff_kind == "regia" ? "Regia" : "Trasmissione" %></td>
|
||
<td>
|
||
<% if ut.role == "owner" %>
|
||
<%= button_to "Rimuovi ruolo staff", public_team_clear_self_staff_path(@team), method: :delete, class: "btn btn-secondary", style: "padding:4px 10px;font-size:0.8rem", form: { data: { turbo_confirm: "Rimuovere il ruolo staff dal tuo account?" } } %>
|
||
<% else %>
|
||
<%= button_to "Revoca", public_team_remove_member_path(@team, ut.user), method: :delete, class: "btn btn-secondary", style: "padding:4px 10px;font-size:0.8rem", form: { data: { turbo_confirm: "Revocare l'accesso a #{ut.user.name}?" } } %>
|
||
<% end %>
|
||
</td>
|
||
</tr>
|
||
<% end %>
|
||
</tbody>
|
||
</table>
|
||
<% else %>
|
||
<p style="color:#888">Nessun membro staff. Usa i pulsanti sopra per il tuo account o <%= link_to "invita qualcuno", public_team_invite_path(@team) %>.</p>
|
||
<% end %>
|
||
</div>
|
||
|
||
<h2>Staff in attesa</h2>
|
||
<div class="card">
|
||
<% if @pending_invitations.any? %>
|
||
<table class="data">
|
||
<thead><tr><th>Email</th><th>Ruolo</th><th>Scade</th><th></th></tr></thead>
|
||
<tbody>
|
||
<% @pending_invitations.each do |inv| %>
|
||
<tr>
|
||
<td><%= inv.email %></td>
|
||
<td><%= inv.staff_kind == "regia" ? "Regia" : "Trasmissione" %></td>
|
||
<td><%= l inv.expires_at, format: :short %></td>
|
||
<td>
|
||
<%= button_to "Annulla", public_team_destroy_invitation_path(@team, inv), method: :delete, class: "btn btn-secondary", style: "padding:4px 10px;font-size:0.8rem" %>
|
||
</td>
|
||
</tr>
|
||
<% end %>
|
||
</tbody>
|
||
</table>
|
||
<% else %>
|
||
<p style="color:#888">Nessuna richiesta in sospeso.</p>
|
||
<% end %>
|
||
</div>
|
||
|
||
<% if @entitlements.can_access_recordings? && @recordings.any? %>
|
||
<h2>Archivio gare</h2>
|
||
<div class="card">
|
||
<table class="data">
|
||
<thead><tr><th>Partita</th><th>Replay</th></tr></thead>
|
||
<tbody>
|
||
<% @recordings.each do |rec| %>
|
||
<tr>
|
||
<td><%= rec.stream_session.match.team.name %> vs <%= rec.stream_session.match.opponent_name %></td>
|
||
<td><%= link_to "Guarda", rec.replay_url %></td>
|
||
</tr>
|
||
<% end %>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<% end %>
|
||
|
||
<p style="color:#888;margin-top:24px">Usa l'app mobile con le stesse credenziali per avviare partite e dirette.</p>
|
||
</div>
|