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

<%= LogbookEntry::LOG_TYPES[@entry.log_type] %> log — <%= fmt_date(@entry.date) %>

<% if owner? %><%= link_to "Edit", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "btn-secondary btn-sm" %><% end %>
Type: <%= LogbookEntry::ENTRY_TYPES[@entry.entry_type] %> Aircraft hours: <%= hours(@entry.aircraft_hours_at_entry) %>
<%= @entry.text %>
Signed off: <%= @entry.signoff_person.presence || "—" %> <%= ", #{@entry.certificate_label}" if @entry.certificate_label %><%= " ##{@entry.signoff_certificate_number}" if @entry.signoff_certificate_number %> <%= "(#{@entry.signoff_location})" if @entry.signoff_location.present? %>
<% if @entry.inspection_result %>
Result: <%= @entry.inspection_result_label %>
<% end %> <% if (missing = @entry.missing_record_items).any? %>

Missing for <%= @entry.entry_type == "INSPECTION" ? "43.11" : "43.9" %>: <%= missing.to_sentence %>. <%= link_to("Fill in", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "link") if owner? %> (Check against the signed logbook.)

<% end %> <% if @entry.document %>

Scan: <%= link_to @entry.document.name, aircraft_document_path(@aircraft, @entry.document, page: @entry.page_number), class: "link" %><%= " (page #{@entry.page_number})" if @entry.page_number %>

<% end %>