<% assignments = match.broadcast_assignments.to_a %> <% pending = tournament_pending_invites_for(match) %> <% tab = local_assigns.fetch(:return_tab, "dirette") %> <% invite = local_assigns.fetch(:allow_invite, false) %> <% assignments.each do |assignment| %> <% label = tournament_streaming_operator_label(assignment.user) %>
<%= label %> <% if writable %> <%= button_to public_tournament_assignment_path(@tournament, assignment), method: :delete, class: "tournament-streaming-chip__action", title: t("tournaments.hub.streaming_revoke"), form: { class: "tournament-streaming-chip__form", data: { turbo_confirm: t("tournaments.hub.streaming_revoke_confirm", name: label) } } do %> <%= t("tournaments.hub.streaming_revoke") %> <% end %> <% end %>
<% end %> <% pending.each do |invitation| %>
<%= invitation.email %> <% if writable %> <%= button_to public_tournament_invitation_path(@tournament, invitation), method: :delete, params: { tab: tab }, class: "tournament-streaming-chip__action", title: t("team.streaming_staff.cancel_invitation"), form: { class: "tournament-streaming-chip__form", data: { turbo_confirm: tournament_invite_cancel_confirm(invitation) } } do %> <%= t("team.streaming_staff.cancel_invitation") %> <% end %> <% end %>
<% end %> <% if writable && invite && assignments.empty? && pending.empty? %> <%= form_with url: public_tournament_invitations_path(@tournament), method: :post, html: { class: "tournament-streaming-form" } do %> <%= hidden_field_tag :from, "calendar" %> <%= hidden_field_tag :tab, tab %> <%= hidden_field_tag "match_ids[]", match.id %> <%= email_field_tag :email, nil, required: true, autocomplete: "email", placeholder: t("tournaments.hub.invite_email"), class: "tournament-streaming-form__email", id: "stream_email_#{match.id}" %> <%= submit_tag t("tournaments.hub.streaming_invite"), class: "btn btn-secondary tournament-match-form__save" %> <% end %> <% elsif assignments.empty? && pending.empty? %> <% end %>