mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
- Aircraft photos get 192px and 960x432 copies made on upload; the header, share page and Fleet cards use them (and the offline copies), instead of the full original. - Flight, engine data, component and major record details show one label and value per row on phones (wide items no longer add grid columns). - Profile re-records this device's push subscription on every visit, and says why if it can't; Send test delivers now and lists each device's result; Google's other push hosts are accepted; turning notifications on shows the browser's actual error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
104 lines
8.1 KiB
ERB
104 lines
8.1 KiB
ERB
<% content_for :title, @aircraft.tail_number %>
|
|
<div class="mb-5 flex flex-wrap items-center justify-between gap-3">
|
|
<div class="flex items-center gap-3">
|
|
<% if @aircraft.picture.attached? %><%= image_tag @aircraft.picture_for(:thumb), width: 64, height: 64, class: "h-16 w-16 rounded-md object-cover", alt: t(".photo_of", tail_number: @aircraft.tail_number) %><% end %>
|
|
<div>
|
|
<h1 class="text-2xl font-bold"><%= @aircraft.tail_number %> <span class="text-base font-normal text-slate-500"><%= [@aircraft.make, @aircraft.model].compact_blank.join(" ") %></span></h1>
|
|
<div class="mt-1 flex flex-wrap items-center gap-2 text-sm">
|
|
<%= airworthiness_badge(@airworthiness) %> <%= aircraft_status_badge(@aircraft) %>
|
|
<span class="text-slate-500"><%= t(".tach_hobbs_html", tach_time: (hours(@aircraft.tach_time)), hobbs_time: (hours(@aircraft.hobbs_time))) %></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<span class="badge-gray"><%= t(".shared_view_html", privilege: (ShareToken::PRIVILEGES[@share.privilege])) %></span>
|
|
</div>
|
|
|
|
<div class="space-y-5">
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title"><%= t(".airworthiness") %></h2>
|
|
<div class="flex items-center gap-2"><% if @share.maintenance? %><%= link_to t(".status_report"), shared_report_path(@share.token), class: "btn-secondary btn-sm" %><% end %><%= airworthiness_badge(@airworthiness, large: true) %></div></div>
|
|
<div class="card-body">
|
|
<% if @airworthiness.issues.empty? %><p class="text-sm text-emerald-700"><%= t(".nothing_overdue_or_due_soon") %></p><% else %>
|
|
<ul class="space-y-1 text-sm"><% @airworthiness.issues.each do |i| %><li><span class="<%= issue_badge_class(i) %>"><%= i.category_label %></span> <%= i.title %> <span class="text-xs text-slate-500"><%= i.description %></span></li><% end %></ul>
|
|
<% end %>
|
|
<p class="hint mt-3"><%= Airworthiness.disclaimer %></p>
|
|
</div>
|
|
</section>
|
|
|
|
<div class="grid gap-5 lg:grid-cols-2">
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title"><%= t(".open_squawks") %></h2></div>
|
|
<% if @active_squawks.any? %>
|
|
<ul class="divide-y divide-slate-100"><% @active_squawks.each do |s| %><li class="px-4 py-2 text-sm"><%= squawk_priority_badge(s) %> <%= s.issue_reported %></li><% end %></ul>
|
|
<% else %><%= empty_state t(".none") %><% end %>
|
|
</section>
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title"><%= t(".consumption") %></h2></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"><%= t(".oil_hrs_qt_recent") %></div></div>
|
|
<div><div class="text-2xl font-semibold"><%= @fuel.recent || "—" %></div><div class="text-xs text-slate-500"><%= t(".fuel_gal_hr_recent") %></div></div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title"><%= t(".components") %></h2></div>
|
|
<div class="overflow-x-auto"><table class="table">
|
|
<thead><tr><th><%= t(".component") %></th><th><%= t(".make_model") %></th><th class="text-right"><%= t(".in_service") %></th><th class="text-right"><%= t(".since_oh_svc") %></th><th><%= t(".tbo") %></th><th><%= t(".life") %></th></tr></thead>
|
|
<tbody><% @components.each do |c| %><tr>
|
|
<td><%= c %></td><td><%= c.manufacturer %> <%= c.model %></td>
|
|
<td class="text-right"><%= hours(c.hours_in_service) %></td><td class="text-right"><%= hours(c.hours_since_overhaul) %></td>
|
|
<td><%= c.tbo_hours %></td><td><%= life_badge(c.life_status) %></td></tr><% end %></tbody>
|
|
</table></div>
|
|
</section>
|
|
|
|
<div class="grid gap-5 lg:grid-cols-2">
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title"><%= t(".inspections") %></h2></div>
|
|
<table class="table"><tbody><% @inspection_rows.each do |r| %><tr>
|
|
<td><%= r.type.name %></td><td class="text-xs"><%= r.latest&.date || "—" %></td><td><%= compliance_badge(r.status) %></td></tr><% end %></tbody></table>
|
|
</section>
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title"><%= t(".ads") %></h2></div>
|
|
<table class="table"><tbody><% @ad_rows.each do |r| %><tr>
|
|
<td><%= ad_link(r.ad) %><div class="text-xs text-slate-500"><%= r.ad.short_description %></div></td><td class="text-xs"><%= r.latest&.date_complied || "—" %></td><td><%= compliance_badge(r.status) %></td></tr><% end %></tbody></table>
|
|
</section>
|
|
</div>
|
|
|
|
<% if @notes.any? %>
|
|
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".notes") %></h2></div>
|
|
<ul class="divide-y divide-slate-100"><% @notes.each do |n| %><li class="px-4 py-2 text-sm"><%= markdown n.text %><div class="text-xs text-slate-500"><%= fmt_date(n.created_at.to_date) %></div></li><% end %></ul></section>
|
|
<% end %>
|
|
|
|
<% if @documents.any? %>
|
|
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".documents") %></h2></div>
|
|
<ul class="divide-y divide-slate-100"><% @documents.each do |d| %><li class="px-4 py-2 text-sm">
|
|
<span class="font-medium"><%= d.name %></span> <span class="text-xs text-slate-500"><%= d.type_label %></span>
|
|
<div class="mt-1 flex flex-wrap gap-2"><% d.pages.each_with_index do |p, i| %><%= link_to "#{i + 1}. #{p.filename}", rails_blob_path(p, disposition: :inline), class: "link text-xs", target: "_blank" %><% end %></div>
|
|
</li><% end %></ul></section>
|
|
<% end %>
|
|
|
|
<% if @share.maintenance? %>
|
|
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".logbook") %></h2></div>
|
|
<% if @logbook.any? %><table class="table"><tbody><% @logbook.each do |e| %><tr>
|
|
<td class="whitespace-nowrap"><%= fmt_date(e.date) %></td><td><span class="badge-gray"><%= LogbookEntry::LOG_TYPES[e.log_type] %></span></td>
|
|
<td class="text-right"><%= hours(e.aircraft_hours_at_entry) %></td><td class="whitespace-pre-wrap text-xs"><%= e.text %></td><td class="text-xs"><%= e.signoff_person %></td></tr><% end %></tbody></table>
|
|
<% else %><%= empty_state t(".no_entries") %><% end %></section>
|
|
|
|
<div class="grid gap-5 lg:grid-cols-2">
|
|
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".inspection_history") %></h2></div>
|
|
<table class="table"><tbody><% @inspection_history.each do |r| %><tr><td><%= fmt_date(r.date) %></td><td><%= r.inspection_type.name %></td><td class="text-right"><%= hours(r.hours_at_inspection) %></td></tr><% end %></tbody></table></section>
|
|
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".ad_compliance_history") %></h2></div>
|
|
<table class="table"><tbody><% @ad_history.each do |c| %><tr><td class="whitespace-nowrap"><%= fmt_date(c.date_complied) %></td><td><%= ad_link(c.airworthiness_directive) %><div class="text-xs text-slate-500"><%= c.airworthiness_directive.short_description %></div></td><td class="text-xs"><%= c.not_applicable? ? "N/A: " : "" %><%= c.compliance_notes %></td></tr><% end %></tbody></table></section>
|
|
</div>
|
|
|
|
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".major_repairs_alterations") %></h2></div>
|
|
<% if @major_records.any? %><table class="table"><tbody><% @major_records.each do |r| %><tr><td><%= fmt_date(r.date_performed) %></td><td><%= r.type_label %></td><td><%= r.title %><div class="text-xs text-slate-500"><%= r.description %></div></td><td class="text-xs"><%= r.stc_number %></td></tr><% end %></tbody></table>
|
|
<% else %><%= empty_state t(".none_recorded") %><% end %></section>
|
|
|
|
<section class="card"><div class="card-header"><h2 class="card-title"><%= t(".resolved_squawks") %></h2></div>
|
|
<% if @resolved_squawks.any? %><ul class="divide-y divide-slate-100"><% @resolved_squawks.each do |s| %><li class="px-4 py-2 text-sm"><%= squawk_priority_badge(s) %> <%= s.issue_reported %> <span class="text-xs text-slate-500"><%= t(".resolved_html", to_date: (fmt_date(s.resolved_at&.to_date))) %></span></li><% end %></ul>
|
|
<% else %><%= empty_state t(".none") %><% end %></section>
|
|
<% end %>
|
|
</div>
|