<% content_for :title, "Programma partita — #{@club.name}" %>
<% content_for :robots, "noindex, nofollow" %>

<div class="wrap" style="padding-top:20px;max-width:560px">
  <p class="results-hint" style="margin-bottom:8px">
    <%= link_to "← Dirette e partite", public_live_index_path(club_id: @club.id), class: "back-link" %>
  </p>
  <h1>Programma partita</h1>
  <p style="color:#888">
    <%= @club.name %>
    <% if @club_admin %>
      · Puoi scegliere qualsiasi squadra della società
    <% else %>
      · Solo le squadre in cui sei responsabile trasmissione
    <% end %>
  </p>

  <div class="card" style="margin-top:16px">
    <%= form_with url: public_club_matches_path(@club), method: :post, local: true do %>
      <%= label_tag :team_id, "Squadra" %>
      <% if @schedulable_teams.size == 1 %>
        <%= hidden_field_tag :team_id, @selected_team.id %>
        <p style="margin:0 0 16px;font-weight:600"><%= @selected_team.name %></p>
      <% else %>
        <%= select_tag :team_id,
              options_from_collection_for_select(@schedulable_teams, :id, :name, @selected_team&.id),
              required: true %>
      <% end %>

      <%= render "public/matches/schedule_fields", match: @match %>

      <%= submit_tag "Salva in programma", class: "btn btn-primary", style: "margin-top:20px" %>
    <% end %>
  </div>
</div>
