Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
2.5 KB
Raw Blame
<%= 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">
            <% if projected? %>
              <%= render DS::Pill.new(label: t("UI.account.activity_date.projected"), tone: :neutral, marker: false, icon: "calendar") %>
            <% end %>
            <span class="font-medium privacy-sensitive"><%= end_balance_money.format %></span>
            <%= render DS::Tooltip.new(text: t(projected? ? "UI.account.activity_date.projected_balance_tooltip" : "UI.account.activity_date.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("UI.account.activity_date.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 %>