Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
1.1 KB
Raw Blame
<%# locals: (title:, occurrences:, suggestions: {}, meta: nil, pay_periods: [], pay_period_occurrences: occurrences) %>
<% return if occurrences.empty? %>

<% markers = bills_pay_period_markers(occurrences, pay_periods, currency: Current.family.currency, counted: pay_period_occurrences) %>

<%# No shell by default: bills/index stacks the month sections in one. %>
<%= render DS::Section.new(title: title, count: occurrences.size, inset: false, divided: false) do |section| %>
  <% section.with_aside { tag.p(meta, class: "text-xs text-secondary privacy-sensitive shrink-0") } if meta %>
  <% occurrences.each do |occurrence| %>
    <%# The marker belongs to the first row of its period, so it lands
        between groups without the section having to pre-bucket the rows. %>
    <% if (marker = markers[occurrence.id]) %>
      <%= render "bills/pay_period_marker",
                 period: marker[:period],
                 currency: Current.family.currency,
                 due_total: marker[:due_total] %>
    <% end %>
    <%= render "bills/occurrence", occurrence: occurrence, suggestion: suggestions[occurrence.id] %>
  <% end %>
<% end %>