% content_for :title, "Aircraft Import" %> <% if @import.in_progress? %><% content_for :head, tag.meta("http-equiv": "refresh", content: "2") %><% end %>
<%= @import.filename %><%= " · from #{@import.source}" if @import.source.present? %>
<% if @import.in_progress? %><%= @import.status == "queued" ? "Waiting to start…" : "Importing…" %>
<% if @import.counts.any? %>So far: <%= @import.summary %>.
<% end %>This page updates by itself. Large archives with many documents can take a few minutes.
<% elsif @import.done? %>Imported.
<%= @import.summary.presence&.upcase_first || "No records" %>.
<% if @import.aircraft %><%= link_to "Open #{@import.aircraft.tail_number} →", aircraft_path(@import.aircraft), class: "btn-primary" %>
<% end %> <% else %>The import failed. Nothing was added.
<%= @import.error %>
<%= link_to "Try another file", new_aircraft_import_path, class: "btn-secondary" %>
<% end %> <% if @import.warnings.any? %><%= pluralize(@import.warnings.size, "note") %>