mirror of
https://github.com/we-promise/sure.git
synced 2026-09-09 08:34:26 +00:00
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>
32 lines
614 B
Ruby
32 lines
614 B
Ruby
class UI::Account::ActivityDate < ApplicationComponent
|
|
attr_reader :account, :data
|
|
|
|
delegate :date, :entries, :balance, :transfers, :split_parents, to: :data
|
|
|
|
def initialize(account:, data:)
|
|
@account = account
|
|
@data = data
|
|
end
|
|
|
|
def id
|
|
dom_id(account, "entries_#{date}")
|
|
end
|
|
|
|
def broadcast_channel
|
|
account
|
|
end
|
|
|
|
def end_balance_money
|
|
balance&.end_balance_money || Money.new(0, account.currency)
|
|
end
|
|
|
|
def broadcast_refresh!
|
|
Turbo::StreamsChannel.broadcast_replace_to(
|
|
broadcast_channel,
|
|
target: id,
|
|
renderable: self,
|
|
layout: false
|
|
)
|
|
end
|
|
end
|