mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- 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>
47 lines
3.0 KiB
ERB
47 lines
3.0 KiB
ERB
<% content_for :title, "Resolve squawk" %>
|
|
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
<%= form_with url: resolve_aircraft_squawk_path(@aircraft, @squawk), method: :patch, class: "card card-body max-w-3xl space-y-4" do %>
|
|
<div>
|
|
<h2 class="card-title">Resolve squawk</h2>
|
|
<p class="mt-1 rounded-md bg-slate-50 p-3 text-sm"><%= @squawk.issue_reported %><%= " · #{@squawk.component}" if @squawk.component %></p>
|
|
</div>
|
|
<% if @entry.errors.any? %>
|
|
<div class="rounded-md bg-red-50 p-3 text-sm text-red-700 ring-1 ring-red-200" role="alert">
|
|
<ul class="list-disc pl-5"><% @entry.errors.full_messages.each do |m| %><li><%= m %></li><% end %></ul>
|
|
</div>
|
|
<% end %>
|
|
<% choice = params[:logbook].presence || "new" %>
|
|
<fieldset class="space-y-2 text-sm">
|
|
<legend class="label">Logbook</legend>
|
|
<label class="flex items-center gap-2"><%= radio_button_tag :logbook, "new", choice == "new" %> Record the fix as a new logbook entry</label>
|
|
<label class="flex items-center gap-2"><%= radio_button_tag :logbook, "existing", choice == "existing" %> Link an existing entry:
|
|
<%= select_tag :logbook_entry_id, options_for_select(logbook_options(@aircraft).reject { _2.nil? }, params[:logbook_entry_id]), class: "input w-auto" %></label>
|
|
<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" 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 %>
|
|
<%= f.field :log_type, as: :select, label: "Logbook", collection: LogbookEntry::LOG_TYPES.invert %>
|
|
<%= f.field :aircraft_hours_at_entry, as: :number, step: 0.1, label: "Aircraft hours" %>
|
|
</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", 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>
|
|
|
|
<div>
|
|
<%= label_tag :resolution_notes, "Resolution notes (optional)", class: "label" %>
|
|
<%= text_area_tag :resolution_notes, params[:resolution_notes], rows: 2, class: "input" %>
|
|
</div>
|
|
<div class="flex gap-2"><%= submit_tag "Resolve", class: "btn-primary" %><%= link_to "Cancel", aircraft_squawks_path(@aircraft), class: "btn-secondary" %></div>
|
|
<% end %>
|