Logbook entries link a component and its times; boxed page printouts

- An entry can link a component (engine, propeller…) and records its total
  time and time since overhaul at the entry; picking the engine or prop log
  selects that component and fills its current times (editable). Squawk
  fixes carry the squawk's component
- Components have an overhaul type (major, factory overhaul, factory new),
  shown as SMOH / SFOH / SNEW
- Printouts: engine and propeller entries add the serial number, total
  time and SMOH/SFOH (blanks when no component is linked); airframe total
  time is labelled as such; full-page layouts draw a box around each entry
- Archives carry the entry's component and times (the original format's
  components / component_hours), no longer dropped on import

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-07 11:19:44 -05:00
1 parent aa262065b2
commit a51f78ebf3
21 files changed
+265 -83

No files matched your search

@@ -0,0 +1,16 @@
<%# 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) %>
<div class="grid gap-4 sm:grid-cols-3">
<div>
<%= f.label :component_id, "Component", class: "label" %>
<%= f.select :component_id, options_for_select([ [ "— None —", "" ] ] + comps.map { |c|
[ "#{c} · #{c.manufacturer} #{c.model}#{" · S/N #{c.serial_number}" if c.serial_number.present?}", c.id,
{ "data-total" => c.hours_in_service.to_f, "data-since" => c.hours_since_overhaul.to_f,
"data-kind" => (c.engine? ? "ENG" : c.propeller? ? "PROP" : ""), "data-abbr" => c.since_overhaul_abbreviation } ] }, f.object.component_id),
{}, class: "input", data: { component_times_target: "component", action: "component-times#componentChanged" } %>
<p class="hint">For engine and propeller logs: printed with its serial number and times.</p>
</div>
<%= f.field :component_hours_at_entry, as: :number, step: 0.1, label: "Component total time", data: { component_times_target: "total" } %>
<%= f.field :component_since_overhaul_at_entry, as: :number, step: 0.1, label: "Since overhaul", data: { component_times_target: "since" },
hint: "Filled in from the component; correct them for an older entry." %>
</div>
+5 -3
View File
@@ -1,4 +1,4 @@
<%= form_with model: [aircraft, entry], class: "card card-body space-y-4 max-w-3xl", data: { controller: "entry-template signer" } do |f| %>
<%= form_with model: [aircraft, entry], class: "card card-body space-y-4 max-w-3xl", data: { controller: "entry-template signer component-times" } do |f| %>
<%= f.errors_summary %>
<% if entry.new_record? %>
<div>
@@ -14,10 +14,12 @@
<% end %>
<div class="grid gap-4 sm:grid-cols-4">
<%= f.field :date, as: :date %>
<%= f.field :log_type, as: :select, label: "Logbook", collection: LogbookEntry::LOG_TYPES.invert %>
<%= f.field :log_type, as: :select, label: "Logbook", collection: LogbookEntry::LOG_TYPES.invert,
data: { component_times_target: "logType", action: "component-times#logTypeChanged" } %>
<%= f.field :entry_type, as: :select, label: "Entry type", collection: LogbookEntry::ENTRY_TYPES.invert, data: { entry_template_target: "entryType" } %>
<%= f.field :aircraft_hours_at_entry, as: :number, step: 0.1, label: "Aircraft hours" %>
<%= f.field :aircraft_hours_at_entry, as: :number, step: 0.1, label: "Airframe total time" %>
</div>
<%= render "logbook_entries/component_fields", f: f, aircraft: aircraft %>
<%= f.field :text, as: :textarea, label: "Entry text", rows: 8, data: { entry_template_target: "text" } %>
<p class="hint !mt-1">A maintenance entry needs a description of the work, the date, and the name, signature, certificate number and kind of certificate of whoever approved the return to service (14 CFR 43.9). An inspection entry also needs the type and extent of the inspection, the aircraft's time in service, and the result (43.11).</p>
<%= render "shared/sign_as" %>
+5 -1
View File
@@ -16,7 +16,11 @@
<% end %>
<div class="flex flex-wrap gap-4 text-sm text-slate-600">
<span>Type: <%= LogbookEntry::ENTRY_TYPES[@entry.entry_type] %></span>
<span>Aircraft hours: <%= hours(@entry.aircraft_hours_at_entry) %></span>
<span>Airframe total time: <%= hours(@entry.aircraft_hours_at_entry) %></span>
<% if (c = @entry.component) %>
<span><%= c %> <%= c.model %><%= " S/N #{c.serial_number}" if c.serial_number.present? %>:
<%= hours(@entry.component_hours_at_entry) %> total, <%= hours(@entry.component_since_overhaul_at_entry) %> <%= c.since_overhaul_abbreviation %></span>
<% end %>
</div>
<div class="whitespace-pre-wrap rounded bg-slate-50 p-3 font-mono text-sm"><%= @entry.text %></div>
<div class="text-sm text-slate-600">