mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- Sign an entry: review exactly what's certified, choose a current certificate (eligibility checked: pilot only for preventive maintenance, inspections need their result and time), re-enter the password or sign in again with SSO (prompt=login, within 5 minutes), and confirm the "Certified by" statement (43.9 return to service, 43.11(a)(5) for inspections, preventive maintenance for pilots) - The signature stores signer, certificate, statement, UTC time, how they authenticated, IP/browser, a SHA-256 fingerprint of the entry's content and a readable snapshot; an HMAC seal covers the signature record. Status shows Valid / Superseded / Altered since signing. The signer is emailed - Signed entries (and their sub-components) can't be edited or deleted; a correction entry, once signed, supersedes the original (kept) - Owners invite an outside mechanic by email to sign one entry: one-time, 14-day link; they create or use their own account and certificate and see only that entry - Admins can disable accounts (signed out, can't sign in or sign; past signatures kept); users with signatures can't be deleted - Printouts show the electronic signature and fingerprint; archives carry signatures (marked imported, with their origin) and corrections Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
55 lines
4.5 KiB
ERB
55 lines
4.5 KiB
ERB
<%= form_with model: [aircraft, entry], class: "card card-body space-y-4 max-w-3xl", data: { controller: "entry-template signer component-times", component_times_aircraft_hours_value: aircraft.current_hours.to_f } do |f| %>
|
|
<%= f.errors_summary %>
|
|
<% if entry.supersedes %>
|
|
<%= f.hidden_field :supersedes_id %>
|
|
<p class="rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-900 ring-1 ring-amber-200">
|
|
Correcting the signed <%= link_to "#{entry.supersedes.date} entry", aircraft_logbook_entry_path(aircraft, entry.supersedes), class: "link" %>.
|
|
Change what's wrong, save, then sign it: the original's signature is then marked superseded (it's kept, not deleted).
|
|
</p>
|
|
<% end %>
|
|
<% templates = entry.new_record? ? LogbookTemplate.ordered.to_a : [] %>
|
|
<% if templates.any? %>
|
|
<div>
|
|
<%= label_tag :template, "Template", class: "label" %>
|
|
<select id="template" class="input" data-entry-template-target="template" data-action="entry-template#apply">
|
|
<option value="">— Write it yourself —</option>
|
|
<% templates.each do |t| %>
|
|
<option value="<%= t.id %>" data-text="<%= t.text %>" data-entry-type="<%= t.entry_type %>" data-log-type="<%= t.log_type %>"
|
|
data-certificate="<%= t.certificate_type %>"><%= t.label %></option>
|
|
<% end %>
|
|
</select>
|
|
<p class="hint">Fill in the blanks (__). The built-in ones are for a pilot doing preventive maintenance on an aircraft they own or operate (14 CFR 43.3(g)); their wording is paraphrased from Part 43 Appendix A(c), which sets each item's limits.<% if current_user.admin? %> <%= link_to "Edit templates", admin_logbook_templates_path, class: "link" %><% end %></p>
|
|
</div>
|
|
<% end %>
|
|
<div class="grid gap-4 sm:grid-cols-4">
|
|
<%= f.field :date, as: :date %>
|
|
<%= f.field :log_type, as: :select, label: "Logbook", collection: LogbookEntry::LOG_TYPES.invert,
|
|
data: { component_times_target: "logType", entry_template_target: "logType", action: "component-times#logTypeChanged" } %>
|
|
<%= f.field :entry_type, as: :select, label: "Entry type", collection: LogbookEntry::ENTRY_TYPES.invert, data: { entry_template_target: "entryType" } %>
|
|
<%= f.field :aircraft_hours_at_entry, as: :number, step: 0.1, label: "Airframe total time",
|
|
data: { component_times_target: "airframe", action: "input->component-times#airframeChanged" } %>
|
|
</div>
|
|
<%= render "logbook_entries/component_fields", f: f, aircraft: aircraft %>
|
|
<%= f.field :text, as: :textarea, label: "Entry text", rows: 8, data: { entry_template_target: "text" } %>
|
|
<p class="hint !mt-1">A maintenance entry needs a description of the work, the date, and the name, signature, certificate number and kind of certificate of whoever approved the return to service (14 CFR 43.9). An inspection entry also needs the type and extent of the inspection, the aircraft's time in service, and the result (43.11).</p>
|
|
<%= render "shared/sign_as" %>
|
|
<div class="grid gap-4 sm:grid-cols-3">
|
|
<%= f.field :signoff_person, label: "Signed off by", placeholder: "Name", data: { signer_target: "name" } %>
|
|
<%= f.field :signoff_certificate_type, as: :select, label: "Kind of certificate", include_blank: "—",
|
|
collection: LogbookEntry::CERTIFICATE_TYPES.invert, data: { entry_template_target: "certificate", signer_target: "kind" } %>
|
|
<%= f.field :signoff_certificate_number, label: "Certificate number", placeholder: "e.g. 1234567", data: { signer_target: "number" } %>
|
|
</div>
|
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
<%= f.field :inspection_result, as: :select, label: "Inspection result", include_blank: "— Not an inspection —",
|
|
collection: LogbookEntry::INSPECTION_RESULTS.invert, hint: "For inspection entries (43.11)." %>
|
|
<%= f.field :signoff_location, label: "Location / shop" %>
|
|
<%= f.field :document_id, as: :select, label: "Scanned page document", collection: document_options(aircraft) %>
|
|
<%= f.field :page_number, as: :number, label: "Page # in document" %>
|
|
</div>
|
|
<% if entry.persisted? && !entry.verified_was %>
|
|
<%= f.field :verified, as: :checkbox, label: "I've checked this against the scan", hint: "Transcribed by Claude; it stays marked unverified until someone checks it." %>
|
|
<% end %>
|
|
<div class="flex gap-2"><%= f.submit "Save Entry" %><%= link_to "Cancel", aircraft_logbook_entries_path(aircraft), class: "btn-secondary" %></div>
|
|
<% end %>
|
|
<% if entry.persisted? %><div class="mt-4"><%= delete_button "Delete entry", aircraft_logbook_entry_path(aircraft, entry) %></div><% end %>
|