<h1>Assign Mat/Queue for Match <%= @match.bout_number %></h1>

<% if @current_mat %>
  <p>Current Assignment: Mat <%= @current_mat.name %><%= @current_queue_position ? " (Queue #{@current_queue_position})" : "" %></p>
<% else %>
  <p>Current Assignment: Unassigned</p>
<% end %>

<%= form_with model: @match, url: update_assignment_match_path(@match), method: :patch do |f| %>
  <div class="field">
    <%= f.label :mat_id, "Mat" %><br>
    <%= f.collection_select :mat_id, @mats, :id, :name, { include_blank: "Unassigned" } %>
  </div>
  <br>
  <div class="field">
    <%= f.label :queue_position, "Queue Position" %><br>
    <%= f.select :queue_position,
      options_for_select(
        [
          ["On Mat (Queue 1)", 1],
          ["On Deck (Queue 2)", 2],
          ["In The Hole (Queue 3)", 3],
          ["Warm Up (Queue 4)", 4]
        ],
        @current_queue_position
      ),
      include_blank: "Select position"
    %>
  </div>
  <br>
  <div class="actions">
    <%= f.submit "Update Assignment", class: "btn btn-success" %>
  </div>
<% end %>
