2024-07-01 10:49:43 -04:00
|
|
|
<%# locals: (entry:, selectable: true, editable: true, short: false, show_tags: false, **opts) %>
|
|
|
|
<% transaction, account = entry.account_transaction, entry.account %>
|
2024-06-24 11:58:39 -04:00
|
|
|
|
2024-07-01 10:49:43 -04:00
|
|
|
<div class="grid grid-cols-12 items-center text-gray-900 text-sm font-medium p-4">
|
2024-08-02 17:09:25 -04:00
|
|
|
<% name_col_span = unconfirmed_transfer?(entry) ? "col-span-10" : short ? "col-span-6" : "col-span-4" %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<div class="pr-10 flex items-center gap-4 <%= name_col_span %>">
|
|
|
|
<% if selectable %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= check_box_tag dom_id(entry, "selection"),
|
2024-06-24 11:58:39 -04:00
|
|
|
class: "maybe-checkbox maybe-checkbox--light",
|
2024-07-01 10:49:43 -04:00
|
|
|
data: { id: entry.id, "bulk-select-target": "row", action: "bulk-select#toggleRowSelection" } %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<div class="max-w-full">
|
|
|
|
<%= content_tag :div, class: ["flex items-center gap-2"] do %>
|
|
|
|
<div class="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gray-600/5 text-gray-600">
|
2024-08-09 20:11:27 -04:00
|
|
|
<%= entry_name(entry).first.upcase %>
|
2024-06-24 11:58:39 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="truncate text-gray-900">
|
2024-10-31 09:57:06 -03:00
|
|
|
<% if entry.new_record? || !editable %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= content_tag :p, entry.name %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% else %>
|
2024-08-09 20:11:27 -04:00
|
|
|
<%= link_to entry_name(entry),
|
2024-07-01 10:49:43 -04:00
|
|
|
account_entry_path(account, entry),
|
2024-06-24 11:58:39 -04:00
|
|
|
data: { turbo_frame: "drawer", turbo_prefetch: false },
|
|
|
|
class: "hover:underline hover:text-gray-800" %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
2024-07-01 10:49:43 -04:00
|
|
|
<% if unconfirmed_transfer?(entry) %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% if editable %>
|
2024-07-16 14:08:24 -04:00
|
|
|
<%= form_with url: unmark_transfers_transactions_path, class: "flex items-center", data: {
|
2024-06-24 11:58:39 -04:00
|
|
|
turbo_confirm: {
|
|
|
|
title: t(".remove_transfer"),
|
|
|
|
body: t(".remove_transfer_body"),
|
|
|
|
accept: t(".remove_transfer_confirm"),
|
|
|
|
},
|
|
|
|
turbo_frame: "_top"
|
|
|
|
} do |f| %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= f.hidden_field "bulk_update[entry_ids][]", value: entry.id %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<%= f.button class: "flex items-center justify-center group", title: "Remove transfer" do %>
|
|
|
|
<%= lucide_icon "arrow-left-right", class: "group-hover:hidden text-gray-500 w-4 h-4" %>
|
|
|
|
<%= lucide_icon "unlink", class: "hidden group-hover:inline-block text-gray-900 w-4 h-4" %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% else %>
|
|
|
|
<%= lucide_icon "arrow-left-right", class: "text-gray-500 w-4 h-4" %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
2024-07-01 10:49:43 -04:00
|
|
|
<% unless entry.marked_as_transfer? %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% unless short %>
|
|
|
|
<div class="flex items-center gap-1 <%= show_tags ? "col-span-6" : "col-span-3" %>">
|
|
|
|
<% if editable %>
|
|
|
|
<%= render "categories/menu", transaction: transaction %>
|
|
|
|
<% else %>
|
|
|
|
<%= render "categories/badge", category: transaction.category %>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<% if show_tags %>
|
|
|
|
<% transaction.tags.each do |tag| %>
|
|
|
|
<%= render partial: "tags/badge", locals: { tag: tag } %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<% unless show_tags %>
|
|
|
|
<%= tag.div class: short ? "col-span-4" : "col-span-3" do %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<% if entry.new_record? %>
|
|
|
|
<%= tag.p account.name %>
|
2024-06-24 11:58:39 -04:00
|
|
|
<% else %>
|
2024-07-01 10:49:43 -04:00
|
|
|
<%= link_to account.name,
|
|
|
|
account_path(account, tab: "transactions"),
|
2024-06-24 11:58:39 -04:00
|
|
|
data: { turbo_frame: "_top" },
|
|
|
|
class: "hover:underline" %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
|
2024-08-09 11:22:57 -04:00
|
|
|
<div class="col-span-2 ml-auto">
|
2024-06-24 11:58:39 -04:00
|
|
|
<%= content_tag :p,
|
2024-07-01 10:49:43 -04:00
|
|
|
format_money(-entry.amount_money),
|
|
|
|
class: ["text-green-600": entry.inflow?] %>
|
2024-06-24 11:58:39 -04:00
|
|
|
</div>
|
2024-07-01 10:49:43 -04:00
|
|
|
</div>
|