mirror of
https://github.com/we-promise/sure.git
synced 2026-04-14 09:34:05 +00:00
- 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)
96 lines
4.0 KiB
Plaintext
96 lines
4.0 KiB
Plaintext
<%# locals: (simplefin_item:) %>
|
|
|
|
<%= tag.div id: dom_id(simplefin_item) do %>
|
|
<details open class="group bg-container p-4 shadow-border-xs rounded-xl">
|
|
<summary class="flex items-center justify-between gap-2 focus-visible:outline-hidden">
|
|
<div class="flex items-center gap-2">
|
|
<%= icon "chevron-right", class: "group-open:transform group-open:rotate-90" %>
|
|
|
|
<div class="flex items-center justify-center h-8 w-8 bg-alpha-black-50 rounded-full">
|
|
<% if simplefin_item.logo.attached? %>
|
|
<%= image_tag simplefin_item.logo, class: "rounded-full h-full w-full", loading: "lazy" %>
|
|
<% else %>
|
|
<div class="flex items-center justify-center">
|
|
<%= tag.p simplefin_item.name.first.upcase, class: "text-primary text-xs font-medium" %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="pl-1 text-sm">
|
|
<div class="flex items-center gap-2">
|
|
<%= tag.p simplefin_item.name, class: "font-medium text-primary" %>
|
|
<% if simplefin_item.scheduled_for_deletion? %>
|
|
<p class="text-destructive text-sm animate-pulse">(deletion in progress...)</p>
|
|
<% end %>
|
|
</div>
|
|
<% if simplefin_item.syncing? %>
|
|
<div class="text-secondary flex items-center gap-1">
|
|
<%= icon "loader", size: "sm", class: "animate-pulse" %>
|
|
<%= tag.span "Syncing..." %>
|
|
</div>
|
|
<% elsif simplefin_item.requires_update? %>
|
|
<div class="text-warning flex items-center gap-1">
|
|
<%= icon "alert-triangle", size: "sm", color: "warning" %>
|
|
<%= tag.span "Requires Update" %>
|
|
</div>
|
|
<% elsif simplefin_item.sync_error.present? %>
|
|
<div class="text-secondary flex items-center gap-1">
|
|
<%= icon "alert-circle", size: "sm", color: "destructive" %>
|
|
<%= tag.span "Error", class: "text-destructive" %>
|
|
</div>
|
|
<% else %>
|
|
<p class="text-secondary">
|
|
<%= simplefin_item.last_synced_at ? "Last synced #{time_ago_in_words(simplefin_item.last_synced_at)} ago" : "Never synced" %>
|
|
</p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-2">
|
|
<% if Rails.env.development? %>
|
|
<%= icon(
|
|
"refresh-cw",
|
|
as_button: true,
|
|
href: sync_simplefin_item_path(simplefin_item)
|
|
) %>
|
|
<% end %>
|
|
|
|
<%= render DS::Menu.new do |menu| %>
|
|
<% menu.with_item(
|
|
variant: "button",
|
|
text: "Delete",
|
|
icon: "trash-2",
|
|
href: simplefin_item_path(simplefin_item),
|
|
method: :delete,
|
|
confirm: CustomConfirm.for_resource_deletion(simplefin_item.name, high_severity: true)
|
|
) %>
|
|
<% end %>
|
|
</div>
|
|
</summary>
|
|
|
|
<% unless simplefin_item.scheduled_for_deletion? %>
|
|
<div class="space-y-4 mt-4">
|
|
<% if simplefin_item.accounts.any? %>
|
|
<%= render "accounts/index/account_groups", accounts: simplefin_item.accounts %>
|
|
<% elsif simplefin_item.pending_account_setup? %>
|
|
<div class="p-4 flex flex-col gap-3 items-center justify-center">
|
|
<p class="text-primary font-medium text-sm">Accounts ready to set up</p>
|
|
<p class="text-secondary text-sm">Choose account types for your imported SimpleFin accounts.</p>
|
|
<%= render DS::Link.new(
|
|
text: "Set Up Accounts",
|
|
icon: "settings",
|
|
variant: "primary",
|
|
href: setup_accounts_simplefin_item_path(simplefin_item)
|
|
) %>
|
|
</div>
|
|
<% else %>
|
|
<div class="p-4 flex flex-col gap-3 items-center justify-center">
|
|
<p class="text-primary font-medium text-sm">No accounts found</p>
|
|
<p class="text-secondary text-sm">This connection doesn't have any synchronized accounts yet.</p>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</details>
|
|
<% end %>
|