Files
sure/app/views/simplefin_items/show.html.erb
Sholom Ber 9e557df68a Fix SimpleFin integration bugs and improve code quality
- Fix upsert method to handle string/symbol keys with indifferent access
- Add missing show route and view for SimpleFin items
- Fix test fixtures to use correct user references
- Update test data to match real-world JSON format (string keys, BigDecimal)
- Apply code formatting and linting fixes (rubocop, erb_lint)
- Ensure all SimpleFin tests pass (16/16 passing)
2025-08-07 15:20:27 -04:00

68 lines
2.6 KiB
Plaintext

<% content_for :title, @simplefin_item.name %>
<div class="mb-8">
<%= link_to simplefin_items_path, class: "text-gray-700 hover:text-gray-900" do %>
← Back to SimpleFin Connections
<% end %>
<h1 class="text-2xl font-bold mt-2"><%= @simplefin_item.name %></h1>
<div class="flex space-x-2 mt-4">
<%= button_to "Sync", sync_simplefin_item_path(@simplefin_item),
method: :post,
class: "btn btn-secondary" %>
<%= button_to "Delete", simplefin_item_path(@simplefin_item),
method: :delete,
class: "btn btn-red",
data: { confirm: "Are you sure?" } %>
</div>
</div>
<div class="space-y-6">
<% if @simplefin_item.syncing? %>
<div class="p-4 bg-blue-50 border border-blue-200 rounded-lg">
<div class="flex items-center">
<%= icon "loader-2", class: "w-5 h-5 text-blue-600 animate-spin mr-2" %>
<p class="text-blue-700">Syncing accounts...</p>
</div>
</div>
<% end %>
<% if @simplefin_item.simplefin_accounts.any? %>
<div class="bg-white shadow rounded-lg">
<div class="px-6 py-4 border-b border-gray-200">
<h3 class="text-lg font-medium">Connected Accounts</h3>
</div>
<ul class="divide-y divide-gray-200">
<% @simplefin_item.simplefin_accounts.each do |simplefin_account| %>
<li class="p-6 flex justify-between items-center">
<div>
<h4 class="font-medium text-gray-900"><%= simplefin_account.name %></h4>
<p class="text-sm text-gray-500"><%= simplefin_account.account_type.humanize %></p>
<p class="text-sm text-gray-500">
Balance: <%= number_to_currency(simplefin_account.current_balance || 0) %>
<% if simplefin_account.currency != "USD" %>
<%= simplefin_account.currency %>
<% end %>
</p>
</div>
<div class="text-right">
<% if simplefin_account.account %>
<%= link_to "View Account", account_path(simplefin_account.account),
class: "text-blue-600 hover:text-blue-800" %>
<% else %>
<span class="text-gray-400">Setting up...</span>
<% end %>
</div>
</li>
<% end %>
</ul>
</div>
<% else %>
<div class="text-center py-12">
<p class="text-gray-500">No accounts found. Try syncing again.</p>
<%= button_to "Sync Now", sync_simplefin_item_path(@simplefin_item),
method: :post,
class: "mt-4 btn btn--secondary" %>
</div>
<% end %>
</div>