mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
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:
1 parent
5584ad59c5
commit
aa262065b2
21 files changed
+253
-22
No files matched your search
@@ -4,7 +4,7 @@
|
||||
<%= f.field :name %>
|
||||
<%= f.field :email_address, as: :email, label: "Email" %>
|
||||
<%= f.field :reminder_emails, as: :checkbox, label: "Weekly maintenance reminders",
|
||||
hint: "A Monday email about overdue and upcoming inspections, ADs, parts and documents on aircraft you own. Only sent when something needs attention#{' (once email is set up)' unless MailSettings.configured?}." %>
|
||||
hint: "A Monday email about overdue and upcoming inspections, ADs, parts and documents on aircraft you own, and certificates of yours about to expire. Only sent when something needs attention#{' (once email is set up)' unless MailSettings.configured?}." %>
|
||||
<%= f.field :password, as: :password, label: "New password", hint: "Leave blank to keep your current password.", autocomplete: "new-password" %>
|
||||
<%= f.field :password_confirmation, as: :password, label: "Confirm new password", autocomplete: "new-password" %>
|
||||
<div>
|
||||
@@ -31,6 +31,31 @@
|
||||
</section>
|
||||
<% end %>
|
||||
|
||||
<section class="card card-body mt-5 max-w-md" id="certificates">
|
||||
<h2 class="card-title">Certificates</h2>
|
||||
<p class="mt-1 text-sm text-slate-600">Your FAA certificates, for signing logbook entries: “Sign as” fills in your name, the kind of certificate and its number.</p>
|
||||
<% if @user.certificates.any? %>
|
||||
<ul class="mt-3 divide-y divide-slate-100 rounded-md ring-1 ring-slate-200">
|
||||
<% @user.certificates.each do |c| %>
|
||||
<li class="flex flex-wrap items-center justify-between gap-2 px-3 py-2 text-sm">
|
||||
<span><span class="font-medium"><%= c.kind_label %></span> · <%= c.number %>
|
||||
<% if c.expires_on %><span class="ml-1 <%= c.expired? ? 'badge-red' : (Date.current + UserCertificate::EXPIRY_WARNING_DAYS >= c.expires_on ? 'badge-orange' : 'badge-gray') %>"><%= c.expired? ? "Expired" : "Expires" %> <%= c.expires_on %></span><% end %></span>
|
||||
<%= button_to "Remove", certificate_path(c), method: :delete, class: "btn-secondary btn-sm", form: { data: { turbo_confirm: "Remove your #{c.kind_label} certificate?" } } %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<%= form_with model: UserCertificate.new, url: certificates_path, class: "mt-3 grid gap-2 sm:grid-cols-[1fr_8rem]" do |f| %>
|
||||
<%= f.select :kind, UserCertificate::KINDS.invert, {}, class: "input", "aria-label": "Kind of certificate" %>
|
||||
<%= f.text_field :number, class: "input", placeholder: "Number", required: true, maxlength: 40, "aria-label": "Certificate number" %>
|
||||
<div class="sm:col-span-2 flex flex-wrap items-end gap-2">
|
||||
<div><%= f.label :expires_on, "Expires (optional)", class: "label" %><%= f.date_field :expires_on, class: "input" %></div>
|
||||
<%= f.submit "Add certificate", class: "btn-secondary" %>
|
||||
</div>
|
||||
<p class="hint sm:col-span-2">An Inspection Authorization expires on March 31 of each odd-numbered year unless renewed; you'll be reminded 60 days ahead in the weekly email.</p>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<section class="card card-body mt-5 max-w-md">
|
||||
<h2 class="card-title">Sessions</h2>
|
||||
<% others = @user.sessions.where.not(id: Current.session.id).count %>
|
||||
|
||||
Reference in new issue
Block a user