Dopo la conferma admin la card restava su «Paga con bonifico»; la società parte da Free, l'owner è staff trasmissione e le mail non bloccano se manca SMTP. Co-authored-by: Cursor <cursoragent@cursor.com>
147 lines
6.5 KiB
ERB
147 lines
6.5 KiB
ERB
<% team = local_assigns[:team] %>
|
|
<% club = local_assigns[:club] %>
|
|
<% can_manage = local_assigns[:can_manage] %>
|
|
<% staff_memberships = local_assigns[:staff_memberships] %>
|
|
<% pending_invitations = local_assigns[:pending_invitations] %>
|
|
<% recordings = local_assigns[:recordings] %>
|
|
<% entitlements = local_assigns[:entitlements] %>
|
|
<% club_owner = club.owner %>
|
|
<% extra_staff = staff_memberships.reject { |ut| ut.user_id == club_owner&.id } %>
|
|
|
|
<section class="team-streaming-staff" id="responsabili-trasmissione">
|
|
<% if club_owner %>
|
|
<div class="card team-streaming-staff__self">
|
|
<h2><%= t("team.streaming_staff.principal_heading") %></h2>
|
|
<p>
|
|
<%= raw t("team.streaming_staff.principal_body_html", email: club_owner.email) %>
|
|
</p>
|
|
<p class="muted">
|
|
<%= raw t("team.streaming_staff.principal_score_hint_html") %>
|
|
</p>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if extra_staff.any? %>
|
|
<h2><%= t("team.streaming_staff.extra_staff_heading") %></h2>
|
|
<div class="card">
|
|
<table class="data">
|
|
<thead><tr><th><%= t("team.streaming_staff.col_name") %></th><th><%= t("team.streaming_staff.col_email") %></th><th><%= t("team.streaming_staff.col_role") %></th><% if can_manage %><th></th><% end %></tr></thead>
|
|
<tbody>
|
|
<% extra_staff.each do |ut| %>
|
|
<tr>
|
|
<td>
|
|
<%= ut.user.name %>
|
|
<% if ut.user_id == current_user.id %><span class="muted"> <%= t("team.streaming_staff.you_suffix") %></span><% end %>
|
|
</td>
|
|
<td><%= ut.user.email %></td>
|
|
<td><%= t("team.streaming_staff.role_transmission") %></td>
|
|
<% if can_manage %>
|
|
<td>
|
|
<% if ut.role == "member" %>
|
|
<%= button_to t("team.streaming_staff.revoke"), 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: t("team.streaming_staff.revoke_confirm", name: ut.user.name), confirm_kind: "delete" } } %>
|
|
<% end %>
|
|
</td>
|
|
<% end %>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if can_manage %>
|
|
<div class="card team-invite-form" id="invita-trasmissione">
|
|
<h2><%= t("team.streaming_staff.invite_form_heading") %></h2>
|
|
<p class="muted team-invite-form__hint"><%= t("team.streaming_staff.invite_form_hint") %></p>
|
|
<%= form_with url: public_team_invite_path(team), method: :post, class: "team-invite-form__fields" do %>
|
|
<%= hidden_field_tag :staff_kind, "transmission" %>
|
|
<%= label_tag :email, t("team.invite.email_label") %>
|
|
<%= email_field_tag :email, params[:email], required: true, autocomplete: "email", placeholder: "nome@email.it" %>
|
|
<%= submit_tag t("team.invite.submit"), class: "btn btn-primary" %>
|
|
<% end %>
|
|
|
|
<% if flash[:invite_url].present? %>
|
|
<div class="team-invite-link" id="invito-generato">
|
|
<p class="team-invite-link__title"><%= t("team.invite.share_hint") %></p>
|
|
<code class="team-invite-link__url" id="team-invite-url"><%= flash[:invite_url] %></code>
|
|
<button type="button" class="btn btn-secondary team-invite-link__copy" data-copy-target="team-invite-url">
|
|
<%= t("regia.copy_link") %>
|
|
</button>
|
|
<p class="muted team-invite-link__note"><%= t("team.streaming_staff.invite_once_note") %></p>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<h2><%= t("team.streaming_staff.pending_invitations_heading") %></h2>
|
|
<div class="card">
|
|
<% if pending_invitations.any? %>
|
|
<table class="data">
|
|
<thead><tr><th><%= t("team.streaming_staff.col_email_short") %></th><th><%= t("team.streaming_staff.col_expires") %></th><th></th></tr></thead>
|
|
<tbody>
|
|
<% pending_invitations.each do |inv| %>
|
|
<tr>
|
|
<td><%= inv.email %></td>
|
|
<td><%= l inv.expires_at, format: :short %></td>
|
|
<td>
|
|
<%= button_to t("team.streaming_staff.cancel_invitation"), public_team_destroy_invitation_path(team, inv), method: :delete, class: "btn btn-secondary", style: "padding:4px 10px;font-size:0.8rem", form: { data: { confirm_kind: "delete" } } %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %>
|
|
<p class="muted"><%= t("team.streaming_staff.no_pending") %></p>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if entitlements.can_access_recordings? %>
|
|
<h2><%= t("team.streaming_staff.archive_heading") %></h2>
|
|
<div class="card">
|
|
<% if recordings.any? %>
|
|
<table class="data">
|
|
<thead><tr><th><%= t("team.streaming_staff.col_match") %></th><th><%= t("team.streaming_staff.col_date") %></th><th><%= t("team.streaming_staff.col_duration") %></th><th><%= t("team.streaming_staff.col_expiry") %></th><th><%= t("team.streaming_staff.col_status") %></th><th></th></tr></thead>
|
|
<tbody>
|
|
<% recordings.each do |rec| %>
|
|
<tr>
|
|
<td><%= rec.title_or_default %></td>
|
|
<td><%= l_local(rec.recorded_at_or_fallback) %></td>
|
|
<td><%= rec.duration_label %></td>
|
|
<td><%= rec.expires_at ? l_local(rec.expires_at) : "—" %></td>
|
|
<td><%= rec.status_label %></td>
|
|
<td>
|
|
<% if rec.replay_url %>
|
|
<%= link_to t("team.streaming_staff.watch"), rec.replay_url, target: "_blank", rel: "noopener" %>
|
|
<% else %>
|
|
—
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<p style="margin-top:12px">
|
|
<%= link_to t("team.streaming_staff.manage_all_replays"), public_club_recordings_path(team.club) %>
|
|
</p>
|
|
<% else %>
|
|
<p class="muted"><%= t("team.streaming_staff.no_recordings") %></p>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</section>
|
|
|
|
<script>
|
|
document.querySelectorAll("[data-copy-target]").forEach(function (btn) {
|
|
btn.addEventListener("click", async function () {
|
|
var el = document.getElementById(btn.getAttribute("data-copy-target"));
|
|
if (!el) return;
|
|
try {
|
|
await navigator.clipboard.writeText(el.textContent.trim());
|
|
btn.textContent = <%= raw t("team.streaming_staff.copied").to_json %>;
|
|
} catch (e) {
|
|
window.getSelection().selectAllChildren(el);
|
|
}
|
|
});
|
|
});
|
|
</script>
|