mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Part 91 inspection rules: limitations, annual as 100-hour, overrun, clock
- Inspection types say what overdue means: grounds the aircraft, no IFR
(91.411), no transponder (91.413) or advisory. Overdue limitations show
as a new LIMITED status ("VFR only", "No transponder") and don't block
flights under airworthiness enforcement
- "Also counts as": an annual satisfies the 100-hour (91.409(b))
- Overrun allowance: a 100-hour done within 10 hrs of due counts the next
one from when it was due; done early, from when it was done
- Per-aircraft maintenance clock (tach or Hobbs) for time in service; new
records default to it (fixes the tach-offset mismatch)
- Status labels Current / Due soon / limitation / Grounded, with the
91.7 pilot-in-command note
- Migration converts existing types by name; archives carry the new fields
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ef7cd2efba
commit
a4b72cf2c1
28 files changed
+371
-63
No files matched your search
@@ -13,7 +13,7 @@
|
||||
<% if rows.none?(&:url) %><p class="rounded-md bg-amber-50 px-3 py-2 text-amber-900 ring-1 ring-amber-200">This file has no links to the AD documents. DRS's <strong>Excel</strong> export includes them; import that file instead (or afterwards) to get clickable AD numbers.</p><% end %>
|
||||
<p>Choose what to do with each AD. The suggestions are based on the FAA data and your aircraft's model (<%= @aircraft.model.presence || "not set" %>); you make the call.</p>
|
||||
<ul class="list-disc space-y-1 pl-5 text-xs text-slate-600">
|
||||
<li><strong>Track</strong>: adds the AD. Until you record compliance, it counts against airworthiness, so <%= @aircraft.tail_number %> will show <span class="badge-red">Not Airworthy</span> for each tracked AD without a compliance record.</li>
|
||||
<li><strong>Track</strong>: adds the AD. Until you record compliance, it counts against airworthiness, so <%= @aircraft.tail_number %> will show <span class="badge-red">Grounded</span> while any tracked AD has no compliance record.</li>
|
||||
<li><strong>Not applicable</strong>: adds the AD with an N/A record (e.g. the equipment isn't installed). You can edit the reason afterwards.</li>
|
||||
<li><strong>Update</strong> (ADs already tracked): refreshes the FAA details: subject, summary, dates, supersession and DRS link. Compliance records aren't touched.</li>
|
||||
<li><strong>Skip</strong>: not imported, or left exactly as is.</li>
|
||||
|
||||
@@ -15,15 +15,18 @@
|
||||
<%= f.field :tach_time, as: :number, step: 0.1, label: "Current tach" %>
|
||||
<%= f.field :hobbs_time, as: :number, step: 0.1, label: "Current hobbs" %>
|
||||
<% end %>
|
||||
<%= f.field :tach_time_offset, as: :number, step: 0.1, hint: "Subtracted from tach for compliance math (e.g. after a tach replacement)." %>
|
||||
<%= f.field :hobbs_time_offset, as: :number, step: 0.1 %>
|
||||
<%= f.field :tach_time_offset, as: :number, step: 0.1, hint: "Subtracted from tach for maintenance math (e.g. after a tach replacement)." %>
|
||||
<%= f.field :hobbs_time_offset, as: :number, step: 0.1, hint: "The same, for Hobbs." %>
|
||||
</div>
|
||||
<%= f.field :time_basis, as: :select, label: "Maintenance clock", collection: Aircraft::TIME_BASES.invert,
|
||||
hint: "The clock used as time in service for inspections, ADs and component times (14 CFR 1.1 defines it as takeoff to landing). " \
|
||||
"Changing it doesn't convert hours already recorded against the other clock." %>
|
||||
<% unless aircraft.new_record? %>
|
||||
<p class="hint">To change hours use “Update Hours” on the overview, so component times stay in sync.</p>
|
||||
<% end %>
|
||||
<%= f.field :picture, as: :file, accept: "image/*" %>
|
||||
<%= f.field :airworthiness_enforcement, as: :checkbox, label: "Enforce airworthiness",
|
||||
hint: "Block flight logs and hours updates while the aircraft is red." %>
|
||||
hint: "Block flight logs and hours updates while the aircraft shows Grounded." %>
|
||||
<div class="flex gap-2">
|
||||
<%= f.submit aircraft.new_record? ? "Add Aircraft" : "Save" %>
|
||||
<%= link_to "Cancel", aircraft.new_record? ? root_path : aircraft_path(aircraft), class: "btn-secondary" %>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<% if aw.issues.any? %>
|
||||
<ul class="mt-3 space-y-1 text-xs">
|
||||
<% aw.issues.first(3).each do |issue| %>
|
||||
<li class="<%= issue.severity == 'RED' ? 'text-red-700' : 'text-amber-700' %>">• <%= issue.title %></li>
|
||||
<li class="<%= issue_text_class(issue) %>">• <%= issue.title %></li>
|
||||
<% end %>
|
||||
<% if aw.issues.size > 3 %><li class="text-slate-500">+ <%= aw.issues.size - 3 %> more</li><% end %>
|
||||
</ul>
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<% if @airworthiness.issues.empty? %>
|
||||
<p class="text-sm text-emerald-700">No open issues. All tracked ADs, inspections, components and squawks are current.</p>
|
||||
<p class="text-sm text-emerald-700">Nothing overdue or due soon. All tracked ADs, inspections, components and squawks are current.</p>
|
||||
<% else %>
|
||||
<ul class="divide-y divide-slate-100">
|
||||
<% @airworthiness.issues.each do |issue| %>
|
||||
<li class="flex items-start gap-3 py-2">
|
||||
<span class="<%= issue.severity == 'RED' ? 'badge-red' : 'badge-orange' %> mt-0.5"><%= issue.category %></span>
|
||||
<span class="<%= issue_badge_class(issue) %> mt-0.5"><%= issue.category %></span>
|
||||
<div>
|
||||
<div class="text-sm font-medium"><%= issue.title %></div>
|
||||
<div class="text-xs text-slate-500"><%= issue.description %></div>
|
||||
@@ -25,8 +25,9 @@
|
||||
</ul>
|
||||
<% end %>
|
||||
<% if @aircraft.airworthiness_enforcement? %>
|
||||
<p class="hint mt-3">Airworthiness enforcement is on: flights and hours updates are blocked while the status is red.</p>
|
||||
<p class="hint mt-3">Airworthiness enforcement is on: flights and hours updates are blocked while the aircraft shows Grounded.</p>
|
||||
<% end %>
|
||||
<p class="hint mt-3"><%= Airworthiness::DISCLAIMER %></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<% if ad.conditional? && ad.trigger_condition.present? %><div class="text-slate-500">Trigger: <%= ad.trigger_condition %></div><% end %></td>
|
||||
<td class="text-xs"><%= ad.recurring? ? [ad.recurring_hours.to_f > 0 && "#{hours(ad.recurring_hours)} h", ad.recurring_months > 0 && "#{ad.recurring_months} mo"].select(&:itself).join(" / ") : "One-time" %></td>
|
||||
<td class="text-xs"><%= row.latest ? "#{row.latest.date_complied}#{' (permanent)' if row.latest.permanent?}" : "—" %></td>
|
||||
<td class="text-xs"><%= [row.next_due_date&.strftime("%b %Y"), row.next_due_hours && "#{hours(row.next_due_hours)} tach (#{hours(row.next_due_hours - @aircraft.current_hours)} h left)"].compact.join(" / ").presence || "—" %></td>
|
||||
<td class="text-xs"><%= [row.next_due_date&.strftime("%b %Y"), row.next_due_hours && "#{hours(row.next_due_hours)} #{@aircraft.time_basis} (#{hours(row.next_due_hours - @aircraft.current_hours)} h left)"].compact.join(" / ").presence || "—" %></td>
|
||||
<td><%= compliance_badge(row.status) %></td>
|
||||
<td class="whitespace-nowrap text-right">
|
||||
<% if owner? %>
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
<%= form_with model: inspection_type, url: inspection_type.new_record? ? aircraft_inspection_types_path(aircraft) : aircraft_inspection_type_path(aircraft, inspection_type), class: "card card-body space-y-4 max-w-2xl" do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<%= f.field :name, required: true, placeholder: "Annual Inspection" %>
|
||||
<div class="flex gap-6">
|
||||
<%= f.field :required, as: :checkbox, label: "Required for airworthiness" %>
|
||||
<%= f.field :recurring, as: :checkbox, label: "Recurring" %>
|
||||
</div>
|
||||
<%= f.field :effect, as: :select, label: "When overdue", collection: InspectionType::EFFECTS.invert,
|
||||
hint: "An overdue pitot-static check (91.411) only rules out IFR, and an overdue transponder check (91.413) only rules out using the transponder. Neither grounds the aircraft." %>
|
||||
<%= f.field :recurring, as: :checkbox, label: "Recurring" %>
|
||||
<div class="grid gap-4 sm:grid-cols-3">
|
||||
<%= f.field :recurring_hours, as: :number, step: 0.1, label: "Every (hours)" %>
|
||||
<%= f.field :recurring_months, as: :number, label: "Every (calendar months)", hint: "Due end of month." %>
|
||||
<%= f.field :recurring_days, as: :number, label: "Every (days)" %>
|
||||
</div>
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<%= f.field :hours_tolerance, as: :number, step: 0.1, min: 0, label: "Overrun allowance (hours)",
|
||||
hint: "For the 100-hour: 10. Done late within this, the next one counts from when it was due (91.409(b))." %>
|
||||
<% others = aircraft.applicable_inspection_types.ordered.where.not(id: inspection_type.id) %>
|
||||
<%= f.field :satisfies_id, as: :select, label: "Also counts as", include_blank: "— Nothing else —",
|
||||
collection: others.map { [ _1.name, _1.id ] },
|
||||
hint: "An annual also counts as the 100-hour (91.409(b))." %>
|
||||
</div>
|
||||
<%= render "shared/applicability_fields", aircraft: aircraft, record: inspection_type, applies_to_airframe: @applies_to_airframe %>
|
||||
<% if inspection_type.persisted? && inspection_type.aircraft.count > 1 %>
|
||||
<p class="rounded bg-amber-50 p-2 text-xs text-amber-800">This inspection type is shared with other aircraft; interval changes affect them too.</p>
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
<tbody>
|
||||
<% @rows.each do |row| %>
|
||||
<tr>
|
||||
<td class="font-medium"><%= row.type.name %><%= tag.span(" optional", class: "text-xs text-slate-400") unless row.type.required? %></td>
|
||||
<td class="font-medium"><%= row.type.name %><%= tag.span(" #{row.type.advisory? ? 'advisory' : row.type.limitation.to_s.downcase + ' if overdue'}", class: "text-xs text-slate-400") if row.type.advisory? || row.type.limitation %>
|
||||
<% if row.type.satisfies %><div class="text-xs text-slate-500">Also counts as <%= row.type.satisfies.name %></div><% end %></td>
|
||||
<td class="text-xs"><%= row.type.interval_description %></td>
|
||||
<td class="text-xs"><%= row.latest ? "#{row.latest.date} @ #{hours(row.latest.hours_at_inspection)} h" : "—" %></td>
|
||||
<td class="text-xs"><%= [row.next_due_date&.to_s, row.next_due_hours && "#{hours(row.next_due_hours)} h"].compact.join(" / ").presence || "—" %></td>
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Airworthiness</h2><%= airworthiness_badge(@airworthiness, large: true) %></div>
|
||||
<div class="card-body">
|
||||
<% if @airworthiness.issues.empty? %><p class="text-sm text-emerald-700">No open issues.</p><% else %>
|
||||
<ul class="space-y-1 text-sm"><% @airworthiness.issues.each do |i| %><li><span class="<%= i.severity == 'RED' ? 'badge-red' : 'badge-orange' %>"><%= i.category %></span> <%= i.title %> <span class="text-xs text-slate-500"><%= i.description %></span></li><% end %></ul>
|
||||
<% if @airworthiness.issues.empty? %><p class="text-sm text-emerald-700">Nothing overdue or due soon.</p><% else %>
|
||||
<ul class="space-y-1 text-sm"><% @airworthiness.issues.each do |i| %><li><span class="<%= issue_badge_class(i) %>"><%= i.category %></span> <%= i.title %> <span class="text-xs text-slate-500"><%= i.description %></span></li><% end %></ul>
|
||||
<% end %>
|
||||
<p class="hint mt-3"><%= Airworthiness::DISCLAIMER %></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in new issue
Block a user