<% content_for :title, "AD Import Preview" %> <%= render "shared/aircraft_header", aircraft: @aircraft %> <% rows = @import.rows %> <%= form_with url: confirm_aircraft_ad_import_path(@aircraft), class: "space-y-5" do |f| %> <%= hidden_field_tag :token, @token %> <%= hidden_field_tag :filename, @filename %>

Preview: <%= @filename %>

<%= pluralize(rows.size, "AD") %> found · <%= rows.count(&:url) %> with DRS links
<% if rows.none?(&:url) %>

This file has no links to the AD documents. DRS's Excel export includes them; import that file instead (or afterwards) to get clickable AD numbers.

<% end %>

Choose what to do with each AD. The suggestions are based on the FAA data and your aircraft's model (<%= @aircraft.model.presence || "not set" %>); you make the call.

<% rows.each do |r| %> <% end %>
ADSubjectEffectiveNotesAction
<%= r.number %><%= link_to " 🔗", r.url, target: "_blank", rel: "noopener noreferrer", title: "Link found in file" if r.url %> <% if r.product_type %>
<%= r.product_type %>
<% end %>
<%= r.subject %> <% if r.summary %>
Summary<%= r.summary %>
<% end %>
<%= r.effective_date %> <% r.notes.each do |n| %>
">• <%= n %>
<% end %>
<% choices = r.tracked ? [ [ "Update", "track" ], [ "Not applicable", "na" ], [ "Skip (leave as is)", "skip" ] ] : AdImport::ACTIONS.invert %> <%= select_tag "decisions[#{r.number}]", options_for_select(choices, r.suggested), class: "input" %>
<%= f.submit "Import ADs", class: "btn-primary", data: { turbo_confirm: "Import these ADs to #{@aircraft.tail_number}?" } %> <%= link_to "Upload a different file", new_aircraft_ad_import_path(@aircraft), class: "btn-secondary" %>
<% end %>