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

<%= @record.type_label %>: <%= @record.title %>

<% if owner? %><%= link_to "Edit", edit_aircraft_major_record_path(@aircraft, @record), class: "btn-secondary btn-sm" %><% end %>
Date
<%= fmt_date(@record.date_performed) %>
Aircraft hours
<%= hours(@record.aircraft_hours) %>
Performed by
<%= @record.performed_by.presence || "—" %>
Component
<%= @record.component || "—" %>
Form 337
<%= @record.form_337_document ? link_to(@record.form_337_document.name, aircraft_document_path(@aircraft, @record.form_337_document), class: "link") : "—" %>
STC
<%= [@record.stc_number, @record.stc_holder].compact_blank.join(" · ").presence || "—" %> <%= link_to("(docs)", aircraft_document_path(@aircraft, @record.stc_document), class: "link") if @record.stc_document %>
Logbook
<%= @record.logbook_entry ? link_to(@record.logbook_entry.date, aircraft_logbook_entry_path(@aircraft, @record.logbook_entry), class: "link") : "—" %>
Weight & balance
<% if (wb = @aircraft.weight_balance_records.where(major_record: @record).recent_first.first) %> <%= link_to "#{fmt_date(wb.date)}: #{number_with_precision(wb.empty_weight, precision: 1)} lb @ #{number_with_precision(wb.empty_arm, precision: 2)} in", aircraft_weight_balance_records_path(@aircraft), class: "link" %> <% elsif owner? %> <%= link_to "Record the new W&B", new_aircraft_weight_balance_record_path(@aircraft, major_record_id: @record.id), class: "link" %> <% else %>—<% end %>
ICAs
<%= @record.has_ica? ? "Yes" : "No" %> <% if (ica = @record.ica_inspection_type) %> <% row = Compliance.inspection_rows(@aircraft).find { _1.type == ica } %> · Inspection: <%= link_to ica.name, aircraft_inspections_path(@aircraft), class: "link" %> <%= compliance_badge(row.status) if row %> <% elsif @record.has_ica? && owner? %> · <%= link_to "Add the ICA's recurring inspection", new_aircraft_inspection_type_path(@aircraft, major_record_id: @record.id), class: "link" %> <% end %>
<% [["Description", @record.description], ["ICA notes", @record.ica_notes], ["Notes", @record.notes]].each do |title, text| %> <% if text.present? %>

<%= title %>

<%= simple_format text %>
<% end %> <% end %>