Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
1.2 KB
Raw Blame
<%# locals: (entry:) %>

<%# The wrapper always renders (empty when no provenance) so the drawer can
    turbo-replace it after in-drawer category edits. %>
<% transaction = entry.transaction %>
<div id="<%= dom_id(entry, :category_provenance) %>">
  <% if (provenance = transaction.category_provenance) %>
    <div class="px-3 pt-3 space-y-1" data-testid="category-provenance">
      <div class="flex items-center justify-between gap-2">
        <span class="text-sm text-secondary"><%= t(".title") %></span>
        <%= render DS::Pill.new(
          label: t("transactions.category_provenance.labels.#{provenance.source}.#{provenance.status}"),
          tone: :neutral,
          marker: false,
          icon: provenance.current? ? "sparkles" : "history"
        ) %>
      </div>
      <p class="text-xs text-secondary">
        <%= t(".assigned",
              category: category_provenance_category_name(transaction, provenance),
              source: t("transactions.category_provenance.sources.#{provenance.source}"),
              time_ago: time_ago_in_words(provenance.recorded_at)) %>
      </p>
      <% if provenance.history? %>
        <p class="text-xs text-secondary"><%= t(".changed_afterwards") %></p>
      <% end %>
    </div>
  <% end %>
</div>