mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Preserve original transaction names when enriching (#1556)
* Preserve original transaction name * Remove stale method * Fix tests
This commit is contained in:
parent
68617514b0
commit
7be6a372bf
22 changed files with 100 additions and 76 deletions
|
@ -13,14 +13,14 @@
|
|||
<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">
|
||||
<%= trade.name.first.upcase %>
|
||||
<%= entry.display_name.first.upcase %>
|
||||
</div>
|
||||
|
||||
<div class="truncate">
|
||||
<% if entry.new_record? %>
|
||||
<%= content_tag :p, trade.name %>
|
||||
<%= content_tag :p, entry.display_name %>
|
||||
<% else %>
|
||||
<%= link_to trade.name,
|
||||
<%= link_to entry.display_name,
|
||||
account_entry_path(entry),
|
||||
data: { turbo_frame: "drawer", turbo_prefetch: false },
|
||||
class: "hover:underline hover:text-gray-800" %>
|
||||
|
|
|
@ -11,17 +11,17 @@
|
|||
|
||||
<div class="max-w-full">
|
||||
<%= content_tag :div, class: ["flex items-center gap-2"] do %>
|
||||
<% if entry.account_transaction.merchant&.icon_url %>
|
||||
<%= image_tag entry.account_transaction.merchant.icon_url, class: "w-6 h-6 rounded-full" %>
|
||||
<% if transaction.merchant&.icon_url %>
|
||||
<%= image_tag transaction.merchant.icon_url, class: "w-6 h-6 rounded-full" %>
|
||||
<% else %>
|
||||
<%= render "shared/circle_logo", name: transaction.name, size: "sm" %>
|
||||
<%= render "shared/circle_logo", name: entry.display_name, size: "sm" %>
|
||||
<% end %>
|
||||
|
||||
<div class="truncate">
|
||||
<% if entry.new_record? %>
|
||||
<%= content_tag :p, transaction.name %>
|
||||
<%= content_tag :p, entry.display_name %>
|
||||
<% else %>
|
||||
<%= link_to transaction.name,
|
||||
<%= link_to entry.display_name,
|
||||
entry.transfer.present? ? account_transfer_path(entry.transfer) : account_entry_path(entry),
|
||||
data: { turbo_frame: "drawer", turbo_prefetch: false },
|
||||
class: "hover:underline hover:text-gray-800" %>
|
||||
|
@ -41,7 +41,7 @@
|
|||
<% end %>
|
||||
|
||||
<div class="col-span-2">
|
||||
<%= render "account/transfers/account_logos", transfer: entry.transfer, outflow: entry.outflow? %>
|
||||
<%= render "account/transfers/account_logos", transfer: entry.transfer, outflow: entry.amount.positive? %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="flex items-center gap-1 col-span-2">
|
||||
|
@ -65,7 +65,7 @@
|
|||
<div class="col-span-2 ml-auto">
|
||||
<%= content_tag :p,
|
||||
format_money(-entry.amount_money),
|
||||
class: ["text-green-600": entry.inflow?] %>
|
||||
class: ["text-green-600": entry.amount.negative?] %>
|
||||
</div>
|
||||
|
||||
<% if balance_trend %>
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
url: account_transaction_path(@entry),
|
||||
class: "space-y-2",
|
||||
data: { controller: "auto-submit-form" } do |f| %>
|
||||
<%= f.text_field :name,
|
||||
|
||||
<%= f.text_field @entry.enriched_at.present? ? :enriched_name : :name,
|
||||
label: t(".name_label"),
|
||||
"data-auto-submit-form-target": "auto" %>
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<% end %>
|
||||
|
||||
<div class="space-y-3">
|
||||
<%= form.hidden_field :name, value: "Balance update" %>
|
||||
<%= form.date_field :date, label: true, required: true, value: Date.current, min: Account::Entry.min_supported_date, max: Date.current %>
|
||||
<%= form.money_field :amount, label: t(".amount"), required: true %>
|
||||
</div>
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
<div class="truncate text-gray-900">
|
||||
<% if entry.new_record? %>
|
||||
<%= content_tag :p, entry.entryable.name %>
|
||||
<%= content_tag :p, entry.display_name %>
|
||||
<% else %>
|
||||
<%= link_to entry.entryable.name,
|
||||
<%= link_to entry.display_name,
|
||||
account_entry_path(entry),
|
||||
data: { turbo_frame: "drawer", turbo_prefetch: false },
|
||||
class: "hover:underline hover:text-gray-800" %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue