<% content_for :title, "Records audit" %>

Records audit

Work through each item; the app has checked the first ones itself.

<%= form_with url: admin_audits_path, class: "space-y-5" do %>

Checked by the app

<% sample = @audit.sample %>

Confirmed by you

<% RecordsAudit::MANUAL.each do |key, title| %>
<% if key == "sample" %>
    <% sample.each do |e| %>
  • <%= hidden_field_tag "sample_ids[]", e.id, id: nil %><%= link_to "#{e.aircraft.tail_number} · #{e.date} · #{e.text.truncate(80)}", aircraft_logbook_entry_path(e.aircraft, e), class: "link", target: "_blank" %><%= " (signed)" if e.signature %>
  • <% end %> <% if sample.empty? %>
  • No entries since the last audit.
  • <% end %>
<% elsif key == "users" %>
    <% @audit.users.each do |u| %>
  • <%= u.display_name %> (<%= u.email_address %>)<%= " · admin" if u.admin? %><%= " · #{u.aircraft_roles.map { "#{_1.role} #{_1.aircraft.tail_number}" }.join(', ')}" if u.aircraft_roles.any? %> · last sign-in <%= u.last_signed_in_at ? time_ago_in_words(u.last_signed_in_at) + " ago" : "never" %><%= " · DISABLED" if u.disabled? %>
  • <% end %>
<% end %> <%= text_field_tag "answers[#{key}][note]", nil, class: "input", placeholder: "Note (what was checked, or what's being done)" %>
<% end %>
<%= label_tag :notes, "Overall notes", class: "label" %><%= text_area_tag :notes, nil, rows: 3, class: "input" %>
<%= submit_tag "Record audit", class: "btn-primary" %>
<% end %>