<% content_for :title, @aircraft.tail_number %> <% content_for :head do %><% end %> <%= render "shared/aircraft_header", aircraft: @aircraft %>
<% if owner? %><%= render "aircraft/setup", aircraft: @aircraft %><% end %>

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

<%= link_to t(".status_report"), aircraft_report_path(@aircraft), class: "btn-secondary btn-sm", title: t(".printable_maintenance_status_91_417") %>
<% if @airworthiness.issues.empty? %>

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

<% else %>
    <% @airworthiness.issues.each do |issue| %>
  • <%= issue.category_label %>
    <%= issue.title %>
    <%= issue.description %>
  • <% end %>
<% end %> <% if @aircraft.airworthiness_enforcement? %>

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

<% end %>

<%= Airworthiness.disclaimer %>

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

<%= link_to t(".all_squawks"), aircraft_squawks_path(@aircraft), class: "link text-sm" %>
<% if @active_squawks.any? %> <%= render "squawks/table", squawks: @active_squawks, aircraft: @aircraft %> <% else %> <%= empty_state t(".no_open_squawks") %> <% end %>

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

<%= link_to t(".oil_fuel"), aircraft_consumable_records_path(@aircraft), class: "link text-sm" %>
<%= @oil.recent || "—" %>
<%= t(".oil_hrs_qt_last_100") %>
<%= @fuel.recent || "—" %>
<%= t(".fuel_burn_gal_hr_last") %>

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

<%= form_with url: hours_aircraft_path(@aircraft), method: :patch, class: "card-body space-y-3", data: { controller: "hours-confirm", action: "submit->hours-confirm#confirm", hours_confirm_tach_value: @aircraft.tach_time.to_f, hours_confirm_hobbs_value: @aircraft.hobbs_time.to_f } do |f| %>
<%= f.label :tach_time, t(".tach"), class: "label" %> <%= f.number_field :tach_time, value: @aircraft.tach_time, step: 0.1, class: "input", required: true, data: { hours_confirm_target: "tach" } %>
<%= f.label :hobbs_time, t(".hobbs"), class: "label" %> <%= f.number_field :hobbs_time, value: @aircraft.hobbs_time, step: 0.1, class: "input", data: { hours_confirm_target: "hobbs" } %>

<%= t(".enter_the_current_meter_readings_html", link: (link_to t(".log_flight"), new_aircraft_flight_log_path(@aircraft), class: "link")) %>

<%= f.submit t(".update_hours"), class: "btn-primary" %> <% end %>
<%= render "aircraft/last_flight", aircraft: @aircraft, last_day: @last_day %>

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

<% if owner? %><%= link_to t(".edit"), edit_aircraft_path(@aircraft), class: "btn-secondary btn-sm" %><% end %>
<%= t(".serial") %>
<%= @aircraft.serial_number.presence || "—" %>
<%= t(".purchased") %>
<%= fmt_date(@aircraft.purchased) %>
<%= t(".tach_offset") %>
<%= hours(@aircraft.tach_time_offset) %>
<%= t(".hobbs_offset") %>
<%= hours(@aircraft.hobbs_time_offset) %>
<% if @aircraft.description.present? %>
<%= simple_format @aircraft.description %>
<% end %>

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

<%= link_to t(".add"), new_aircraft_note_path(@aircraft), class: "btn-secondary btn-sm" %>
<% if @notes.any? %>
    <% @notes.each do |note| %>
  • <%= markdown_excerpt note.text %>
    <%= t(".ago_html", display_name: note.user&.display_name, created_at: (time_ago_in_words(note.created_at)), public: (t(".public") if note.public?)) %>
  • <% end %>
<% else %> <%= empty_state t(".no_notes") %> <% end %>

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

<%= link_to t(".all"), aircraft_events_path(@aircraft), class: "link text-sm" %>
<%= render "events/list", events: @recent_events %>