<%= datetime_local_field_tag "match[scheduled_at]", tournament_datetime_local(match.scheduled_at),
id: "match_at_#{match.id}", form: form_id, required: true, class: "tournament-match-form__datetime" %>
<%= select_tag "match[court]", options_for_select(courts, match.court),
id: "match_court_#{match.id}", form: form_id, include_blank: true, class: "tournament-match-form__court" %>
<%= t("tournaments.hub.round") %>
<%= tournament_phase_label(match) %>
<%= t("tournaments.hub.home") %>
<%= render "public/tournaments/match_side_select", match: match, side: :home, form_id: form_id %>
<%= button_to public_swap_tournament_match_path(@tournament, match), method: :post,
class: "tournament-match-swap__btn",
title: t("tournaments.hub.swap_sides"),
form: { class: "tournament-match-swap__form", data: { turbo: false } } do %>
<%= t("tournaments.hub.swap_sides") %>
<% end %>
<%= t("tournaments.hub.away") %>
<%= render "public/tournaments/match_side_select", match: match, side: :away, form_id: form_id %>
<%= t("tournaments.hub.result") %>
<% if match.result_recorded? %>
<%= match.home_score %>–<%= match.away_score %>
<% else %> <%= number_field_tag :home_score, match.home_score, id: "home_score_#{match.id}", form: form_id, data: { swap_score: "home" } %> – <%= number_field_tag :away_score, match.away_score, id: "away_score_#{match.id}", form: form_id, data: { swap_score: "away" } %> <% end %>
<%= submit_tag t("tournaments.hub.save_match"), form: form_id, class: "btn btn-secondary tournament-match-form__save" %>
<% if match.deletable? %>
<%= button_to t("matches.index.delete"), public_tournament_match_path(@tournament, match),
method: :delete, class: "btn btn-secondary tournament-match-form__save",
form: { class: "tournament-match-delete-form", data: { turbo_confirm: match.matchup_label } } %>
<% end %>
<% else %>
<%= t("tournaments.hub.datetime") %>
<%= match.scheduled_at ? l(match.scheduled_at, format: :short) : "—" %>
<%= t("tournaments.hub.court") %>
<%= match.court || "—" %>
<%= t("tournaments.hub.round") %>
<%= tournament_phase_label(match) %>
<%= t("tournaments.hub.home") %>
<%= tournament_team_chip(match.home_participant, name: match.home_display_name) %>
<%= t("tournaments.hub.away") %>
<%= tournament_team_chip(match.away_participant, name: match.away_display_name) %>
<%= t("tournaments.hub.result") %>
<% if match.home_score.present? %> <%= match.home_score %>–<%= match.away_score %> <% else %> — <% end %>