mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
AC 120-78B chapter 3:
- Every change to logbook entries, sub-components, signatures, inspection
records, AD compliance, major records, W&B, components, squawks and
documents is kept as a RecordVersion (who, IP, when, field changes),
hash-chained per aircraft; versions can't be edited or deleted. Shown on
each logbook entry and in Activity -> Record history
- Nightly job: SQLite online-backup copy to storage/backups, verified
(integrity_check + record counts), pruned to the configured number; then
an integrity check of the history chains and every signature's seal and
fingerprint. Results on Admin -> About ("Back up and check now"); admins
are emailed on failure
- Software versions recorded (first/last seen) on Admin -> About
- Records package (Access & Sharing): logbook entries PDF with signatures,
signatures.csv, record-history.csv, self-contained status report HTML,
the .sam.zip, and a README, for the FAA/NTSB or a buyer
- Legacy (paper) records: documents can be marked as legacy records;
aircraft have an "electronic records since" date (status report, package)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
4.8 KiB
ERB
69 lines
4.8 KiB
ERB
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
<section class="card max-w-4xl">
|
|
<div class="card-header">
|
|
<h2 class="card-title"><%= LogbookEntry::LOG_TYPES[@entry.log_type] %> log — <%= fmt_date(@entry.date) %></h2>
|
|
<div class="flex gap-2">
|
|
<%= link_to "Print for logbook", new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "btn-secondary btn-sm" %>
|
|
<% if @entry.signed? %>
|
|
<% if owner? && !@entry.superseded? && !@entry.superseded_by %><%= link_to "Correct this entry", new_aircraft_logbook_entry_path(@aircraft, supersedes: @entry.id), class: "btn-secondary btn-sm" %><% end %>
|
|
<% else %>
|
|
<%= link_to "Sign", new_aircraft_logbook_entry_signature_path(@aircraft, @entry), class: "btn-primary btn-sm" %>
|
|
<% if owner? %>
|
|
<%= link_to "Ask someone to sign", new_aircraft_logbook_entry_signing_invitation_path(@aircraft, @entry), class: "btn-secondary btn-sm" %>
|
|
<%= link_to "Edit", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "btn-secondary btn-sm" %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<div class="card-body space-y-3">
|
|
<% if @entry.signed? %><%= render "logbook_entries/signature", entry: @entry %>
|
|
<% elsif LogbookEntry::RECORD_TYPES.include?(@entry.entry_type) %>
|
|
<p class="rounded-md bg-slate-50 px-3 py-2 text-sm text-slate-600 ring-1 ring-slate-200">Not signed electronically.<%= " Pending correction of the #{@entry.supersedes.date} entry." if @entry.supersedes %> Sign it here, or print it and sign the paper copy.</p>
|
|
<% end %>
|
|
<% unless @entry.verified? %>
|
|
<div class="flex flex-wrap items-center justify-between gap-2 rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-900 ring-1 ring-amber-200">
|
|
<span>Transcribed by Claude<%= " (#{@entry.transcription_confidence} confidence)" if @entry.transcription_confidence %> and not yet checked. Compare it with the scan<%= @entry.document ? "" : " or the paper logbook" %> before relying on it.</span>
|
|
<% if owner? %><%= button_to "Matches the scan: mark verified", verify_aircraft_logbook_entry_path(@aircraft, @entry), method: :patch, class: "btn-secondary btn-sm" %><% end %>
|
|
</div>
|
|
<% end %>
|
|
<div class="flex flex-wrap gap-4 text-sm text-slate-600">
|
|
<span>Type: <%= LogbookEntry::ENTRY_TYPES[@entry.entry_type] %></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 %>
|
|
<% @entry.parts.each do |part| %>
|
|
<% pc = part.component %>
|
|
<span><%= pc %> <%= pc.model %><%= " S/N #{pc.serial_number}" if pc.serial_number.present? %>:
|
|
<%= hours(part.hours_at_entry) %> total, <%= hours(part.since_overhaul_at_entry) %> <%= pc.since_overhaul_abbreviation.downcase %></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">
|
|
Signed off: <%= @entry.signoff_person.presence || "—" %>
|
|
<%= ", #{@entry.certificate_label}" if @entry.certificate_label %><%= " ##{@entry.signoff_certificate_number}" if @entry.signoff_certificate_number %>
|
|
<%= "(#{@entry.signoff_location})" if @entry.signoff_location.present? %>
|
|
</div>
|
|
<% if @entry.inspection_result %><div class="text-sm text-slate-600">Result: <%= @entry.inspection_result_label %></div><% end %>
|
|
<% if (missing = @entry.missing_record_items).any? %>
|
|
<p class="rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-900 ring-1 ring-amber-200">
|
|
Missing for <%= @entry.entry_type == "INSPECTION" ? "43.11" : "43.9" %>: <%= missing.to_sentence %>.
|
|
<%= link_to("Fill in", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "link") if owner? %>
|
|
(Check against the signed logbook.)
|
|
</p>
|
|
<% end %>
|
|
<% if @entry.document %>
|
|
<p class="text-sm">Scan: <%= link_to @entry.document.name, aircraft_document_path(@aircraft, @entry.document, page: @entry.page_number), class: "link" %><%= " (page #{@entry.page_number})" if @entry.page_number %></p>
|
|
<% end %>
|
|
</div>
|
|
</section>
|
|
|
|
<% history = (@entry.versions.to_a + @entry.parts.flat_map { _1.versions.to_a } + (@entry.signature ? @entry.signature.versions.to_a : [])).sort_by(&:id).reverse %>
|
|
<% if history.any? %>
|
|
<details class="card mt-5 max-w-4xl">
|
|
<summary class="card-header cursor-pointer"><span class="card-title">Change history (<%= history.size %>)</span></summary>
|
|
<%= render "record_versions/list", versions: history %>
|
|
</details>
|
|
<% end %>
|