%# locals: (form:, entry:, candidates:, accounts:) %>
<% if candidates.any? %>
<%= t(".select_method") %>
<%= form.select :method,
[
[t(".match_existing_recommended"), "existing"],
[t(".create_new_transaction"), "new"]
],
{ selected: "existing", label: t(".matching_method") },
data: { action: "change->transfer-match#update" } %>
<%= form.select :matched_entry_id,
candidates.map { |entry|
[entry_name_detailed(entry), entry.id]
},
{ label: t(".matching_transaction") } %>
<%= form.select :target_account_id,
accounts.map { |account| [account.name, account.id] },
{ label: t(".target_account") } %>
<% else %>
<%= t(".no_matching_transactions") %>
<%= form.hidden_field :method, value: "new" %>
<%= form.select :target_account_id,
accounts.map { |account| [account.name, account.id] },
{ label: t(".target_account") } %>
<% end %>