mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- 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>
162 lines
12 KiB
ERB
162 lines
12 KiB
ERB
<% a = @report.aircraft %>
|
|
<% clock = a.time_basis_label.downcase %>
|
|
<% content_for :title, t(".maintenance_status", tail_number: a.tail_number) %>
|
|
<% section = "mt-6 break-inside-avoid-page" %>
|
|
<% th = "border-b border-slate-300 py-1 pr-3 text-left text-[11px] font-semibold uppercase tracking-wide text-slate-500" %>
|
|
<% td = "border-b border-slate-100 py-1 pr-3 align-top" %>
|
|
|
|
<% unless @standalone %>
|
|
<div class="mb-4 flex flex-wrap items-center justify-between gap-2 print:hidden">
|
|
<% back = @share ? shared_path(@share.token) : aircraft_path(a) %>
|
|
<%= link_to t(".back"), back, class: "link text-sm" %>
|
|
<button type="button" class="btn-primary" data-print><%= t(".print_or_save_as_pdf") %></button>
|
|
</div>
|
|
<% end %>
|
|
|
|
<header class="flex flex-wrap items-end justify-between gap-4 border-b-2 border-slate-800 pb-3">
|
|
<div>
|
|
<p class="text-xs uppercase tracking-wide text-slate-500"><%= t(".maintenance_status_14_cfr_91") %></p>
|
|
<h1 class="text-2xl font-bold"><%= a.tail_number %> <span class="text-lg font-normal text-slate-600"><%= [ a.make, a.model ].compact_blank.join(" ") %></span></h1>
|
|
<p class="text-sm text-slate-600"><%= t(".serial_number_html", serial_number: (a.serial_number.presence || "—")) %></p>
|
|
</div>
|
|
<dl class="grid grid-cols-2 gap-x-6 text-sm">
|
|
<dt class="text-slate-500"><%= t(".prepared") %></dt><dd><%= l(@report.generated_at.to_date, format: :long) %></dd>
|
|
<dt class="text-slate-500"><%= t(".airframe_time_in_service") %></dt><dd class="font-semibold"><%= t(".hrs_html", time_in_service: (hours(@report.time_in_service)), clock: clock) %></dd>
|
|
<dt class="text-slate-500"><%= t(".tach_hobbs") %></dt><dd><%= hours(a.tach_time) %> / <%= hours(a.hobbs_time) %></dd>
|
|
<dt class="text-slate-500"><%= t(".status") %></dt><dd><%= airworthiness_badge(@report.airworthiness) %></dd>
|
|
<dt class="text-slate-500"><%= t(".electronic_records_since") %></dt><dd><%= a.electronic_records_since || "—" %></dd>
|
|
</dl>
|
|
</header>
|
|
|
|
<section class="<%= section %>">
|
|
<h2 class="text-base font-semibold"><%= t(".total_time_in_service_engines") %></h2>
|
|
<% majors = @report.engines + @report.propellers %>
|
|
<% if majors.any? %>
|
|
<table class="mt-2 w-full text-sm">
|
|
<thead><tr><th class="<%= th %>"><%= t(".item") %></th><th class="<%= th %>"><%= t(".make_model") %></th><th class="<%= th %>"><%= t(".serial") %></th><th class="<%= th %> text-right"><%= t(".total_time") %></th><th class="<%= th %> text-right"><%= t(".since_overhaul") %></th><th class="<%= th %>"><%= t(".overhauled") %></th></tr></thead>
|
|
<tbody>
|
|
<% majors.each do |c| %>
|
|
<tr><td class="<%= td %>"><%= c %></td><td class="<%= td %>"><%= [ c.manufacturer, c.model ].compact_blank.join(" ") %></td><td class="<%= td %>"><%= c.serial_number.presence || "—" %></td>
|
|
<td class="<%= td %> text-right tabular-nums"><%= hours(c.hours_in_service) %></td><td class="<%= td %> text-right tabular-nums"><%= hours(c.hours_since_overhaul) %></td><td class="<%= td %>"><%= c.overhaul_date || "—" %></td></tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %><p class="mt-1 text-sm text-slate-500"><%= t(".no_engines_or_propellers_recorded") %></p><% end %>
|
|
</section>
|
|
|
|
<section class="<%= section %>">
|
|
<h2 class="text-base font-semibold"><%= t(".life_limited_parts") %></h2>
|
|
<% if @report.life_limited.any? %>
|
|
<table class="mt-2 w-full text-sm">
|
|
<thead><tr><th class="<%= th %>"><%= t(".part") %></th><th class="<%= th %>"><%= t(".serial") %></th><th class="<%= th %>"><%= t(".limit") %></th><th class="<%= th %> text-right"><%= t(".used") %></th><th class="<%= th %>"><%= t(".remaining") %></th><th class="<%= th %>"><%= t(".status") %></th></tr></thead>
|
|
<tbody>
|
|
<% @report.life_limited.each do |c| %>
|
|
<tr><td class="<%= td %>"><%= c %> <span class="text-slate-500"><%= c.model %></span></td><td class="<%= td %>"><%= c.serial_number.presence || "—" %></td>
|
|
<td class="<%= td %>"><%= [ (c.replacement_hours && "#{hours(c.replacement_hours)} hrs"), c.replacement_interval_label, (c.expires_on && "expires #{fmt_date(c.expires_on)}") ].compact.join(" / ") %></td>
|
|
<td class="<%= td %> text-right tabular-nums"><%= t(".hrs_2_html", hours_since_overhaul: (hours(c.hours_since_overhaul))) %></td>
|
|
<td class="<%= td %>"><%= [ (c.hours_to_replacement && "#{hours(c.hours_to_replacement)} hrs"), (c.next_replacement_date && "by #{fmt_date(c.next_replacement_date)}") ].compact.join(", ") %></td>
|
|
<td class="<%= td %>"><%= life_badge(c.life_status) %></td></tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %><p class="mt-1 text-sm text-slate-500"><%= t(".none_recorded") %></p><% end %>
|
|
</section>
|
|
|
|
<section class="<%= section %>">
|
|
<h2 class="text-base font-semibold"><%= t(".time_since_overhaul") %></h2>
|
|
<% if @report.overhaul_items.any? %>
|
|
<table class="mt-2 w-full text-sm">
|
|
<thead><tr><th class="<%= th %>"><%= t(".item") %></th><th class="<%= th %>"><%= t(".serial") %></th><th class="<%= th %>"><%= t(".overhaul_interval") %></th><th class="<%= th %> text-right"><%= t(".since_overhaul") %></th><th class="<%= th %>"><%= t(".remaining") %></th><th class="<%= th %>"><%= t(".tracked_as") %></th></tr></thead>
|
|
<tbody>
|
|
<% @report.overhaul_items.each do |c| %>
|
|
<tr><td class="<%= td %>"><%= c %> <span class="text-slate-500"><%= c.model %></span></td><td class="<%= td %>"><%= c.serial_number.presence || "—" %></td>
|
|
<td class="<%= td %>"><%= [ (c.tbo_hours && "#{hours(c.tbo_hours)} hrs"), c.tbo_interval_label ].compact.join(" / ") %></td>
|
|
<td class="<%= td %> text-right tabular-nums"><%= t(".hrs_2_html", hours_since_overhaul: (hours(c.hours_since_overhaul))) %></td>
|
|
<td class="<%= td %>"><%= c.hours_to_tbo ? "#{hours(c.hours_to_tbo)} hrs" : "—" %></td>
|
|
<td class="<%= td %> text-xs"><%= c.on_condition? ? t(".on_condition_part_91") : (c.tbo_critical? ? t(".hard_limit") : t(".recommended")) %></td></tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %><p class="mt-1 text-sm text-slate-500"><%= t(".none_recorded") %></p><% end %>
|
|
</section>
|
|
|
|
<section class="<%= section %>">
|
|
<h2 class="text-base font-semibold"><%= t(".inspection_status") %></h2>
|
|
<% if @report.inspections.any? %>
|
|
<table class="mt-2 w-full text-sm">
|
|
<thead><tr><th class="<%= th %>"><%= t(".inspection") %></th><th class="<%= th %>"><%= t(".interval") %></th><th class="<%= th %>"><%= t(".last_done") %></th><th class="<%= th %> text-right"><%= t(".since") %></th><th class="<%= th %>"><%= t(".next_due") %></th><th class="<%= th %>"><%= t(".status") %></th></tr></thead>
|
|
<tbody>
|
|
<% @report.inspections.each do |row| %>
|
|
<% last = row.latest %>
|
|
<tr><td class="<%= td %>"><%= row.type.name %><% if row.type.satisfies %><div class="text-xs text-slate-500"><%= t(".also_counts_as_html", satisfies: row.type.satisfies.name) %></div><% end %></td>
|
|
<td class="<%= td %> text-xs"><%= row.type.interval_description %></td>
|
|
<td class="<%= td %>"><%= last ? "#{fmt_date(last.date)}#{" @ #{hours(last.hours_at_inspection)}" if last.hours_at_inspection}" : t(".never") %><%= " (#{last.inspection_type.name})" if last && last.inspection_type != row.type %></td>
|
|
<td class="<%= td %> text-right tabular-nums"><%= last&.hours_at_inspection ? "#{hours(@report.time_in_service - last.hours_at_inspection)} hrs" : "—" %></td>
|
|
<td class="<%= td %>"><%= [ row.next_due_date&.to_s, row.next_due_hours && "#{hours(row.next_due_hours)} hrs" ].compact.join(" / ").presence || "—" %></td>
|
|
<td class="<%= td %>"><%= compliance_badge(row.status) %></td></tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %><p class="mt-1 text-sm text-slate-500"><%= t(".no_inspections_tracked") %></p><% end %>
|
|
</section>
|
|
|
|
<section class="<%= section %>">
|
|
<h2 class="text-base font-semibold"><%= t(".airworthiness_directives") %></h2>
|
|
<% if @report.ads.any? %>
|
|
<table class="mt-2 w-full text-sm">
|
|
<thead><tr><th class="<%= th %>"><%= t(".ad") %></th><th class="<%= th %>"><%= t(".revision_complied_with") %></th><th class="<%= th %>"><%= t(".method_of_compliance") %></th><th class="<%= th %>"><%= t(".complied") %></th><th class="<%= th %>"><%= t(".recurring_next_due") %></th><th class="<%= th %>"><%= t(".status") %></th></tr></thead>
|
|
<tbody>
|
|
<% @report.ads.each do |row| %>
|
|
<% c = row.latest %>
|
|
<tr><td class="<%= td %>"><span class="font-medium"><%= row.ad.name %></span><div class="text-xs text-slate-500"><%= row.ad.short_description.to_s.truncate(70) %></div></td>
|
|
<td class="<%= td %> text-xs"><%= c&.ad_revision.presence || "—" %></td>
|
|
<td class="<%= td %> text-xs"><%= c ? c.method_label : "—" %><% if c&.compliance_notes.present? %><div class="text-slate-500"><%= c.compliance_notes.truncate(90) %></div><% end %></td>
|
|
<td class="<%= td %>"><%= c ? "#{c.date_complied}#{" @ #{hours(c.aircraft_hours_at_compliance)}" if c.aircraft_hours_at_compliance}" : "—" %></td>
|
|
<td class="<%= td %> text-xs"><%= if c&.closed? then t(".no_further_action")
|
|
elsif row.ad.recurring? then [ row.next_due_date&.to_s, row.next_due_hours && "#{hours(row.next_due_hours)} hrs" ].compact.join(" / ").presence || t(".recurring")
|
|
else t(".one_time") end %></td>
|
|
<td class="<%= td %>"><%= compliance_badge(row.status) %></td></tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %><p class="mt-1 text-sm text-slate-500"><%= t(".no_ads_tracked") %></p><% end %>
|
|
</section>
|
|
|
|
<section class="<%= section %>">
|
|
<h2 class="text-base font-semibold"><%= t(".major_repairs_and_alterations") %></h2>
|
|
<% if (majors = @report.major_records.to_a).any? %>
|
|
<table class="mt-2 w-full text-sm">
|
|
<thead><tr><th class="<%= th %>"><%= t(".date") %></th><th class="<%= th %>"><%= t(".type") %></th><th class="<%= th %>"><%= t(".description") %></th><th class="<%= th %>"><%= t(".stc") %></th><th class="<%= th %>"><%= t(".form_337") %></th></tr></thead>
|
|
<tbody>
|
|
<% majors.each do |m| %>
|
|
<tr><td class="<%= td %>"><%= fmt_date(m.date_performed) %></td><td class="<%= td %> text-xs"><%= m.type_label %></td>
|
|
<td class="<%= td %>"><%= m.title %><%= " · #{m.component}" if m.component %></td>
|
|
<td class="<%= td %> text-xs"><%= [ m.stc_number, m.stc_holder ].compact_blank.join(", ").presence || "—" %></td>
|
|
<td class="<%= td %> text-xs"><%= m.form_337_document ? t(".on_file") : "—" %></td></tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<% else %><p class="mt-1 text-sm text-slate-500"><%= t(".none_recorded") %></p><% end %>
|
|
</section>
|
|
|
|
<section class="<%= section %>">
|
|
<h2 class="text-base font-semibold"><%= t(".weight_and_balance") %></h2>
|
|
<% if (wb = a.current_weight_balance) %>
|
|
<p class="mt-1 text-sm"><%= t(".empty_weight_lb_cg_in_html", delimiter: (number_with_precision(wb.empty_weight, precision: 1, delimiter: ",")), precision: (number_with_precision(wb.empty_arm, precision: 2)), useful_load: (t(".useful_load_lb", delimiter: (number_with_precision(wb.useful_load, precision: 1, delimiter: ','))) if wb.useful_load), date: (fmt_date(wb.date)), present: (" (#{wb.reason})" if wb.reason.present?)) %></p>
|
|
<% else %><p class="mt-1 text-sm text-slate-500"><%= t(".none_recorded") %></p><% end %>
|
|
</section>
|
|
|
|
<section class="<%= section %>">
|
|
<h2 class="text-base font-semibold"><%= t(".open_discrepancies") %></h2>
|
|
<% if (squawks = @report.open_squawks.to_a).any? %>
|
|
<ul class="mt-2 space-y-1 text-sm">
|
|
<% squawks.each do |s| %><li><%= squawk_priority_badge(s) %> <%= s.issue_reported %><%= " · #{s.component}" if s.component %> <span class="text-xs text-slate-500">(<%= fmt_date(s.created_at.to_date) %>)</span></li><% end %>
|
|
</ul>
|
|
<% else %><p class="mt-1 text-sm text-slate-500"><%= t(".none_open") %></p><% end %>
|
|
</section>
|
|
|
|
<footer class="mt-8 border-t border-slate-300 pt-2 text-xs text-slate-500">
|
|
<%= t(".prepared_from_the_records_kept_html", time: (l(@report.generated_at, format: :long)), clock: clock) %>
|
|
<%= t(".this_summary_doesn_t_replace_html", disclaimer: (Airworthiness.disclaimer)) %>
|
|
</footer>
|