% content_for :title, "#{@aircraft.tail_number} Bulk Upload" %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<% file_classes = "block w-full 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" %>
<%= form_with url: bulk_aircraft_documents_path(@aircraft), multipart: true, class: "card card-body max-w-3xl space-y-4",
data: { controller: "bulk-upload", bulk_upload_url_value: rails_direct_uploads_path,
bulk_upload_max_bytes_value: UploadValidation::MAX_SIZE, action: "submit->bulk-upload#submit" } do %>
Bulk upload
Each file becomes its own document, named after the file. Give files the same name to combine them, in order, as the pages of one document.
<% if @bulk_error %>
<%= @bulk_error %>
<% end %>
<%= label_tag :doc_type, "Type", class: "label" %>
<%= select_tag :doc_type, options_for_select(Document::TYPES.invert, @bulk[:doc_type]), class: "input" %>
<%= label_tag :visibility, "Share-link visibility", class: "label" %>
<%= select_tag :visibility, options_for_select([ [ "Inherit from collection", "" ] ] + DocumentCollection::VISIBILITIES.invert.to_a, @bulk[:visibility]), class: "input" %>
<%= label_tag :document_collection_id, "Collection", class: "label" %>
<%= select_tag :document_collection_id,
options_for_select([ [ "— None —", "" ] ] + @aircraft.document_collections.ordered.map { [ _1.name, _1.id ] }, @bulk[:document_collection_id]), class: "input" %>
<%= label_tag :new_collection, "…or a new collection", class: "label" %>
<%= text_field_tag :new_collection, @bulk[:new_collection], class: "input", placeholder: "e.g. 2025 Annual" %>
Images, PDFs or text, up to <%= UploadValidation::MAX_SIZE / 1.megabyte %> MB each and <%= DocumentsController::MAX_BULK_FILES %> at a time.
<%= link_to "Cancel", aircraft_documents_path(@aircraft), class: "btn-secondary" %>
<% end %>