mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
* Consolidate modal form structure into partial + helper * Scaffold out trade transaction form * Normalize translations * Add buy and sell trade form with tests * Move entryable lists to dedicated controllers * Delegate entry group contents rendering * More cleanup * Extract transaction and valuation update logic from entries controller * Delegate edit and show actions to entryables * Trade builder * Update paths for transaction updates
51 lines
2.0 KiB
Plaintext
51 lines
2.0 KiB
Plaintext
<%# locals: (entry:, selectable: true, **opts) %>
|
|
|
|
<% trade, account = entry.account_trade, entry.account %>
|
|
|
|
<div class="grid grid-cols-12 items-center text-gray-900 text-sm font-medium p-4">
|
|
<div class="pr-10 flex items-center gap-4 col-span-6">
|
|
<% if selectable %>
|
|
<%= check_box_tag dom_id(entry, "selection"),
|
|
class: "maybe-checkbox maybe-checkbox--light",
|
|
data: { id: entry.id, "bulk-select-target": "row", action: "bulk-select#toggleRowSelection" } %>
|
|
<% end %>
|
|
|
|
<div class="max-w-full">
|
|
<%= 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">
|
|
<%= entry_name(entry).first.upcase %>
|
|
</div>
|
|
|
|
<div class="truncate text-gray-900">
|
|
<% if entry.new_record? %>
|
|
<%= content_tag :p, entry_name(entry) %>
|
|
<% else %>
|
|
<%= link_to entry_name(entry),
|
|
account_entry_path(account, entry),
|
|
data: { turbo_frame: "drawer", turbo_prefetch: false },
|
|
class: "hover:underline hover:text-gray-800" %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-center justify-end gap-1 col-span-3">
|
|
<% if entry.account_transaction? && entry.marked_as_transfer? %>
|
|
<%= tag.p entry.inflow? ? t(".deposit") : t(".withdrawal") %>
|
|
<% elsif entry.account_transaction? %>
|
|
<%= tag.p entry.inflow? ? t(".inflow") : t(".outflow") %>
|
|
<% else %>
|
|
<%= tag.p trade.buy? ? t(".buy") : t(".sell") %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="col-span-3 flex items-center justify-end">
|
|
<% if entry.account_transaction? %>
|
|
<%= tag.p format_money(entry.amount_money), class: { "text-green-500": entry.inflow? } %>
|
|
<% else %>
|
|
<%= tag.p format_money(entry.amount_money * -1), class: { "text-green-500": trade.sell? } %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|