mirror of
https://github.com/we-promise/sure.git
synced 2026-06-06 11:19:02 +00:00
* First pass of Akahu * fix up sync all * conflicts * fix db migration issue? - fix auto selection of akahu account type * Address Akahu PR feedback * Complete provider metadata * Fix PR 1921 CI tests * PR feedback * PR feedback * post merge --------- Co-authored-by: failing <failing@users.noreply.github.com> Co-authored-by: Juan José Mata <jjmata@jjmata.com> Co-authored-by: sure-admin <sure-admin@splashblot.com>
115 lines
4.8 KiB
Plaintext
115 lines
4.8 KiB
Plaintext
<%# locals: (akahu_item:) %>
|
|
|
|
<%= tag.div id: dom_id(akahu_item) do %>
|
|
<%= render DS::Disclosure.new(variant: :card, open: true) do |disclosure| %>
|
|
<% disclosure.with_summary_content do %>
|
|
<div class="flex items-center justify-between gap-2 w-full">
|
|
<div class="flex items-center gap-2">
|
|
<%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>
|
|
|
|
<div class="flex items-center justify-center h-8 w-8 bg-surface rounded-full">
|
|
<p class="text-primary text-xs font-medium"><%= akahu_item.name.to_s.first.to_s.upcase %></p>
|
|
</div>
|
|
|
|
<div class="pl-1 text-sm">
|
|
<div class="flex items-center gap-2">
|
|
<%= tag.p akahu_item.name, class: "font-medium text-primary" %>
|
|
<% if akahu_item.scheduled_for_deletion? %>
|
|
<p class="text-destructive text-sm animate-pulse"><%= t(".deletion_in_progress") %></p>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% if akahu_item.accounts.any? %>
|
|
<p class="text-xs text-secondary"><%= akahu_item.institution_summary %></p>
|
|
<% end %>
|
|
|
|
<% if akahu_item.syncing? %>
|
|
<div class="text-secondary flex items-center gap-1">
|
|
<%= icon "loader", size: "sm", class: "animate-spin" %>
|
|
<%= tag.span t(".syncing") %>
|
|
</div>
|
|
<% elsif akahu_item.sync_error.present? %>
|
|
<div class="text-secondary flex items-center gap-1">
|
|
<%= render DS::Tooltip.new(text: akahu_item.sync_error, icon: "alert-circle", size: "sm", color: "destructive", as: :span) %>
|
|
<%= tag.span t(".error"), class: "text-destructive" %>
|
|
</div>
|
|
<% else %>
|
|
<p class="text-secondary">
|
|
<% if akahu_item.last_synced_at %>
|
|
<%= t(".status_with_summary", timestamp: time_ago_in_words(akahu_item.last_synced_at), summary: akahu_item.sync_status_summary) %>
|
|
<% else %>
|
|
<%= t(".status_never") %>
|
|
<% end %>
|
|
</p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<% if Current.user&.admin? %>
|
|
<div class="flex items-center gap-2">
|
|
<%= render DS::Menu.new do |menu| %>
|
|
<% menu.with_item(
|
|
variant: "button",
|
|
text: t(".delete"),
|
|
icon: "trash-2",
|
|
href: akahu_item_path(akahu_item),
|
|
method: :delete,
|
|
confirm: CustomConfirm.for_resource_deletion(akahu_item.name, high_severity: true)
|
|
) %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% unless akahu_item.scheduled_for_deletion? %>
|
|
<div class="space-y-4 mt-4">
|
|
<% if akahu_item.accounts.any? %>
|
|
<%= render "accounts/index/account_groups", accounts: akahu_item.accounts %>
|
|
<% end %>
|
|
|
|
<% stats = if defined?(@akahu_sync_stats_map) && @akahu_sync_stats_map
|
|
@akahu_sync_stats_map[akahu_item.id] || {}
|
|
else
|
|
akahu_item.syncs.ordered.first&.sync_stats || {}
|
|
end %>
|
|
<%= render ProviderSyncSummary.new(
|
|
stats: stats,
|
|
provider_item: akahu_item,
|
|
institutions_count: akahu_item.connected_institutions.size
|
|
) %>
|
|
|
|
<% unlinked_count = akahu_item.unlinked_accounts_count %>
|
|
<% linked_count = akahu_item.linked_accounts_count %>
|
|
<% total_count = akahu_item.total_accounts_count %>
|
|
|
|
<% if unlinked_count > 0 %>
|
|
<div class="p-4 flex flex-col gap-3 items-center justify-center">
|
|
<p class="text-primary font-medium text-sm"><%= t(".setup_needed") %></p>
|
|
<p class="text-secondary text-sm"><%= t(".setup_description", linked: linked_count, total: total_count) %></p>
|
|
<%= render DS::Link.new(
|
|
text: t(".setup_action"),
|
|
icon: "settings",
|
|
variant: "primary",
|
|
href: setup_accounts_akahu_item_path(akahu_item),
|
|
frame: :modal
|
|
) %>
|
|
</div>
|
|
<% elsif akahu_item.accounts.empty? && total_count == 0 %>
|
|
<div class="p-4 flex flex-col gap-3 items-center justify-center">
|
|
<p class="text-primary font-medium text-sm"><%= t(".no_accounts_title") %></p>
|
|
<p class="text-secondary text-sm"><%= t(".no_accounts_description") %></p>
|
|
<%= render DS::Link.new(
|
|
text: t(".setup_action"),
|
|
icon: "settings",
|
|
variant: "primary",
|
|
href: setup_accounts_akahu_item_path(akahu_item),
|
|
frame: :modal
|
|
) %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|