%# Engine / propeller (or other component) the entry is for, and its times at the entry. %>
<% comps = aircraft.components.where.not(status: "DISPOSED").includes(:component_type).order(:install_location) %>
For engine and propeller logs: printed with its serial number and times.
<%= f.field :component_hours_at_entry, as: :number, step: 0.1, label: "Component total time",
data: { component_times_target: "total", action: "input->component-times#markManual" } %>
<%= f.field :component_since_overhaul_at_entry, as: :number, step: 0.1, label: "Since overhaul",
data: { component_times_target: "since", action: "input->component-times#markManual" },
hint: "Worked out from the component's current times and the airframe total time above; edit them if they differ." %>
<%# Sub-components of the chosen component (oil filter, magnetos…): tick to include them with their times. %>
<% children = comps.select(&:parent_component_id) %>
<% if children.any? %>
<% parts = f.object.parts.index_by(&:component_id) %>
<% selected = f.object.component %>
<% end %>