<% error_msg = local_assigns[:error_message] || @error_message %> <% if error_msg.present? %> <%= render DS::Alert.new(message: error_msg, variant: :error) %> <% end %> <%= render "settings/providers/setup_steps", steps: [ t(".steps.step_1"), t(".steps.step_2"), t(".steps.step_3"), t(".steps.step_4"), t(".steps.step_5") ] %>

<%= t(".flex_query_details.eyebrow") %>

<%= t(".flex_query_details.title") %>

<%= t(".flex_query_details.summary") %>

<%= icon "chevron-down", class: "mt-0.5 text-secondary transition-transform group-open:rotate-180" %>

<%= t(".flex_query_details.sections_heading") %>

  • <%= t(".sections.account_information") %>
  • <%= t(".sections.cash_report") %>
    • <%= t(".sections.cash_report_options") %>
    • <%= t(".sections.cash_report_fields") %>
  • <%= t(".sections.cash_transactions") %>
    • <%= t(".sections.cash_transactions_options") %>
    • <%= t(".sections.cash_transactions_fields") %>
  • <%= t(".sections.change_in_position_value_summary") %>
  • <%= t(".sections.net_asset_value") %>
    • <%= t(".sections.net_asset_value_options") %>
    • <%= t(".sections.net_asset_value_fields") %>
  • <%= t(".sections.open_positions") %>
    • <%= t(".sections.open_positions_options") %>
    • <%= t(".sections.open_positions_fields") %>
  • <%= t(".sections.trades") %>
    • <%= t(".sections.trades_options") %>
    • <%= t(".sections.trades_fields") %>

<%= t(".flex_query_details.configuration_heading") %>

  • <%= t(".configuration.models") %>
  • <%= t(".configuration.format") %>
  • <%= t(".configuration.period") %>
  • <%= t(".configuration.date_format") %>
  • <%= t(".configuration.time_format") %>
  • <%= t(".configuration.date_time_separator") %>
  • <%= t(".configuration.profit_and_loss") %>
  • <%= t(".configuration.all_other_options") %>

<%= t(".report_window_note") %>

<% ibkr_item = Current.family.ibkr_items.first_or_initialize(name: "Interactive Brokers") is_new_record = ibkr_item.new_record? %> <% if ibkr_item.persisted? %>
<%= button_to sync_ibkr_item_path(ibkr_item), method: :post, class: "inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium text-secondary hover:text-primary border border-secondary rounded-lg hover:border-primary", disabled: ibkr_item.syncing? do %> <%= icon "refresh-cw", size: "sm" %> <%= t(".sync") %> <% end %> <%= button_to ibkr_item_path(ibkr_item), method: :delete, class: "inline-flex items-center gap-1 px-3 py-1.5 text-sm font-medium text-destructive hover:bg-destructive/10 rounded-lg", data: { turbo_confirm: t(".disconnect_confirm") } do %> <%= icon "trash-2", size: "sm" %> <% end %>
<% end %> <%= styled_form_with model: ibkr_item, url: is_new_record ? ibkr_items_path : ibkr_item_path(ibkr_item), scope: :ibkr_item, method: is_new_record ? :post : :patch, data: { turbo: true }, class: "space-y-3" do |form| %> <%= form.text_field :query_id, label: t(".query_id_label"), placeholder: is_new_record ? t(".query_id_placeholder_new") : t(".query_id_placeholder_existing"), type: :password %> <%= form.text_field :token, label: t(".token_label"), placeholder: is_new_record ? t(".token_placeholder_new") : t(".token_placeholder_existing"), type: :password %>
<%= form.submit(is_new_record ? t(".save_configuration") : t(".update_configuration"), class: "btn btn--primary") %>
<% end %>
<% if ibkr_item.persisted? && ibkr_item.credentials_configured? %>

<%= t(".status_configured_prefix", summary: ibkr_item.sync_status_summary) %> <%= link_to t(".accounts_tab"), accounts_path, class: "link" %> <%= t(".status_configured_suffix") %>

<% else %>

<%= t(".not_configured") %>

<% end %>