mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
AirTrail (https://github.com/johanohly/AirTrail): - File export (Flights → Export for AirTrail) in AirTrail's import format, validated against its schema; same-day repeat legs get leg numbers so AirTrail's de-duplication doesn't merge them. - Automatic sync through AirTrail's REST API (Profile → AirTrail sync): per-user connection with an encrypted API key and scope check; flights are created/updated/deleted in background jobs; a full sync first links flights already in AirTrail (e.g. from a file import) instead of duplicating them; airports are resolved and cached, with manual mapping for unknown codes. - GPS tracks: GPX, KML and CSV track logs are converted to AirTrail's track format for both sync and export; the flight page shows a summary. - Aircraft ICAO type (e.g. C150) for AirTrail's aircraft type. Airport database (OurAirports, the source AirTrail uses): - Managed like AirTrail: downloaded in the background on first start, updated in place from Admin → Airports (adds, changes, removes; ids stable), with admin-managed custom airports that updates never touch. - Each airport carries AirTrail's code, so logged codes translate to AirTrail's exactly (1B9 → K1B9, 4MB → K5M3). - From/To autocomplete on new flights (airports this aircraft has used rank first); From is pre-filled with the last flight's destination; codes are normalized to uppercase. - Flights → Standardize airport codes: rewrite logged codes to the standard code, and fix codes not in the database (typos such as 0R8 → 08R are suggested). Also: admin pages grouped under an Admin dropdown menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
2.0 KiB
ERB
30 lines
2.0 KiB
ERB
<% content_for :title, "#{@aircraft.tail_number} Flights" %>
|
|
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
<% if @stats.any? %><%= render "flight_logs/stats", stats: @stats %><% end %>
|
|
<section class="card">
|
|
<div class="card-header"><h2 class="card-title">Flight Log</h2><div class="flex gap-2"><%= link_to "Export for AirTrail", new_aircraft_air_trail_export_path(@aircraft), class: "btn-secondary" %><% if owner? %><%= link_to "Standardize airport codes", aircraft_airport_codes_path(@aircraft), class: "btn-secondary" %><%= link_to "Import from spreadsheet", new_aircraft_flight_import_path(@aircraft), class: "btn-secondary" %><% end %><%= link_to "+ Log Flight", new_aircraft_flight_log_path(@aircraft), class: "btn-primary" %></div></div>
|
|
<% if @flight_logs.any? %>
|
|
<div class="overflow-x-auto">
|
|
<table class="table">
|
|
<thead><tr><th>Date</th><th>Route</th><th class="text-right">Tach</th><th class="text-right">Hobbs</th><th class="text-right">Oil</th><th class="text-right">Fuel</th><th>Pilot</th><th></th></tr></thead>
|
|
<tbody>
|
|
<% @flight_logs.each do |fl| %>
|
|
<tr>
|
|
<td class="whitespace-nowrap"><%= link_to fl.date, aircraft_flight_log_path(@aircraft, fl), class: "link" %></td>
|
|
<td><%= fl.route_summary.presence || "—" %></td>
|
|
<td class="text-right tabular-nums"><%= hours(fl.tach_time) %></td>
|
|
<td class="text-right tabular-nums"><%= hours(fl.hobbs_time) %></td>
|
|
<td class="text-right tabular-nums"><%= fl.oil_added ? "#{fl.oil_added} qt" : "" %></td>
|
|
<td class="text-right tabular-nums"><%= fl.fuel_added ? "#{fl.fuel_added} gal" : "" %></td>
|
|
<td class="text-xs"><%= fl.user&.display_name %></td>
|
|
<td class="text-right"><%= "📍" if fl.track_log.attached? %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<% else %>
|
|
<%= empty_state "No flights logged yet." %>
|
|
<% end %>
|
|
</section>
|