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>
78 lines
5.3 KiB
ERB
78 lines
5.3 KiB
ERB
<% content_for :title, t(".oil_analysis", sample_date: fmt_date(@analysis.sample_date)) %>
|
|
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
<div class="grid gap-5 lg:grid-cols-3">
|
|
<section class="card lg:col-span-1">
|
|
<div class="card-header">
|
|
<h2 class="card-title"><%= t(".sample_html", sample_date: (fmt_date(@analysis.sample_date))) %></h2>
|
|
<%= oil_status_badge(@analysis) %>
|
|
</div>
|
|
<dl class="card-body grid grid-cols-2 gap-x-4 gap-y-2 text-sm">
|
|
<dt class="text-slate-500"><%= t(".engine") %></dt><dd><%= @analysis.component ? link_to(@analysis.component, aircraft_component_path(@aircraft, @analysis.component), class: "link") : "—" %></dd>
|
|
<dt class="text-slate-500"><%= t(".engine_hrs_tsn_tso") %></dt><dd><%= @analysis.engine_hours ? hours(@analysis.engine_hours) : "—" %></dd>
|
|
<dt class="text-slate-500"><%= t(".oil_hrs") %></dt><dd><%= @analysis.oil_hours ? hours(@analysis.oil_hours) : "—" %></dd>
|
|
<dt class="text-slate-500"><%= t(".filter_hrs") %></dt><dd><%= @analysis.filter_hours ? hours(@analysis.filter_hours) : "—" %></dd>
|
|
<dt class="text-slate-500"><%= t(".oil_added") %></dt><dd><%= @analysis.oil_added ? "#{number_with_precision(@analysis.oil_added, precision: 2, strip_insignificant_zeros: true)} qt" : "—" %></dd>
|
|
<dt class="text-slate-500"><%= t(".oil") %></dt><dd><%= @analysis.oil_type || "—" %></dd>
|
|
<dt class="text-slate-500"><%= t(".lab") %></dt><dd><%= @analysis.lab || "—" %></dd>
|
|
<dt class="text-slate-500"><%= t(".sample_2") %></dt><dd><%= @analysis.sample_number || "—" %></dd>
|
|
<dt class="text-slate-500"><%= t(".analyzed") %></dt><dd><%= @analysis.analysis_date ? fmt_date(@analysis.analysis_date) : "—" %></dd>
|
|
<dt class="text-slate-500"><%= t(".report") %></dt><dd><%= @analysis.report.attached? ? link_to(@analysis.report.filename, rails_blob_path(@analysis.report, disposition: :inline), class: "link", target: "_blank", rel: "noopener") : "—" %></dd>
|
|
</dl>
|
|
<% if @analysis.excluded_from_averages? %>
|
|
<p class="border-t border-slate-100 px-4 py-2 text-xs text-slate-500"><%= t(".left_out_of_trend_charts") %></p>
|
|
<% end %>
|
|
<% if @analysis.oil_properties.any? %>
|
|
<div class="border-t border-slate-100 px-4 py-3 text-sm">
|
|
<div class="mb-1 text-xs font-semibold text-slate-500"><%= t(".oil_properties") %></div>
|
|
<dl class="grid grid-cols-2 gap-x-4 gap-y-1">
|
|
<% OilAnalysis::PROPERTIES.each_key do |key| %>
|
|
<% next unless @analysis.property(key) %>
|
|
<dt class="text-slate-500"><%= OilAnalysis::PROPERTIES[key] %></dt><dd class="tabular-nums"><%= oil_property(@analysis, key) %></dd>
|
|
<% end %>
|
|
</dl>
|
|
</div>
|
|
<% end %>
|
|
<% if @analysis.lab_comments.present? %>
|
|
<div class="border-t border-slate-100 px-4 py-3 text-sm"><div class="mb-1 text-xs font-semibold text-slate-500"><%= t(".lab_comments") %></div><%= simple_format @analysis.lab_comments %></div>
|
|
<% end %>
|
|
<% if @analysis.notes.present? %>
|
|
<div class="border-t border-slate-100 px-4 py-3 text-sm"><div class="mb-1 text-xs font-semibold text-slate-500"><%= t(".notes") %></div><%= simple_format @analysis.notes %></div>
|
|
<% end %>
|
|
<% if owner? %>
|
|
<div class="flex gap-2 border-t border-slate-100 px-4 py-3">
|
|
<%= link_to t(".edit"), edit_aircraft_oil_analysis_path(@aircraft, @analysis), class: "btn-secondary btn-sm" %>
|
|
<%= delete_button t(".delete"), aircraft_oil_analysis_path(@aircraft, @analysis), confirm: t(".delete_this_oil_analysis") %>
|
|
</div>
|
|
<% end %>
|
|
</section>
|
|
|
|
<section class="card lg:col-span-2">
|
|
<div class="card-header"><h2 class="card-title"><%= t(".results_ppm") %></h2>
|
|
<span class="text-xs text-slate-500"><%= @previous ? t(".compared_with", sample_date: (fmt_date(@previous.sample_date))) : t(".first_sample_for_this_engine") %></span></div>
|
|
<% if @analysis.any_results? %>
|
|
<div class="overflow-x-auto">
|
|
<table class="table">
|
|
<thead><tr><th><%= t(".element") %></th><th class="text-right"><%= t(".this_sample") %></th><th class="text-right"><%= t(".lab_average") %></th><% if @previous %><th class="text-right"><%= t(".previous") %></th><th class="text-right"><%= t(".change") %></th><% end %><th><%= t(".usual_source") %></th></tr></thead>
|
|
<tbody>
|
|
<% OilAnalysis::ELEMENTS.each do |el, label| %><% source = OilAnalysis::ELEMENT_SOURCES[el] %>
|
|
<% next unless @analysis.value(el) %>
|
|
<tr class="<%= "bg-red-50" if @analysis.flagged?(el) %>">
|
|
<td><%= label %></td>
|
|
<td class="text-right tabular-nums <%= "font-semibold text-red-700" if @analysis.flagged?(el) %>"><%= ppm(@analysis.value(el)) %></td>
|
|
<td class="text-right tabular-nums text-slate-500"><%= ppm(@analysis.average(el)) %></td>
|
|
<% if @previous %>
|
|
<td class="text-right tabular-nums"><%= ppm(@previous.value(el)) %></td>
|
|
<td class="text-right tabular-nums"><%= ppm_change(@analysis, @previous, el) %></td>
|
|
<% end %>
|
|
<td class="text-xs text-slate-500"><%= source %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<% else %>
|
|
<%= empty_state t(".no_results_entered") %>
|
|
<% end %>
|
|
</section>
|
|
</div>
|