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>
79 lines
4.8 KiB
ERB
79 lines
4.8 KiB
ERB
<% content_for :title, "#{@aircraft.tail_number} Access" %>
|
|
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
<div class="grid gap-5 lg:grid-cols-2">
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title">People</h2></div>
|
|
<table class="table">
|
|
<tbody>
|
|
<% @roles.each do |r| %>
|
|
<tr>
|
|
<td><%= r.user.display_name %><div class="text-xs text-slate-500"><%= r.user.email_address %></div></td>
|
|
<td>
|
|
<%= form_with url: aircraft_aircraft_role_path(@aircraft, r), method: :patch do |f| %>
|
|
<%= f.select :role, AircraftRole::ROLES.invert, { selected: r.role }, class: "input w-28", data: { submit_on_change: true } %>
|
|
<% end %>
|
|
</td>
|
|
<td class="text-right"><% unless r.user == current_user %><%= delete_button "Remove", aircraft_aircraft_role_path(@aircraft, r), confirm: "Remove #{r.user.display_name}'s access?" %><% end %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<%= form_with url: aircraft_aircraft_roles_path(@aircraft), class: "flex flex-wrap items-end gap-2 border-t border-slate-100 p-4" do |f| %>
|
|
<div class="flex-1"><%= f.label :email_address, "Add by email", class: "label" %><%= f.email_field :email_address, class: "input", required: true %></div>
|
|
<%= f.select :role, AircraftRole::ROLES.invert, { selected: "pilot" }, class: "input w-28" %>
|
|
<%= f.submit "Add", class: "btn-primary" %>
|
|
<% end %>
|
|
<p class="px-4 pb-4 hint"><strong>Owners</strong> can edit everything. <strong>Pilots</strong> can view all records, log flights, update hours, and add squawks, notes and oil/fuel.</p>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title">Share Links</h2></div>
|
|
<% if @share_tokens.any? %>
|
|
<ul class="divide-y divide-slate-100">
|
|
<% @share_tokens.each do |t| %>
|
|
<li class="px-4 py-3">
|
|
<div class="flex items-center justify-between gap-2">
|
|
<div>
|
|
<span class="font-medium"><%= t.label.presence || "Untitled link" %></span>
|
|
<%= tag.span ShareToken::PRIVILEGES[t.privilege], class: t.maintenance? ? "badge-blue" : "badge-green" %>
|
|
<% if t.expired? %><span class="badge-red">Expired</span><% end %>
|
|
</div>
|
|
<%= delete_button "Revoke", aircraft_share_token_path(@aircraft, t), confirm: "Revoke this link? Anyone using it will lose access." %>
|
|
</div>
|
|
<input type="text" readonly value="<%= shared_url(t.token) %>" class="input mt-2 font-mono text-xs" data-select-on-click>
|
|
<div class="mt-1 text-xs text-slate-500">Created <%= t.created_at.to_date %><%= " by #{t.created_by.display_name}" if t.created_by %> · <%= t.expires_at ? "expires #{l t.expires_at, format: :short}" : "never expires" %></div>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
<% else %>
|
|
<%= empty_state "No share links." %>
|
|
<% end %>
|
|
<%= form_with model: ShareToken.new, url: aircraft_share_tokens_path(@aircraft), class: "space-y-3 border-t border-slate-100 p-4" do |f| %>
|
|
<div class="grid gap-3 sm:grid-cols-3">
|
|
<%= f.field :label, placeholder: "Mechanic, buyer…" %>
|
|
<%= f.field :privilege, as: :select, label: "Shows", collection: ShareToken::PRIVILEGES.invert %>
|
|
<%= f.field :expires_at, as: :datetime, label: "Expires (optional)" %>
|
|
</div>
|
|
<p class="hint"><strong>Current Status</strong>: overview, airworthiness, components, open squawks, AD/inspection status, oil & fuel, public notes and documents shared with all links. <strong>Maintenance Detail</strong> adds the full logbook, history, resolved squawks and major records.</p>
|
|
<%= f.submit "Create Share Link" %>
|
|
<% end %>
|
|
</section>
|
|
|
|
<section class="card lg:col-span-2">
|
|
<div class="card-header">
|
|
<div>
|
|
<h2 class="card-title">Backup & transfer</h2>
|
|
<p class="hint">Everything recorded for <%= @aircraft.tail_number %>, with its files, in one .sam.zip archive. Import it from the Fleet page here or into another Simple Aircraft Manager (including the original).</p>
|
|
</div>
|
|
<%= link_to "Download .sam.zip", aircraft_export_path(@aircraft), class: "btn-secondary", data: { turbo: false } %>
|
|
</div>
|
|
<div class="card-header border-t border-slate-100">
|
|
<div>
|
|
<h2 class="card-title">Records package</h2>
|
|
<p class="hint">For an FAA or NTSB request, or a buyer: every logbook entry as a PDF with its electronic signature, a signature register, the full change history, the status report, and the .sam.zip, in one ZIP with a README.</p>
|
|
</div>
|
|
<%= link_to "Download records package", aircraft_records_package_path(@aircraft), class: "btn-secondary", data: { turbo: false } %>
|
|
</div>
|
|
</section>
|
|
</div>
|