mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 05:25:24 +02:00
Enhance account links in transfers view to handle missing accounts gracefully. Added conditional checks to display a warning message when account data is unavailable.
This commit is contained in:
parent
ae41b3de46
commit
47017a6432
1 changed files with 19 additions and 2 deletions
|
@ -1,7 +1,24 @@
|
||||||
<%# locals: (transfer:, is_inflow: false) %>
|
<%# locals: (transfer:, is_inflow: false) %>
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
<% first_account, second_account = is_inflow ? [transfer.to_account, transfer.from_account] : [transfer.from_account, transfer.to_account] %>
|
<% first_account, second_account = is_inflow ? [transfer.to_account, transfer.from_account] : [transfer.from_account, transfer.to_account] %>
|
||||||
|
|
||||||
|
<%# Check if first_account exists before creating link %>
|
||||||
|
<% if first_account %>
|
||||||
<%= link_to first_account.name, account_path(first_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %>
|
<%= link_to first_account.name, account_path(first_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %>
|
||||||
|
<% else %>
|
||||||
|
<span class="text-warning text-xs italic" title="Transfer ID: <%= transfer.id %>">
|
||||||
|
Data Error: Missing account
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= lucide_icon is_inflow ? "arrow-left" : "arrow-right", class: "w-4 h-4 shrink-0" %>
|
<%= lucide_icon is_inflow ? "arrow-left" : "arrow-right", class: "w-4 h-4 shrink-0" %>
|
||||||
|
|
||||||
|
<%# Check if second_account exists before creating link %>
|
||||||
|
<% if second_account %>
|
||||||
<%= link_to second_account.name, account_path(second_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %>
|
<%= link_to second_account.name, account_path(second_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %>
|
||||||
|
<% else %>
|
||||||
|
<span class="text-warning text-xs italic" title="Transfer ID: <%= transfer.id %>">
|
||||||
|
Data Error: Missing account
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue