<% content_for :title, t(".oil_fuel", tail_number: @aircraft.tail_number) %> <%= render "shared/aircraft_header", aircraft: @aircraft %> <%= render "shared/oil_subnav", aircraft: @aircraft %>
<% [@oil, @fuel].each do |stats| %>

<%= stats.oil? ? t(".oil_consumption") : t(".fuel_burn") %>

<%= link_to t(stats.oil? ? ".add_oil" : ".add_fuel"), new_aircraft_consumable_record_path(@aircraft, type: stats.record_type), class: "btn-secondary btn-sm" %>
<%= stats.recent || "—" %> <%= t(".last_hrs_html", metric_label: stats.metric_label, recent_window_hours: stats.recent_window_hours) %>
<%= stats.lifetime || "—" %> <%= t(".lifetime") %>
<% if stats.points.size >= 2 %> <%= line_chart stats.chart_data, xtitle: "Tach hours", ytitle: stats.metric_label, height: "220px", curve: false, points: false, library: { scales: { x: { type: "linear" } } }, colors: [stats.oil? ? "#b45309" : "#0369a1"] %>

<%= t(".rolling_hour_window_total_added_html", chart_window_hours: stats.chart_window_hours, fuel: (stats.oil? ? "oil" : "fuel"), oil: (t(".higher_is_better") if stats.oil?)) %>

<% else %> <%= empty_state t(".not_enough_history_yet_need", chart_window_hours: stats.chart_window_hours) %> <% end %>
<% end %>

<%= t(".records") %>

<% if @records.any? %> <%= render "consumable_records/records", records: @records, page: @page, more: @more %> <% else %> <%= empty_state t(".no_oil_or_fuel_records") %> <% end %>