%# locals: (simplefin_item:, suggestions:) Banner rendered at the top of the SimpleFIN item card when the importer detects a likely card-replacement pair (old card + new card, same institution, same type). "Relink" reuses the existing link_existing_account controller action to atomically swap the AccountProvider on the linked Sure account. "Dismiss" persists a per-(dormant_sfa_id) dismissal on the latest sync's sync_stats so the banner stops showing for that pair. Suggestions are also auto-suppressed once the relink has already landed. %> <% latest_sync = simplefin_item.syncs.order(created_at: :desc).first %> <% dismissed_ids = Array(latest_sync&.sync_stats&.dig("dismissed_replacement_suggestions")) %>
<%= t("simplefin_items.replacement_prompt.title", institution: suggestion["institution_name"].presence || simplefin_item.name) %>
<%= button_to dismiss_replacement_suggestion_simplefin_item_path(simplefin_item), params: { dormant_sfa_id: old_sfa.id, active_sfa_id: new_sfa.id }, method: :post, form: { class: "inline shrink-0" }, class: "-mt-1 -mr-1 p-1 rounded hover:bg-yellow-100 theme-dark:hover:bg-yellow-900/40 text-secondary", aria: { label: t("simplefin_items.replacement_prompt.dismiss_aria") } do %> <%= icon "x", size: "sm" %> <% end %><%= t("simplefin_items.replacement_prompt.description", account_name: sure_account.name, old_name: old_sfa.name, new_name: new_sfa.name) %>