<%# locals: (balance_sheet:, **args) %>
<% balance_sheet.classification_groups.each do |classification_group| %>

"> <%= classification_group.name %> <% if classification_group.account_groups.any? %> · <%= classification_group.total_money.format(precision: 0) %> <% end %>

<% if classification_group.account_groups.any? %>
<% classification_group.account_groups.each do |account_group| %>
<% end %>
<% classification_group.account_groups.each do |account_group| %>

<%= account_group.name %>

<%= number_to_percentage(account_group.weight, precision: 0) %>

<% end %>
Name

Weight

Value

<% classification_group.account_groups.each_with_index do |account_group, idx| %>
<%= idx == classification_group.account_groups.size - 1 ? "rounded-b-lg" : "" %> ">
<%= icon("chevron-right", class: "group-open:rotate-90") %>

<%= account_group.name %>

<%= render "pages/dashboard/group_weight", weight: account_group.weight, color: account_group.color %>

<%= format_money(account_group.total_money) %>

<% account_group.accounts.each_with_index do |account, idx| %>
<%= render "accounts/logo", account: account, size: "sm", color: account_group.color %> <%= link_to account.name, account_path(account) %>
<% # Calculate weight as percentage of classification total classification_total = classification_group.total_money.amount account_weight = classification_total.zero? ? 0 : account.converted_balance / classification_total * 100 %> <%= render "pages/dashboard/group_weight", weight: account_weight, color: account_group.color %>

<%= format_money(account.balance_money) %>

<% if idx < account_group.accounts.size - 1 %> <%= render "shared/ruler", classes: "ml-21 mr-4" %> <% end %> <% end %>
<% unless idx == classification_group.account_groups.size - 1 %> <%= render "shared/ruler", classes: "mx-4 group-ruler" %> <% end %> <% end %>
<% else %>
<%= render DS::FilledIcon.new( variant: :container, icon: classification_group.icon, ) %>

<%= t("pages.dashboard.balance_sheet.no_items", name: classification_group.name) %>

<%= t("pages.dashboard.balance_sheet.add_accounts", name: classification_group.name) %>

<% end %>
<% end %>
<%# Custom style for hiding ruler when details are open %>