Sub-components on logbook entries (e.g. the oil filter on the engine)

- Once a component is chosen, its sub-components are offered on the entry
  form (and the squawk Resolve page); ticked ones are saved with their
  total time and time since service, worked out from the airframe total
  time like the component's (editable; blank before it was installed)
- Entry page and printed PDFs list each sub-component with its serial
  number and times; parts without an overhaul type read "Since service"
- Archives carry them: the original format's list of components per entry
  (first = the entry's component, the rest = sub-components)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-07 12:54:49 -05:00
1 parent 72e1d7760f
commit 7caa213e7a
16 files changed
+249 -22

No files matched your search

+10 -1
View File
@@ -6,7 +6,8 @@ Prawn::Fonts::AFM.hide_m17n_warning = true # text is reduced to what the built-i
# want (aircraft, date, airframe total time, the work, the signer's name and
# certificate) and a blank line for the signature, which must be signed by
# hand. Engine and propeller entries add the component's serial number, total
# time and time since overhaul (blanks to fill in when no component is linked).
# time and time since overhaul (blanks to fill in when no component is linked),
# and a line for each sub-component the entry covers (an oil filter…).
#
# Labels: one entry per label; long entries shrink to fit, then continue on
# the next label. Pages: entries follow one another, each in a box with its
@@ -171,6 +172,14 @@ class LogbookEntryPdf
elsif noun
lines << "#{noun}: ______________ S/N __________ #{noun} total time: ________ SMOH / SFOH: ________"
end
entry.parts.each do |part|
c = part.component
name = c.component_type&.name || "Part"
model = [ c.manufacturer, c.model ].compact_blank.join(" ")
lines << [ "#{name}: #{model}#{" S/N #{c.serial_number}" if c.serial_number.present?}",
"Total time: #{blank_or_hours(part.hours_at_entry)}",
"#{c.since_overhaul_abbreviation}: #{blank_or_hours(part.since_overhaul_at_entry)}" ].join(" ")
end
lines
end