<%= render DS::Dialog.new do |dialog| %> <% dialog.with_header(title: "Match transfer or payment") %> <% dialog.with_body do %> <%= styled_form_with( url: transaction_transfer_match_path(@entry), scope: :transfer_match, class: "space-y-8", data: { turbo_frame: :_top } ) do |f| %>

<%= @entry.amount.positive? ? "From account: #{@entry.account.name}" : "From account" %>

<% if @entry.amount.positive? %> <%= f.select( :entry_id, [[entry_name_detailed(@entry), @entry.id]], { label: "Outflow transaction", selected: @entry.id, }, disabled: true ) %> <% else %> <%= render "transfer_matches/matching_fields", form: f, entry: @entry, candidates: @transfer_match_candidates.map { |pm| pm.outflow_transaction.entry }, accounts: @accounts %> <% end %>
<%= icon "arrow-down" %>

<%= @entry.amount.negative? ? "To account: #{@entry.account.name}" : "To account" %>

<% if @entry.amount.negative? %> <%= f.select( :entry_id, [[entry_name_detailed(@entry), @entry.id]], { label: "Inflow transaction", selected: @entry.id, }, disabled: true ) %> <% else %> <%= render "transfer_matches/matching_fields", form: f, entry: @entry, candidates: @transfer_match_candidates.map { |pm| pm.inflow_transaction.entry }, accounts: @accounts %> <% end %>
<%= f.submit "Create transfer match" %> <% end %> <% end %> <% end %>