% content_for :title, t(".import_logbook_pages", tail_number: @aircraft.tail_number) %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<% ai = LogbookImport.ai_available? %>
<%= form_with url: aircraft_logbook_imports_path(@aircraft), multipart: true, class: "card card-body max-w-3xl space-y-5" do |f| %>
<%= t(".import_scanned_logbook_pages") %>
<%= t(".the_pages_are_saved_as") %>
<% if ai %><%= t(".claude_can_also_read_them") %><% else %>
<%= t(".to_have_entries_transcribed_automatically_html") %><% end %>
<%= f.label :pages, t(".scanned_pages"), class: "label" %>
<%= f.file_field :pages, multiple: true, required: true, accept: "image/jpeg,image/png,image/gif,image/webp,application/pdf",
class: "block text-sm text-slate-600 file:mr-3 file:rounded-md file:border-0 file:bg-slate-100 file:px-3 file:py-1.5 file:text-sm file:font-medium hover:file:bg-slate-200" %>
<%= t(".jpeg_png_webp_or_pdf") %>
<%= f.label :collection_id, t(".collection"), class: "label" %>
<%= f.select :collection_id, [ [ t(".new_collection"), "new" ] ] + @collections.map { [ _1.name, _1.id ] },
{ selected: params[:collection_id] || @collections.find { _1.name.match?(/log/i) }&.id || "new" }, class: "input" %>
<%= f.label :collection_name, t(".new_collection_name"), class: "label" %>
<%= f.text_field :collection_name, value: params[:collection_name], placeholder: t(".airframe_log_2"), class: "input" %>
<%= f.label :document_name, t(".document_name"), class: "label" %>
<%= f.text_field :document_name, value: params[:document_name], placeholder: t(".same_as_the_collection"), class: "input" %>
<%= f.label :doc_type, t(".document_type"), class: "label" %>
<%= f.select :doc_type, Document::TYPES.invert, { selected: params[:doc_type] || "LOG" }, class: "input" %>
<%= f.submit ai ? t(".upload_transcribe") : t(".upload_pages"), class: "btn-primary" %>
<%= link_to t(".cancel"), aircraft_logbook_entries_path(@aircraft), class: "btn-secondary" %>
<% end %>