<% content_for :title, @aircraft.tail_number %>
<% if @aircraft.picture.attached? %><%= image_tag rails_blob_path(@aircraft.picture, disposition: :inline), class: "h-16 w-16 rounded-md object-cover", alt: t(".photo_of", tail_number: @aircraft.tail_number) %><% end %>

<%= @aircraft.tail_number %> <%= [@aircraft.make, @aircraft.model].compact_blank.join(" ") %>

<%= airworthiness_badge(@airworthiness) %> <%= aircraft_status_badge(@aircraft) %> <%= t(".tach_hobbs_html", tach_time: (hours(@aircraft.tach_time)), hobbs_time: (hours(@aircraft.hobbs_time))) %>
<%= t(".shared_view_html", privilege: (ShareToken::PRIVILEGES[@share.privilege])) %>

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

<% if @share.maintenance? %><%= link_to t(".status_report"), shared_report_path(@share.token), class: "btn-secondary btn-sm" %><% end %><%= airworthiness_badge(@airworthiness, large: true) %>
<% if @airworthiness.issues.empty? %>

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

<% else %>
    <% @airworthiness.issues.each do |i| %>
  • <%= i.category_label %> <%= i.title %> <%= i.description %>
  • <% end %>
<% end %>

<%= Airworthiness.disclaimer %>

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

<% if @active_squawks.any? %>
    <% @active_squawks.each do |s| %>
  • <%= squawk_priority_badge(s) %> <%= s.issue_reported %>
  • <% end %>
<% else %><%= empty_state t(".none") %><% end %>

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

<%= @oil.recent || "—" %>
<%= t(".oil_hrs_qt_recent") %>
<%= @fuel.recent || "—" %>
<%= t(".fuel_gal_hr_recent") %>

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

<% @components.each do |c| %><% end %>
<%= t(".component") %><%= t(".make_model") %><%= t(".in_service") %><%= t(".since_oh_svc") %><%= t(".tbo") %><%= t(".life") %>
<%= c %><%= c.manufacturer %> <%= c.model %> <%= hours(c.hours_in_service) %><%= hours(c.hours_since_overhaul) %> <%= c.tbo_hours %><%= life_badge(c.life_status) %>

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

<% @inspection_rows.each do |r| %><% end %>
<%= r.type.name %><%= r.latest&.date || "—" %><%= compliance_badge(r.status) %>

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

<% @ad_rows.each do |r| %><% end %>
<%= ad_link(r.ad) %>
<%= r.ad.short_description %>
<%= r.latest&.date_complied || "—" %><%= compliance_badge(r.status) %>
<% if @notes.any? %>

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

<% end %> <% if @documents.any? %>

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

<% end %> <% if @share.maintenance? %>

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

<% if @logbook.any? %><% @logbook.each do |e| %><% end %>
<%= fmt_date(e.date) %><%= LogbookEntry::LOG_TYPES[e.log_type] %> <%= hours(e.aircraft_hours_at_entry) %><%= e.text %><%= e.signoff_person %>
<% else %><%= empty_state t(".no_entries") %><% end %>

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

<% @inspection_history.each do |r| %><% end %>
<%= fmt_date(r.date) %><%= r.inspection_type.name %><%= hours(r.hours_at_inspection) %>

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

<% @ad_history.each do |c| %><% end %>
<%= fmt_date(c.date_complied) %><%= ad_link(c.airworthiness_directive) %>
<%= c.airworthiness_directive.short_description %>
<%= c.not_applicable? ? "N/A: " : "" %><%= c.compliance_notes %>

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

<% if @major_records.any? %><% @major_records.each do |r| %><% end %>
<%= fmt_date(r.date_performed) %><%= r.type_label %><%= r.title %>
<%= r.description %>
<%= r.stc_number %>
<% else %><%= empty_state t(".none_recorded") %><% end %>

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

<% if @resolved_squawks.any? %> <% else %><%= empty_state t(".none") %><% end %>
<% end %>