mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Overview shows coming due and the last flight; intervals in days, months or years
- Overview: "Coming due" (next 30 days or 10 hours) and "Last flight" (the most recent day's legs, meters at the end, fuel and oil left). - Component replace / TBO / inspect intervals, inspection types and ADs take a number and a days / months / years choice (CalendarInterval). Components gain month columns (years stored as 12 months; months land on the same date); inspection types and ADs keep end-of-month. ADs now honour days. - Due list: hours already run out count as overdue; a component covered by an inspection type no longer gets its own "Inspect every" item. - Loading calculator moved to a partial; no limit warnings until a load is entered. Header buttons don't wrap on phones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
215efe6814
commit
31ac991bab
37 files changed
+385
-75
No files matched your search
@@ -0,0 +1,22 @@
|
||||
<%# What's due in the next few weeks or hours (Overview). %>
|
||||
<section class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title">Coming due</h2>
|
||||
<span class="text-xs text-slate-500">next <%= DueList::SOON_DAYS %> days or <%= DueList::SOON_HOURS %> hrs</span>
|
||||
</div>
|
||||
<% if due.any? %>
|
||||
<ul class="divide-y divide-slate-100">
|
||||
<% due.each do |item| %>
|
||||
<li class="flex items-baseline justify-between gap-3 px-4 py-2 text-sm">
|
||||
<%= link_to item.title, item.path, class: [ "hover:underline", ("font-medium text-red-700" if item.overdue?) ] %>
|
||||
<span class="shrink-0 text-right text-xs text-slate-500 tabular-nums">
|
||||
<% if item.overdue? %>overdue<% else %><%= "~" if item.projected %><%= fmt_date(item.date) %><% end %><%= " · at #{hours(item.due_hours)} hrs" if item.due_hours %>
|
||||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% if due.any?(&:projected) %><p class="hint px-4 pb-3">"~" dates are estimated from the last year's flying.</p><% end %>
|
||||
<% else %>
|
||||
<%= empty_state "Nothing coming due soon." %>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -0,0 +1,27 @@
|
||||
<%# The most recent day's flying (Overview). %>
|
||||
<section class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title">Last flight</h2>
|
||||
<%= link_to "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">Date</dt>
|
||||
<dd><%= fmt_date(last_leg.date) %><%= " · #{pluralize(last_day.size, 'leg')}" if last_day.size > 1 %></dd>
|
||||
<% if route.any? %><dt class="text-slate-500">Route</dt><dd><%= route.join(" → ") %></dd><% end %>
|
||||
<dt class="text-slate-500">Flown</dt><dd><%= hours(last_day.sum { _1.tach_time.to_d }) %> hrs tach</dd>
|
||||
<% if last_leg.tach_in %><dt class="text-slate-500">Ended at</dt><dd>Tach <%= hours(last_leg.tach_in) %><%= " · Hobbs #{hours(last_leg.hobbs_in)}" if last_leg.hobbs_in %></dd><% end %>
|
||||
<% if fuel_after %><dt class="text-slate-500">Fuel after</dt><dd><%= number_with_precision(fuel_after, precision: 1, strip_insignificant_zeros: true) %> gal</dd><% end %>
|
||||
<% if oil_after %><dt class="text-slate-500">Oil after</dt><dd><%= number_with_precision(oil_after, precision: 1, strip_insignificant_zeros: true) %> qt</dd><% end %>
|
||||
<% if (notes = last_day.filter_map { _1.notes.presence }).any? %>
|
||||
<dt class="text-slate-500">Notes</dt><dd class="whitespace-pre-line"><%= notes.join("\n") %></dd>
|
||||
<% end %>
|
||||
</dl>
|
||||
<% else %>
|
||||
<%= empty_state "No flights logged yet." %>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -46,6 +46,8 @@
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<%= render "aircraft/coming_due", aircraft: @aircraft, due: @coming_due %>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-header"><h2 class="card-title">Consumption</h2>
|
||||
<%= link_to "Oil & fuel →", aircraft_consumable_records_path(@aircraft), class: "link text-sm" %></div>
|
||||
@@ -71,6 +73,8 @@
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<%= render "aircraft/last_flight", aircraft: @aircraft, last_day: @last_day %>
|
||||
|
||||
<section class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title">Details</h2>
|
||||
|
||||
Reference in new issue
Block a user