mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
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:
1 parent
aa262065b2
commit
a51f78ebf3
21 files changed
+265
-83
No files matched your search
@@ -18,9 +18,11 @@
|
||||
<fieldset class="grid gap-4 sm:grid-cols-4">
|
||||
<legend class="mb-2 text-sm font-semibold text-slate-900">Time</legend>
|
||||
<%= f.field :date_in_service, as: :date, required: true %>
|
||||
<%= f.field :hours_in_service, as: :number, step: 0.1 %>
|
||||
<%= f.field :hours_in_service, as: :number, step: 0.1, label: "Total time (hours)" %>
|
||||
<%= f.field :overhaul_date, as: :date, label: "Last overhaul / service" %>
|
||||
<%= f.field :hours_since_overhaul, as: :number, step: 0.1, label: "Hours since OH / service" %>
|
||||
<%= f.field :overhaul_kind, as: :select, label: "Overhaul type", include_blank: "—", collection: Component::OVERHAUL_KINDS.invert,
|
||||
wrapper: { class: "sm:col-span-2" }, hint: "For engines and propellers: printed in logbook entries as SMOH, SFOH or SNEW." %>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="grid gap-4 sm:grid-cols-3">
|
||||
|
||||
@@ -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>
|
||||
@@ -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" %>
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -19,15 +19,17 @@
|
||||
<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">
|
||||
<div class="space-y-4 rounded-md border border-slate-200 p-3" data-controller="signer component-times">
|
||||
<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| %>
|
||||
<div class="grid gap-4 sm:grid-cols-3">
|
||||
<%= f.field :date, as: :date %>
|
||||
<%= f.field :log_type, as: :select, label: "Logbook", collection: LogbookEntry::LOG_TYPES.invert %>
|
||||
<%= f.field :aircraft_hours_at_entry, as: :number, step: 0.1, label: "Aircraft hours" %>
|
||||
<%= 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" %>
|
||||
</div>
|
||||
<%= render "logbook_entries/component_fields", f: f, aircraft: @aircraft %>
|
||||
<%= f.field :text, as: :textarea, label: "Work performed", rows: 3 %>
|
||||
<div class="grid gap-4 sm:grid-cols-3">
|
||||
<%= f.field :signoff_person, label: "Signed off by", data: { signer_target: "name" } %>
|
||||
|
||||
Reference in new issue
Block a user