% content_for :title, "Set Up SimpleFin Accounts" %>
<%= render DS::Dialog.new do |dialog| %>
<% dialog.with_header(title: "Set Up Your SimpleFin Accounts") do %>
<%= icon "building-2", class: "text-primary" %>
Choose the correct account types for your imported accounts
<% end %>
<% dialog.with_body do %>
<%= form_with url: complete_account_setup_simplefin_item_path(@simplefin_item),
method: :post,
local: true,
data: {
controller: "loading-button",
action: "submit->loading-button#showLoading",
loading_button_loading_text_value: "Creating Accounts...",
turbo_frame: "_top"
},
class: "space-y-6" do |form| %>
<%= icon "info", size: "sm", class: "text-primary mt-0.5 flex-shrink-0" %>
Choose the correct account type for each SimpleFin account:
- Checking or Savings - Regular bank accounts
- Credit Card - Credit card accounts
- Investment - Brokerage, 401(k), IRA accounts
- Loan or Mortgage - Debt accounts
- Other Asset - Everything else
<%= icon "clock", size: "sm", class: "text-primary mt-0.5 flex-shrink-0" %>
Transaction History:
SimpleFin typically provides 60-90 days of transaction history, depending on your bank.
After initial setup, new transactions will sync automatically going forward.
Historical data availability varies by institution and account type.
<% @simplefin_accounts.each do |simplefin_account| %>
<% inferred = @inferred_map[simplefin_account.id] || {} %>
<% selected_type = inferred[:confidence] == :high ? inferred[:type] : "skip" %>
<%# Check if this account needs user attention (type selected but subtype missing) %>
<% types_with_subtypes = %w[Depository Investment Loan] %>
<% needs_subtype_attention = selected_type != "skip" && types_with_subtypes.include?(selected_type) && inferred[:subtype].blank? %>
">
<%= simplefin_account.name %>
<% if simplefin_account.org_data.present? && simplefin_account.org_data['name'].present? %>
• <%= simplefin_account.org_data["name"] %>
<% end %>
Balance: <%= number_to_currency(simplefin_account.current_balance || 0, unit: simplefin_account.currency) %>
<%= label_tag "account_types[#{simplefin_account.id}]", "Account Type:",
class: "block text-sm font-medium text-primary mb-2" %>
<%= select_tag "account_types[#{simplefin_account.id}]",
options_for_select(@account_type_options, selected_type),
{ class: "appearance-none bg-container border border-primary rounded-md px-3 py-2 text-sm leading-6 text-primary focus:border-primary focus:ring-1 focus:ring-primary focus:outline-none w-full",
data: {
action: "change->account-type-selector#updateSubtype"
} } %>
<% @subtype_options.each do |account_type, subtype_config| %>
<%= render "subtype_select", account_type: account_type, subtype_config: subtype_config, simplefin_account: simplefin_account %>
<% end %>
<% end %>
<% if @stale_simplefin_accounts&.any? %>
<%= icon "alert-triangle", size: "sm", class: "text-warning mt-0.5 flex-shrink-0" %>
<%= t("simplefin_items.setup_accounts.stale_accounts.title") %>
<%= t("simplefin_items.setup_accounts.stale_accounts.description") %>
<% @stale_simplefin_accounts.each do |simplefin_account| %>
<%= render "stale_account_row", simplefin_account: simplefin_account, target_accounts: @target_accounts %>
<% end %>
<% end %>
<%= render DS::Button.new(
text: "Create Accounts",
variant: "primary",
icon: "plus",
type: "submit",
class: "flex-1",
data: { loading_button_target: "button" }
) %>
<%= render DS::Link.new(
text: "Cancel",
variant: "secondary",
href: accounts_path
) %>
<% end %>
<% end %>
<% end %>