<% content_for :title, t(".components", tail_number: @aircraft.tail_number) %> <%= render "shared/aircraft_header", aircraft: @aircraft %>

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

<%= link_to (@show_disposed ? t(".hide_disposed") : t(".show_disposed")), aircraft_components_path(@aircraft, disposed: (@show_disposed ? nil : 1)), class: "link text-sm" %> <% if owner? %><%= link_to t(".add_component"), new_aircraft_component_path(@aircraft), class: "btn-primary" %><% end %>
<% if @rows.empty? %> <%= empty_state t(".no_components_yet_add_the") %> <% else %>
<% @rows.each do |c, depth| %> <% end %>
<%= t(".component") %><%= t(".make_model") %><%= t(".status") %> <%= t(".in_service") %><%= t(".since_oh_svc") %> <%= t(".limit") %><%= t(".life") %>
<%= "↳ " if depth > 0 %><%= link_to c.component_type.name, aircraft_component_path(@aircraft, c), class: "link font-medium" %> <% if c.install_location.present? %>
<%= c.install_location %>
<% end %>
<%= c.manufacturer %> <%= c.model %><% if c.serial_number.present? %>
S/N <%= c.serial_number %>
<% end %>
<%= tag.span c.status_label, class: { "IN-USE" => "badge-green", "SPARE" => "badge-gray", "DISPOSED" => "badge-gray" }[c.status] %> <%= hours(c.hours_in_service) %> <%= hours(c.hours_since_overhaul) %> <% if c.replacement_critical? && (c.replacement_hours || c.replacement_calendar?) %> <%= t(".replace_html", interval: ([c.replacement_hours && "#{c.replacement_hours} h", c.replacement_interval_label].compact.join(" / ")), installed: (t(".since_installed") if c.replacement_from_install?)) %> <% end %> <% if c.tbo_critical? && c.tbo_hours %><%= t(".tbo_h_html", tbo_hours: c.tbo_hours, on_condition: (t(".on_condition") if c.on_condition?)) %><% end %> <% if c.expires_on %><%= t(".expires_html", expires_on: (fmt_date(c.expires_on))) %><% end %> <%= life_badge(c.life_status) %> <% if owner? %> <%= link_to t(".edit"), edit_aircraft_component_path(@aircraft, c), class: "btn-secondary btn-sm" %> <%= link_to t(".service"), aircraft_component_path(@aircraft, c, anchor: "service"), class: "btn-secondary btn-sm" %> <% end %>
<% end %>