<% content_for :title, "#{@aircraft.tail_number} Inspections" %> <%= render "shared/aircraft_header", aircraft: @aircraft %>

Inspection Status

<% if owner? %><%= link_to "+ Inspection Type", new_aircraft_inspection_type_path(@aircraft), class: "btn-primary" %><% end %>
<% if @rows.any? %>
<% @rows.each do |row| %> <% end %>
InspectionIntervalLast doneNext dueStatus
<%= row.type.name %><%= tag.span(" #{row.type.advisory? ? 'advisory' : row.type.limitation.to_s.downcase + ' if overdue'}", class: "text-xs text-slate-400") if row.type.advisory? || row.type.limitation %> <% if row.type.satisfies %>
Also counts as <%= row.type.satisfies.name %>
<% end %>
<%= row.type.interval_description %> <%= row.latest ? "#{row.latest.date} @ #{hours(row.latest.hours_at_inspection)} h" : "—" %> <%= [row.next_due_date&.to_s, row.next_due_hours && "#{hours(row.next_due_hours)} h"].compact.join(" / ").presence || "—" %> <%= compliance_badge(row.status) %> <% if owner? %> <%= link_to "Record", new_aircraft_inspection_record_path(@aircraft, inspection_type_id: row.type.id), class: "btn-secondary btn-sm" %> <%= link_to "Edit", edit_aircraft_inspection_type_path(@aircraft, row.type), class: "btn-secondary btn-sm" %> <% end %>
<% else %> <%= empty_state "No inspections tracked. Add Annual, 100-hour, transponder (91.413), pitot-static (91.411), ELT (91.207)…" %> <% end %>

History

<% if @history.any? %> <% @history.each do |r| %> <% end %>
DateInspectionHoursNotes
<%= r.date %> <%= r.inspection_type.name %><%= " (#{r.component})" if r.component %> <%= hours(r.hours_at_inspection) %> <%= r.notes %><% if r.logbook_entry %> <%= link_to "logbook", aircraft_logbook_entry_path(@aircraft, r.logbook_entry), class: "link" %><% end %> <% if owner? %><%= link_to "Edit", edit_aircraft_inspection_record_path(@aircraft, r), class: "btn-secondary btn-sm" %><% end %>
<% else %> <%= empty_state "No inspections recorded." %> <% end %>