mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- Edit on a flight: owners can correct any flight; a pilot, the flights they logged (the same rule as its engine data). - Date, airports, route, notes, oil and fuel (its oil and fuel records follow) and the attached files can always be changed. - The meter readings only on the latest flight, while its tach in is still the aircraft's tach: the aircraft and installed components move by the difference, and with both readings the duration is worked out from them. On earlier flights they're locked (later flights started from them), pointing to Update Hours; the server ignores them too. - Each correction is in the activity log with what changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
3.4 KiB
ERB
33 lines
3.4 KiB
ERB
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
<div class="space-y-6">
|
|
<section class="card max-w-3xl">
|
|
<div class="card-header"><h2 class="card-title"><%= t(".flight_on_html", date: (fmt_date(@flight_log.date))) %></h2>
|
|
<div class="flex flex-wrap gap-2">
|
|
<% if can_edit_flight?(@flight_log) %><%= link_to t(".edit"), edit_aircraft_flight_log_path(@aircraft, @flight_log), class: "btn-secondary btn-sm" %><% end %>
|
|
<% if owner? %><%= delete_button t(".delete"), aircraft_flight_log_path(@aircraft, @flight_log), confirm: t(".delete_this_flight_log_aircraft") %><% end %>
|
|
</div></div>
|
|
<%# One item per row on a phone (label, then value); two columns on wider screens. %>
|
|
<dl class="card-body grid gap-x-8 gap-y-3 text-sm sm:grid-cols-2">
|
|
<div class="detail-row"><dt><%= t(".tach") %></dt><dd><%= hours(@flight_log.tach_time) %> <span class="text-xs text-slate-500"><%= "(#{@flight_log.tach_out} → #{@flight_log.tach_in})" if @flight_log.tach_out && @flight_log.tach_in %></span></dd></div>
|
|
<div class="detail-row"><dt><%= t(".hobbs") %></dt><dd><%= hours(@flight_log.hobbs_time) %> <span class="text-xs text-slate-500"><%= "(#{@flight_log.hobbs_out} → #{@flight_log.hobbs_in})" if @flight_log.hobbs_out && @flight_log.hobbs_in %></span></dd></div>
|
|
<div class="detail-row sm:col-span-2"><dt><%= t(".route") %></dt><dd><%= @flight_log.route_summary.presence || "—" %> <%= @flight_log.route %></dd></div>
|
|
<div class="detail-row"><dt><%= t(".oil_added") %></dt><dd><%= @flight_log.oil_added ? "#{@flight_log.oil_added} qt #{@flight_log.oil_added_type}" : "—" %></dd></div>
|
|
<div class="detail-row"><dt><%= t(".fuel_added") %></dt><dd><%= @flight_log.fuel_added ? "#{@flight_log.fuel_added} gal #{@flight_log.fuel_added_type}" : "—" %></dd></div>
|
|
<div class="detail-row"><dt><%= t(".pilot") %></dt><dd><%= @flight_log.user&.display_name || "—" %></dd></div>
|
|
<div class="detail-row sm:col-span-2"><dt><%= t(".track_log") %></dt><dd class="min-w-0 break-words"><%= @flight_log.track_log.attached? ? link_to(@flight_log.track_log.filename, rails_blob_path(@flight_log.track_log, disposition: :attachment), class: "link") : "—" %>
|
|
<% if @track %><span class="text-xs text-slate-500"> <%= t(".gps_points_html", points: (number_with_delimiter(@track.points)), max_altitude_ft: (t(".max_ft", max_altitude_ft: (number_with_delimiter(@track.max_altitude_ft))) if @track.max_altitude_ft)) %></span>
|
|
<% elsif @track_error %><span class="text-xs text-amber-700"> · <%= @track_error %></span><% end %></dd></div>
|
|
<% if @air_trail_sync || @air_trail_connection %>
|
|
<div class="detail-row sm:col-span-2"><dt><%= t(".airtrail") %></dt>
|
|
<dd class="text-xs">
|
|
<% if @air_trail_sync&.status == "synced" %><span class="badge-green"><%= t(".synced") %></span> <%= t(".ago_html", synced_at: (time_ago_in_words(@air_trail_sync.synced_at))) %>
|
|
<% elsif @air_trail_sync&.status == "error" %><span class="badge-red"><%= t(".not_synced") %></span> <%= @air_trail_sync.last_error %>
|
|
<% else %><span class="badge-gray"><%= t(".pending") %></span><% end %>
|
|
</dd></div>
|
|
<% end %>
|
|
</dl>
|
|
<% if @flight_log.notes.present? %><div class="border-t border-slate-100 px-4 py-3 text-sm"><%= simple_format @flight_log.notes %></div><% end %>
|
|
</section>
|
|
<%= render "engine_data", flight_log: @flight_log, recording: @engine_data, error: @engine_data_error %>
|
|
</div>
|