Editable logbook templates; component times follow the airframe time

- Templates move to the database (Admin -> Logbook templates: add, edit,
  delete, restore the built-in ones). The built-in preventive maintenance
  set is added once on first use; deletions stick. A template can set the
  entry type, logbook (picking the matching component) and certificate
- Template list shows "Name — Part 43 App. A (c)(6), (c)(23)" instead of
  the doubled parentheses
- Component total time and time since overhaul are worked out from the
  entry's airframe total time (current times shifted by the difference);
  blank when the entry predates the overhaul; typing them stops the
  automatic updates

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-07 11:40:23 -05:00
1 parent a51f78ebf3
commit 72e1d7760f
22 files changed
+366 -74

No files matched your search

+4 -2
View File
@@ -19,7 +19,8 @@
<label class="flex items-center gap-2"><%= radio_button_tag :logbook, "none", choice == "none" %> No logbook entry (e.g. it wasn't a defect)</label>
</fieldset>
<div class="space-y-4 rounded-md border border-slate-200 p-3" data-controller="signer component-times">
<div class="space-y-4 rounded-md border border-slate-200 p-3" data-controller="signer component-times"
data-component-times-aircraft-hours-value="<%= @aircraft.current_hours.to_f %>">
<p class="text-xs text-slate-500">For a new entry. 14 CFR 43.9: what was done, the date, and the name, certificate number and kind of certificate of whoever approved the return to service.</p>
<%= render "shared/sign_as" %>
<%= fields_for :logbook_entry, @entry do |f| %>
@@ -27,7 +28,8 @@
<%= f.field :date, as: :date %>
<%= f.field :log_type, as: :select, label: "Logbook", collection: LogbookEntry::LOG_TYPES.invert,
data: { component_times_target: "logType", action: "component-times#logTypeChanged" } %>
<%= f.field :aircraft_hours_at_entry, as: :number, step: 0.1, label: "Airframe total time" %>
<%= f.field :aircraft_hours_at_entry, as: :number, step: 0.1, label: "Airframe total time",
data: { component_times_target: "airframe", action: "input->component-times#airframeChanged" } %>
</div>
<%= render "logbook_entries/component_fields", f: f, aircraft: @aircraft %>
<%= f.field :text, as: :textarea, label: "Work performed", rows: 3 %>