The personal finance app for everyone (by everyone)
Ruby
<%= render DS::Dialog.new do |dialog| %>
<% dialog.with_header(title: t(".header.title"), subtitle: t(".header.subtitle")) %>
<% 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| %>
<section class="space-y-4">
<div class="space-y-2">
<h2 class="text-sm font-medium text-secondary">
<%= @entry.amount.positive? ? t(".from_account_named", name: @entry.account.name) : t(".from_account") %>
</h2>
<% if @entry.amount.positive? %>
<%= render DS::Select.new(
form: f,
method: :entry_id,
items: [ { value: @entry.id, label: entry_name_detailed(@entry), object: @entry.account } ],
selected: @entry.id,
variant: :logo,
disabled: true,
label: t(".outflow_transaction")
) %>
<% else %>
<%= render "transfer_matches/matching_fields",
form: f, entry: @entry, candidates: @candidate_entries, accounts: @accounts %>
<% end %>
</div>
</section>
<div class="flex justify-center py-2">
<%= icon "arrow-down" %>
</div>
<section class="space-y-4">
<div class="space-y-2">
<h2 class="text-sm font-medium text-secondary">
<%= @entry.amount.negative? ? t(".to_account_named", name: @entry.account.name) : t(".to_account") %>
</h2>
<% if @entry.amount.negative? %>
<%= render DS::Select.new(
form: f,
method: :entry_id,
items: [ { value: @entry.id, label: entry_name_detailed(@entry), object: @entry.account } ],
selected: @entry.id,
variant: :logo,
disabled: true,
label: t(".inflow_transaction")
) %>
<% else %>
<%= render "transfer_matches/matching_fields",
form: f, entry: @entry, candidates: @candidate_entries, accounts: @accounts %>
<% end %>
</div>
</section>
<%= f.submit t(".create_transfer_match") %>
<% end %>
<% end %>
<% end %>