% content_for :title, "#{@aircraft.tail_number} Standard inspections" %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<%= form_with url: aircraft_standard_inspections_path(@aircraft), class: "card card-body max-w-3xl space-y-4" do %>
Standard inspections
The recurring inspections and checks Part 91 calls for. Pick the ones that apply to how <%= @aircraft.tail_number %> is flown. Each is added with its interval and what being overdue means; you can change them afterwards.
<% StandardInspections::TEMPLATES.each do |t| %>
<% existing = StandardInspections.existing_for(t, @aircraft) %>
<%= check_box_tag "templates[]", t.key, t.checked && !existing, id: "template_#{t.key}", disabled: existing.present?, class: "mt-1 h-4 w-4 shrink-0 rounded border-slate-300" %>
<%= t.name %>
· <%= [ (t.months && "every #{t.months} calendar months"), (t.days && "every #{t.days} days"), (t.hours && "every #{t.hours} hours") ].compact.join %>
<%= t.who %>. Overdue: <%= InspectionType::EFFECT_SUMMARIES[t.effect] %>.
<% if existing %>Already tracked as “<%= existing.name %>” <% end %>
<% end %>
With both an annual and a 100-hour, the annual also counts as the 100-hour (91.409(b)).
<%= submit_tag "Add selected", class: "btn-primary" %><%= link_to "Cancel", aircraft_inspections_path(@aircraft), class: "btn-secondary" %>
<% end %>