<%= 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 :icao_type, label: "ICAO type", placeholder: "C150", maxlength: 4, hint: "Type designator, used for AirTrail." %>
<%= 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 maintenance math (e.g. after a tach replacement)." %> <%= f.field :hobbs_time_offset, as: :number, step: 0.1, hint: "The same, for Hobbs." %>
<%= f.field :time_basis, as: :select, label: "Maintenance clock", collection: Aircraft::TIME_BASES.invert, hint: "The clock used as time in service for inspections, ADs and component times (14 CFR 1.1 defines it as takeoff to landing). " \ "Changing it doesn't convert hours already recorded against the other clock." %> <% 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 :electronic_records_since, as: :date, label: "Electronic records since", wrapper: { class: "max-w-xs" }, hint: "The date this app became the maintenance record. Earlier records stay in the paper logbooks (mark their scans as legacy records)." %> <%= f.field :airworthiness_enforcement, as: :checkbox, label: "Enforce airworthiness", hint: "Block flight logs and hours updates while the aircraft shows Grounded." %>
<%= f.submit aircraft.new_record? ? "Add Aircraft" : "Save" %> <%= link_to "Cancel", aircraft.new_record? ? root_path : aircraft_path(aircraft), class: "btn-secondary" %>
<% end %>