mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- 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>
56 lines
3.6 KiB
ERB
56 lines
3.6 KiB
ERB
<%= form_with model: [aircraft, component], class: "card card-body space-y-5 max-w-4xl" do |f| %>
|
|
<%= f.errors_summary %>
|
|
<div class="grid gap-4 sm:grid-cols-3">
|
|
<div>
|
|
<%= f.field :component_type_id, as: :select, label: "Type",
|
|
collection: ComponentType.ordered.map { [_1.name, _1.id] }, include_blank: "— Select —" %>
|
|
<%= text_field_tag :new_component_type, params[:new_component_type], class: "input mt-2", placeholder: "…or type a new one" %>
|
|
</div>
|
|
<%= f.field :manufacturer, required: true %>
|
|
<%= f.field :model, required: true %>
|
|
<%= f.field :serial_number %>
|
|
<%= f.field :install_location, hint: "e.g. Left mag, #3 cylinder" %>
|
|
<%= f.field :status, as: :select, collection: Component::STATUSES.invert %>
|
|
<%= f.field :parent_component_id, as: :select, label: "Parent component",
|
|
collection: [["— None —", nil]] + aircraft.components.where.not(id: component.id).includes(:component_type).map { [_1.to_s, _1.id] } %>
|
|
</div>
|
|
|
|
<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, 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">
|
|
<legend class="mb-2 text-sm font-semibold text-slate-900">Limits</legend>
|
|
<%= f.field :replacement_hours, as: :number, label: "Replace every (hrs)" %>
|
|
<%= f.field :replacement_days, as: :number, label: "Replace every (days)" %>
|
|
<%= f.field :replacement_critical, as: :checkbox, label: "Replacement critical", hint: "Overdue replacement or expiry grounds the aircraft (oil, filters, ELT battery…)." %>
|
|
<%= f.field :expires_on, as: :date, label: "Expires on",
|
|
hint: "The date marked on the part, e.g. an ELT battery's replacement date (14 CFR 91.207(c): also replace it after 1 hour of cumulative use)." %>
|
|
<%= f.field :tbo_hours, as: :number, label: "TBO (hrs)" %>
|
|
<%= f.field :tbo_days, as: :number, label: "TBO (days)" %>
|
|
<div class="space-y-2">
|
|
<%= f.field :tbo_critical, as: :checkbox, label: "Treat TBO as a hard limit",
|
|
hint: "Under Part 91, TBO is usually the manufacturer's recommendation, unless an AD or the Airworthiness Limitations make it mandatory." %>
|
|
<%= f.field :on_condition, as: :checkbox, label: "On condition (Part 91)" %>
|
|
</div>
|
|
<%= f.field :inspection_hours, as: :number, label: "Inspect every (hrs)" %>
|
|
<%= f.field :inspection_days, as: :number, label: "Inspect every (days)" %>
|
|
<%= f.field :inspection_critical, as: :checkbox, label: "Inspection critical" %>
|
|
</fieldset>
|
|
|
|
<%= f.field :notes, as: :textarea, rows: 3 %>
|
|
<div class="flex gap-2">
|
|
<%= f.submit component.new_record? ? "Add Component" : "Save" %>
|
|
<%= link_to "Cancel", aircraft_components_path(aircraft), class: "btn-secondary" %>
|
|
</div>
|
|
<% end %>
|
|
<% if component.persisted? %>
|
|
<div class="mt-4"><%= delete_button "Delete component", aircraft_component_path(aircraft, component), confirm: "Delete #{component} and its sub-components?" %></div>
|
|
<% end %>
|