<%= t("pages.dashboard.outflows_donut.categories") %>·<%= outflows_data[:categories].count %>
<%= t("pages.dashboard.outflows_donut.value") %>
<%= t("pages.dashboard.outflows_donut.weight") %>
<% outflows_data[:categories].each_with_index do |category, idx| %>
<%
category_content = capture do
%>
<% if category[:icon] %>
<%= icon(category[:icon], color: "current", size: "sm") %>
<% else %>
<%= render DS::FilledIcon.new(
variant: :text,
hex_color: category[:color],
text: category[:name],
size: "sm",
rounded: true
) %>
<% end %>
<%= category[:name] %>
<%= format_money Money.new(category[:amount], category[:currency]) %>
<%= category[:percentage] %>%
<% end %>
<% if category[:clickable] != false %>
<%= link_to transactions_path(q: { categories: [category[:name]], start_date: period.date_range.first, end_date: period.date_range.last }),
class: "flex items-center justify-between mx-3 p-3 rounded-lg cursor-pointer group gap-3",
data: {
turbo_frame: "_top",
category_id: category[:id],
action: "mouseenter->donut-chart#highlightSegment mouseleave->donut-chart#unhighlightSegment"
} do %>
<%= category_content %>
<% end %>
<% else %>
<%= category_content %>
<% end %>
<% if idx < outflows_data[:categories].size - 1 %>
<%= render "shared/ruler", classes: "mx-3 lg:mx-4" %>
<% end %>
<% end %>