<%= render "shared/aircraft_header", aircraft: @aircraft %>

Flight on <%= fmt_date(@flight_log.date) %>

<% if owner? %><%= delete_button "Delete", aircraft_flight_log_path(@aircraft, @flight_log), confirm: "Delete this flight log? Aircraft and component hours will NOT be rolled back." %><% end %>
Tach
<%= hours(@flight_log.tach_time) %> <%= "(#{@flight_log.tach_out} → #{@flight_log.tach_in})" if @flight_log.tach_out && @flight_log.tach_in %>
Hobbs
<%= hours(@flight_log.hobbs_time) %> <%= "(#{@flight_log.hobbs_out} → #{@flight_log.hobbs_in})" if @flight_log.hobbs_out && @flight_log.hobbs_in %>
Route
<%= @flight_log.route_summary.presence || "—" %> <%= @flight_log.route %>
Oil added
<%= @flight_log.oil_added ? "#{@flight_log.oil_added} qt #{@flight_log.oil_added_type}" : "—" %>
Fuel added
<%= @flight_log.fuel_added ? "#{@flight_log.fuel_added} gal #{@flight_log.fuel_added_type}" : "—" %>
Pilot
<%= @flight_log.user&.display_name || "—" %>
Track log
<%= @flight_log.track_log.attached? ? link_to(@flight_log.track_log.filename, rails_blob_path(@flight_log.track_log, disposition: :attachment), class: "link") : "—" %> <% if @track %> · <%= number_with_delimiter(@track.points) %> GPS points<%= " · max #{number_with_delimiter(@track.max_altitude_ft)} ft" if @track.max_altitude_ft %> <% elsif @track_error %> · <%= @track_error %><% end %>
<% if @air_trail_sync || @air_trail_connection %>
AirTrail
<% if @air_trail_sync&.status == "synced" %>Synced <%= time_ago_in_words(@air_trail_sync.synced_at) %> ago <% elsif @air_trail_sync&.status == "error" %>Not synced <%= @air_trail_sync.last_error %> <% else %>Pending<% end %>
<% end %>
<% if @flight_log.notes.present? %>
<%= simple_format @flight_log.notes %>
<% end %>