mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Move all user-facing text into config/locales/en.yml for localization
- Views use lazy t(".key") lookups; sentences with values or links stay
whole (interpolation, _html keys); counts use one/other plurals
- Stored-value labels (statuses, types, priorities...) are LabelSets read
from labels: in the current locale; field names and validation messages
under activerecord:; flash and activity text under flash:
- Services, models, helpers, mailer subjects, the logbook PDF, procedures
templates, records package README and transcription warnings localized;
the PDF reuses LogbookEntry#certification_statement instead of a copy
- Scripts read js: strings from a JSON tag via app/javascript/i18n.js
- Dates through I18n.l (app, weekday, month_year, long formats); html lang
follows the locale
- APP_LOCALE picks the language (falls back to English); missing
translations raise in development and tests
- README: Translating section and APP_LOCALE
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f45b557c2
commit
89ed0a76f9
313 files changed
+6387
-2653
No files matched your search
@@ -1,78 +1,77 @@
|
||||
<% content_for :title, "About" %>
|
||||
<% content_for :title, t(".about") %>
|
||||
<% info = @info %>
|
||||
|
||||
<h1 class="mb-1 text-2xl font-bold">About</h1>
|
||||
<p class="mb-5 text-sm text-slate-500">Simple Aircraft Manager: what's running, and how it's set up.</p>
|
||||
<h1 class="mb-1 text-2xl font-bold"><%= t(".about") %></h1>
|
||||
<p class="mb-5 text-sm text-slate-500"><%= t(".simple_aircraft_manager_what_s") %></p>
|
||||
|
||||
<section class="card card-body mb-5">
|
||||
<div class="flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<p class="text-xs uppercase tracking-wide text-slate-500">Version</p>
|
||||
<p class="text-xs uppercase tracking-wide text-slate-500"><%= t(".version") %></p>
|
||||
<p class="font-mono text-2xl font-semibold" data-version><%= info.version %></p>
|
||||
<p class="text-sm text-slate-600" data-revision>Build
|
||||
<%= info.revision_url ? link_to(info.revision, info.revision_url, class: "link font-mono", target: "_blank", rel: "noopener", title: "This commit on GitHub") : tag.span(info.revision, class: "font-mono") %></p>
|
||||
<p class="mt-1 flex flex-wrap gap-x-3 text-sm"><%= link_to "What's new", help_page_path("changelog"), class: "link" %><%= link_to "Disclaimer", help_page_path("disclaimer"), class: "link" %><% if info.repository_url %><%= link_to "Source code", info.repository_url, class: "link", target: "_blank", rel: "noopener" %><% end %></p>
|
||||
<p class="text-sm text-slate-600" data-revision><%= t(".build_html", build: (info.revision_url ? link_to(info.revision, info.revision_url, class: "link font-mono", target: "_blank", rel: "noopener", title: t(".this_commit_on_github")) : tag.span(info.revision, class: "font-mono"))) %></p>
|
||||
<p class="mt-1 flex flex-wrap gap-x-3 text-sm"><%= link_to t(".what_s_new"), help_page_path("changelog"), class: "link" %><%= link_to t(".disclaimer"), help_page_path("disclaimer"), class: "link" %><% if info.repository_url %><%= link_to t(".source_code"), info.repository_url, class: "link", target: "_blank", rel: "noopener" %><% end %></p>
|
||||
</div>
|
||||
<dl class="grid grid-cols-2 gap-x-6 gap-y-1 text-sm sm:grid-cols-3">
|
||||
<div><dt class="text-slate-500">Built</dt><dd class="font-medium"><%= info.built_at ? fmt_time(info.built_at.in_time_zone) : "—" %></dd></div>
|
||||
<div><dt class="text-slate-500">Started</dt><dd class="font-medium"><%= fmt_time(info.booted_at.in_time_zone) %></dd></div>
|
||||
<div><dt class="text-slate-500">Uptime</dt><dd class="font-medium"><%= distance_of_time_in_words(info.booted_at, Time.current) %></dd></div>
|
||||
<div><dt class="text-slate-500"><%= t(".built") %></dt><dd class="font-medium"><%= info.built_at ? fmt_time(info.built_at.in_time_zone) : "—" %></dd></div>
|
||||
<div><dt class="text-slate-500"><%= t(".started") %></dt><dd class="font-medium"><%= fmt_time(info.booted_at.in_time_zone) %></dd></div>
|
||||
<div><dt class="text-slate-500"><%= t(".uptime") %></dt><dd class="font-medium"><%= distance_of_time_in_words(info.booted_at, Time.current) %></dd></div>
|
||||
</dl>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="grid gap-5 lg:grid-cols-2">
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Runtime</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".runtime") %></h2></div>
|
||||
<%= render "pairs", pairs: info.runtime %>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Features</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".features") %></h2></div>
|
||||
<%= render "pairs", pairs: info.features %>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Key components</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".key_components") %></h2></div>
|
||||
<%= render "pairs", pairs: info.key_gems %>
|
||||
</section>
|
||||
|
||||
<div class="space-y-5">
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Storage</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".storage") %></h2></div>
|
||||
<% s = info.storage %>
|
||||
<%= render "pairs", pairs: [
|
||||
[ "Uploaded files", "#{number_with_delimiter(s[:files])} (#{number_to_human_size(s[:bytes])})" ],
|
||||
[ "Saved by storing duplicates once", number_to_human_size(s[:shared_bytes]) ],
|
||||
[ "Free disk space", s[:free_bytes] && number_to_human_size(s[:free_bytes]) ]
|
||||
[ t(".uploaded_files"), "#{number_with_delimiter(s[:files])} (#{number_to_human_size(s[:bytes])})" ],
|
||||
[ t(".saved_by_storing_duplicates_once"), number_to_human_size(s[:shared_bytes]) ],
|
||||
[ t(".free_disk_space"), s[:free_bytes] && number_to_human_size(s[:free_bytes]) ]
|
||||
] + info.databases.map { |label, bytes| [ "#{label} database", bytes && number_to_human_size(bytes) ] } %>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title">Email</h2>
|
||||
<%= button_to "Send test email", admin_test_email_path, class: "btn-secondary btn-sm", disabled: !MailSettings.configured?,
|
||||
data: { turbo_submits_with: "Sending…" }, title: "Sends to #{current_user.email_address}" %>
|
||||
<h2 class="card-title"><%= t(".email") %></h2>
|
||||
<%= button_to t(".send_test_email"), admin_test_email_path, class: "btn-secondary btn-sm", disabled: !MailSettings.configured?,
|
||||
data: { turbo_submits_with: t(".sending") }, title: t(".sends_to", email_address: current_user.email_address) %>
|
||||
</div>
|
||||
<%= render "pairs", pairs: MailSettings.summary.merge("Weekly reminders" => "Mondays, to owners who haven't turned them off") %>
|
||||
<div class="px-4 pb-3"><%= button_to "Send me this week's reminder", admin_test_reminder_path, class: "btn-secondary btn-sm", disabled: !MailSettings.configured? %></div>
|
||||
<%= render "pairs", pairs: MailSettings.summary.merge(t(".weekly_reminders") => t(".mondays_to_owners_who_haven")) %>
|
||||
<div class="px-4 pb-3"><%= button_to t(".send_me_this_week_s"), admin_test_reminder_path, class: "btn-secondary btn-sm", disabled: !MailSettings.configured? %></div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Background jobs</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".background_jobs") %></h2></div>
|
||||
<% if (j = info.jobs) %>
|
||||
<%= render "pairs", pairs: [
|
||||
[ "Workers running", j[:workers].zero? ? tag.span("none", class: "badge-red") : j[:workers] ],
|
||||
[ "Waiting", j[:ready] ], [ "Scheduled", j[:scheduled] ],
|
||||
[ "Failed", j[:failed].positive? ? tag.span(j[:failed], class: "badge-orange") : 0 ]
|
||||
[ t(".workers_running"), j[:workers].zero? ? tag.span("none", class: "badge-red") : j[:workers] ],
|
||||
[ t(".waiting"), j[:ready] ], [ t(".scheduled"), j[:scheduled] ],
|
||||
[ t(".failed"), j[:failed].positive? ? tag.span(j[:failed], class: "badge-orange") : 0 ]
|
||||
] %>
|
||||
<% else %>
|
||||
<%= empty_state "Job queue not available." %>
|
||||
<%= empty_state t(".job_queue_not_available") %>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Records</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".records") %></h2></div>
|
||||
<%= render "pairs", pairs: info.record_counts.transform_values { number_with_delimiter(_1) } %>
|
||||
</section>
|
||||
</div>
|
||||
@@ -81,23 +80,23 @@
|
||||
<section class="card mt-5" id="records">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<h2 class="card-title">Records integrity</h2>
|
||||
<p class="text-xs text-slate-500">Nightly: a verified database backup, then a check of the record history chains and every electronic signature (AC 120-78B 3.2).</p>
|
||||
<h2 class="card-title"><%= t(".records_integrity") %></h2>
|
||||
<p class="text-xs text-slate-500"><%= t(".nightly_a_verified_database_backup") %></p>
|
||||
</div>
|
||||
<%= button_to "Back up and check now", admin_check_records_path, class: "btn-secondary btn-sm", data: { turbo_submits_with: "Checking…" } %>
|
||||
<%= button_to t(".back_up_and_check_now"), admin_check_records_path, class: "btn-secondary btn-sm", data: { turbo_submits_with: t(".checking") } %>
|
||||
</div>
|
||||
<% check = IntegrityCheck.latest %>
|
||||
<% backup = BackupRun.latest %>
|
||||
<%= render "pairs", pairs: [
|
||||
[ "Last check", check ? "#{fmt_time(check.created_at)} · #{check.ok ? 'no problems' : pluralize(check.problems.size, 'problem')}" : "not run yet" ],
|
||||
[ "Checked", check ? "#{number_with_delimiter(check.versions_checked)} history entries, #{number_with_delimiter(check.signatures_checked)} signatures" : nil ],
|
||||
[ "Last backup", backup ? "#{fmt_time(backup.created_at)} · #{backup.ok ? number_to_human_size(backup.bytes) : 'FAILED'}" : "not run yet" ],
|
||||
[ "Backup check", backup&.message ],
|
||||
[ "Backups kept", "#{Setting.integer('backups_kept')} (in storage/backups)" ],
|
||||
[ "Off-site backup", OffsiteConnection.connected? ? ((o = OffsiteRun.latest_backup) ? tag.span("#{o.ok ? 'OK' : 'FAILED'} #{fmt_date(o.created_at.to_date)}", class: (o.ok && o.recent? ? nil : "badge-orange")) + " · Google Drive (#{OffsiteConnection.current.account_email})" : "Google Drive connected, none yet") : link_to("not set up", admin_offsite_backup_path, class: "badge-orange") ],
|
||||
[ "Procedures", (r = ProceduresRevision.current) ? "Revision #{r.number}, adopted #{fmt_date(r.adopted_at.to_date)}" : tag.span("not adopted", class: "badge-orange") ],
|
||||
[ "Last audit", AuditRun.latest ? "#{fmt_date(AuditRun.latest.performed_at.to_date)} · #{AuditRun.latest.passed ? 'passed' : 'items not passed'}" : "none yet" ],
|
||||
[ "Next audit due", AuditRun.due_soon? ? tag.span(fmt_date(AuditRun.next_due), class: "badge-orange") : fmt_date(AuditRun.next_due) ]
|
||||
[ t(".last_check"), check ? "#{fmt_time(check.created_at)} · #{check.ok ? t(".no_problems") : t("counts.problem", count: check.problems.size)}" : t(".not_run_yet") ],
|
||||
[ t(".checked"), check ? t(".checked_counts", versions: number_with_delimiter(check.versions_checked), signatures: number_with_delimiter(check.signatures_checked)) : nil ],
|
||||
[ t(".last_backup"), backup ? "#{fmt_time(backup.created_at)} · #{backup.ok ? number_to_human_size(backup.bytes) : 'FAILED'}" : t(".not_run_yet") ],
|
||||
[ t(".backup_check"), backup&.message ],
|
||||
[ t(".backups_kept"), t(".in_storage_backups", backups_kept: (Setting.integer('backups_kept'))) ],
|
||||
[ t(".off_site_backup"), OffsiteConnection.connected? ? ((o = OffsiteRun.latest_backup) ? tag.span("#{o.ok ? 'OK' : 'FAILED'} #{fmt_date(o.created_at.to_date)}", class: (o.ok && o.recent? ? nil : "badge-orange")) + t(".google_drive", account_email: OffsiteConnection.current.account_email) : t(".google_drive_connected_none_yet")) : link_to(t(".not_set_up"), admin_offsite_backup_path, class: "badge-orange") ],
|
||||
[ t(".procedures"), (r = ProceduresRevision.current) ? t(".revision_adopted", number: r.number, to_date: (fmt_date(r.adopted_at.to_date))) : tag.span(t(".not_adopted"), class: "badge-orange") ],
|
||||
[ t(".last_audit"), AuditRun.latest ? "#{fmt_date(AuditRun.latest.performed_at.to_date)} · #{AuditRun.latest.passed ? 'passed' : 'items not passed'}" : t(".none_yet") ],
|
||||
[ t(".next_audit_due"), AuditRun.due_soon? ? tag.span(fmt_date(AuditRun.next_due), class: "badge-orange") : fmt_date(AuditRun.next_due) ]
|
||||
] %>
|
||||
<% if check && !check.ok %>
|
||||
<ul class="list-disc space-y-1 px-8 pb-3 text-sm text-red-700"><% check.problems.each do |p| %><li><%= p %></li><% end %></ul>
|
||||
@@ -105,17 +104,17 @@
|
||||
</section>
|
||||
|
||||
<section class="card mt-5">
|
||||
<div class="card-header"><h2 class="card-title">Software versions</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".software_versions") %></h2></div>
|
||||
<% revisions = AppRevision.latest_first.limit(20) %>
|
||||
<% if revisions.any? %>
|
||||
<%= render "pairs", pairs: revisions.map { |r| [ [ r.version, "build #{r.revision}" ].compact.join(" · "), "#{fmt_time(r.first_seen_at)} – #{fmt_time(r.last_seen_at)}" ] } %>
|
||||
<% else %>
|
||||
<%= empty_state "No versions recorded yet." %>
|
||||
<%= empty_state t(".no_versions_recorded_yet") %>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<details class="card mt-5">
|
||||
<summary class="card-header cursor-pointer"><span class="card-title">All gems (<%= info.all_gems.size %>)</span></summary>
|
||||
<summary class="card-header cursor-pointer"><span class="card-title"><%= t(".all_gems_html", all_gems: info.all_gems.size) %></span></summary>
|
||||
<div class="grid gap-x-6 px-4 py-3 font-mono text-xs sm:grid-cols-2 lg:grid-cols-3">
|
||||
<% info.all_gems.each do |name, version| %>
|
||||
<div class="flex justify-between gap-2 py-0.5"><span class="truncate"><%= name %></span><span class="text-slate-500"><%= version %></span></div>
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<%= form_with model: [:admin, airport], class: "card card-body space-y-4 max-w-2xl" do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<div class="grid gap-4 sm:grid-cols-3">
|
||||
<%= f.field :ident, label: "Code", required: true, hint: "The code you log, e.g. 0R8." %>
|
||||
<%= f.field :ident, label: t(".code"), required: true, hint: t(".the_code_you_log_e") %>
|
||||
<%= f.field :name, required: true, wrapper: { class: "sm:col-span-2" } %>
|
||||
<%= f.field :kind, as: :select, label: "Type", collection: Airport::KINDS.map { [_1.humanize, _1] } %>
|
||||
<%= f.field :municipality, label: "Town" %>
|
||||
<%= f.field :region, placeholder: "US-RI", hint: "ISO region" %>
|
||||
<%= f.field :kind, as: :select, label: t(".type"), collection: Airport::KINDS.map { [_1.humanize, _1] } %>
|
||||
<%= f.field :municipality, label: t(".town") %>
|
||||
<%= f.field :region, placeholder: t(".us_ri"), hint: t(".iso_region") %>
|
||||
<%= f.field :latitude, as: :number, step: "any" %>
|
||||
<%= f.field :longitude, as: :number, step: "any" %>
|
||||
<%= f.field :elevation_ft, as: :number, label: "Elevation (ft)" %>
|
||||
<%= f.field :elevation_ft, as: :number, label: t(".elevation_ft") %>
|
||||
</div>
|
||||
<p class="hint">Custom airports are kept when the database is updated from OurAirports. To sync flights at this airport to AirTrail, add it there too with the same code (or map it on your AirTrail sync page).</p>
|
||||
<div class="flex gap-2"><%= f.submit "Save" %><%= link_to "Cancel", admin_airports_path, class: "btn-secondary" %></div>
|
||||
<p class="hint"><%= t(".custom_airports_are_kept_when") %></p>
|
||||
<div class="flex gap-2"><%= f.submit t(".save") %><%= link_to t(".cancel"), admin_airports_path, class: "btn-secondary" %></div>
|
||||
<% end %>
|
||||
<% if airport.persisted? %><div class="mt-4"><%= delete_button "Remove #{airport.ident}", admin_airport_path(airport) %></div><% end %>
|
||||
<% if airport.persisted? %><div class="mt-4"><%= delete_button t(".remove", ident: airport.ident), admin_airport_path(airport) %></div><% end %>
|
||||
@@ -1,2 +1,2 @@
|
||||
<h1 class="mb-4 text-2xl font-bold">Edit <%= @airport.ident %></h1>
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".edit_html", ident: @airport.ident) %></h1>
|
||||
<%= render "form", airport: @airport %>
|
||||
@@ -1,38 +1,38 @@
|
||||
<% content_for :title, "Airports" %>
|
||||
<% content_for :title, t(".airports") %>
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<h1 class="text-2xl font-bold">Airports</h1>
|
||||
<%= link_to "+ Custom Airport", new_admin_airport_path, class: "btn-primary" %>
|
||||
<h1 class="text-2xl font-bold"><%= t(".airports") %></h1>
|
||||
<%= link_to t(".custom_airport"), new_admin_airport_path, class: "btn-primary" %>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-5 lg:grid-cols-3">
|
||||
<section class="card lg:col-span-2">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title">Airport database</h2>
|
||||
<h2 class="card-title"><%= t(".airport_database") %></h2>
|
||||
<% if @running %>
|
||||
<span class="badge-blue">Updating…</span>
|
||||
<span class="badge-blue"><%= t(".updating") %></span>
|
||||
<% else %>
|
||||
<%= button_to "Update from OurAirports", refresh_admin_airports_path, class: "btn-secondary",
|
||||
form: { data: { turbo_confirm: "Download the latest airport data from OurAirports? Custom airports are kept." } } %>
|
||||
<%= button_to t(".update_from_ourairports"), refresh_admin_airports_path, class: "btn-secondary",
|
||||
form: { data: { turbo_confirm: t(".download_the_latest_airport_data") } } %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="card-body space-y-3 text-sm">
|
||||
<div class="grid grid-cols-3 gap-3 text-center">
|
||||
<div><div class="text-2xl font-semibold"><%= number_with_delimiter(@total) %></div><div class="text-xs text-slate-500">airports</div></div>
|
||||
<div><div class="text-2xl font-semibold"><%= @custom.size %></div><div class="text-xs text-slate-500">custom</div></div>
|
||||
<div><div class="text-sm font-semibold"><%= @last_success ? "#{time_ago_in_words(@last_success.finished_at)} ago" : "never" %></div><div class="text-xs text-slate-500">last updated</div></div>
|
||||
<div><div class="text-2xl font-semibold"><%= number_with_delimiter(@total) %></div><div class="text-xs text-slate-500"><%= t(".airports_2") %></div></div>
|
||||
<div><div class="text-2xl font-semibold"><%= @custom.size %></div><div class="text-xs text-slate-500"><%= t(".custom") %></div></div>
|
||||
<div><div class="text-sm font-semibold"><%= @last_success ? "#{time_ago_in_words(@last_success.finished_at)} ago" : "never" %></div><div class="text-xs text-slate-500"><%= t(".last_updated") %></div></div>
|
||||
</div>
|
||||
<% if @total.zero? %>
|
||||
<p class="rounded-md bg-amber-50 px-3 py-2 text-amber-900 ring-1 ring-amber-200">No airport data yet. It downloads automatically when the app starts. Use “Update from OurAirports” if that didn't happen.</p>
|
||||
<p class="rounded-md bg-amber-50 px-3 py-2 text-amber-900 ring-1 ring-amber-200"><%= t(".no_airport_data_yet_it") %></p>
|
||||
<% end %>
|
||||
<p class="hint">Airport data comes from <a href="https://ourairports.com/data/" class="link" target="_blank" rel="noopener noreferrer">OurAirports</a> (public domain), the same source AirTrail uses. It's used for From/To autocomplete and to match airport codes when syncing to AirTrail. Updates add new airports, apply changes and remove closed-out entries; custom airports are never changed.</p>
|
||||
<p class="hint"><%= t(".airport_data_comes_from_ourairports_html") %></p>
|
||||
<% if @updates.any? %>
|
||||
<table class="table">
|
||||
<thead><tr><th>Started</th><th>By</th><th>Status</th><th>Result</th></tr></thead>
|
||||
<thead><tr><th><%= t(".started") %></th><th><%= t(".by") %></th><th><%= t(".status") %></th><th><%= t(".result") %></th></tr></thead>
|
||||
<tbody>
|
||||
<% @updates.each do |u| %>
|
||||
<tr>
|
||||
<td class="whitespace-nowrap text-xs"><%= fmt_time(u.created_at) %></td>
|
||||
<td class="text-xs"><%= u.requested_by&.display_name || "Startup" %></td>
|
||||
<td class="text-xs"><%= u.requested_by&.display_name || t(".startup") %></td>
|
||||
<td><%= tag.span u.status.capitalize, class: { "done" => "badge-green", "failed" => "badge-red" }.fetch(u.status, "badge-blue") %></td>
|
||||
<td class="text-xs"><%= u.done? ? u.summary : u.error %></td>
|
||||
</tr>
|
||||
@@ -44,22 +44,22 @@
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Look up</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".look_up") %></h2></div>
|
||||
<div class="card-body space-y-2">
|
||||
<%= form_with url: admin_airports_path, method: :get, class: "flex gap-2" do |f| %>
|
||||
<%= f.search_field :q, value: @query, class: "input", placeholder: "Code or name" %>
|
||||
<%= f.submit "Search", class: "btn-secondary" %>
|
||||
<%= f.search_field :q, value: @query, class: "input", placeholder: t(".code_or_name") %>
|
||||
<%= f.submit t(".search"), class: "btn-secondary" %>
|
||||
<% end %>
|
||||
<% if @query.present? %>
|
||||
<% if @results.any? %>
|
||||
<ul class="divide-y divide-slate-100 text-sm">
|
||||
<% @results.each do |a| %>
|
||||
<li class="py-1.5"><span class="font-mono font-semibold"><%= a.code %></span> <%= a.name %>
|
||||
<div class="text-xs text-slate-500"><%= [a.place, "AirTrail #{a.airtrail_code}", (a.custom? ? "custom" : nil), Airport::KIND_LABELS[a.kind]].compact_blank.join(" · ") %></div></li>
|
||||
<div class="text-xs text-slate-500"><%= [a.place, t(".airtrail", airtrail_code: a.airtrail_code), (a.custom? ? "custom" : nil), Airport::KIND_LABELS[a.kind]].compact_blank.join(" · ") %></div></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% else %>
|
||||
<p class="text-sm text-slate-600">No match for “<%= @query %>”. <%= link_to "Add it as a custom airport", new_admin_airport_path(ident: @query.upcase), class: "link" %>.</p>
|
||||
<p class="text-sm text-slate-600"><%= t(".no_match_for_html", query: @query, link: (link_to t(".add_it_as_a_custom"), new_admin_airport_path(ident: @query.upcase), class: "link")) %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -67,21 +67,21 @@
|
||||
</div>
|
||||
|
||||
<section class="card mt-5">
|
||||
<div class="card-header"><h2 class="card-title">Custom airports</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".custom_airports") %></h2></div>
|
||||
<% if @custom.any? %>
|
||||
<table class="table">
|
||||
<thead><tr><th>Code</th><th>Name</th><th>Location</th><th>Type</th><th></th></tr></thead>
|
||||
<thead><tr><th><%= t(".code") %></th><th><%= t(".name") %></th><th><%= t(".location") %></th><th><%= t(".type") %></th><th></th></tr></thead>
|
||||
<tbody>
|
||||
<% @custom.each do |a| %>
|
||||
<tr>
|
||||
<td class="font-mono font-semibold"><%= a.ident %></td><td><%= a.name %></td><td class="text-xs"><%= a.place %></td>
|
||||
<td class="text-xs"><%= a.kind.to_s.humanize %></td>
|
||||
<td class="text-right"><%= link_to "Edit", edit_admin_airport_path(a), class: "btn-secondary btn-sm" %></td>
|
||||
<td class="text-right"><%= link_to t(".edit"), edit_admin_airport_path(a), class: "btn-secondary btn-sm" %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<%= empty_state "None. Add private strips or fields that aren't in OurAirports." %>
|
||||
<%= empty_state t(".none_add_private_strips_or") %>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -1,2 +1,2 @@
|
||||
<h1 class="mb-4 text-2xl font-bold">New Custom Airport</h1>
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".new_custom_airport") %></h1>
|
||||
<%= render "form", airport: @airport %>
|
||||
@@ -1,10 +1,10 @@
|
||||
<% content_for :title, "Records audits" %>
|
||||
<% content_for :title, t(".records_audits") %>
|
||||
<div class="mb-4 flex flex-wrap items-center justify-between gap-2">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold">Records audits</h1>
|
||||
<p class="text-sm text-slate-600">Quality-control audits of the electronic records (AC 120-78B 3.2.8.5), every <%= RecordkeepingPolicy.current.audit_interval_months %> months. Next due <strong class="<%= AuditRun.due_soon? ? 'text-amber-700' : '' %>"><%= AuditRun.next_due %></strong>.</p>
|
||||
<h1 class="text-2xl font-bold"><%= t(".records_audits") %></h1>
|
||||
<p class="text-sm text-slate-600"><%= t(".quality_control_audits_of_the_html", audit_interval_months: RecordkeepingPolicy.current.audit_interval_months) %> <strong class="<%= AuditRun.due_soon? ? 'text-amber-700' : '' %>"><%= AuditRun.next_due %></strong>.</p>
|
||||
</div>
|
||||
<%= link_to "Start an audit", new_admin_audit_path, class: "btn-primary" %>
|
||||
<%= link_to t(".start_an_audit"), new_admin_audit_path, class: "btn-primary" %>
|
||||
</div>
|
||||
<section class="card">
|
||||
<% if @audits.any? %>
|
||||
@@ -12,9 +12,9 @@
|
||||
<% @audits.each do |a| %>
|
||||
<li class="flex items-center justify-between px-4 py-2">
|
||||
<span><%= link_to fmt_date(a.performed_at.to_date), admin_audit_path(a), class: "link" %> · <%= a.performed_by&.display_name %></span>
|
||||
<span class="<%= a.passed ? 'badge-green' : 'badge-orange' %>"><%= a.passed ? "Passed" : "Items not passed" %></span>
|
||||
<span class="<%= a.passed ? 'badge-green' : 'badge-orange' %>"><%= a.passed ? t(".passed") : t(".items_not_passed") %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% else %><%= empty_state "No audits yet." %><% end %>
|
||||
<% else %><%= empty_state t(".no_audits_yet") %><% end %>
|
||||
</section>
|
||||
@@ -1,12 +1,12 @@
|
||||
<% content_for :title, "Records audit" %>
|
||||
<h1 class="mb-1 text-2xl font-bold">Records audit</h1>
|
||||
<p class="mb-5 text-sm text-slate-600">Work through each item; the app has checked the first ones itself.</p>
|
||||
<% content_for :title, t(".records_audit") %>
|
||||
<h1 class="mb-1 text-2xl font-bold"><%= t(".records_audit") %></h1>
|
||||
<p class="mb-5 text-sm text-slate-600"><%= t(".work_through_each_item_the") %></p>
|
||||
<%= form_with url: admin_audits_path, class: "space-y-5" do %>
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Checked by the app</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".checked_by_the_app") %></h2></div>
|
||||
<ul class="divide-y divide-slate-100 text-sm">
|
||||
<% @audit.auto_items.each do |item| %>
|
||||
<li class="flex items-start gap-3 px-4 py-2"><span class="<%= item.passed ? 'badge-green' : 'badge-red' %>"><%= item.passed ? "Pass" : "Fail" %></span>
|
||||
<li class="flex items-start gap-3 px-4 py-2"><span class="<%= item.passed ? 'badge-green' : 'badge-red' %>"><%= item.passed ? t(".pass") : t(".fail") %></span>
|
||||
<span><span class="font-medium"><%= item.title %></span><span class="block text-xs text-slate-500"><%= item.detail %></span></span></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
@@ -14,32 +14,32 @@
|
||||
|
||||
<% sample = @audit.sample %>
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Confirmed by you</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".confirmed_by_you") %></h2></div>
|
||||
<div class="space-y-4 p-4">
|
||||
<% RecordsAudit::MANUAL.each do |key, title| %>
|
||||
<div class="space-y-2 rounded-md p-3 ring-1 ring-slate-200">
|
||||
<label class="flex items-start gap-2 text-sm font-medium"><%= check_box_tag "answers[#{key}][passed]", "1", false, class: "mt-0.5 h-4 w-4 shrink-0 rounded border-slate-300" %><span><%= title %></span></label>
|
||||
<% if key == "restore_test" && OffsiteConnection.connected? %>
|
||||
<p class="ml-6 text-xs text-slate-600">
|
||||
<% if (rt = @audit.restore_test) %>Last automatic restore test (<%= fmt_date(rt.created_at.to_date) %>): <span class="<%= rt.ok ? 'badge-green' : 'badge-red' %>"><%= rt.ok ? "OK" : "Failed" %></span> <%= rt.message %><% else %>No automatic restore test yet.<% end %>
|
||||
<%= link_to "Run one", admin_offsite_backup_path, class: "link", target: "_blank" %> (Admin → Off-site Backup → Test restore), then also open a copy downloaded from Google Drive yourself.
|
||||
<% if (rt = @audit.restore_test) %><%= t(".last_automatic_restore_test_html", to_date: (fmt_date(rt.created_at.to_date))) %> <span class="<%= rt.ok ? 'badge-green' : 'badge-red' %>"><%= rt.ok ? "OK" : t(".failed") %></span> <%= 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")) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% if key == "sample" %>
|
||||
<ul class="ml-6 list-disc text-xs text-slate-600">
|
||||
<% sample.each do |e| %><li><%= 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" %><%= " (signed)" if e.signature %></li><% end %>
|
||||
<% if sample.empty? %><li>No entries since the last audit.</li><% end %>
|
||||
<% sample.each do |e| %><li><%= 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 %></li><% end %>
|
||||
<% if sample.empty? %><li><%= t(".no_entries_since_the_last") %></li><% end %>
|
||||
</ul>
|
||||
<% elsif key == "users" %>
|
||||
<ul class="ml-6 list-disc text-xs text-slate-600">
|
||||
<% @audit.users.each do |u| %><li><%= 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? %></li><% end %>
|
||||
<% @audit.users.each do |u| %><li><%= 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 { "#{AircraftRole::ROLES[_1.role]} #{_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?)) %></li><% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
<%= text_field_tag "answers[#{key}][note]", nil, class: "input", placeholder: "Note (what was checked, or what's being done)" %>
|
||||
<%= text_field_tag "answers[#{key}][note]", nil, class: "input", placeholder: t(".note_what_was_checked_or") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div><%= label_tag :notes, "Overall notes", class: "label" %><%= text_area_tag :notes, nil, rows: 3, class: "input" %></div>
|
||||
<%= submit_tag "Record audit", class: "btn-primary" %>
|
||||
<div><%= label_tag :notes, t(".overall_notes"), class: "label" %><%= text_area_tag :notes, nil, rows: 3, class: "input" %></div>
|
||||
<%= submit_tag t(".record_audit"), class: "btn-primary" %>
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
||||
@@ -1,14 +1,14 @@
|
||||
<% content_for :title, "Records audit" %>
|
||||
<h1 class="mb-1 text-2xl font-bold">Records audit, <%= fmt_date(@audit.performed_at.to_date) %></h1>
|
||||
<p class="mb-4 text-sm text-slate-600">By <%= @audit.performed_by&.display_name %> · <span class="<%= @audit.passed ? 'badge-green' : 'badge-orange' %>"><%= @audit.passed ? "Passed" : "Items not passed" %></span></p>
|
||||
<% content_for :title, t(".records_audit") %>
|
||||
<h1 class="mb-1 text-2xl font-bold"><%= t(".records_audit_2_html", to_date: (fmt_date(@audit.performed_at.to_date))) %></h1>
|
||||
<p class="mb-4 text-sm text-slate-600"><%= t(".by_html", display_name: @audit.performed_by&.display_name) %> <span class="<%= @audit.passed ? 'badge-green' : 'badge-orange' %>"><%= @audit.passed ? t(".passed") : t(".items_not_passed") %></span></p>
|
||||
<section class="card">
|
||||
<ul class="divide-y divide-slate-100 text-sm">
|
||||
<% @audit.results.each do |r| %>
|
||||
<li class="flex items-start gap-3 px-4 py-2"><span class="<%= r['passed'] ? 'badge-green' : 'badge-red' %>"><%= r["passed"] ? "Pass" : "Fail" %></span>
|
||||
<span><span class="font-medium"><%= r["title"] %></span><%= tag.span(" (checked by the app)", class: "text-xs text-slate-500") if r["auto"] %>
|
||||
<li class="flex items-start gap-3 px-4 py-2"><span class="<%= r['passed'] ? 'badge-green' : 'badge-red' %>"><%= r["passed"] ? t(".pass") : t(".fail") %></span>
|
||||
<span><span class="font-medium"><%= r["title"] %></span><%= tag.span(t(".checked_by_the_app"), class: "text-xs text-slate-500") if r["auto"] %>
|
||||
<% if r["detail"].present? %><span class="block text-xs text-slate-600"><%= r["detail"] %></span><% end %></span></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% if @audit.notes.present? %><div class="whitespace-pre-wrap border-t border-slate-100 px-4 py-3 text-sm"><%= @audit.notes %></div><% end %>
|
||||
</section>
|
||||
<p class="mt-4"><%= link_to "All audits", admin_audits_path, class: "link" %></p>
|
||||
<p class="mt-4"><%= link_to t(".all_audits"), admin_audits_path, class: "link" %></p>
|
||||
@@ -1,7 +1,7 @@
|
||||
<%= form_with model: [:admin, component_type], class: "card card-body space-y-4 max-w-md" do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<%= f.field :name, required: true %>
|
||||
<%= f.field :consumable, as: :checkbox, label: "Consumable (oil filter, spark plugs…)" %>
|
||||
<div class="flex gap-2"><%= f.submit "Save" %><%= link_to "Cancel", admin_component_types_path, class: "btn-secondary" %></div>
|
||||
<%= f.field :consumable, as: :checkbox, label: t(".consumable_oil_filter_spark_plugs") %>
|
||||
<div class="flex gap-2"><%= f.submit t(".save") %><%= link_to t(".cancel"), admin_component_types_path, class: "btn-secondary" %></div>
|
||||
<% end %>
|
||||
<% if component_type.persisted? %><div class="mt-4"><%= delete_button "Delete type", admin_component_type_path(component_type) %></div><% end %>
|
||||
<% if component_type.persisted? %><div class="mt-4"><%= delete_button t(".delete_type"), admin_component_type_path(component_type) %></div><% end %>
|
||||
@@ -1,2 +1,2 @@
|
||||
<h1 class="mb-4 text-2xl font-bold">Edit Component Type</h1>
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".edit_component_type") %></h1>
|
||||
<%= render "form", component_type: @component_type %>
|
||||
@@ -1,7 +1,7 @@
|
||||
<% content_for :title, "Component Types" %>
|
||||
<div class="mb-4 flex items-center justify-between"><h1 class="text-2xl font-bold">Component Types</h1><%= link_to "+ New Type", new_admin_component_type_path, class: "btn-primary" %></div>
|
||||
<% content_for :title, t(".component_types") %>
|
||||
<div class="mb-4 flex items-center justify-between"><h1 class="text-2xl font-bold"><%= t(".component_types") %></h1><%= link_to t(".new_type"), new_admin_component_type_path, class: "btn-primary" %></div>
|
||||
<section class="card"><table class="table">
|
||||
<thead><tr><th>Name</th><th>Consumable</th><th></th></tr></thead>
|
||||
<tbody><% @component_types.each do |t| %><tr><td><%= t.name %></td><td><%= "Yes" if t.consumable? %></td>
|
||||
<td class="text-right"><%= link_to "Edit", edit_admin_component_type_path(t), class: "btn-secondary btn-sm" %></td></tr><% end %></tbody>
|
||||
<thead><tr><th><%= t(".name") %></th><th><%= t(".consumable") %></th><th></th></tr></thead>
|
||||
<tbody><% @component_types.each do |t| %><tr><td><%= t.name %></td><td><%= t(".yes") if t.consumable? %></td>
|
||||
<td class="text-right"><%= link_to t(".edit"), edit_admin_component_type_path(t), class: "btn-secondary btn-sm" %></td></tr><% end %></tbody>
|
||||
</table></section>
|
||||
@@ -1,2 +1,2 @@
|
||||
<h1 class="mb-4 text-2xl font-bold">New Component Type</h1>
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".new_component_type") %></h1>
|
||||
<%= render "form", component_type: @component_type %>
|
||||
@@ -1,17 +1,17 @@
|
||||
<%= form_with model: [ :admin, template ], class: "card card-body max-w-3xl space-y-4" do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<%= f.field :name, required: true, placeholder: "Oil and filter change" %>
|
||||
<%= f.field :reference, placeholder: "Part 43 App. A (c)(6)", hint: "Shown next to the name, e.g. the regulation or manual paragraph." %>
|
||||
<%= f.field :name, required: true, placeholder: t(".oil_and_filter_change") %>
|
||||
<%= f.field :reference, placeholder: t(".part_43_app_a_c"), hint: t(".shown_next_to_the_name") %>
|
||||
</div>
|
||||
<%= f.field :text, as: :textarea, rows: 5, required: true, hint: "The entry text. Use __ for blanks to fill in (quantities, part numbers…)." %>
|
||||
<%= f.field :text, as: :textarea, rows: 5, required: true, hint: t(".the_entry_text_use_for") %>
|
||||
<div class="grid gap-4 sm:grid-cols-4">
|
||||
<%= f.field :entry_type, as: :select, label: "Entry type", collection: LogbookEntry::ENTRY_TYPES.invert %>
|
||||
<%= f.field :log_type, as: :select, label: "Logbook", include_blank: "— Leave as is —", collection: LogbookEntry::LOG_TYPES.invert %>
|
||||
<%= f.field :certificate_type, as: :select, label: "Kind of certificate", include_blank: "— Leave as is —", collection: LogbookEntry::CERTIFICATE_TYPES.invert,
|
||||
hint: "Only filled in when none is chosen yet." %>
|
||||
<%= f.field :position, as: :number, label: "Order" %>
|
||||
<%= f.field :entry_type, as: :select, label: t(".entry_type"), collection: LogbookEntry::ENTRY_TYPES.invert %>
|
||||
<%= f.field :log_type, as: :select, label: t(".logbook"), include_blank: t(".leave_as_is"), collection: LogbookEntry::LOG_TYPES.invert %>
|
||||
<%= f.field :certificate_type, as: :select, label: t(".kind_of_certificate"), include_blank: t(".leave_as_is"), collection: LogbookEntry::CERTIFICATE_TYPES.invert,
|
||||
hint: t(".only_filled_in_when_none") %>
|
||||
<%= f.field :position, as: :number, label: t(".order") %>
|
||||
</div>
|
||||
<div class="flex gap-2"><%= f.submit "Save Template" %><%= link_to "Cancel", admin_logbook_templates_path, class: "btn-secondary" %></div>
|
||||
<div class="flex gap-2"><%= f.submit t(".save_template") %><%= link_to t(".cancel"), admin_logbook_templates_path, class: "btn-secondary" %></div>
|
||||
<% end %>
|
||||
<% if template.persisted? %><div class="mt-4"><%= delete_button "Delete template", admin_logbook_template_path(template) %></div><% end %>
|
||||
<% if template.persisted? %><div class="mt-4"><%= delete_button t(".delete_template"), admin_logbook_template_path(template) %></div><% end %>
|
||||
@@ -1,3 +1,3 @@
|
||||
<% content_for :title, "Logbook template" %>
|
||||
<h1 class="mb-4 text-2xl font-bold">Logbook template</h1>
|
||||
<% content_for :title, t(".logbook_template") %>
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".logbook_template") %></h1>
|
||||
<%= render "form", template: @template %>
|
||||
@@ -1,12 +1,12 @@
|
||||
<% content_for :title, "Logbook templates" %>
|
||||
<% content_for :title, t(".logbook_templates") %>
|
||||
<div class="mb-4 flex flex-wrap items-center justify-between gap-2">
|
||||
<h1 class="text-2xl font-bold">Logbook templates</h1>
|
||||
<h1 class="text-2xl font-bold"><%= t(".logbook_templates") %></h1>
|
||||
<div class="flex gap-2">
|
||||
<%= button_to "Restore built-in templates", restore_admin_logbook_templates_path, class: "btn-secondary", title: "Add back any of the built-in preventive maintenance templates that were deleted" %>
|
||||
<%= link_to "+ New Template", new_admin_logbook_template_path, class: "btn-primary" %>
|
||||
<%= button_to t(".restore_built_in_templates"), restore_admin_logbook_templates_path, class: "btn-secondary", title: t(".add_back_any_of_the") %>
|
||||
<%= link_to t(".new_template"), new_admin_logbook_template_path, class: "btn-primary" %>
|
||||
</div>
|
||||
</div>
|
||||
<p class="mb-4 text-sm text-slate-600">Wording to start a logbook entry from: the "Template" list on a new entry. Use __ for blanks to fill in.</p>
|
||||
<p class="mb-4 text-sm text-slate-600"><%= t(".wording_to_start_a_logbook") %></p>
|
||||
<section class="card">
|
||||
<% if @templates.any? %>
|
||||
<ul class="divide-y divide-slate-100">
|
||||
@@ -17,11 +17,11 @@
|
||||
<div class="text-xs text-slate-500"><%= [ LogbookEntry::ENTRY_TYPES[t.entry_type], (t.log_type && "#{LogbookEntry::LOG_TYPES[t.log_type]} log"), (t.certificate_type && LogbookEntry::CERTIFICATE_TYPES[t.certificate_type]) ].compact.join(" · ") %></div>
|
||||
<p class="mt-1 text-xs text-slate-600"><%= t.text.truncate(220) %></p>
|
||||
</div>
|
||||
<%= link_to "Edit", edit_admin_logbook_template_path(t), class: "btn-secondary btn-sm" %>
|
||||
<%= link_to t(".edit"), edit_admin_logbook_template_path(t), class: "btn-secondary btn-sm" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% else %>
|
||||
<%= empty_state "No templates." %>
|
||||
<%= empty_state t(".no_templates") %>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -1,3 +1,3 @@
|
||||
<% content_for :title, "Logbook template" %>
|
||||
<h1 class="mb-4 text-2xl font-bold">Logbook template</h1>
|
||||
<% content_for :title, t(".logbook_template") %>
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".logbook_template") %></h1>
|
||||
<%= render "form", template: @template %>
|
||||
@@ -1,59 +1,59 @@
|
||||
<% content_for :title, "Off-site backup" %>
|
||||
<h1 class="mb-1 text-2xl font-bold">Off-site backup</h1>
|
||||
<p class="mb-5 max-w-3xl text-sm text-slate-600">Every night, after the verified database backup, the app copies it to Google Drive with every uploaded file not already there, so the records survive losing this server (AC 120-78B 3.2.7). The newest <%= Setting.integer("offsite_backups_kept") %> database copies are kept (<%= link_to "Settings", edit_admin_settings_path, class: "link" %>); uploaded files are copied once and never deleted there. The app can only see the files it created in your Drive.</p>
|
||||
<% content_for :title, t(".off_site_backup") %>
|
||||
<h1 class="mb-1 text-2xl font-bold"><%= t(".off_site_backup") %></h1>
|
||||
<p class="mb-5 max-w-3xl text-sm text-slate-600"><%= t(".every_night_after_the_verified_html", offsite_backups_kept: (Setting.integer("offsite_backups_kept")), link: (link_to t(".settings"), edit_admin_settings_path, class: "link")) %></p>
|
||||
|
||||
<div class="grid gap-5 lg:grid-cols-2">
|
||||
<section class="card card-body space-y-3">
|
||||
<h2 class="card-title">Google Drive</h2>
|
||||
<h2 class="card-title"><%= t(".google_drive") %></h2>
|
||||
<% if @connection.connected? %>
|
||||
<p class="text-sm"><span class="badge-green">Connected</span> <strong><%= @connection.account_email %></strong>, by <%= @connection.connected_by&.display_name %> on <%= fmt_date(@connection.connected_at&.to_date) %>.
|
||||
Folder: <em><%= OffsiteConnection::ROOT_FOLDER %></em>.</p>
|
||||
<p class="text-sm">Uploaded files copied: <%= @files_copied %> of <%= @files_total %>.</p>
|
||||
<p class="text-sm"><span class="badge-green"><%= t(".connected") %></span> <%= t(".by_on_html", account_email: @connection.account_email, display_name: @connection.connected_by&.display_name, to_date: (fmt_date(@connection.connected_at&.to_date))) %>
|
||||
<%= t(".folder_html", folder: (OffsiteConnection::ROOT_FOLDER)) %></p>
|
||||
<p class="text-sm"><%= t(".uploaded_files_copied_of_html", files_copied: @files_copied, files_total: @files_total) %></p>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<%= button_to "Back up now", backup_now_admin_offsite_backup_path, class: "btn-primary" %>
|
||||
<%= button_to "Test restore", restore_test_admin_offsite_backup_path, class: "btn-secondary",
|
||||
title: "Download the newest database copy and a few files from Drive and check them" %>
|
||||
<%= button_to "Disconnect", admin_offsite_backup_path, method: :delete, class: "btn-secondary",
|
||||
form: { data: { turbo_confirm: "Stop copying backups to #{@connection.account_email}? The copies already there stay in that Drive." } } %>
|
||||
<%= button_to t(".back_up_now"), backup_now_admin_offsite_backup_path, class: "btn-primary" %>
|
||||
<%= button_to t(".test_restore"), restore_test_admin_offsite_backup_path, class: "btn-secondary",
|
||||
title: t(".download_the_newest_database_copy") %>
|
||||
<%= button_to t(".disconnect"), admin_offsite_backup_path, method: :delete, class: "btn-secondary",
|
||||
form: { data: { turbo_confirm: t(".stop_copying_backups_to_the", account_email: @connection.account_email) } } %>
|
||||
</div>
|
||||
<% elsif @connection.configured? %>
|
||||
<p class="text-sm">The OAuth client is saved. Connect the Google account whose Drive will hold the backups.</p>
|
||||
<%= link_to "Connect Google Drive", connect_admin_offsite_backup_path, class: "btn-primary self-start", data: { turbo: false } %>
|
||||
<p class="text-sm"><%= t(".the_oauth_client_is_saved") %></p>
|
||||
<%= link_to t(".connect_google_drive"), connect_admin_offsite_backup_path, class: "btn-primary self-start", data: { turbo: false } %>
|
||||
<% else %>
|
||||
<p class="text-sm text-amber-800">Not set up. Follow the steps to create a Google OAuth client, then connect.</p>
|
||||
<p class="text-sm text-amber-800"><%= t(".not_set_up_follow_the") %></p>
|
||||
<% end %>
|
||||
|
||||
<%= form_with model: @connection, url: admin_offsite_backup_path, method: :patch, class: "space-y-3 border-t border-slate-100 pt-3" do |f| %>
|
||||
<%= f.field :client_id, label: "OAuth client ID", placeholder: "1234567890-abc.apps.googleusercontent.com" %>
|
||||
<%= f.field :client_secret, as: :password, label: "OAuth client secret", value: nil,
|
||||
placeholder: (@connection.client_secret.present? ? "saved (leave blank to keep)" : nil), autocomplete: "off" %>
|
||||
<%= f.submit "Save client", class: "btn-secondary" %>
|
||||
<%= f.field :client_id, label: t(".oauth_client_id"), placeholder: "1234567890-abc.apps.googleusercontent.com" %>
|
||||
<%= f.field :client_secret, as: :password, label: t(".oauth_client_secret"), value: nil,
|
||||
placeholder: (@connection.client_secret.present? ? t(".saved_leave_blank_to_keep") : nil), autocomplete: "off" %>
|
||||
<%= f.submit t(".save_client"), class: "btn-secondary" %>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<section class="card card-body space-y-2 text-sm">
|
||||
<h2 class="card-title">Setting up Google (once)</h2>
|
||||
<h2 class="card-title"><%= t(".setting_up_google_once") %></h2>
|
||||
<ol class="list-decimal space-y-1.5 pl-5">
|
||||
<li>Open the <a class="link" href="https://console.cloud.google.com/projectcreate" target="_blank" rel="noopener">Google Cloud console</a> signed in as the account that will hold the backups, and create a project (e.g. “Aircraft records backup”).</li>
|
||||
<li><a class="link" href="https://console.cloud.google.com/apis/library/drive.googleapis.com" target="_blank" rel="noopener">Enable the Google Drive API</a> for it.</li>
|
||||
<li>Under <strong>Google Auth Platform → Branding</strong>, give the app a name and your email; under <strong>Audience</strong> choose <strong>External</strong> and then <strong>Publish app</strong> (in “Testing”, Google expires the access after 7 days). Google doesn't need to verify it: the app only asks for access to files it creates.</li>
|
||||
<li>Under <strong>Clients</strong>, create an <strong>OAuth client ID</strong> of type <strong>Web application</strong> with this authorized redirect URI:
|
||||
<li><%= t(".open_the_google_cloud_console_html") %></li>
|
||||
<li><%= t(".enable_the_google_drive_api_html") %></li>
|
||||
<li><%= t(".under_google_auth_platform_branding_html") %></li>
|
||||
<li><%= t(".under_clients_create_an_oauth_html") %>
|
||||
<code class="mt-1 block break-all rounded bg-slate-100 px-2 py-1"><%= @connection.redirect_uri %></code>
|
||||
(It must be the address you open the app at; set <code>APP_URL</code> if it isn't.)</li>
|
||||
<li>Paste the client ID and secret here, save, and choose <strong>Connect Google Drive</strong>. Google will warn that the app isn't verified: choose <strong>Advanced → Go to …</strong> and allow access.</li>
|
||||
<%= t(".it_must_be_the_address_html") %></li>
|
||||
<li><%= t(".paste_the_client_id_and_html") %></li>
|
||||
</ol>
|
||||
<p class="text-slate-600">Restoring: see <%= link_to "Help → Administration", help_page_path("administration", anchor: "restoring-from-google-drive"), class: "link" %>.</p>
|
||||
<p class="text-slate-600"><%= t(".restoring_see_html", link: (link_to t(".help_administration"), help_page_path("administration", anchor: "restoring-from-google-drive"), class: "link")) %></p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="card mt-5">
|
||||
<div class="card-header"><h2 class="card-title">Recent runs</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".recent_runs") %></h2></div>
|
||||
<% if @runs.any? %>
|
||||
<ul class="divide-y divide-slate-100 text-sm">
|
||||
<% @runs.each do |r| %>
|
||||
<li class="flex items-start gap-3 px-4 py-2"><span class="<%= r.ok ? 'badge-green' : 'badge-red' %>"><%= r.ok ? "OK" : "Failed" %></span>
|
||||
<span><span class="font-medium"><%= r.kind == "restore_test" ? "Restore test" : "Backup" %></span> · <%= fmt_time(r.created_at.in_time_zone) %><span class="block text-xs text-slate-600"><%= r.message %></span></span></li>
|
||||
<li class="flex items-start gap-3 px-4 py-2"><span class="<%= r.ok ? 'badge-green' : 'badge-red' %>"><%= r.ok ? "OK" : t(".failed") %></span>
|
||||
<span><span class="font-medium"><%= r.kind == "restore_test" ? t(".restore_test") : t(".backup") %></span> · <%= fmt_time(r.created_at.in_time_zone) %><span class="block text-xs text-slate-600"><%= r.message %></span></span></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% else %><%= empty_state "None yet." %><% end %>
|
||||
<% else %><%= empty_state t(".none_yet") %><% end %>
|
||||
</section>
|
||||
@@ -7,111 +7,111 @@
|
||||
<% p_ = "mt-1 text-sm leading-relaxed" %>
|
||||
<article class="text-slate-900">
|
||||
<header class="border-b-2 border-slate-800 pb-3">
|
||||
<p class="text-xs uppercase tracking-wide text-slate-500">Standalone procedures document · AC 120-78B paragraphs 2.2.11 and 3.2.8</p>
|
||||
<h1 class="text-2xl font-bold">Electronic Signature and Recordkeeping Procedures</h1>
|
||||
<p class="text-sm text-slate-600"><%= policy.operator_name.presence || "[Operator]" %> · Simple Aircraft Manager</p>
|
||||
<p class="mt-1 text-sm"><strong>Revision <%= number %></strong><%= adopted_at ? " · adopted #{adopted_at.to_date.iso8601} by #{adopted_by&.display_name}" : " · not yet adopted" %></p>
|
||||
<p class="text-xs uppercase tracking-wide text-slate-500"><%= t(".standalone_procedures_document_ac_120") %></p>
|
||||
<h1 class="text-2xl font-bold"><%= t(".electronic_signature_and_recordkeeping_procedure") %></h1>
|
||||
<p class="text-sm text-slate-600"><%= t(".simple_aircraft_manager_html", operator: (policy.operator_name.presence || t(".operator"))) %></p>
|
||||
<p class="mt-1 text-sm"><%= t(".revision_html", number: number, adopted: (adopted_at ? t(".adopted_by", date: adopted_at.to_date.iso8601, display_name: adopted_by&.display_name) : t(".not_yet_adopted"))) %></p>
|
||||
</header>
|
||||
|
||||
<h2 class="<%= h2 %>">1. Purpose and scope</h2>
|
||||
<p class="<%= p_ %>">These procedures describe how <%= policy.operator_name.presence || "[Operator]" %> keeps the maintenance records required by 14 CFR 91.417 electronically in Simple Aircraft Manager, and how entries are signed electronically under 14 CFR 43.9 and 43.11. They follow FAA AC 120-78B. Under its paragraph 1.9.5, use of electronic signatures and recordkeeping under part 91 (other than subpart K) needs no FAA approval, acceptance or authorization; the FAA recommends following the AC, and these procedures do.</p>
|
||||
<h2 class="<%= h2 %>"><%= t(".n1_purpose_and_scope") %></h2>
|
||||
<p class="<%= p_ %>"><%= t(".these_procedures_describe_how_keeps_html", operator: (policy.operator_name.presence || t(".operator"))) %></p>
|
||||
<table class="mt-2 w-full text-sm">
|
||||
<thead><tr class="border-b border-slate-300 text-left text-xs uppercase text-slate-500"><th class="py-1">Aircraft</th><th>Serial number</th><th>Electronic records since</th><th>Earlier records</th></tr></thead>
|
||||
<thead><tr class="border-b border-slate-300 text-left text-xs uppercase text-slate-500"><th class="py-1"><%= t(".aircraft") %></th><th><%= t(".serial_number") %></th><th><%= t(".electronic_records_since") %></th><th><%= t(".earlier_records") %></th></tr></thead>
|
||||
<tbody>
|
||||
<% aircraft.each do |a| %>
|
||||
<tr class="border-b border-slate-100"><td class="py-1"><%= a.tail_number %> <%= [ a.make, a.model ].compact_blank.join(" ") %></td><td><%= a.serial_number.presence || "—" %></td>
|
||||
<td><%= a.electronic_records_since || "not set" %></td><td>Paper logbooks<%= " (scans held as legacy records)" if a.documents.where(legacy_record: true).exists? %></td></tr>
|
||||
<td><%= a.electronic_records_since || t(".not_set") %></td><td><%= t(".paper_logbooks_html", legacy: (t(".scans_held_as_legacy_records") if a.documents.where(legacy_record: true).exists?)) %></td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="<%= p_ %>">Records kept electronically: logbook entries (maintenance, preventive maintenance, inspections, alterations), inspection status and history, airworthiness directive compliance, component times and life limits, major repairs and alterations with their Form 337s, weight and balance, and supporting documents. Paper logbooks from before the date above remain the record for that period and are kept.</p>
|
||||
<p class="<%= p_ %>"><%= t(".records_kept_electronically_logbook_entries") %></p>
|
||||
|
||||
<h2 class="<%= h2 %>">2. Regulatory compliance</h2>
|
||||
<p class="<%= p_ %>">Each logbook entry carries what 14 CFR 43.9 requires (description of the work, date, the name, certificate number and kind of certificate of the person approving return to service, and their signature) and, for inspections, what 43.11 requires (type and extent of inspection, aircraft time in service, and the airworthiness statement or discrepancy list). The app flags entries missing any of these. Records include the key elements of AC 120-78B 3.1.1: the event, when (date, and the signature's time), where (location), who, the signature, and the make, model and serial of the aircraft, engine, propeller and components. The status required by 91.417(a)(2) is produced by the maintenance status report. Records are made available under 91.417(c) and transferred under 91.419 as described in sections 9 and 10.</p>
|
||||
<h2 class="<%= h2 %>"><%= t(".n2_regulatory_compliance") %></h2>
|
||||
<p class="<%= p_ %>"><%= t(".each_logbook_entry_carries_what") %></p>
|
||||
|
||||
<h2 class="<%= h2 %>">3. System description</h2>
|
||||
<h2 class="<%= h2 %>"><%= t(".n3_system_description") %></h2>
|
||||
<ul class="<%= p_ %> list-disc pl-5">
|
||||
<li><strong>Software:</strong> Simple Aircraft Manager, version <%= info.version_label %> (Ruby <%= RUBY_VERSION %>, Rails <%= Rails.version %>, SQLite <%= SQLite3::SQLITE_VERSION %>).</li>
|
||||
<li><strong>Hosting and network:</strong>
|
||||
<% if policy.hosting_description.present? %><div class="mt-1"><%= markdown(policy.hosting_description) %></div><% else %>[describe the server, location and network]<% end %>
|
||||
<p class="mt-1"><%= ProceduresTemplates.https? ? "Connections use HTTPS only: the system redirects plain HTTP and marks its cookies secure." : "The system is set not to enforce HTTPS itself (FORCE_SSL=false); how connections are protected is described above." %> <%= ProceduresTemplates.sign_in_sentence %></p></li>
|
||||
<li><strong>Data:</strong> one SQLite database plus uploaded files (stored once per identical file) on the server's storage volume.</li>
|
||||
<li><strong>Backups:</strong> every night the app makes a verified copy of the database in the storage volume (SQLite integrity check and record counts compared) and keeps the newest <%= Setting.integer("backups_kept") %>. Off-site: <% if OffsiteConnection.connected? %>after each nightly backup the app copies the verified database snapshot (compressed) to Google Drive (account <%= OffsiteConnection.current.account_email %>, folder “<%= OffsiteConnection::ROOT_FOLDER %>”), keeping the newest <%= Setting.integer("offsite_backups_kept") %>, together with every uploaded file (scans, documents, attachments) not already copied; files are never deleted from the off-site copy. A failed copy is emailed to the administrators. A restore test downloads the newest copy, opens it and checks it, and checks a sample of files against their checksums.<%= " #{policy.offsite_backup_description}" if policy.offsite_backup_description.present? %><% else %><%= policy.offsite_backup_description.presence || "[describe the off-site backup]" %><% end %></li>
|
||||
<li><%= t(".software_simple_aircraft_manager_version_html", version_label: info.version_label, ruby: RUBY_VERSION, rails: Rails.version, sqlite: (SQLite3::SQLITE_VERSION)) %></li>
|
||||
<li><%= t(".hosting_and_network_html") %>
|
||||
<% if policy.hosting_description.present? %><div class="mt-1"><%= markdown(policy.hosting_description) %></div><% else %><%= t(".describe_the_server_location_and") %><% end %>
|
||||
<p class="mt-1"><%= ProceduresTemplates.https? ? t(".connections_use_https_only_the") : t(".https_not_enforced") %> <%= ProceduresTemplates.sign_in_sentence %></p></li>
|
||||
<li><%= t(".data_one_sqlite_database_plus_html") %></li>
|
||||
<li><%= t(".backups_every_night_the_app_html", backups_kept: (Setting.integer("backups_kept"))) %> <% if OffsiteConnection.connected? %><%= t(".after_each_nightly_backup_the_html", account_email: OffsiteConnection.current.account_email, folder: (OffsiteConnection::ROOT_FOLDER), offsite_backups_kept: (Setting.integer("offsite_backups_kept")), present: (" #{policy.offsite_backup_description}" if policy.offsite_backup_description.present?)) %><% else %><%= policy.offsite_backup_description.presence || t(".describe_the_off_site_backup") %><% end %></li>
|
||||
</ul>
|
||||
|
||||
<h2 class="<%= h2 %>">4. Responsible personnel</h2>
|
||||
<p class="<%= p_ %>"><%= policy.responsible_name.presence || "[Name]" %><%= ", #{policy.responsible_title}" if policy.responsible_title.present? %>, has authority and overall responsibility for the electronic signature process and the recordkeeping system, for controlling access to it (accounts, roles, disabling accounts), and for the quality-control audits. Administrators: <%= users.select(&:admin?).reject(&:disabled?).map(&:display_name).to_sentence.presence || "none" %>.</p>
|
||||
<h2 class="<%= h2 %>"><%= t(".n4_responsible_personnel") %></h2>
|
||||
<p class="<%= p_ %>"><%= t(".has_authority_and_overall_responsibility_html", name: (policy.responsible_name.presence || t(".name")), title: (", #{policy.responsible_title}" if policy.responsible_title.present?), admins: (users.select(&:admin?).reject(&:disabled?).map(&:display_name).to_sentence.presence || t(".none"))) %></p>
|
||||
|
||||
<h2 class="<%= h2 %>">5. Defined users and roles</h2>
|
||||
<p class="<%= p_ %>">Owners keep an aircraft's records; pilots can view them and record flights, squawks and preventive maintenance. A user may sign entries with a current certificate on their profile: mechanic certificates (A&P, IA, airframe, powerplant, repair station, repairman) for maintenance and inspection entries; a pilot certificate for preventive maintenance only. Disabled accounts can't sign in or sign.</p>
|
||||
<h2 class="<%= h2 %>"><%= t(".n5_defined_users_and_roles") %></h2>
|
||||
<p class="<%= p_ %>"><%= t(".owners_keep_an_aircraft_s_html") %></p>
|
||||
<table class="mt-2 w-full text-sm">
|
||||
<thead><tr class="border-b border-slate-300 text-left text-xs uppercase text-slate-500"><th class="py-1">User</th><th>Roles</th><th>Certificates</th><th>May sign</th></tr></thead>
|
||||
<thead><tr class="border-b border-slate-300 text-left text-xs uppercase text-slate-500"><th class="py-1"><%= t(".user") %></th><th><%= t(".roles") %></th><th><%= t(".certificates") %></th><th><%= t(".may_sign") %></th></tr></thead>
|
||||
<tbody>
|
||||
<% users.each do |u| %>
|
||||
<% current = u.certificates.reject(&:expired?) %>
|
||||
<tr class="border-b border-slate-100 align-top"><td class="py-1"><%= u.display_name %><div class="text-xs text-slate-500"><%= u.email_address %></div></td>
|
||||
<td class="text-xs"><%= [ ("Administrator" if u.admin?), *u.aircraft_roles.map { "#{_1.role.capitalize}, #{_1.aircraft.tail_number}" } ].compact.join("; ").presence || "—" %><%= " (DISABLED)" if u.disabled? %></td>
|
||||
<td class="text-xs"><%= u.certificates.map { "#{_1.short_label} #{_1.number}#{" exp. #{_1.expires_on}" if _1.expires_on}" }.join("; ").presence || "—" %></td>
|
||||
<td class="text-xs"><%= if u.disabled? || current.empty? then "No"
|
||||
elsif current.any?(&:mechanic?) then "Maintenance and inspection entries"
|
||||
else "Preventive maintenance entries" end %></td></tr>
|
||||
<td class="text-xs"><%= [ (t(".administrator") if u.admin?), *u.aircraft_roles.map { "#{_1.role.capitalize}, #{_1.aircraft.tail_number}" } ].compact.join("; ").presence || "—" %><%= t(".disabled") if u.disabled? %></td>
|
||||
<td class="text-xs"><%= u.certificates.map { "#{_1.short_label} #{_1.number}#{" #{t('.expires_short', date: _1.expires_on)}" if _1.expires_on}" }.join("; ").presence || "—" %></td>
|
||||
<td class="text-xs"><%= if u.disabled? || current.empty? then t(".no")
|
||||
elsif current.any?(&:mechanic?) then t(".maintenance_and_inspection_entries")
|
||||
else t(".preventive_maintenance_entries") end %></td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="<%= p_ %>">People outside these users (e.g. a mechanic who did the work) sign through a one-time email invitation from an owner, with their own account and certificate, for that entry only; or they sign on paper (section 11).</p>
|
||||
<p class="<%= p_ %>"><%= t(".people_outside_these_users_e") %></p>
|
||||
|
||||
<h2 class="<%= h2 %>">6. Electronic signature process</h2>
|
||||
<h2 class="<%= h2 %>"><%= t(".n6_electronic_signature_process") %></h2>
|
||||
<ol class="<%= p_ %> list-decimal pl-5">
|
||||
<li>The signer opens the entry and chooses Sign. The entry is shown in full exactly as it will be certified (AC 2.2.4).</li>
|
||||
<li>They choose one of their own current certificates. The statement they will certify is shown with it, under the heading “Certified by” (2.2.2): for maintenance, “I certify that the work described in this entry was performed in accordance with 14 CFR Part 43, and I approve it for return to service with respect to that work”; for inspections, the 43.11(a)(5) statement; for preventive maintenance by a pilot, the corresponding statement.</li>
|
||||
<li>They prove who they are again: their password (with a code from their authenticator app, if they use one), or signing in again with single sign-on within the last five minutes (2.2.6), and confirm that they are signing with intent to sign (2.1.2.4–5).</li>
|
||||
<li>The system records the signer, the certificate (kind and number), the statement, the time (UTC), how they authenticated, their network address and browser, a SHA-256 fingerprint of the entry's content and a readable copy of it, and a server seal (HMAC) over the signature record (2.1.2.6, 2.2.5). The signer is told on screen and by email (2.2.3).</li>
|
||||
<li>Once signed, the entry and its components can't be edited or deleted (2.1.2.7–8, 2.2.7). A correction is made as a new entry that, once signed, supersedes the original; the original and its signature are kept and marked superseded (2.2.8).</li>
|
||||
<li>When someone no longer needs access, the responsible person disables their account: they can no longer sign in or sign, and their past signatures stay valid (2.2.6.4).</li>
|
||||
<li><%= t(".the_signer_opens_the_entry") %></li>
|
||||
<li><%= t(".they_choose_one_of_their") %></li>
|
||||
<li><%= t(".they_prove_who_they_are") %></li>
|
||||
<li><%= t(".the_system_records_the_signer") %></li>
|
||||
<li><%= t(".once_signed_the_entry_and") %></li>
|
||||
<li><%= t(".when_someone_no_longer_needs") %></li>
|
||||
</ol>
|
||||
<p class="<%= p_ %>">Signed records are archived in the database, its nightly verified copies and the off-site backup, and can be exported with their signatures (2.2.9).</p>
|
||||
<p class="<%= p_ %>"><%= t(".signed_records_are_archived_in") %></p>
|
||||
|
||||
<h2 class="<%= h2 %>">7. Recordkeeping system controls</h2>
|
||||
<h2 class="<%= h2 %>"><%= t(".n7_recordkeeping_system_controls") %></h2>
|
||||
<ul class="<%= p_ %> list-disc pl-5">
|
||||
<li><strong>Controlled access (3.2.1):</strong> personal accounts (<%= Sso.enabled? ? (Sso.password_login? ? "single sign-on with #{Sso.label} or password" : "single sign-on with #{Sso.label} only") : "email and password" %>); roles per aircraft; passwords of at least 12 characters, refused if known from a data breach; optional authenticator-app codes; accounts locked for 15 minutes after 10 failed sign-ins (the user is emailed); rate-limited sign-in; sessions end after 30 days unused; changing an email or password needs the current password.</li>
|
||||
<li><strong>Record preservation (3.2.2):</strong> every change to a maintenance record is kept with who, when and what changed, in a hash chain per aircraft that can't be edited; signed entries are locked.</li>
|
||||
<li><strong>Confidential information (3.2.3):</strong> records are visible only to the aircraft's users, and to share links an owner creates (scoped and optionally expiring).</li>
|
||||
<li><strong>Data corruption (3.2.4):</strong> nightly, the history chains and every signature's seal and fingerprint are checked; administrators are emailed on any problem.</li>
|
||||
<li><strong>Outages (3.2.5):</strong> entries are made on paper and signed in ink during an outage (section 13); the database is restored from the latest verified copy or the off-site backup.</li>
|
||||
<li><strong>Software revision control (3.2.6):</strong> the software is updated by deploying a new release built from its source repository. Each release has a version (year.month.release, e.g. 2026.11.0) and a build (the exact source commit), with release notes describing what changed (What's new); each version and when it ran is recorded by the system. Before an update that changes how records are entered, displayed or accessed, the responsible person reviews it, and these procedures are revised if they're affected.</li>
|
||||
<li><strong>Backups (3.2.7):</strong> see section 3.</li>
|
||||
<li><%= t(".controlled_access_3_2_1_html", password: (Sso.enabled? ? (Sso.password_login? ? t(".single_sign_on_with_or", so: Sso.label) : t(".single_sign_on_with_only", so: Sso.label)) : t(".email_and_password"))) %></li>
|
||||
<li><%= t(".record_preservation_3_2_2_html") %></li>
|
||||
<li><%= t(".confidential_information_3_2_3_html") %></li>
|
||||
<li><%= t(".data_corruption_3_2_4_html") %></li>
|
||||
<li><%= t(".outages_3_2_5_entries_html") %></li>
|
||||
<li><%= t(".software_revision_control_3_2_html") %></li>
|
||||
<li><%= t(".backups_3_2_7_see_html") %></li>
|
||||
</ul>
|
||||
|
||||
<h2 class="<%= h2 %>">8. Quality control and auditing</h2>
|
||||
<p class="<%= p_ %>">Every <%= policy.audit_interval_months %> months the responsible person carries out and records an audit in the system (3.2.8.5). The app checks that the integrity check and backups are passing, the procedures are adopted, signatures are intact, and lists expired certificates and software versions since the last audit. The auditor restores the off-site backup somewhere separate and opens it, compares <%= policy.audit_sample_size %> randomly chosen entries with their work orders or source documents, reviews the users and roles (disabling accounts no longer needed), and confirms the paper logbooks are kept. Audit results are kept in the system.<%= " Last audit: #{AuditRun.latest.performed_at.to_date}." if AuditRun.latest %></p>
|
||||
<h2 class="<%= h2 %>"><%= t(".n8_quality_control_and_auditing") %></h2>
|
||||
<p class="<%= p_ %>"><%= t(".every_months_the_responsible_person_html", audit_interval_months: policy.audit_interval_months, audit_sample_size: policy.audit_sample_size, latest: (t(".last_audit", to_date: AuditRun.latest.performed_at.to_date) if AuditRun.latest)) %></p>
|
||||
|
||||
<h2 class="<%= h2 %>">9. Making records available to the FAA and NTSB</h2>
|
||||
<p class="<%= p_ %>">On request (14 CFR 91.417(c), 49 CFR 830), the responsible person provides the records package for the aircraft: every logbook entry as a PDF with its electronic signature, a signature register, the full change history, the maintenance status report and the data archive, with a README. Printed copies are produced the same way. Direct access to the system can be offered but isn't required (3.2.8.6).</p>
|
||||
<h2 class="<%= h2 %>"><%= t(".n9_making_records_available_to") %></h2>
|
||||
<p class="<%= p_ %>"><%= t(".on_request_14_cfr_91") %></p>
|
||||
|
||||
<h2 class="<%= h2 %>">10. Transfer of records</h2>
|
||||
<p class="<%= p_ %>"><strong>At sale (91.419, 3.2.8.12):</strong> the buyer receives the records package and the data archive, which another installation of the system can import, together with the paper logbooks. <strong>To another system (3.2.8.9):</strong> records are exported as the data archive and the records package; both systems run side by side until the transfer is checked.</p>
|
||||
<h2 class="<%= h2 %>"><%= t(".n10_transfer_of_records") %></h2>
|
||||
<p class="<%= p_ %>"><%= t(".at_sale_91_419_3_html") %></p>
|
||||
|
||||
<h2 class="<%= h2 %>">11. Continuity</h2>
|
||||
<p class="<%= p_ %>"><strong>Legacy records (3.2.8.10):</strong> records before the dates in section 1 are the paper logbooks, which are kept; scans are held as legacy records for reference. <strong>Maintenance providers (3.2.8.11):</strong> a provider signs electronically through an invitation, or signs a printed entry in ink; the signed paper is kept with the logbooks and scanned into the system.</p>
|
||||
<h2 class="<%= h2 %>"><%= t(".n11_continuity") %></h2>
|
||||
<p class="<%= p_ %>"><%= t(".legacy_records_3_2_8_html") %></p>
|
||||
|
||||
<h2 class="<%= h2 %>">12. Changes to the system and these procedures</h2>
|
||||
<p class="<%= p_ %>">These procedures are revised when the system or its use changes. Each revision is numbered, dated and adopted in the system by an administrator; earlier revisions are kept. Under AC 120-78B 1.9.5 no submission to the FAA is required for part 91 operations (3.2.8.13).</p>
|
||||
<h2 class="<%= h2 %>"><%= t(".n12_changes_to_the_system") %></h2>
|
||||
<p class="<%= p_ %>"><%= t(".these_procedures_are_revised_when") %></p>
|
||||
|
||||
<h2 class="<%= h2 %>">13. User instructions and training</h2>
|
||||
<p class="<%= p_ %>">Every user who keeps or signs records reads these instructions (also in the system under “How electronic records work”) before signing (2.2.12, 3.2.9).</p>
|
||||
<h2 class="<%= h2 %>"><%= t(".n13_user_instructions_and_training") %></h2>
|
||||
<p class="<%= p_ %>"><%= t(".every_user_who_keeps_or") %></p>
|
||||
<div class="mt-2 rounded border border-slate-200 p-3"><%= guide_html(HelpGuide.find("records"), links: false, title: false) %></div>
|
||||
|
||||
<% if policy.additional_procedures.present? %>
|
||||
<h2 class="<%= h2 %>">14. Additional procedures</h2>
|
||||
<h2 class="<%= h2 %>"><%= t(".n14_additional_procedures") %></h2>
|
||||
<div class="<%= p_ %>"><%= markdown(policy.additional_procedures) %></div>
|
||||
<% end %>
|
||||
|
||||
<h2 class="<%= h2 %>">Revision history</h2>
|
||||
<h2 class="<%= h2 %>"><%= t(".revision_history") %></h2>
|
||||
<table class="mt-2 w-full text-sm">
|
||||
<thead><tr class="border-b border-slate-300 text-left text-xs uppercase text-slate-500"><th class="py-1">Revision</th><th>Adopted</th><th>By</th><th>Summary</th></tr></thead>
|
||||
<thead><tr class="border-b border-slate-300 text-left text-xs uppercase text-slate-500"><th class="py-1"><%= t(".revision_2") %></th><th><%= t(".adopted") %></th><th><%= t(".by") %></th><th><%= t(".summary") %></th></tr></thead>
|
||||
<tbody>
|
||||
<% revisions.each do |r| %><tr class="border-b border-slate-100"><td class="py-1"><%= r.number %></td><td><%= fmt_date(r.adopted_at.to_date) %></td><td><%= r.adopted_by&.display_name %></td><td><%= r.summary %></td></tr><% end %>
|
||||
<tr><td class="py-1"><%= number %></td><td><%= adopted_at&.to_date || "—" %></td><td><%= adopted_by&.display_name %></td><td><%= summary.presence || "This revision" %></td></tr>
|
||||
<tr><td class="py-1"><%= number %></td><td><%= adopted_at&.to_date || "—" %></td><td><%= adopted_by&.display_name %></td><td><%= summary.presence || t(".this_revision") %></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</article>
|
||||
@@ -1,62 +1,62 @@
|
||||
<% content_for :title, "Recordkeeping procedures" %>
|
||||
<h1 class="mb-1 text-2xl font-bold">Recordkeeping procedures</h1>
|
||||
<p class="mb-5 max-w-3xl text-sm text-slate-600">The standalone procedures document AC 120-78B asks for (paragraphs 2.2.11 and 3.2.8): how signatures and records work here, who's responsible, who may sign, backups, audits, and how records are produced and transferred. It's generated from the system's setup; fill in what the app can't know, review the draft, and adopt it as a revision. Adopt a new revision whenever users, hosting or procedures change.</p>
|
||||
<% content_for :title, t(".recordkeeping_procedures") %>
|
||||
<h1 class="mb-1 text-2xl font-bold"><%= t(".recordkeeping_procedures") %></h1>
|
||||
<p class="mb-5 max-w-3xl text-sm text-slate-600"><%= t(".the_standalone_procedures_document_ac") %></p>
|
||||
|
||||
<div class="grid gap-5 lg:grid-cols-2">
|
||||
<%= form_with model: @policy, url: admin_procedures_path, method: :patch, class: "card card-body space-y-4" do |f| %>
|
||||
<h2 class="card-title">Details</h2>
|
||||
<h2 class="card-title"><%= t(".details") %></h2>
|
||||
<%= f.errors_summary %>
|
||||
<%= f.field :operator_name, label: "Owner / operator", placeholder: "Jane Pilot" %>
|
||||
<%= f.field :operator_name, label: t(".owner_operator"), placeholder: t(".jane_pilot") %>
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<%= f.field :responsible_name, label: "Responsible person", placeholder: "Jane Pilot" %>
|
||||
<%= f.field :responsible_title, label: "Their role", placeholder: "Owner" %>
|
||||
<%= f.field :responsible_name, label: t(".responsible_person"), placeholder: t(".jane_pilot") %>
|
||||
<%= f.field :responsible_title, label: t(".their_role"), placeholder: t(".owner") %>
|
||||
</div>
|
||||
<div data-controller="insert-text" data-insert-text-text-value="<%= ProceduresTemplates.hosting %>">
|
||||
<%= f.field :hosting_description, as: :textarea, rows: 8, label: "Hosting and network",
|
||||
hint: "Leave a blank line between paragraphs. Markdown works: **bold**, lists.", data: { insert_text_target: "field" },
|
||||
placeholder: "Where the server is, who can administer it, how it's reached and protected, how updates are installed." %>
|
||||
<button type="button" class="btn-secondary btn-sm mt-2" data-action="insert-text#insert">Insert suggested text</button>
|
||||
<%= f.field :hosting_description, as: :textarea, rows: 8, label: t(".hosting_and_network"),
|
||||
hint: t(".leave_a_blank_line_between"), data: { insert_text_target: "field" },
|
||||
placeholder: t(".where_the_server_is_who") %>
|
||||
<button type="button" class="btn-secondary btn-sm mt-2" data-action="insert-text#insert"><%= t(".insert_suggested_text") %></button>
|
||||
</div>
|
||||
<%= f.field :offsite_backup_description, as: :textarea, rows: 2, label: (OffsiteConnection.connected? ? "Off-site backup (optional: Google Drive is connected)" : "Off-site backup"),
|
||||
hint: (OffsiteConnection.connected? ? "The Google Drive backup is described automatically; add anything else here." : "Or set up the built-in Google Drive backup under Admin → Off-site Backup."),
|
||||
placeholder: "The storage volume is backed up nightly with restic to an encrypted off-site repository; retention 30 days." %>
|
||||
<%= f.field :offsite_backup_description, as: :textarea, rows: 2, label: (OffsiteConnection.connected? ? t(".off_site_backup_optional_google") : t(".off_site_backup")),
|
||||
hint: (OffsiteConnection.connected? ? t(".the_google_drive_backup_is") : t(".or_set_up_the_built")),
|
||||
placeholder: t(".the_storage_volume_is_backed") %>
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<%= f.field :audit_interval_months, as: :number, min: 1, max: 24, label: "Audit every (months)" %>
|
||||
<%= f.field :audit_sample_size, as: :number, min: 1, max: 50, label: "Entries sampled per audit" %>
|
||||
<%= f.field :audit_interval_months, as: :number, min: 1, max: 24, label: t(".audit_every_months") %>
|
||||
<%= f.field :audit_sample_size, as: :number, min: 1, max: 50, label: t(".entries_sampled_per_audit") %>
|
||||
</div>
|
||||
<div data-controller="insert-text" data-insert-text-text-value="<%= ProceduresTemplates.additional %>">
|
||||
<%= f.field :additional_procedures, as: :textarea, rows: 12, label: "Additional procedures (optional)",
|
||||
hint: "Leave a blank line between items. Markdown works: **bold** headings, lists.", data: { insert_text_target: "field" } %>
|
||||
<button type="button" class="btn-secondary btn-sm mt-2" data-action="insert-text#insert">Insert suggested text</button>
|
||||
<%= f.field :additional_procedures, as: :textarea, rows: 12, label: t(".additional_procedures_optional"),
|
||||
hint: t(".leave_a_blank_line_between_2"), data: { insert_text_target: "field" } %>
|
||||
<button type="button" class="btn-secondary btn-sm mt-2" data-action="insert-text#insert"><%= t(".insert_suggested_text") %></button>
|
||||
</div>
|
||||
<p class="hint">Suggested text is filled in from this installation's settings, with [bracketed] blanks for what only you know. Edit it to match how you actually work, then save. A revision can't be adopted while a blank is left.</p>
|
||||
<%= f.submit "Save" %>
|
||||
<p class="hint"><%= t(".suggested_text_is_filled_in") %></p>
|
||||
<%= f.submit t(".save") %>
|
||||
<% end %>
|
||||
|
||||
<div class="space-y-5">
|
||||
<section class="card card-body space-y-3">
|
||||
<h2 class="card-title">Current revision</h2>
|
||||
<h2 class="card-title"><%= t(".current_revision") %></h2>
|
||||
<% current = @revisions.first %>
|
||||
<% if current %>
|
||||
<p class="text-sm">Revision <strong><%= current.number %></strong>, adopted <%= fmt_date(current.adopted_at.to_date) %> by <%= current.adopted_by&.display_name %>. <%= link_to "View / print", revision_admin_procedures_path(current), class: "link", target: "_blank" %></p>
|
||||
<p class="text-sm"><%= t(".revision_adopted_by_html", number: current.number, to_date: (fmt_date(current.adopted_at.to_date)), display_name: current.adopted_by&.display_name, link: (link_to t(".view_print"), revision_admin_procedures_path(current), class: "link", target: "_blank")) %></p>
|
||||
<% else %>
|
||||
<p class="text-sm text-amber-800">No revision adopted yet.</p>
|
||||
<p class="text-sm text-amber-800"><%= t(".no_revision_adopted_yet") %></p>
|
||||
<% end %>
|
||||
<p class="text-sm"><%= link_to "Preview the draft", draft_admin_procedures_path, class: "link", target: "_blank" %> (generated from the current setup).</p>
|
||||
<p class="text-sm"><%= t(".generated_from_the_current_setup_html", link: (link_to t(".preview_the_draft"), draft_admin_procedures_path, class: "link", target: "_blank")) %></p>
|
||||
<%= form_with url: adopt_admin_procedures_path, class: "flex flex-wrap items-end gap-2" do %>
|
||||
<div class="min-w-0 flex-1"><%= label_tag :summary, "What changed", class: "label" %><%= text_field_tag :summary, nil, class: "input", placeholder: current ? "e.g. new mechanic added" : "Initial issue" %></div>
|
||||
<% if @policy.unfilled_fields.any? %><p class="w-full text-sm text-amber-800">Fill in the [bracketed] blanks in: <%= @policy.unfilled_fields.to_sentence %>.</p><% end %>
|
||||
<%= submit_tag "Adopt as revision #{(current&.number || 0) + 1}", class: "btn-primary", disabled: !@policy.complete?,
|
||||
title: (@policy.complete? ? nil : "Fill in the operator, responsible person, hosting and off-site backup (or connect Google Drive) first") %>
|
||||
<div class="min-w-0 flex-1"><%= label_tag :summary, t(".what_changed"), class: "label" %><%= text_field_tag :summary, nil, class: "input", placeholder: current ? t(".e_g_new_mechanic_added") : t(".initial_issue") %></div>
|
||||
<% if @policy.unfilled_fields.any? %><p class="w-full text-sm text-amber-800"><%= t(".fill_in_the_bracketed_blanks_html", to_sentence: @policy.unfilled_fields.to_sentence) %></p><% end %>
|
||||
<%= submit_tag t(".adopt_as_revision", number: (current&.number || 0) + 1), class: "btn-primary", disabled: !@policy.complete?,
|
||||
title: (@policy.complete? ? nil : t(".fill_in_the_operator_responsible")) %>
|
||||
<% end %>
|
||||
</section>
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Earlier revisions</h2></div>
|
||||
<div class="card-header"><h2 class="card-title"><%= t(".earlier_revisions") %></h2></div>
|
||||
<% if @revisions.size > 1 %>
|
||||
<ul class="divide-y divide-slate-100 text-sm">
|
||||
<% @revisions.drop(1).each do |r| %><li class="flex justify-between px-4 py-2"><span>Revision <%= r.number %> · <%= fmt_date(r.adopted_at.to_date) %> · <%= r.summary %></span><%= link_to "View", revision_admin_procedures_path(r), class: "link", target: "_blank" %></li><% end %>
|
||||
<% @revisions.drop(1).each do |r| %><li class="flex justify-between px-4 py-2"><span><%= t(".revision_html", number: r.number, to_date: (fmt_date(r.adopted_at.to_date)), summary: r.summary) %></span><%= link_to t(".view"), revision_admin_procedures_path(r), class: "link", target: "_blank" %></li><% end %>
|
||||
</ul>
|
||||
<% else %><%= empty_state "None." %><% end %>
|
||||
<% else %><%= empty_state t(".none") %><% end %>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,5 +1,5 @@
|
||||
<% content_for :title, "Settings" %>
|
||||
<h1 class="mb-4 text-2xl font-bold">Settings</h1>
|
||||
<% content_for :title, t(".settings") %>
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".settings") %></h1>
|
||||
<%= form_with url: admin_settings_path, method: :patch, class: "card card-body max-w-xl space-y-4" do |f| %>
|
||||
<% if @errors.present? %>
|
||||
<div class="rounded-md bg-red-50 p-3 text-sm text-red-700 ring-1 ring-red-200" role="alert">
|
||||
@@ -7,44 +7,44 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<h2 class="card-title">Uploads</h2>
|
||||
<h2 class="card-title"><%= t(".uploads") %></h2>
|
||||
<% upload = Setting::INTEGERS["max_upload_mb"] %>
|
||||
<div>
|
||||
<%= label_tag "settings[max_upload_mb]", upload[:label], class: "label" %>
|
||||
<%= label_tag "settings[max_upload_mb]", Setting::LABELS["max_upload_mb"], class: "label" %>
|
||||
<%= number_field_tag "settings[max_upload_mb]", @values["max_upload_mb"], id: "settings_max_upload_mb",
|
||||
min: upload[:in].min, max: upload[:in].max, step: 1, required: true, class: "input w-32" %>
|
||||
<p class="hint">
|
||||
The largest single file anyone can upload: documents, squawk photos and bulk uploads. Default <%= upload[:default] %> MB, up to <%= upload[:in].max %> MB.
|
||||
<%= t(".the_largest_single_file_anyone_html", default_mb: (upload[:default]), max: (upload[:in].max)) %>
|
||||
</p>
|
||||
<p class="hint">
|
||||
A proxy in front of the app can have its own, smaller limit. Cloudflare's proxy stops at 100 MB on its free plan; nginx needs <code>client_max_body_size</code>.
|
||||
Logbook transcription with Claude reads PDFs up to <%= LogbookTranscriber::MAX_PDF_BYTES / 1.megabyte %> MB and images up to <%= LogbookTranscriber::MAX_IMAGE_BYTES / 1.megabyte %> MB, whatever this is set to.
|
||||
<%= t(".a_proxy_in_front_of_html") %>
|
||||
<%= t(".logbook_transcription_with_claude_reads_html", pdf_mb: (LogbookTranscriber::MAX_PDF_BYTES / 1.megabyte), image_mb: (LogbookTranscriber::MAX_IMAGE_BYTES / 1.megabyte)) %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h2 class="card-title pt-2">Backups</h2>
|
||||
<h2 class="card-title pt-2"><%= t(".backups") %></h2>
|
||||
<% kept = Setting::INTEGERS["backups_kept"] %>
|
||||
<div>
|
||||
<%= label_tag "settings[backups_kept]", kept[:label], class: "label" %>
|
||||
<%= label_tag "settings[backups_kept]", Setting::LABELS["backups_kept"], class: "label" %>
|
||||
<%= number_field_tag "settings[backups_kept]", @values["backups_kept"], id: "settings_backups_kept", min: kept[:in].min, max: kept[:in].max,
|
||||
step: 1, required: true, class: "input w-32" %>
|
||||
<p class="hint">A verified copy of the database is made nightly in storage/backups; this many of the newest are kept. Back up off the server too: <%= link_to "Off-site Backup", admin_offsite_backup_path, class: "link" %>.</p>
|
||||
<p class="hint"><%= t(".a_verified_copy_of_the_html", link: (link_to t(".off_site_backup"), admin_offsite_backup_path, class: "link")) %></p>
|
||||
</div>
|
||||
<% okept = Setting::INTEGERS["offsite_backups_kept"] %>
|
||||
<div>
|
||||
<%= label_tag "settings[offsite_backups_kept]", okept[:label], class: "label" %>
|
||||
<%= label_tag "settings[offsite_backups_kept]", Setting::LABELS["offsite_backups_kept"], class: "label" %>
|
||||
<%= number_field_tag "settings[offsite_backups_kept]", @values["offsite_backups_kept"], id: "settings_offsite_backups_kept", min: okept[:in].min, max: okept[:in].max,
|
||||
step: 1, required: true, class: "input w-32" %>
|
||||
<p class="hint">With off-site backup to Google Drive, this many of the newest nightly database copies are kept there. Uploaded files are copied once and kept.</p>
|
||||
<p class="hint"><%= t(".with_off_site_backup_to") %></p>
|
||||
</div>
|
||||
|
||||
<h2 class="card-title pt-2">Document search</h2>
|
||||
<h2 class="card-title pt-2"><%= t(".document_search") %></h2>
|
||||
<div>
|
||||
<%= label_tag "settings[documents_claude_text]", "Read scanned documents with", class: "label" %>
|
||||
<%= select_tag "settings[documents_claude_text]", options_for_select([ [ "Tesseract (free, on this server)", 0 ], [ "Claude (better on handwriting; uses the Anthropic API)", 1 ] ], @values["documents_claude_text"].to_i),
|
||||
<%= label_tag "settings[documents_claude_text]", t(".read_scanned_documents_with"), class: "label" %>
|
||||
<%= select_tag "settings[documents_claude_text]", options_for_select([ [ t(".tesseract_free_on_this_server"), 0 ], [ t(".claude_better_on_handwriting_uses"), 1 ] ], @values["documents_claude_text"].to_i),
|
||||
id: "settings_documents_claude_text", class: "input" %>
|
||||
<p class="hint">Text in documents is read so search can find it. PDFs that contain text are read directly either way. Claude is used only when an ANTHROPIC_API_KEY is set<%= " (it isn't)" if ENV["ANTHROPIC_API_KEY"].blank? %>, and costs API credit per page.</p>
|
||||
<p class="hint"><%= t(".text_in_documents_is_read_html", blank: (t(".it_isn_t") if ENV["ANTHROPIC_API_KEY"].blank?)) %></p>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2"><%= f.submit "Save Settings", class: "btn-primary" %><%= link_to "Cancel", admin_about_path, class: "btn-secondary" %></div>
|
||||
<div class="flex gap-2"><%= f.submit t(".save_settings"), class: "btn-primary" %><%= link_to t(".cancel"), admin_about_path, class: "btn-secondary" %></div>
|
||||
<% end %>
|
||||
@@ -1,10 +1,10 @@
|
||||
<%= form_with model: [:admin, user], class: "card card-body space-y-4 max-w-md" do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<%= f.field :name %>
|
||||
<%= f.field :email_address, as: :email, label: "Email", required: true %>
|
||||
<%= f.field :password, as: :password, hint: (user.persisted? ? "Leave blank to keep current password." : "At least #{User::PASSWORD_MIN} characters; not one known from a data breach."), autocomplete: "new-password" %>
|
||||
<%= f.field :email_address, as: :email, label: t(".email"), required: true %>
|
||||
<%= f.field :password, as: :password, hint: (user.persisted? ? t(".leave_blank_to_keep_current") : t(".at_least_characters_not_one", _: (User::PASSWORD_MIN))), autocomplete: "new-password" %>
|
||||
<%= f.field :password_confirmation, as: :password %>
|
||||
<%= f.field :admin, as: :checkbox, label: "Administrator", hint: "Admins can see and edit every aircraft and manage users." %>
|
||||
<div class="flex gap-2"><%= f.submit "Save" %><%= link_to "Cancel", admin_users_path, class: "btn-secondary" %></div>
|
||||
<%= f.field :admin, as: :checkbox, label: t(".administrator"), hint: t(".admins_can_see_and_edit") %>
|
||||
<div class="flex gap-2"><%= f.submit t(".save") %><%= link_to t(".cancel"), admin_users_path, class: "btn-secondary" %></div>
|
||||
<% end %>
|
||||
<% if user.persisted? && user != current_user %><div class="mt-4"><%= delete_button "Delete user", admin_user_path(user) %></div><% end %>
|
||||
<% if user.persisted? && user != current_user %><div class="mt-4"><%= delete_button t(".delete_user"), admin_user_path(user) %></div><% end %>
|
||||
@@ -1,2 +1,2 @@
|
||||
<h1 class="mb-4 text-2xl font-bold">Edit User</h1>
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".edit_user") %></h1>
|
||||
<%= render "form", user: @user %>
|
||||
@@ -1,18 +1,18 @@
|
||||
<% content_for :title, "Users" %>
|
||||
<div class="mb-4 flex items-center justify-between"><h1 class="text-2xl font-bold">Users</h1><%= link_to "+ New User", new_admin_user_path, class: "btn-primary" %></div>
|
||||
<% content_for :title, t(".users") %>
|
||||
<div class="mb-4 flex items-center justify-between"><h1 class="text-2xl font-bold"><%= t(".users") %></h1><%= link_to t(".new_user"), new_admin_user_path, class: "btn-primary" %></div>
|
||||
<section class="card"><table class="table">
|
||||
<thead><tr><th>Name</th><th>Email</th><th>Aircraft</th><th>Last sign-in</th><th></th></tr></thead>
|
||||
<thead><tr><th><%= t(".name") %></th><th><%= t(".email") %></th><th><%= t(".aircraft") %></th><th><%= t(".last_sign_in") %></th><th></th></tr></thead>
|
||||
<tbody><% @users.each do |u| %><tr>
|
||||
<td><%= u.name %> <% if u.admin? %><span class="badge-blue">Admin</span><% end %><% if u.sso_uid? %> <span class="badge-gray" title="Signs in with <%= Sso.label %>"><%= Sso.label %></span><% end %><% if u.otp_enabled? %> <span class="badge-green" title="Authenticator app on">2FA</span><% end %><% if u.locked? %> <span class="badge-red" title="Too many failed sign-ins">Locked</span><% end %></td>
|
||||
<td><%= u.name %> <% if u.admin? %><span class="badge-blue"><%= t(".admin") %></span><% end %><% if u.sso_uid? %> <span class="badge-gray" title="Signs in with <%= Sso.label %>"><%= Sso.label %></span><% end %><% if u.otp_enabled? %> <span class="badge-green" title="<%= t(".authenticator_app_on") %>"><%= t(".n2fa") %></span><% end %><% if u.locked? %> <span class="badge-red" title="<%= t(".too_many_failed_sign_ins") %>"><%= t(".locked") %></span><% end %></td>
|
||||
<td><%= u.email_address %><% if u.certificates.any? %><div class="text-xs text-slate-500"><%= u.certificates.map { "#{_1.short_label} #{_1.number}" }.join(", ") %></div><% end %></td>
|
||||
<td class="text-xs"><%= u.aircraft_roles.map { "#{_1.aircraft.tail_number} (#{_1.role})" }.join(", ").presence || "—" %></td>
|
||||
<td class="text-xs text-slate-500"><%= u.last_signed_in_at ? "#{time_ago_in_words(u.last_signed_in_at)} ago" : "never" %></td>
|
||||
<td class="whitespace-nowrap text-right">
|
||||
<% if u.disabled? %><span class="badge-red mr-1">Disabled</span><%= button_to "Enable", enable_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline" } %>
|
||||
<% elsif u != current_user %><%= button_to "Disable", disable_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline", data: { turbo_confirm: "Disable #{u.email_address}? They'll be signed out and can't sign in or sign entries. Their past signatures are kept." } } %><% end %>
|
||||
<% if u.locked? %><%= button_to "Unlock", unlock_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline" } %><% end %>
|
||||
<% if u.otp_enabled? %><%= button_to "Reset 2FA", reset_two_factor_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", title: "Turn off their authenticator app (lost phone)", form: { class: "inline", data: { turbo_confirm: "Turn off two-factor for #{u.email_address}? Only do this after confirming it's really them." } } %><% end %>
|
||||
<%= link_to "Edit", edit_admin_user_path(u), class: "btn-secondary btn-sm" %></td>
|
||||
<% if u.disabled? %><span class="badge-red mr-1"><%= t(".disabled") %></span><%= button_to t(".enable"), enable_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline" } %>
|
||||
<% elsif u != current_user %><%= button_to t(".disable"), disable_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline", data: { turbo_confirm: t(".disable_they_ll_be_signed", email_address: u.email_address) } } %><% end %>
|
||||
<% if u.locked? %><%= button_to t(".unlock"), unlock_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", form: { class: "inline" } %><% end %>
|
||||
<% if u.otp_enabled? %><%= button_to t(".reset_2fa"), reset_two_factor_admin_user_path(u), method: :patch, class: "btn-secondary btn-sm", title: t(".turn_off_their_authenticator_app"), form: { class: "inline", data: { turbo_confirm: t(".turn_off_two_factor_for", email_address: u.email_address) } } %><% end %>
|
||||
<%= link_to t(".edit"), edit_admin_user_path(u), class: "btn-secondary btn-sm" %></td>
|
||||
</tr><% end %></tbody>
|
||||
</table></section>
|
||||
<p class="hint mt-3">After creating an account, an aircraft owner can grant access from the aircraft's “Access & Sharing” tab.</p>
|
||||
<p class="hint mt-3"><%= t(".after_creating_an_account_an") %></p>
|
||||
@@ -1,2 +1,2 @@
|
||||
<h1 class="mb-4 text-2xl font-bold">New User</h1>
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".new_user") %></h1>
|
||||
<%= render "form", user: @user %>
|
||||
Reference in new issue
Block a user