Files
simple-aircraft-manager-rails/app/views/aircraft/_last_flight.html.erb
T
rickyandClaude Opus 5.5 89ed0a76f9 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>
2026-11-13 22:08:20 -05:00

28 lines
2.1 KiB
ERB

<%# The most recent day's flying (Overview). %>
<section class="card">
<div class="card-header">
<h2 class="card-title"><%= t(".last_flight") %></h2>
<%= link_to t(".flights"), aircraft_flight_logs_path(aircraft), class: "link text-sm" %>
</div>
<% if last_day %>
<% route = last_day.flat_map { [ _1.departure_location, _1.destination_location ] }.compact_blank.chunk_while { _1 == _2 }.map(&:first) %>
<% last_leg = last_day.last %>
<% fuel_after = last_day.reverse.find(&:fuel_level_after)&.fuel_level_after %>
<% oil_after = last_day.reverse.find(&:oil_level_after)&.oil_level_after %>
<dl class="card-body grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 text-sm">
<dt class="text-slate-500"><%= t(".date") %></dt>
<dd><%= fmt_date(last_leg.date) %><%= " · #{t("counts.leg", count: last_day.size)}" if last_day.size > 1 %></dd>
<% if route.any? %><dt class="text-slate-500"><%= t(".route") %></dt><dd><%= route.join(" → ") %></dd><% end %>
<dt class="text-slate-500"><%= t(".flown") %></dt><dd><%= t(".hrs_tach_html", hours: (hours(last_day.sum { _1.tach_time.to_d }))) %></dd>
<% if last_leg.tach_in %><dt class="text-slate-500"><%= t(".ended_at") %></dt><dd><%= t(".tach_html", tach_in: (hours(last_leg.tach_in)), hobbs_in: (t(".hobbs", hobbs_in: (hours(last_leg.hobbs_in))) if last_leg.hobbs_in)) %></dd><% end %>
<% if fuel_after %><dt class="text-slate-500"><%= t(".fuel_after") %></dt><dd><%= t(".gal_html", fuel: (number_with_precision(fuel_after, precision: 1, strip_insignificant_zeros: true))) %></dd><% end %>
<% if oil_after %><dt class="text-slate-500"><%= t(".oil_after") %></dt><dd><%= t(".qt_html", oil: (number_with_precision(oil_after, precision: 1, strip_insignificant_zeros: true))) %></dd><% end %>
<% if (notes = last_day.filter_map { _1.notes.presence }).any? %>
<dt class="text-slate-500"><%= t(".notes") %></dt><dd class="whitespace-pre-line"><%= notes.join("\n") %></dd>
<% end %>
</dl>
<% else %>
<%= empty_state t(".no_flights_logged_yet") %>
<% end %>
</section>