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>
37 lines
2.4 KiB
ERB
37 lines
2.4 KiB
ERB
<% content_for :title, "Log Flight" %>
|
|
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
<%= form_with model: [@aircraft, @flight_log], class: "card card-body space-y-5 max-w-3xl" do |f| %>
|
|
<%= f.errors_summary %>
|
|
<div class="grid gap-4 sm:grid-cols-3">
|
|
<%= f.field :date, as: :date, required: true %>
|
|
<%= render "shared/airport_field", f: f, attribute: :departure_location, label: "From", aircraft: @aircraft, placeholder: "KOQU" %>
|
|
<%= render "shared/airport_field", f: f, attribute: :destination_location, label: "To", aircraft: @aircraft, placeholder: "Code or name" %>
|
|
</div>
|
|
<fieldset class="grid gap-4 sm:grid-cols-3">
|
|
<legend class="mb-2 text-sm font-semibold">Tach (required)</legend>
|
|
<%= f.field :tach_out, as: :number, step: 0.1, label: "Tach out" %>
|
|
<%= f.field :tach_in, as: :number, step: 0.1, label: "Tach in" %>
|
|
<%= f.field :tach_time, as: :number, step: 0.1, label: "…or duration", hint: "Calculated from out/in if blank." %>
|
|
</fieldset>
|
|
<fieldset class="grid gap-4 sm:grid-cols-3">
|
|
<legend class="mb-2 text-sm font-semibold">Hobbs (optional)</legend>
|
|
<%= f.field :hobbs_out, as: :number, step: 0.1, label: "Hobbs out" %>
|
|
<%= f.field :hobbs_in, as: :number, step: 0.1, label: "Hobbs in" %>
|
|
<%= f.field :hobbs_time, as: :number, step: 0.1, label: "…or duration" %>
|
|
</fieldset>
|
|
<fieldset class="grid gap-4 sm:grid-cols-3">
|
|
<legend class="mb-2 text-sm font-semibold">Oil & fuel added</legend>
|
|
<%= f.field :oil_added, as: :number, step: 0.25, label: "Oil added (qt)" %>
|
|
<%= f.field :oil_level_after, as: :number, step: 0.25, label: "Oil level after (qt)" %>
|
|
<%= f.field :oil_added_type, label: "Oil type", placeholder: "Aeroshell W100" %>
|
|
<%= f.field :fuel_added, as: :number, step: 0.1, label: "Fuel added (gal)" %>
|
|
<%= f.field :fuel_level_after, as: :number, step: 0.1, label: "Fuel level after (gal)" %>
|
|
<%= f.field :fuel_added_type, label: "Fuel type", placeholder: "100LL" %>
|
|
</fieldset>
|
|
<%= f.field :route, as: :textarea, rows: 2 %>
|
|
<%= f.field :notes, as: :textarea, rows: 2 %>
|
|
<%= f.field :track_log, as: :file, label: "Track log (GPX/KML/CSV)" %>
|
|
<p class="hint">Saving adds the tach time to the aircraft and all in-service components, and records any oil/fuel added.</p>
|
|
<div class="flex gap-2"><%= f.submit "Log Flight" %><%= link_to "Cancel", aircraft_flight_logs_path(@aircraft), class: "btn-secondary" %></div>
|
|
<% end %>
|