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:
rickyandClaude Opus 5.5 committed 2026-11-13 22:08:20 -05:00
1 parent 3f45b557c2
commit 89ed0a76f9
313 files changed
+6387 -2653

No files matched your search

@@ -2,19 +2,19 @@
<% comps = aircraft.components.where.not(status: "DISPOSED").includes(:component_type).order(:install_location) %>
<div class="grid gap-4 sm:grid-cols-3">
<div>
<%= f.label :component_id, "Component", class: "label" %>
<%= f.select :component_id, options_for_select([ [ "— None —", "" ] ] + comps.map { |c|
[ "#{c} · #{c.manufacturer} #{c.model}#{" · S/N #{c.serial_number}" if c.serial_number.present?}", c.id,
<%= f.label :component_id, t(".component"), class: "label" %>
<%= f.select :component_id, options_for_select([ [ t(".none"), "" ] ] + comps.map { |c|
[ "#{c} · #{c.manufacturer} #{c.model}#{" · #{t('.serial_short', serial: c.serial_number)}" if c.serial_number.present?}", c.id,
{ "data-total" => c.hours_in_service.to_f, "data-since" => c.hours_since_overhaul.to_f,
"data-kind" => (c.engine? ? "ENG" : c.propeller? ? "PROP" : ""), "data-abbr" => c.since_overhaul_abbreviation } ] }, f.object.component_id),
{}, class: "input", data: { component_times_target: "component", action: "component-times#componentChanged" } %>
<p class="hint">For engine and propeller logs: printed with its serial number and times.</p>
<p class="hint"><%= t(".for_engine_and_propeller_logs") %></p>
</div>
<%= f.field :component_hours_at_entry, as: :number, step: 0.1, label: "Component total time",
<%= f.field :component_hours_at_entry, as: :number, step: 0.1, label: t(".component_total_time"),
data: { component_times_target: "total", action: "input->component-times#markManual" } %>
<%= f.field :component_since_overhaul_at_entry, as: :number, step: 0.1, label: "Since overhaul",
<%= f.field :component_since_overhaul_at_entry, as: :number, step: 0.1, label: t(".since_overhaul"),
data: { component_times_target: "since", action: "input->component-times#markManual" },
hint: "Worked out from the component's current times and the airframe total time above; edit them if they differ." %>
hint: t(".worked_out_from_the_component") %>
</div>
<%# Sub-components of the chosen component (oil filter, magnetos…): tick to include them with their times. %>
<% children = comps.select(&:parent_component_id) %>
@@ -22,7 +22,7 @@
<% parts = f.object.parts.index_by(&:component_id) %>
<% selected = f.object.component %>
<fieldset class="space-y-2" data-component-times-target="partsBox" <%= "hidden" unless selected && (children.map(&:id) & selected.descendant_ids).any? %>>
<legend class="label">Sub-components</legend>
<legend class="label"><%= t(".sub_components") %></legend>
<% children.each do |c| %>
<% part = parts[c.id] %>
<% ancestors = c.ancestor_ids %>
@@ -35,19 +35,19 @@
data: { action: "component-times#partToggled" } %>
<span><%= c %> · <%= c.manufacturer %> <%= c.model %><%= " · S/N #{c.serial_number}" if c.serial_number.present? %></span>
</label>
<div><label class="text-xs text-slate-500" for="part_<%= c.id %>_hours">Total time</label>
<div><label class="text-xs text-slate-500" for="part_<%= c.id %>_hours"><%= t(".total_time") %></label>
<%= number_field_tag "#{field}[hours]", part&.hours_at_entry, id: "part_#{c.id}_hours", step: 0.1, class: "input",
data: { role: "hours", action: "input->component-times#partEdited" } %></div>
<div><label class="text-xs text-slate-500" for="part_<%= c.id %>_since"><%= c.since_overhaul_abbreviation.capitalize %></label>
<%= number_field_tag "#{field}[since]", part&.since_overhaul_at_entry, id: "part_#{c.id}_since", step: 0.1, class: "input",
data: { role: "since", action: "input->component-times#partEdited" } %></div>
<% if f.object.new_record? %>
<div><label class="text-xs text-slate-500" for="part_<%= c.id %>_service">On the Components tab</label>
<%= select_tag "#{field}[service]", options_for_select([ [ "Not changed", "" ], [ "Serviced", "serviced" ], [ "Replaced", "replaced" ] ], params.dig(:logbook_entry, :parts, c.id.to_s, :service)),
<div><label class="text-xs text-slate-500" for="part_<%= c.id %>_service"><%= t(".on_the_components_tab") %></label>
<%= select_tag "#{field}[service]", options_for_select([ [ t(".not_changed"), "" ], [ t(".serviced"), "serviced" ], [ t(".replaced"), "replaced" ] ], params.dig(:logbook_entry, :parts, c.id.to_s, :service)),
id: "part_#{c.id}_service", class: "input" %></div>
<% end %>
</div>
<% end %>
<p class="hint">Their times are worked out the same way as the component's. Sub-components are set up on the Components tab (a part's "Parent component").<%= " “Serviced” or “Replaced” also records it on the Components tab (e.g. an oil and filter change), dated to this entry." if f.object.new_record? %></p>
<p class="hint"><%= t(f.object.new_record? ? ".their_times_new_html" : ".their_times_are_worked_out_html") %></p>
</fieldset>
<% end %>
+9 -9
View File
@@ -1,19 +1,19 @@
<%# Everything a signature covers, as the signer reviews it (AC 120-78B 2.2.4). %>
<dl class="grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[10rem_1fr]">
<dt class="text-slate-500">Aircraft</dt><dd><%= entry.aircraft.tail_number %> <%= [ entry.aircraft.make, entry.aircraft.model ].compact_blank.join(" ") %><%= " · S/N #{entry.aircraft.serial_number}" if entry.aircraft.serial_number.present? %></dd>
<dt class="text-slate-500">Date</dt><dd><%= fmt_date(entry.date) %></dd>
<dt class="text-slate-500">Logbook</dt><dd><%= LogbookEntry::LOG_TYPES[entry.log_type] %> · <%= LogbookEntry::ENTRY_TYPES[entry.entry_type] %></dd>
<dt class="text-slate-500">Airframe total time</dt><dd><%= hours(entry.aircraft_hours_at_entry) %> (<%= entry.aircraft.time_basis %>)</dd>
<dt class="text-slate-500"><%= t(".aircraft") %></dt><dd><%= entry.aircraft.tail_number %> <%= [ entry.aircraft.make, entry.aircraft.model ].compact_blank.join(" ") %><%= " · S/N #{entry.aircraft.serial_number}" if entry.aircraft.serial_number.present? %></dd>
<dt class="text-slate-500"><%= t(".date") %></dt><dd><%= fmt_date(entry.date) %></dd>
<dt class="text-slate-500"><%= t(".logbook") %></dt><dd><%= LogbookEntry::LOG_TYPES[entry.log_type] %> · <%= LogbookEntry::ENTRY_TYPES[entry.entry_type] %></dd>
<dt class="text-slate-500"><%= t(".airframe_total_time") %></dt><dd><%= hours(entry.aircraft_hours_at_entry) %> (<%= entry.aircraft.time_basis %>)</dd>
<% if (c = entry.component) %>
<dt class="text-slate-500"><%= c.component_type&.name %></dt>
<dd><%= c.manufacturer %> <%= c.model %><%= " · S/N #{c.serial_number}" if c.serial_number.present? %> · <%= hours(entry.component_hours_at_entry) %> total, <%= hours(entry.component_since_overhaul_at_entry) %> <%= c.since_overhaul_abbreviation %></dd>
<dd><%= t(".total_html", manufacturer: c.manufacturer, model: c.model, present: (" · S/N #{c.serial_number}" if c.serial_number.present?), component_hours_at_entry: (hours(entry.component_hours_at_entry)), component_since_overhaul_at_entry: (hours(entry.component_since_overhaul_at_entry)), since_overhaul_abbreviation: c.since_overhaul_abbreviation) %></dd>
<% end %>
<% entry.parts.each do |part| %>
<dt class="text-slate-500"><%= part.component.component_type&.name %></dt>
<dd><%= part.component.manufacturer %> <%= part.component.model %><%= " · S/N #{part.component.serial_number}" if part.component.serial_number.present? %> · <%= hours(part.hours_at_entry) %> total, <%= hours(part.since_overhaul_at_entry) %> <%= part.component.since_overhaul_abbreviation.downcase %></dd>
<dd><%= t(".total_2_html", manufacturer: part.component.manufacturer, model: part.component.model, present: (" · S/N #{part.component.serial_number}" if part.component.serial_number.present?), hours_at_entry: (hours(part.hours_at_entry)), since_overhaul_at_entry: (hours(part.since_overhaul_at_entry)), since_overhaul_abbreviation: part.component.since_overhaul_abbreviation.downcase) %></dd>
<% end %>
<% if entry.inspection_result %><dt class="text-slate-500">Result</dt><dd><%= entry.inspection_result_label %></dd><% end %>
<% if entry.signoff_location.present? %><dt class="text-slate-500">Location</dt><dd><%= entry.signoff_location %></dd><% end %>
<% if entry.supersedes %><dt class="text-slate-500">Corrects</dt><dd>The <%= fmt_date(entry.supersedes.date) %> entry</dd><% end %>
<% if entry.inspection_result %><dt class="text-slate-500"><%= t(".result") %></dt><dd><%= entry.inspection_result_label %></dd><% end %>
<% if entry.signoff_location.present? %><dt class="text-slate-500"><%= t(".location") %></dt><dd><%= entry.signoff_location %></dd><% end %>
<% if entry.supersedes %><dt class="text-slate-500"><%= t(".corrects") %></dt><dd><%= t(".the_entry_html", date: (fmt_date(entry.supersedes.date))) %></dd><% end %>
</dl>
<div class="mt-3 whitespace-pre-wrap rounded bg-slate-50 p-3 font-mono text-sm"><%= entry.text %></div>
+23 -23
View File
@@ -3,41 +3,41 @@
<% if entry.supersedes %>
<%= f.hidden_field :supersedes_id %>
<p class="rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-900 ring-1 ring-amber-200">
Correcting the signed <%= link_to "#{fmt_date(entry.supersedes.date)} entry", aircraft_logbook_entry_path(aircraft, entry.supersedes), class: "link" %>.
Change what's wrong, save, then sign it: the original's signature is then marked superseded (it's kept, not deleted).
<%= t(".correcting_the_signed_html", link: (link_to t(".entry", date: fmt_date(entry.supersedes.date)), aircraft_logbook_entry_path(aircraft, entry.supersedes), class: "link")) %>
<%= t(".change_what_s_wrong_save") %>
</p>
<% end %>
<% templates = entry.new_record? ? LogbookTemplate.ordered.to_a : [] %>
<% if templates.any? %>
<div>
<%= label_tag :template, "Template", class: "label" %>
<%= label_tag :template, t(".template"), class: "label" %>
<select id="template" class="input" data-entry-template-target="template" data-action="entry-template#apply">
<option value="">— Write it yourself —</option>
<option value=""><%= t(".write_it_yourself") %></option>
<% templates.each do |t| %>
<option value="<%= t.id %>" data-text="<%= t.text %>" data-entry-type="<%= t.entry_type %>" data-log-type="<%= t.log_type %>"
data-certificate="<%= t.certificate_type %>"><%= t.label %></option>
<% end %>
</select>
<p class="hint">Fill in the blanks (__). The built-in ones are for a pilot doing preventive maintenance on an aircraft they own or operate (14 CFR 43.3(g)); their wording is paraphrased from Part 43 Appendix A(c), which sets each item's limits.<% if current_user.admin? %> <%= link_to "Edit templates", admin_logbook_templates_path, class: "link" %><% end %></p>
<p class="hint"><%= t(".fill_in_the_blanks_the") %><% if current_user.admin? %> <%= link_to t(".edit_templates"), admin_logbook_templates_path, class: "link" %><% end %></p>
</div>
<% end %>
<div class="grid gap-4 sm:grid-cols-4">
<%= f.field :date, as: :date %>
<%= f.field :log_type, as: :select, label: "Logbook", collection: LogbookEntry::LOG_TYPES.invert,
<%= f.field :log_type, as: :select, label: t(".logbook"), collection: LogbookEntry::LOG_TYPES.invert,
data: { component_times_target: "logType", entry_template_target: "logType", action: "component-times#logTypeChanged" } %>
<%= f.field :entry_type, as: :select, label: "Entry type", collection: LogbookEntry::ENTRY_TYPES.invert, data: { entry_template_target: "entryType" } %>
<%= f.field :aircraft_hours_at_entry, as: :number, step: 0.1, label: "Airframe total time",
<%= f.field :entry_type, as: :select, label: t(".entry_type"), collection: LogbookEntry::ENTRY_TYPES.invert, data: { entry_template_target: "entryType" } %>
<%= f.field :aircraft_hours_at_entry, as: :number, step: 0.1, label: t(".airframe_total_time"),
data: { component_times_target: "airframe", action: "input->component-times#airframeChanged" } %>
</div>
<%= render "logbook_entries/component_fields", f: f, aircraft: aircraft %>
<%= f.field :text, as: :textarea, label: "Entry text", rows: 8, data: { entry_template_target: "text" } %>
<p class="hint !mt-1">A maintenance entry needs a description of the work, the date, and the name, signature, certificate number and kind of certificate of whoever approved the return to service (14 CFR 43.9). An inspection entry also needs the type and extent of the inspection, the aircraft's time in service, and the result (43.11).</p>
<%= f.field :text, as: :textarea, label: t(".entry_text"), rows: 8, data: { entry_template_target: "text" } %>
<p class="hint !mt-1"><%= t(".a_maintenance_entry_needs_a") %></p>
<%= render "shared/sign_as" %>
<% if entry.new_record? && (types = aircraft.applicable_inspection_types.order(:name)).any? %>
<%# Recurring items this work completes (e.g. an oil change): recorded on the Inspections tab, dated to this entry. %>
<% ticked = Array(params.dig(:logbook_entry, :inspection_type_ids)).map(&:to_s) %>
<fieldset>
<legend class="label">Inspections completed</legend>
<legend class="label"><%= t(".inspections_completed") %></legend>
<div class="grid gap-x-4 gap-y-1 sm:grid-cols-3">
<% types.each do |t| %>
<label class="flex items-center gap-2 text-sm">
@@ -47,25 +47,25 @@
</label>
<% end %>
</div>
<p class="hint">Ticked ones are recorded as done on the Inspections tab, at this entry's date and airframe time, linked to this entry.</p>
<p class="hint"><%= t(".ticked_ones_are_recorded_as") %></p>
</fieldset>
<% end %>
<div class="grid gap-4 sm:grid-cols-3">
<%= f.field :signoff_person, label: "Signed off by", placeholder: "Name", data: { signer_target: "name" } %>
<%= f.field :signoff_certificate_type, as: :select, label: "Kind of certificate", include_blank: "—",
<%= f.field :signoff_person, label: t(".signed_off_by"), placeholder: t(".name"), data: { signer_target: "name" } %>
<%= f.field :signoff_certificate_type, as: :select, label: t(".kind_of_certificate"), include_blank: "—",
collection: LogbookEntry::CERTIFICATE_TYPES.invert, data: { entry_template_target: "certificate", signer_target: "kind" } %>
<%= f.field :signoff_certificate_number, label: "Certificate number", placeholder: "e.g. 1234567", data: { signer_target: "number" } %>
<%= f.field :signoff_certificate_number, label: t(".certificate_number"), placeholder: "e.g. 1234567", data: { signer_target: "number" } %>
</div>
<div class="grid gap-4 sm:grid-cols-2">
<%= f.field :inspection_result, as: :select, label: "Inspection result", include_blank: "— Not an inspection —",
collection: LogbookEntry::INSPECTION_RESULTS.invert, hint: "For inspection entries (43.11)." %>
<%= f.field :signoff_location, label: "Location / shop" %>
<%= f.field :document_id, as: :select, label: "Scanned page document", collection: document_options(aircraft) %>
<%= f.field :page_number, as: :number, label: "Page # in document" %>
<%= f.field :inspection_result, as: :select, label: t(".inspection_result"), include_blank: t(".not_an_inspection"),
collection: LogbookEntry::INSPECTION_RESULTS.invert, hint: t(".for_inspection_entries_43_11") %>
<%= f.field :signoff_location, label: t(".location_shop") %>
<%= f.field :document_id, as: :select, label: t(".scanned_page_document"), collection: document_options(aircraft) %>
<%= f.field :page_number, as: :number, label: t(".page_in_document") %>
</div>
<% if entry.persisted? && !entry.verified_was %>
<%= f.field :verified, as: :checkbox, label: "I've checked this against the scan", hint: "Transcribed by Claude; it stays marked unverified until someone checks it." %>
<%= f.field :verified, as: :checkbox, label: t(".i_ve_checked_this_against"), hint: t(".transcribed_by_claude_it_stays") %>
<% end %>
<div class="flex gap-2"><%= f.submit "Save Entry" %><%= link_to "Cancel", aircraft_logbook_entries_path(aircraft), class: "btn-secondary" %></div>
<div class="flex gap-2"><%= f.submit t(".save_entry") %><%= link_to t(".cancel"), aircraft_logbook_entries_path(aircraft), class: "btn-secondary" %></div>
<% end %>
<% if entry.persisted? %><div class="mt-4"><%= delete_button "Delete entry", aircraft_logbook_entry_path(aircraft, entry) %></div><% end %>
<% if entry.persisted? %><div class="mt-4"><%= delete_button t(".delete_entry"), aircraft_logbook_entry_path(aircraft, entry) %></div><% end %>
@@ -3,12 +3,12 @@
<% box, title = { valid: [ "bg-emerald-50 ring-emerald-200", "text-emerald-900" ], superseded: [ "bg-amber-50 ring-amber-200", "text-amber-900" ],
altered: [ "bg-red-50 ring-red-200", "text-red-900" ] }.fetch(sig.imported? ? :valid : sig.status) %>
<div class="rounded-md p-3 text-sm ring-1 <%= box %>">
<div class="font-medium <%= title %>"><%= EntrySignature::LABEL %> <%= sig.signer_name %>, <%= sig.certificate_label %> <%= sig.certificate_number %></div>
<div class="text-slate-700">Signed electronically <%= sig.signed_at.utc.strftime("%Y-%m-%d %H:%M UTC") %><%= " (#{EntrySignature::AUTH_METHODS[sig.auth_method]})" if EntrySignature::AUTH_METHODS[sig.auth_method] %></div>
<div class="font-medium <%= title %>"><%= EntrySignature.label %> <%= sig.signer_name %>, <%= sig.certificate_label %> <%= sig.certificate_number %></div>
<div class="text-slate-700"><%= t(".signed_electronically_html", d: (sig.signed_at.utc.strftime("%Y-%m-%d %H:%M UTC")), auth_method: (" (#{EntrySignature::AUTH_METHODS[sig.auth_method]})" if EntrySignature::AUTH_METHODS[sig.auth_method])) %></div>
<div class="mt-1 italic text-slate-700">“<%= sig.statement %>”</div>
<div class="mt-1 text-xs text-slate-500">
Status: <strong><%= sig.imported? ? "Signed on #{sig.origin} (imported)" : sig.status_label %></strong>
· Fingerprint <span class="font-mono"><%= sig.content_digest.first(16) %>…</span>
<% if entry.superseded_by %> · Corrected by <%= link_to "the #{fmt_date(entry.superseded_by.date)} entry", aircraft_logbook_entry_path(entry.aircraft, entry.superseded_by), class: "link" %><% end %>
<%= t(".status_html", status_label: (sig.imported? ? t(".signed_on_imported", origin: sig.origin) : sig.status_label)) %>
<%= t(".fingerprint") %> <span class="font-mono"><%= sig.content_digest.first(16) %>…</span>
<% if entry.superseded_by %> <%= t(".corrected_by_html", link: (link_to t(".the_entry", date: fmt_date(entry.superseded_by.date)), aircraft_logbook_entry_path(entry.aircraft, entry.superseded_by), class: "link")) %><% end %>
</div>
</div>
+15 -15
View File
@@ -1,21 +1,21 @@
<% content_for :title, "#{@aircraft.tail_number} Logbook" %>
<% content_for :title, t(".logbook", tail_number: @aircraft.tail_number) %>
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<section class="card">
<div class="card-header">
<h2 class="card-title">Maintenance Logbook <%= link_to "How records and signing work", records_help_path, class: "link ml-2 text-xs font-normal" %></h2>
<h2 class="card-title"><%= t(".maintenance_logbook_html", link: (link_to t(".how_records_and_signing_work"), records_help_path, class: "link ml-2 text-xs font-normal")) %></h2>
<div class="flex flex-wrap items-center gap-2">
<%= form_with url: aircraft_logbook_entries_path(@aircraft), method: :get, class: "flex w-full flex-wrap gap-2 sm:w-auto" do |f| %>
<%= f.search_field :q, value: @query, placeholder: "Search entries…", class: "input min-w-0 flex-1 sm:w-48 sm:flex-none" %>
<%= f.select :log_type, LogbookEntry::LOG_TYPES.invert, { include_blank: "All logs", selected: @log_type }, class: "input w-32", data: { submit_on_change: true } %>
<%= f.search_field :q, value: @query, placeholder: t(".search_entries"), class: "input min-w-0 flex-1 sm:w-48 sm:flex-none" %>
<%= f.select :log_type, LogbookEntry::LOG_TYPES.invert, { include_blank: t(".all_logs"), selected: @log_type }, class: "input w-32", data: { submit_on_change: true } %>
<% if @unverified_count.positive? || @unverified_only %>
<label class="flex items-center gap-1 text-sm text-slate-700"><%= f.check_box :unverified, { checked: @unverified_only, data: { submit_on_change: true } }, "1", nil %> Unverified (<%= @unverified_count %>)</label>
<label class="flex items-center gap-1 text-sm text-slate-700"><%= t(".unverified_html", checkbox: (f.check_box :unverified, { checked: @unverified_only, data: { submit_on_change: true } }, "1", nil), unverified_count: @unverified_count) %></label>
<% end %>
<%= f.submit "Filter", class: "sr-only" %>
<%= f.submit t(".filter"), class: "sr-only" %>
<% end %>
<% if @entries.any? %><button type="submit" form="print-entries" class="btn-secondary" hidden data-needs-selection="print-entries" title="Print the ticked entries on labels or pages for the paper logbook">Print selected</button><% end %>
<% if @entries.any? %><button type="submit" form="print-entries" class="btn-secondary" hidden data-needs-selection="print-entries" title="<%= t(".print_the_ticked_entries_on") %>"><%= t(".print_selected") %></button><% end %>
<% if owner? %>
<%= more_menu do %><%= link_to "Import scans", new_aircraft_logbook_import_path(@aircraft), class: "menu-item" %><% end %>
<%= link_to "+ New Entry", new_aircraft_logbook_entry_path(@aircraft), class: "btn-primary" %>
<%= more_menu do %><%= link_to t(".import_scans"), new_aircraft_logbook_import_path(@aircraft), class: "menu-item" %><% end %>
<%= link_to t(".new_entry"), new_aircraft_logbook_entry_path(@aircraft), class: "btn-primary" %>
<% end %>
</div>
</div>
@@ -23,7 +23,7 @@
<%= form_with url: new_aircraft_logbook_print_path(@aircraft), method: :get, id: "print-entries" do %><% end %>
<div class="overflow-x-auto">
<table class="table">
<thead><tr><th><input type="checkbox" class="mr-1 align-middle" aria-label="Select all entries" data-check-all> Date</th><th>Log</th><th>Type</th><th class="text-right">Hours</th><th>Entry</th><th>Signed off</th></tr></thead>
<thead><tr><th><input type="checkbox" class="mr-1 align-middle" aria-label="<%= t(".select_all_entries") %>" data-check-all> <%= t(".date") %></th><th><%= t(".log") %></th><th><%= t(".type") %></th><th class="text-right"><%= t(".hours") %></th><th><%= t(".entry") %></th><th><%= t(".signed_off") %></th></tr></thead>
<tbody>
<% @entries.each do |e| %>
<tr>
@@ -31,17 +31,17 @@
<td><span class="badge-gray"><%= LogbookEntry::LOG_TYPES[e.log_type] %></span></td>
<td class="text-xs"><%= LogbookEntry::ENTRY_TYPES[e.entry_type] %></td>
<td class="text-right tabular-nums"><%= hours(e.aircraft_hours_at_entry) %></td>
<td class="max-w-xl"><%= e.text.truncate(220) %> <% if e.document %><span role="img" title="Has a scanned page" aria-label="Has a scanned page">📄</span><% end %>
<% unless e.verified? %><span class="badge-orange" title="Transcribed by Claude<%= " (#{e.transcription_confidence} confidence)" if e.transcription_confidence %>; check it against the scan">Unverified</span><% end %></td>
<td class="max-w-xl"><%= e.text.truncate(220) %> <% if e.document %><span role="img" title="<%= t(".has_a_scanned_page") %>" aria-label="<%= t(".has_a_scanned_page") %>">📄</span><% end %>
<% unless e.verified? %><span class="badge-orange" title="Transcribed by Claude<%= t(".confidence", transcription_confidence: e.transcription_confidence) if e.transcription_confidence %>; check it against the scan"><%= t(".unverified_2") %></span><% end %></td>
<td class="text-xs text-slate-500"><%= e.signoff_person %><%= " ##{e.signoff_certificate_number}" if e.signoff_certificate_number %><% if e.signoff_location.present? %><br><%= e.signoff_location %><% end %>
<% if e.signature %><br><span class="<%= e.superseded? ? 'badge-orange' : 'badge-green' %>" title="Signed electronically by <%= e.signature.signer_name %>"><%= e.superseded? ? "Superseded" : "Signed" %></span>
<% elsif (missing = e.missing_record_items).any? %><br><span class="badge-orange" title="Missing: <%= missing.to_sentence %>">Incomplete</span><% end %></td>
<% if e.signature %><br><span class="<%= e.superseded? ? 'badge-orange' : 'badge-green' %>" title="Signed electronically by <%= e.signature.signer_name %>"><%= e.superseded? ? t(".superseded") : t(".signed") %></span>
<% elsif (missing = e.missing_record_items).any? %><br><span class="badge-orange" title="Missing: <%= missing.to_sentence %>"><%= t(".incomplete") %></span><% end %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% else %>
<%= empty_state(@query.present? ? "No entries match “#{@query}”." : "No logbook entries yet.") %>
<%= empty_state(@query.present? ? t(".no_entries_match", query: @query) : t(".no_logbook_entries_yet")) %>
<% end %>
</section>
+21 -21
View File
@@ -1,19 +1,19 @@
<%= render "shared/aircraft_header", aircraft: @aircraft %>
<section class="card max-w-4xl">
<div class="card-header">
<h2 class="card-title"><%= LogbookEntry::LOG_TYPES[@entry.log_type] %> log — <%= fmt_date(@entry.date) %></h2>
<h2 class="card-title"><%= t(".log_html", log_type: (LogbookEntry::LOG_TYPES[@entry.log_type]), date: (fmt_date(@entry.date))) %></h2>
<div class="flex gap-2">
<% if @entry.signed? %>
<%= link_to "Print for logbook", new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "btn-secondary btn-sm" %>
<%= link_to t(".print_for_logbook"), new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "btn-secondary btn-sm" %>
<% if owner? && !@entry.superseded? && !@entry.superseded_by %>
<%= more_menu(small: true) do %><%= link_to "Correct this entry", new_aircraft_logbook_entry_path(@aircraft, supersedes: @entry.id), class: "menu-item" %><% end %>
<%= more_menu(small: true) do %><%= link_to t(".correct_this_entry"), new_aircraft_logbook_entry_path(@aircraft, supersedes: @entry.id), class: "menu-item" %><% end %>
<% end %>
<% else %>
<%= link_to "Sign", new_aircraft_logbook_entry_signature_path(@aircraft, @entry), class: "btn-primary btn-sm" %>
<% if owner? %><%= link_to "Edit", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "btn-secondary btn-sm" %><% end %>
<%= link_to t(".sign"), new_aircraft_logbook_entry_signature_path(@aircraft, @entry), class: "btn-primary btn-sm" %>
<% if owner? %><%= link_to t(".edit"), edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "btn-secondary btn-sm" %><% end %>
<%= more_menu(small: true) do %>
<% if owner? %><%= link_to "Ask someone to sign", new_aircraft_logbook_entry_signing_invitation_path(@aircraft, @entry), class: "menu-item" %><% end %>
<%= link_to "Print for logbook", new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "menu-item" %>
<% if owner? %><%= link_to t(".ask_someone_to_sign"), new_aircraft_logbook_entry_signing_invitation_path(@aircraft, @entry), class: "menu-item" %><% end %>
<%= link_to t(".print_for_logbook"), new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "menu-item" %>
<% end %>
<% end %>
</div>
@@ -21,43 +21,43 @@
<div class="card-body space-y-3">
<% if @entry.signed? %><%= render "logbook_entries/signature", entry: @entry %>
<% elsif LogbookEntry::RECORD_TYPES.include?(@entry.entry_type) %>
<p class="rounded-md bg-slate-50 px-3 py-2 text-sm text-slate-600 ring-1 ring-slate-200">Not signed electronically.<%= " Pending correction of the #{fmt_date(@entry.supersedes.date)} entry." if @entry.supersedes %> Sign it here, or print it and sign the paper copy.</p>
<p class="rounded-md bg-slate-50 px-3 py-2 text-sm text-slate-600 ring-1 ring-slate-200"><%= t(".not_signed_electronically_sign_it_html", supersedes: (t(".pending_correction_of_the_entry", date: (fmt_date(@entry.supersedes.date))) if @entry.supersedes)) %></p>
<% end %>
<% unless @entry.verified? %>
<div class="flex flex-wrap items-center justify-between gap-2 rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-900 ring-1 ring-amber-200">
<span>Transcribed by Claude<%= " (#{@entry.transcription_confidence} confidence)" if @entry.transcription_confidence %> and not yet checked. Compare it with the scan<%= @entry.document ? "" : " or the paper logbook" %> before relying on it.</span>
<% if owner? %><%= button_to "Matches the scan: mark verified", verify_aircraft_logbook_entry_path(@aircraft, @entry), method: :patch, class: "btn-secondary btn-sm" %><% end %>
<span><%= t(".transcribed_by_claude_and_not_html", transcription_confidence: (t(".confidence", transcription_confidence: @entry.transcription_confidence) if @entry.transcription_confidence), logbook: (@entry.document ? "" : t(".or_the_paper_logbook"))) %></span>
<% if owner? %><%= button_to t(".matches_the_scan_mark_verified"), verify_aircraft_logbook_entry_path(@aircraft, @entry), method: :patch, class: "btn-secondary btn-sm" %><% end %>
</div>
<% end %>
<div class="flex flex-wrap gap-4 text-sm text-slate-600">
<span>Type: <%= LogbookEntry::ENTRY_TYPES[@entry.entry_type] %></span>
<span>Airframe total time: <%= hours(@entry.aircraft_hours_at_entry) %></span>
<span><%= t(".type_html", entry_type: (LogbookEntry::ENTRY_TYPES[@entry.entry_type])) %></span>
<span><%= t(".airframe_total_time_html", aircraft_hours_at_entry: (hours(@entry.aircraft_hours_at_entry))) %></span>
<% if (c = @entry.component) %>
<span><%= c %> <%= c.model %><%= " S/N #{c.serial_number}" if c.serial_number.present? %>:
<%= hours(@entry.component_hours_at_entry) %> total, <%= hours(@entry.component_since_overhaul_at_entry) %> <%= c.since_overhaul_abbreviation %></span>
<%= t(".total_html", component_hours_at_entry: (hours(@entry.component_hours_at_entry)), component_since_overhaul_at_entry: (hours(@entry.component_since_overhaul_at_entry)), since_overhaul_abbreviation: c.since_overhaul_abbreviation) %></span>
<% end %>
<% @entry.parts.each do |part| %>
<% pc = part.component %>
<span><%= pc %> <%= pc.model %><%= " S/N #{pc.serial_number}" if pc.serial_number.present? %>:
<%= hours(part.hours_at_entry) %> total, <%= hours(part.since_overhaul_at_entry) %> <%= pc.since_overhaul_abbreviation.downcase %></span>
<%= t(".total_2_html", hours_at_entry: (hours(part.hours_at_entry)), since_overhaul_at_entry: (hours(part.since_overhaul_at_entry)), since_overhaul_abbreviation: pc.since_overhaul_abbreviation.downcase) %></span>
<% end %>
</div>
<div class="whitespace-pre-wrap rounded bg-slate-50 p-3 font-mono text-sm"><%= @entry.text %></div>
<div class="text-sm text-slate-600">
Signed off: <%= @entry.signoff_person.presence || "—" %>
<%= t(".signed_off_html", signoff_person: (@entry.signoff_person.presence || "—")) %>
<%= ", #{@entry.certificate_label}" if @entry.certificate_label %><%= " ##{@entry.signoff_certificate_number}" if @entry.signoff_certificate_number %>
<%= "(#{@entry.signoff_location})" if @entry.signoff_location.present? %>
</div>
<% if @entry.inspection_result %><div class="text-sm text-slate-600">Result: <%= @entry.inspection_result_label %></div><% end %>
<% if @entry.inspection_result %><div class="text-sm text-slate-600"><%= t(".result_html", inspection_result_label: @entry.inspection_result_label) %></div><% end %>
<% if (missing = @entry.missing_record_items).any? %>
<p class="rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-900 ring-1 ring-amber-200">
Missing for <%= @entry.entry_type == "INSPECTION" ? "43.11" : "43.9" %>: <%= missing.to_sentence %>.
<%= link_to("Fill in", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "link") if owner? %>
(Check against the signed logbook.)
<%= t(".missing_for_html", entry_type: (@entry.entry_type == "INSPECTION" ? "43.11" : "43.9"), items: missing.to_sentence) %>
<%= link_to(t(".fill_in"), edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "link") if owner? %>
<%= t(".check_against_the_signed_logbook") %>
</p>
<% end %>
<% if @entry.document %>
<p class="text-sm">Scan: <%= link_to @entry.document.name, aircraft_document_path(@aircraft, @entry.document, page: @entry.page_number), class: "link" %><%= " (page #{@entry.page_number})" if @entry.page_number %></p>
<p class="text-sm"><%= t(".scan_html", link: (link_to @entry.document.name, aircraft_document_path(@aircraft, @entry.document, page: @entry.page_number), class: "link"), page_number: (t(".page", page_number: @entry.page_number) if @entry.page_number)) %></p>
<% end %>
</div>
</section>
@@ -65,7 +65,7 @@
<% history = (@entry.versions.to_a + @entry.parts.flat_map { _1.versions.to_a } + (@entry.signature ? @entry.signature.versions.to_a : [])).sort_by(&:id).reverse %>
<% if history.any? %>
<details class="card mt-5 max-w-4xl">
<summary class="card-header cursor-pointer"><span class="card-title">Change history (<%= history.size %>)</span></summary>
<summary class="card-header cursor-pointer"><span class="card-title"><%= t(".change_history_html", history: history.size) %></span></summary>
<%= render "record_versions/list", versions: history %>
</details>
<% end %>