The personal finance app for everyone (by everyone)
Ruby
<%= render DS::Dialog.new(variant: "drawer", frame: "bulk_transaction_edit_drawer") do |dialog| %>
<% dialog.with_header(title: t(".header_title"), data: { bulk_select_target: "bulkEditDrawerHeader" }) %>
<% dialog.with_body do %>
<%= styled_form_with url: transactions_bulk_update_path, scope: "bulk_update", class: "h-full flex flex-col justify-between gap-4", data: { turbo_frame: "_top" } do |form| %>
<div class="space-y-4">
<% unless @has_transfer_entry %>
<%= render DS::Disclosure.new(title: t(".overview"), open: true) do %>
<%= form.date_field :date, label: t(".date_label") %>
<% end %>
<% end %>
<%= render DS::Disclosure.new(title: t(".transactions_section"), open: true) do %>
<div class="space-y-2">
<%= form.text_field :name, label: t(".name_label"), placeholder: t(".name_placeholder") %>
<% if @has_category_editable_entry %>
<%= form.collection_select :category_id, Current.family.categories.alphabetically_by_hierarchy, :id, :name, { prompt: t(".category_prompt"), label: t(".category_label"), class: "text-subdued", variant: :badge, searchable: true } %>
<% end %>
<% if @has_normal_transaction_entry %>
<%= form.collection_select :merchant_id, Current.family.available_merchants_for(Current.user).alphabetically, :id, :name, { prompt: t(".merchant_prompt"), label: t(".merchant_label"), class: "text-subdued" } %>
<% end %>
<%= form.select :tag_ids, Current.family.tags.alphabetically.pluck(:name, :id), { include_blank: t(".none"), multiple: true, label: t(".tags_label"), include_hidden: false } %>
<% if Current.family&.manual_reconciliation? && @has_transaction_entry %>
<%= form.select :reconciled_status,
Entry.reconciled_statuses.keys.map { |status| [ t("transactions.reconcile.statuses.#{status}"), status ] },
{ include_blank: t(".no_change"), label: t(".reconciled_status_label") } %>
<p class="text-xs text-secondary"><%= t(".reconciled_status_hint") %></p>
<% end %>
<%= form.text_area :notes, label: t(".notes_label"), placeholder: t(".notes_placeholder"), rows: 5 %>
<% if @has_transfer_entry %>
<p class="text-xs text-secondary"><%= t(".transfer_fields_hint") %></p>
<% end %>
</div>
<% end %>
</div>
<div class="flex justify-end gap-2 mt-auto">
<%= render DS::Button.new(text: t(".cancel"), variant: "ghost", data: { action: "click->DS--dialog#close" }) %>
<%= render DS::Button.new(text: t(".save"), type: :submit, data: { bulk_select_scope_param: "bulk_update", action: "bulk-select#submitBulkRequest" }) %>
</div>
<% end %>
<% end %>
<% end %>