<% RecordsAudit::MANUAL.each do |key, title| %>
<% if key == "restore_test" && OffsiteConnection.connected? %>
<% if (rt = @audit.restore_test) %><%= t(".last_automatic_restore_test_html", to_date: (fmt_date(rt.created_at.to_date))) %> <%= rt.ok ? "OK" : t(".failed") %> <%= rt.message %><% else %><%= t(".no_automatic_restore_test_yet") %><% end %>
<%= t(".admin_off_site_backup_test_html", link: (link_to t(".run_one"), admin_offsite_backup_path, class: "link", target: "_blank")) %>
<% end %>
<% if key == "sample" %>
<% sample.each do |e| %>- <%= hidden_field_tag "sample_ids[]", e.id, id: nil %><%= link_to "#{e.aircraft.tail_number} · #{fmt_date(e.date)} · #{e.text.truncate(80)}", aircraft_logbook_entry_path(e.aircraft, e), class: "link", target: "_blank" %><%= t(".signed") if e.signature %>
<% end %>
<% if sample.empty? %>- <%= t(".no_entries_since_the_last") %>
<% end %>
<% elsif key == "users" %>
<% @audit.users.each do |u| %>- <%= t(".last_sign_in_html", display_name: u.display_name, email_address: u.email_address, admin: (t(".admin") if u.admin?), any: (" · #{u.aircraft_roles.map { "#{_1.role.name} #{_1.aircraft.tail_number}" }.join(', ')}" if u.aircraft_roles.any?), never: (u.last_signed_in_at ? t(".ago", time: time_ago_in_words(u.last_signed_in_at)) : t(".never")), disabled: (t(".disabled") if u.disabled?)) %>
<% end %>
<% end %>
<%= text_field_tag "answers[#{key}][note]", nil, class: "input", placeholder: t(".note_what_was_checked_or") %>
<% end %>
<%= label_tag :notes, t(".overall_notes"), class: "label" %><%= text_area_tag :notes, nil, rows: 3, class: "input" %>
<%= submit_tag t(".record_audit"), class: "btn-primary" %>