<% submit_label = local_assigns.fetch(:submit_label, "Update Match") %> <% redirect_path = local_assigns[:redirect_path] %>

Match Results


<%= f.label "Win type" %>
<%= f.select :win_type, Match::WIN_TYPES, { include_blank: false }, { data: { match_score_target: "winType", action: "change->match-score#winTypeChanged" } } %>

<%= f.label "Overtime Type" %> Leave blank if not overtime. For High School the 1st overtime is SV-1, second overtime is TB-1, third overtime is UTB.
<%= f.select(:overtime_type, Match::OVERTIME_TYPES, {}, { data: { match_score_target: "overtimeSelect" } }) %>

<%= f.label "Winner" %> Please choose the winner
<%= f.collection_select :winner_id, @wrestlers, :id, :name_with_school, { include_blank: true }, { data: { match_score_target: "winnerSelect", action: "change->match-score#winnerChanged" } } %>

<%= f.label "Final Score" %>
<% if @match.finished == 1 %> <%= f.text_field :score, id: "final-score-field", data: { match_score_target: "finalScoreField" }, class: "form-control", style: "max-width: 220px;" %> <% else %> The input will adjust based on the selected win type.
<%= f.hidden_field :score, id: "final-score-field", data: { match_score_target: "finalScoreField" } %> <% end %>
<%= hidden_field_tag :redirect_to, redirect_path if redirect_path.present? %> <%= f.hidden_field :finished, value: 1 %> <%= f.hidden_field :round, value: @match.round %>
<%= f.submit submit_label, id: "update-match-btn", data: { match_score_target: "submitButton", action: "click->match-score#confirmWinner" }, class: "btn btn-success" %>