mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
The report layout now always loads as a full page (turbo-visit-control reload) and without Turbo (an inline Print handler), so the app's dark theme isn't carried onto the white report and the report's styles aren't left behind on Back. Coming due repeated the Airworthiness card, so it's gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
116 lines
5.6 KiB
ERB
116 lines
5.6 KiB
ERB
<% content_for :title, @aircraft.tail_number %>
|
|
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
|
|
<div class="grid gap-5 lg:grid-cols-3">
|
|
<div class="space-y-5 lg:col-span-2">
|
|
<section class="card">
|
|
<div class="card-header">
|
|
<h2 class="card-title">Airworthiness</h2>
|
|
<div class="flex items-center gap-2">
|
|
<%= link_to "Status report", aircraft_report_path(@aircraft), class: "btn-secondary btn-sm", title: "Printable maintenance status (91.417)" %>
|
|
<%= airworthiness_badge(@airworthiness, large: true) %>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<% if @airworthiness.issues.empty? %>
|
|
<p class="text-sm text-emerald-700">Nothing overdue or due soon. All tracked ADs, inspections, components and squawks are current.</p>
|
|
<% else %>
|
|
<ul class="divide-y divide-slate-100">
|
|
<% @airworthiness.issues.each do |issue| %>
|
|
<li class="flex items-start gap-3 py-2">
|
|
<span class="<%= issue_badge_class(issue) %> mt-0.5"><%= issue.category %></span>
|
|
<div>
|
|
<div class="text-sm font-medium"><%= issue.title %></div>
|
|
<div class="text-xs text-slate-500"><%= issue.description %></div>
|
|
</div>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
<% end %>
|
|
<% if @aircraft.airworthiness_enforcement? %>
|
|
<p class="hint mt-3">Airworthiness enforcement is on: flights and hours updates are blocked while the aircraft shows Grounded.</p>
|
|
<% end %>
|
|
<p class="hint mt-3"><%= Airworthiness::DISCLAIMER %></p>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<div class="card-header">
|
|
<h2 class="card-title">Active Squawks</h2>
|
|
<%= link_to "All squawks →", aircraft_squawks_path(@aircraft), class: "link text-sm" %>
|
|
</div>
|
|
<% if @active_squawks.any? %>
|
|
<%= render "squawks/table", squawks: @active_squawks, aircraft: @aircraft %>
|
|
<% else %>
|
|
<%= empty_state "No open squawks." %>
|
|
<% end %>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title">Consumption</h2>
|
|
<%= link_to "Oil & fuel →", aircraft_consumable_records_path(@aircraft), class: "link text-sm" %></div>
|
|
<div class="card-body grid grid-cols-2 gap-4 text-center">
|
|
<div><div class="text-2xl font-semibold"><%= @oil.recent || "—" %></div><div class="text-xs text-slate-500">Oil, hrs/qt (last ~100 hrs)</div></div>
|
|
<div><div class="text-2xl font-semibold"><%= @fuel.recent || "—" %></div><div class="text-xs text-slate-500">Fuel burn, gal/hr (last ~50 hrs)</div></div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<div class="space-y-5">
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title">Update Hours</h2></div>
|
|
<%= form_with url: hours_aircraft_path(@aircraft), method: :patch, class: "card-body space-y-3" do |f| %>
|
|
<div class="grid grid-cols-2 gap-3">
|
|
<div><%= f.label :tach_time, "Tach", class: "label" %>
|
|
<%= f.number_field :tach_time, value: @aircraft.tach_time, step: 0.1, class: "input", required: true %></div>
|
|
<div><%= f.label :hobbs_time, "Hobbs", class: "label" %>
|
|
<%= f.number_field :hobbs_time, value: @aircraft.hobbs_time, step: 0.1, class: "input" %></div>
|
|
</div>
|
|
<p class="hint">Enter the current meter readings. The difference is applied to every in-service component. For a single flight, use <%= link_to "Log Flight", new_aircraft_flight_log_path(@aircraft), class: "link" %>.</p>
|
|
<%= f.submit "Update Hours", class: "btn-primary" %>
|
|
<% end %>
|
|
</section>
|
|
|
|
<%= render "aircraft/last_flight", aircraft: @aircraft, last_day: @last_day %>
|
|
|
|
<section class="card">
|
|
<div class="card-header">
|
|
<h2 class="card-title">Details</h2>
|
|
<% if owner? %><%= link_to "Edit", edit_aircraft_path(@aircraft), class: "btn-secondary btn-sm" %><% end %>
|
|
</div>
|
|
<dl class="card-body grid grid-cols-2 gap-x-3 gap-y-2 text-sm">
|
|
<dt class="text-slate-500">Serial</dt><dd><%= @aircraft.serial_number.presence || "—" %></dd>
|
|
<dt class="text-slate-500">Purchased</dt><dd><%= fmt_date(@aircraft.purchased) %></dd>
|
|
<dt class="text-slate-500">Tach offset</dt><dd><%= hours(@aircraft.tach_time_offset) %></dd>
|
|
<dt class="text-slate-500">Hobbs offset</dt><dd><%= hours(@aircraft.hobbs_time_offset) %></dd>
|
|
</dl>
|
|
<% if @aircraft.description.present? %>
|
|
<p class="border-t border-slate-100 px-4 py-3 text-sm text-slate-600"><%= simple_format @aircraft.description %></p>
|
|
<% end %>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title">Notes</h2>
|
|
<%= link_to "+ Add", new_aircraft_note_path(@aircraft), class: "btn-secondary btn-sm" %></div>
|
|
<% if @notes.any? %>
|
|
<ul class="divide-y divide-slate-100">
|
|
<% @notes.each do |note| %>
|
|
<li class="px-4 py-2 text-sm">
|
|
<div><%= markdown_excerpt note.text %></div>
|
|
<div class="text-xs text-slate-500"><%= note.user&.display_name %> · <%= time_ago_in_words(note.created_at) %> ago <%= "· public" if note.public? %></div>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
<% else %>
|
|
<%= empty_state "No notes." %>
|
|
<% end %>
|
|
</section>
|
|
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title">Recent Activity</h2>
|
|
<%= link_to "All →", aircraft_events_path(@aircraft), class: "link text-sm" %></div>
|
|
<%= render "events/list", events: @recent_events %>
|
|
</section>
|
|
</div>
|
|
</div>
|