2024-07-01 10:49:43 -04:00
|
|
|
<%# locals: (entry:, **opts) %>
|
|
|
|
|
|
|
|
<% account = entry.account %>
|
|
|
|
|
|
|
|
<%= turbo_frame_tag dom_id(entry) do %>
|
|
|
|
<% is_oldest = entry.first_of_type? %>
|
|
|
|
|
2024-06-21 16:23:28 -04:00
|
|
|
<div class="p-4 grid grid-cols-10 items-center">
|
|
|
|
<div class="col-span-5 flex items-center gap-4">
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= tag.div class: "w-8 h-8 rounded-full p-1.5 flex items-center justify-center", style: entry_style(entry, is_oldest:).html_safe do %>
|
|
|
|
<%= lucide_icon entry_icon(entry, is_oldest:), class: "w-4 h-4" %>
|
2024-06-21 16:23:28 -04:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<div class="text-sm">
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= tag.p entry.date, class: "text-gray-900 font-medium" %>
|
|
|
|
<%= tag.p is_oldest ? t(".start_balance") : t(".value_update"), class: "text-gray-500" %>
|
2024-06-21 16:23:28 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-span-2 justify-self-end">
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= tag.p format_money(entry.amount_money), class: "font-medium text-sm text-gray-900" %>
|
2024-06-21 16:23:28 -04:00
|
|
|
</div>
|
|
|
|
|
2024-07-01 10:49:43 -04:00
|
|
|
<div class="col-span-2 justify-self-end font-medium text-sm" style="color: <%= entry.trend.color %>">
|
|
|
|
<% if entry.trend.direction.flat? %>
|
2024-06-21 16:23:28 -04:00
|
|
|
<%= tag.span t(".no_change"), class: "text-gray-500" %>
|
|
|
|
<% else %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= tag.span format_money(entry.trend.value) %>
|
|
|
|
<%= tag.span "(#{entry.trend.percent}%)" %>
|
2024-06-21 16:23:28 -04:00
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-span-1 justify-self-end">
|
|
|
|
<%= contextual_menu do %>
|
|
|
|
<div class="w-48 p-1 text-sm leading-6 text-gray-900 bg-white shadow-lg shrink rounded-xl ring-1 ring-gray-900/5">
|
2024-09-09 17:13:52 -04:00
|
|
|
<%= contextual_menu_modal_action_item t(".edit_entry"), edit_account_entry_path(account, entry), turbo_frame: dom_id(entry) %>
|
2024-06-21 16:23:28 -04:00
|
|
|
|
|
|
|
<%= contextual_menu_destructive_item t(".delete_entry"),
|
2024-07-01 10:49:43 -04:00
|
|
|
account_entry_path(account, entry),
|
2024-06-21 16:23:28 -04:00
|
|
|
turbo_frame: "_top",
|
|
|
|
turbo_confirm: {
|
|
|
|
title: t(".confirm_title"),
|
|
|
|
body: t(".confirm_body_html"),
|
|
|
|
accept: t(".confirm_accept")
|
|
|
|
} %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|