<%= form_with model: [aircraft, squawk], multipart: true, class: "card card-body space-y-4 max-w-2xl" do |f| %> <%= f.errors_summary %> <%= f.field :priority, as: :select, collection: Squawk::PRIORITIES.invert, hint: "“Ground Aircraft” makes the aircraft not airworthy until resolved." %> <%= f.field :issue_reported, as: :textarea, label: "Issue", required: true, autofocus: true %> <%= f.field :component_id, as: :select, label: "Component (optional)", collection: component_options(aircraft) %> <%= f.field :attachments, as: :file, multiple: true, label: squawk.attachments.attached? ? "Add photos / files" : "Photos / files", hint: "Select several at once. Images, PDFs or text, up to #{Setting.max_upload_mb} MB each." %> <% if squawk.persisted? && squawk.attachments.attached? %>

Remove attached files

<% squawk.attachments.each do |file| %> <% end %>
<% end %> <% if squawk.persisted? %><%= f.field :notes, as: :textarea, rows: 3 %><% end %>
<%= f.submit squawk.new_record? ? "Report Squawk" : "Save" %> <%= link_to "Cancel", aircraft_squawks_path(aircraft), class: "btn-secondary" %>
<% end %> <% if squawk.persisted? && owner? %>
<%= delete_button "Delete squawk", aircraft_squawk_path(aircraft, squawk) %>
<% end %>