mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
- 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>
19 lines
1.5 KiB
ERB
19 lines
1.5 KiB
ERB
<%# 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", action: "input->component-times#markManual" } %>
|
|
<%= f.field :component_since_overhaul_at_entry, as: :number, step: 0.1, label: "Since overhaul",
|
|
data: { component_times_target: "since", action: "input->component-times#markManual" },
|
|
hint: "Worked out from the component's current times and the airframe total time above; edit them if they differ." %>
|
|
</div>
|