mirror of
https://github.com/we-promise/sure.git
synced 2026-04-08 14:54:49 +00:00
* Support manual recurring * Automatic variance calc * Automatic variance update * Tooltip for manual * Review * Fix variance calculations Manual recurring updates collapse occurrence tracking when amounts repeat * Proper Bigdecimal calcs * Fix n+1 query * Nicer UI errors. * Style --------- Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
61 lines
2.5 KiB
Plaintext
61 lines
2.5 KiB
Plaintext
<%# locals: (recurring_transaction:) %>
|
|
|
|
<div class="grid grid-cols-12 items-center text-subdued text-sm font-medium p-4 lg:p-4 bg-container-inset rounded">
|
|
<div class="pr-4 lg:pr-10 flex items-center gap-3 lg:gap-4 col-span-8">
|
|
<div class="max-w-full">
|
|
<%= content_tag :div, class: ["flex items-center gap-2"] do %>
|
|
<% if recurring_transaction.merchant.present? %>
|
|
<% if recurring_transaction.merchant.logo_url.present? %>
|
|
<%= image_tag recurring_transaction.merchant.logo_url,
|
|
class: "w-6 h-6 rounded-full",
|
|
loading: "lazy" %>
|
|
<% else %>
|
|
<%= render DS::FilledIcon.new(
|
|
variant: :text,
|
|
text: recurring_transaction.merchant.name,
|
|
size: "sm",
|
|
rounded: true
|
|
) %>
|
|
<% end %>
|
|
<% else %>
|
|
<%= render DS::FilledIcon.new(
|
|
variant: :text,
|
|
text: recurring_transaction.name,
|
|
size: "sm",
|
|
rounded: true
|
|
) %>
|
|
<% end %>
|
|
|
|
<div class="truncate">
|
|
<div class="space-y-0.5">
|
|
<div class="flex items-center gap-2 min-w-0">
|
|
<div class="truncate flex-shrink">
|
|
<%= recurring_transaction.merchant.present? ? recurring_transaction.merchant.name : recurring_transaction.name %>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-1 flex-shrink-0">
|
|
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-tint-10 text-link">
|
|
<%= t("recurring_transactions.projected") %>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-secondary text-xs font-normal">
|
|
<%= t("recurring_transactions.expected_on", date: l(recurring_transaction.next_expected_date, format: :short)) %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="hidden lg:flex items-center gap-1 col-span-2">
|
|
<span class="text-xs text-secondary"><%= t("recurring_transactions.recurring") %></span>
|
|
</div>
|
|
|
|
<div class="col-span-2 ml-auto text-right">
|
|
<% display_amount = recurring_transaction.manual? && recurring_transaction.expected_amount_avg.present? ? recurring_transaction.expected_amount_avg : recurring_transaction.amount %>
|
|
<%= content_tag :p, format_money(-Money.new(display_amount, recurring_transaction.currency)), class: ["font-medium", display_amount.negative? ? "text-success" : "text-subdued"] %>
|
|
</div>
|
|
</div>
|