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,34 @@
|
||||
<%# The loading calculator (W&B tab). %>
|
||||
<div class="card-body space-y-3" data-controller="wb-calculator"
|
||||
data-wb-calculator-empty-weight-value="<%= record.empty_weight.to_f %>" data-wb-calculator-empty-moment-value="<%= record.empty_moment.to_f %>"
|
||||
data-wb-calculator-max-gross-value="<%= record.max_gross_weight.to_f %>" data-wb-calculator-fuel-density-value="<%= setup.fuel_lb_per_gal.to_f %>"
|
||||
data-wb-calculator-envelope-value="<%= setup.envelope.map { |w, c| [ w.to_f, c.to_f ] }.to_json %>">
|
||||
<div class="grid gap-2 sm:grid-cols-2">
|
||||
<% setup.stations.each do |st| %>
|
||||
<label class="text-sm">
|
||||
<span class="label"><%= st.name %> <span class="font-normal text-slate-500">· arm <%= st.arm %> in<%= ", max #{st.max.to_s.sub(/\.0\z/, '')} #{st.fuel ? 'gal' : 'lb'}" if st.max %></span></span>
|
||||
<span class="flex items-center gap-2">
|
||||
<input type="number" min="0" step="0.1" class="input" inputmode="decimal" data-wb-calculator-target="station"
|
||||
data-arm="<%= st.arm.to_f %>" data-fuel="<%= st.fuel %>" data-max="<%= st.max.to_f %>" data-action="input->wb-calculator#update">
|
||||
<span class="w-6 text-xs text-slate-500"><%= st.fuel ? "gal" : "lb" %></span>
|
||||
</span>
|
||||
</label>
|
||||
<% end %>
|
||||
<% if setup.stations.any?(&:fuel) %>
|
||||
<label class="text-sm"><span class="label">Fuel burned in flight</span>
|
||||
<span class="flex items-center gap-2"><input type="number" min="0" step="0.1" class="input" inputmode="decimal" data-wb-calculator-target="burn" data-action="input->wb-calculator#update"><span class="w-6 text-xs text-slate-500">gal</span></span></label>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="grid items-start gap-3 sm:grid-cols-[1fr_auto]">
|
||||
<table class="w-full text-sm table-keep">
|
||||
<thead><tr class="text-left text-xs uppercase text-slate-500"><th></th><th class="text-right">Weight</th><th class="text-right">CG</th><th class="text-right">Moment</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>Takeoff</td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffWeight">—</td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffCg">—</td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffMoment">—</td></tr>
|
||||
<tr><td>Landing</td><td class="text-right tabular-nums" data-wb-calculator-target="landingWeight">—</td><td class="text-right tabular-nums" data-wb-calculator-target="landingCg">—</td><td class="text-right tabular-nums" data-wb-calculator-target="landingMoment">—</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<svg viewBox="0 0 220 160" class="h-40 w-56 rounded bg-slate-50" data-wb-calculator-target="chart" aria-label="CG envelope"></svg>
|
||||
</div>
|
||||
<ul class="space-y-1 text-sm" data-wb-calculator-target="messages" role="status"></ul>
|
||||
<p class="hint">A planning aid from the figures entered here. Check against the POH and the aircraft's current W&B report.</p>
|
||||
</div>
|
||||
@@ -27,39 +27,7 @@
|
||||
<% if owner? %><%= link_to "Loading setup", edit_aircraft_loading_setup_path(@aircraft), class: "btn-secondary btn-sm" %><% end %>
|
||||
</div>
|
||||
<% if @current && setup.configured? %>
|
||||
<div class="card-body space-y-3" data-controller="wb-calculator"
|
||||
data-wb-calculator-empty-weight-value="<%= @current.empty_weight.to_f %>" data-wb-calculator-empty-moment-value="<%= @current.empty_moment.to_f %>"
|
||||
data-wb-calculator-max-gross-value="<%= @current.max_gross_weight.to_f %>" data-wb-calculator-fuel-density-value="<%= setup.fuel_lb_per_gal.to_f %>"
|
||||
data-wb-calculator-envelope-value="<%= setup.envelope.map { |w, c| [ w.to_f, c.to_f ] }.to_json %>">
|
||||
<div class="grid gap-2 sm:grid-cols-2">
|
||||
<% setup.stations.each do |st| %>
|
||||
<label class="text-sm">
|
||||
<span class="label"><%= st.name %> <span class="font-normal text-slate-500">· arm <%= st.arm %> in<%= ", max #{st.max.to_s.sub(/\.0\z/, '')} #{st.fuel ? 'gal' : 'lb'}" if st.max %></span></span>
|
||||
<span class="flex items-center gap-2">
|
||||
<input type="number" min="0" step="0.1" class="input" inputmode="decimal" data-wb-calculator-target="station"
|
||||
data-arm="<%= st.arm.to_f %>" data-fuel="<%= st.fuel %>" data-max="<%= st.max.to_f %>" data-action="input->wb-calculator#update">
|
||||
<span class="w-6 text-xs text-slate-500"><%= st.fuel ? "gal" : "lb" %></span>
|
||||
</span>
|
||||
</label>
|
||||
<% end %>
|
||||
<% if setup.stations.any?(&:fuel) %>
|
||||
<label class="text-sm"><span class="label">Fuel burned in flight</span>
|
||||
<span class="flex items-center gap-2"><input type="number" min="0" step="0.1" class="input" inputmode="decimal" data-wb-calculator-target="burn" data-action="input->wb-calculator#update"><span class="w-6 text-xs text-slate-500">gal</span></span></label>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="grid items-start gap-3 sm:grid-cols-[1fr_auto]">
|
||||
<table class="w-full text-sm table-keep">
|
||||
<thead><tr class="text-left text-xs uppercase text-slate-500"><th></th><th class="text-right">Weight</th><th class="text-right">CG</th><th class="text-right">Moment</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>Takeoff</td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffWeight">—</td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffCg">—</td><td class="text-right tabular-nums" data-wb-calculator-target="takeoffMoment">—</td></tr>
|
||||
<tr><td>Landing</td><td class="text-right tabular-nums" data-wb-calculator-target="landingWeight">—</td><td class="text-right tabular-nums" data-wb-calculator-target="landingCg">—</td><td class="text-right tabular-nums" data-wb-calculator-target="landingMoment">—</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<svg viewBox="0 0 220 160" class="h-40 w-56 rounded bg-slate-50" data-wb-calculator-target="chart" aria-label="CG envelope"></svg>
|
||||
</div>
|
||||
<ul class="space-y-1 text-sm" data-wb-calculator-target="messages" role="status"></ul>
|
||||
<p class="hint">A planning aid from the figures entered here. Check against the POH and the aircraft's current W&B report.</p>
|
||||
</div>
|
||||
<%= render "weight_balance_records/calculator", record: @current, setup: setup %>
|
||||
<% elsif !@current %>
|
||||
<%= empty_state "Record the current weight & balance first." %>
|
||||
<% else %>
|
||||
|
||||
Reference in new issue
Block a user