<%= content_for :header_nav do %> <%= render "imports/nav", import: @import %> <% end %> <%= content_for :previous_path, imports_path %>

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

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

<%= render DS::Tabs.new(active_tab: params[:tab] || "csv-upload", url_param_key: "tab", testid: "import-tabs") do |tabs| %> <% tabs.with_nav do |nav| %> <% nav.with_btn(id: "csv-upload", label: "Upload CSV") %> <% nav.with_btn(id: "csv-paste", label: "Copy & Paste") %> <% end %> <% tabs.with_panel(tab_id: "csv-upload") do %> <%= styled_form_with model: @import, scope: :import, url: import_upload_path(@import), multipart: true, class: "space-y-2" do |form| %> <%= form.select :col_sep, Import::SEPARATORS, label: true %> <% if @import.type == "TransactionImport" || @import.type == "TradeImport" %> <%= form.select :account_id, @import.family.accounts.visible.pluck(:name, :id), { label: "Account (optional)", include_blank: "Multi-account import", selected: @import.account_id } %> <% end %>
<%= icon("plus", size: "lg", class: "mb-4 mx-auto") %>

Browse to add your CSV file here

<%= form.file_field :csv_file, class: "hidden", "data-auto-submit-form-target": "auto", "data-file-upload-target": "input" %>
<%= form.submit "Upload CSV", disabled: @import.complete? %> <% end %> <% end %> <% tabs.with_panel(tab_id: "csv-paste") do %> <%= styled_form_with model: @import, scope: :import, url: import_upload_path(@import), multipart: true, class: "space-y-2" do |form| %> <%= form.select :col_sep, Import::SEPARATORS, label: true %> <% if @import.type == "TransactionImport" || @import.type == "TradeImport" %> <%= form.select :account_id, @import.family.accounts.visible.pluck(:name, :id), { label: "Account (optional)", include_blank: "Multi-account import", selected: @import.account_id } %> <% end %> <%= form.text_area :raw_file_str, rows: 10, required: true, placeholder: "Paste your CSV file contents here", "data-auto-submit-form-target": "auto" %> <%= form.submit "Upload CSV", disabled: @import.complete? %> <% end %> <% end %> <% end %>
<%= link_to "Download a sample CSV", "/imports/#{@import.id}/upload/sample_csv", class: "text-primary underline", data: { turbo: false } %> to see the required CSV format