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

@@ -1,7 +1,8 @@
import { Controller } from "@hotwired/stimulus"
// Fills a new logbook entry from a preventive maintenance template: the
// wording, the entry type and "pilot" as the kind of certificate.
// wording, the entry type, and "pilot" as the kind of certificate unless one
// is already chosen.
export default class extends Controller {
static targets = [ "template", "text", "entryType", "certificate" ]
@@ -11,7 +12,7 @@ export default class extends Controller {
if (this.textTarget.value.trim() && !confirm("Replace the entry text with this template?")) return
this.textTarget.value = option.dataset.text
if (this.hasEntryTypeTarget) this.entryTypeTarget.value = "MAINTENANCE"
if (this.hasCertificateTarget) this.certificateTarget.value = "PILOT"
if (this.hasCertificateTarget && !this.certificateTarget.value) this.certificateTarget.value = "PILOT" // keep a chosen certificate
this.textTarget.focus()
}
}
@@ -0,0 +1,15 @@
import { Controller } from "@hotwired/stimulus"
// "Sign as": fills the signer's name, kind of certificate and number from one
// of the current user's certificates.
export default class extends Controller {
static targets = [ "choice", "name", "kind", "number" ]
fill() {
const option = this.choiceTarget.selectedOptions[0]
if (!option?.dataset.number) return
if (this.hasNameTarget) this.nameTarget.value = option.dataset.name
if (this.hasKindTarget) this.kindTarget.value = option.dataset.kind
if (this.hasNumberTarget) this.numberTarget.value = option.dataset.number
}
}