Certificates on user profiles, with "Sign as"

- Users add their FAA certificates (kind, number, optional expiry) on
  their profile; admins see them on the Users list
- "Sign as" on new/edited logbook entries and the squawk Resolve page
  fills the signer's name, kind of certificate and number (expired
  certificates aren't offered); deferrals default to mechanic for users
  with a mechanic certificate
- Weekly reminder lists certificates expiring within 60 days (or lapsed
  in the last 30), even when nothing else is due
- Preventive maintenance templates keep a certificate already chosen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-07 11:08:21 -05:00
1 parent 5584ad59c5
commit aa262065b2
21 files changed
+253 -22

No files matched your search

+2 -1
View File
@@ -33,7 +33,8 @@
</div>
<div>
<%= label_tag :deferred_by_role, "As", class: "label" %>
<%= select_tag :deferred_by_role, options_for_select(Squawk::DEFERRAL_ROLES.invert, params[:deferred_by_role]), class: "input" %>
<%= select_tag :deferred_by_role, options_for_select(Squawk::DEFERRAL_ROLES.invert,
params[:deferred_by_role] || (current_user.certificates.any?(&:mechanic?) ? "mechanic" : "pilot")), class: "input" %>
</div>
</div>
</div>
+6 -4
View File
@@ -19,8 +19,9 @@
<label class="flex items-center gap-2"><%= radio_button_tag :logbook, "none", choice == "none" %> No logbook entry (e.g. it wasn't a defect)</label>
</fieldset>
<div class="space-y-4 rounded-md border border-slate-200 p-3">
<div class="space-y-4 rounded-md border border-slate-200 p-3" data-controller="signer">
<p class="text-xs text-slate-500">For a new entry. 14 CFR 43.9: what was done, the date, and the name, certificate number and kind of certificate of whoever approved the return to service.</p>
<%= render "shared/sign_as" %>
<%= fields_for :logbook_entry, @entry do |f| %>
<div class="grid gap-4 sm:grid-cols-3">
<%= f.field :date, as: :date %>
@@ -29,9 +30,10 @@
</div>
<%= f.field :text, as: :textarea, label: "Work performed", rows: 3 %>
<div class="grid gap-4 sm:grid-cols-3">
<%= f.field :signoff_person, label: "Signed off by" %>
<%= f.field :signoff_certificate_type, as: :select, label: "Kind of certificate", include_blank: "—", collection: LogbookEntry::CERTIFICATE_TYPES.invert %>
<%= f.field :signoff_certificate_number, label: "Certificate number" %>
<%= f.field :signoff_person, label: "Signed off by", data: { signer_target: "name" } %>
<%= f.field :signoff_certificate_type, as: :select, label: "Kind of certificate", include_blank: "—", collection: LogbookEntry::CERTIFICATE_TYPES.invert,
data: { signer_target: "kind" } %>
<%= f.field :signoff_certificate_number, label: "Certificate number", data: { signer_target: "number" } %>
</div>
<% end %>
</div>