%= form_with model: aircraft, class: "card card-body space-y-4 max-w-3xl" do |f| %>
<%= f.errors_summary %>
<%= f.field :tail_number, required: true, autofocus: true %>
<%= f.field :make %>
<%= f.field :model %>
<%= f.field :serial_number %>
<%= f.field :purchased, as: :date %>
<%= f.field :status, as: :select, collection: Aircraft::STATUSES.invert %>
<%= f.field :description, as: :textarea, rows: 3 %>
<% if aircraft.new_record? %>
<%= f.field :tach_time, as: :number, step: 0.1, label: "Current tach" %>
<%= f.field :hobbs_time, as: :number, step: 0.1, label: "Current hobbs" %>
<% end %>
<%= f.field :tach_time_offset, as: :number, step: 0.1, hint: "Subtracted from tach for compliance math (e.g. after a tach replacement)." %>
<%= f.field :hobbs_time_offset, as: :number, step: 0.1 %>
<% unless aircraft.new_record? %>
To change hours use “Update Hours” on the overview, so component times stay in sync.
<% end %>
<%= f.field :picture, as: :file, accept: "image/*" %>
<%= f.field :airworthiness_enforcement, as: :checkbox, label: "Enforce airworthiness",
hint: "Block flight logs and hours updates while the aircraft is red." %>
<%= f.submit aircraft.new_record? ? "Add Aircraft" : "Save" %>
<%= link_to "Cancel", aircraft.new_record? ? root_path : aircraft_path(aircraft), class: "btn-secondary" %>
<% end %>