Files
sure/app/components/UI/account/activity_date.html.erb
T
7e26fcb478 feat(accounts): group split transactions in account activity feed (#3359)
The account activity tab rendered split transaction children as flat,
ungrouped rows, unlike /transactions which collapses them into a
parent row with indented children when "Group split transactions" is
enabled. Wire the same EntriesHelper.group_split_entries logic into
the account activity feed (UI::Account::ActivityDate, the actual
render path since the ViewComponent refactor superseded the old
accounts/show/_activity partial), sourcing split parents via the same
single-query batched lookup pattern already used by
TransactionsController#index.

Also forward view_ctx through entries/_split_group so split children
render correctly regardless of which page renders the group.

Fixes we-promise/sure#3227

Co-authored-by: Gerald <248542187+gfr-free@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-03 22:20:25 +02:00

56 lines
2.2 KiB
ERB

<%= tag.div id: id, data: { bulk_select_target: "group" }, class: "bg-container-inset rounded-xl p-1 w-full" do %>
<details class="group">
<summary>
<div class="py-2 px-4 flex items-center justify-between font-medium text-xs text-secondary">
<div class="flex pl-0.5 items-center gap-4">
<%= check_box_tag "#{date}_entries_selection",
class: ["checkbox checkbox--light hidden lg:block", "lg:hidden": entries.size == 0],
id: "selection_entry_#{date}",
data: {
action: "bulk-select#toggleGroupSelection",
checkbox_toggle_target: "selectionEntry"
} %>
<p class="uppercase space-x-1.5">
<%= tag.span I18n.l(date, format: :long) %>
<span>&middot;</span>
<%= tag.span entries.size %>
</p>
</div>
<div class="flex items-center gap-4">
<div class="flex items-center gap-2">
<span class="font-medium privacy-sensitive"><%= end_balance_money.format %></span>
<%= render DS::Tooltip.new(text: t(".balance_tooltip"), placement: "left", size: "sm", as: :span) %>
</div>
<%= helpers.icon "chevron-down", class: "group-open:rotate-180" %>
</div>
</div>
</summary>
<div class="p-4">
<% if balance %>
<%= render UI::Account::BalanceReconciliation.new(balance: balance, account: account) %>
<% else %>
<p class="text-sm text-secondary"><%= t(".no_balance_data") %></p>
<% end %>
</div>
</details>
<div class="bg-container shadow-border-xs rounded-lg">
<% if Current.user.show_split_grouped? %>
<% helpers.group_split_entries(entries, split_parents).each do |item| %>
<% if item.is_a?(EntriesHelper::SplitGroup) %>
<%= render "entries/split_group", split_group: item, view_ctx: "account" %>
<% else %>
<%= render item, view_ctx: "account" %>
<% end %>
<% end %>
<% else %>
<% entries.each do |entry| %>
<%= render entry, view_ctx: "account" %>
<% end %>
<% end %>
</div>
<% end %>