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

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

<% if owner? %><%= link_to t(".edit"), edit_aircraft_major_record_path(@aircraft, @record), class: "btn-secondary btn-sm" %><% end %>
<%= t(".date") %>
<%= fmt_date(@record.date_performed) %>
<%= t(".aircraft_hours") %>
<%= hours(@record.aircraft_hours) %>
<%= t(".performed_by") %>
<%= @record.performed_by.presence || "—" %>
<%= t(".component") %>
<%= @record.component || "—" %>
<%= t(".form_337") %>
<%= @record.form_337_document ? link_to(@record.form_337_document.name, aircraft_document_path(@aircraft, @record.form_337_document), class: "link") : "—" %>
<%= t(".stc") %>
<%= [@record.stc_number, @record.stc_holder].compact_blank.join(" · ").presence || "—" %> <%= link_to(t(".docs"), aircraft_document_path(@aircraft, @record.stc_document), class: "link") if @record.stc_document %>
<%= t(".logbook") %>
<%= @record.logbook_entry ? link_to(@record.logbook_entry.date, aircraft_logbook_entry_path(@aircraft, @record.logbook_entry), class: "link") : "—" %>
<%= t(".weight_balance") %>
<% if (wb = @aircraft.weight_balance_records.where(major_record: @record).recent_first.first) %> <%= link_to t(".lb_in", date: fmt_date(wb.date), weight: number_with_precision(wb.empty_weight, precision: 1), arm: number_with_precision(wb.empty_arm, precision: 2)), aircraft_weight_balance_records_path(@aircraft), class: "link" %> <% elsif owner? %> <%= link_to t(".record_the_new_w_b"), new_aircraft_weight_balance_record_path(@aircraft, major_record_id: @record.id), class: "link" %> <% else %>—<% end %>
<%= t(".icas") %>
<%= @record.has_ica? ? t(".yes") : t(".no") %> <% if (ica = @record.ica_inspection_type) %> <% row = Compliance.inspection_rows(@aircraft).find { _1.type == ica } %> <%= t(".inspection_html", link: (link_to ica.name, aircraft_inspections_path(@aircraft), class: "link"), row: (compliance_badge(row.status) if row)) %> <% elsif @record.has_ica? && owner? %> · <%= link_to t(".add_the_ica_s_recurring"), new_aircraft_inspection_type_path(@aircraft, major_record_id: @record.id), class: "link" %> <% end %>
<% [[t(".description"), @record.description], [t(".ica_notes"), @record.ica_notes], [t(".notes"), @record.notes]].each do |title, text| %> <% if text.present? %>

<%= title %>

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