mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Initial commit: Rails port of Simple Aircraft Manager
Rails 8.1 + SQLite rewrite of marbindrakon/simple-aircraft-manager, designed to self-host as a single container (Solid Queue/Cache/Cable, Active Storage on disk, Hotwire + importmap, Tailwind). - Airworthiness engine ported from health/services.py (ADs, grounding squawks, inspection recurrency, component replacement) - Hours updates and flight logs cascading to in-service components, optional airworthiness enforcement - Components, squawks, ADs, inspections, logbook, documents, major records, oil/fuel consumption stats and charts, activity log - Admin/owner/pilot RBAC and public share links (status/maintenance) - Docker Compose and Kamal deployment, env-driven production config - Service and integration tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
38df19c331
264 files changed
+8365
No files matched your search
@@ -0,0 +1,15 @@
|
||||
<%= form_with model: [aircraft, record], class: "card card-body space-y-4 max-w-2xl" do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<%= f.field :record_type, as: :select, label: "Type", collection: ConsumableRecord::TYPES.invert %>
|
||||
<%= f.field :date, as: :date %>
|
||||
<%= f.field :quantity_added, as: :number, step: 0.01, label: "Quantity added (qt / gal)" %>
|
||||
<%= f.field :level_after, as: :number, step: 0.01, label: "Level after" %>
|
||||
<%= f.field :consumable_type, label: "Product", placeholder: "Aeroshell W100 / 100LL" %>
|
||||
<%= f.field :flight_hours, as: :number, step: 0.1, label: "Tach at time of record" %>
|
||||
</div>
|
||||
<%= f.field :notes, as: :textarea, rows: 2 %>
|
||||
<%= f.field :excluded_from_averages, as: :checkbox, label: "Exclude from averages", hint: "Use for oil changes or partial fills that would skew the trend." %>
|
||||
<div class="flex gap-2"><%= f.submit "Save" %><%= link_to "Cancel", aircraft_consumable_records_path(aircraft), class: "btn-secondary" %></div>
|
||||
<% end %>
|
||||
<% if record.persisted? %><div class="mt-4"><%= delete_button "Delete record", aircraft_consumable_record_path(aircraft, record) %></div><% end %>
|
||||
@@ -0,0 +1,2 @@
|
||||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||||
<%= render "form", aircraft: @aircraft, record: @record %>
|
||||
@@ -0,0 +1,51 @@
|
||||
<% content_for :title, "#{@aircraft.tail_number} Oil & Fuel" %>
|
||||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||||
<div class="grid gap-5 lg:grid-cols-2">
|
||||
<% [@oil, @fuel].each do |stats| %>
|
||||
<section class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title"><%= stats.oil? ? "Oil Consumption" : "Fuel Burn" %></h2>
|
||||
<%= link_to "+ Add #{stats.oil? ? 'Oil' : 'Fuel'}", new_aircraft_consumable_record_path(@aircraft, type: stats.record_type), class: "btn-secondary btn-sm" %>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3 flex gap-6 text-sm">
|
||||
<div><span class="text-2xl font-semibold"><%= stats.average || "—" %></span> <span class="text-slate-500"><%= stats.metric_label %> avg (last 20)</span></div>
|
||||
<div><span class="text-lg"><%= stats.latest || "—" %></span> <span class="text-slate-500">latest</span></div>
|
||||
</div>
|
||||
<% if stats.points.size >= 2 %>
|
||||
<%= line_chart stats.chart_data, xtitle: "Tach hours", ytitle: stats.metric_label, height: "220px",
|
||||
library: { scales: { x: { type: "linear" } } }, colors: [stats.oil? ? "#b45309" : "#0369a1"] %>
|
||||
<% else %>
|
||||
<%= empty_state "Add at least three records to see a trend." %>
|
||||
<% end %>
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<section class="card mt-5">
|
||||
<div class="card-header"><h2 class="card-title">Records</h2></div>
|
||||
<% if @records.any? %>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table">
|
||||
<thead><tr><th>Date</th><th>Type</th><th class="text-right">Added</th><th class="text-right">Level after</th><th>Product</th><th class="text-right">Tach</th><th>Notes</th><th></th></tr></thead>
|
||||
<tbody>
|
||||
<% @records.each do |r| %>
|
||||
<tr>
|
||||
<td class="whitespace-nowrap"><%= r.date %></td>
|
||||
<td><%= tag.span ConsumableRecord::TYPES[r.record_type], class: r.record_type == "oil" ? "badge-orange" : "badge-blue" %></td>
|
||||
<td class="text-right tabular-nums"><%= r.quantity_added %> <%= r.unit %></td>
|
||||
<td class="text-right tabular-nums"><%= r.level_after ? "#{r.level_after} #{r.unit}" : "" %></td>
|
||||
<td><%= r.consumable_type %></td>
|
||||
<td class="text-right tabular-nums"><%= hours(r.flight_hours) %></td>
|
||||
<td class="text-xs text-slate-500"><%= r.notes %><%= " (excluded from average)" if r.excluded_from_averages? %></td>
|
||||
<td class="text-right"><% if owner? %><%= link_to "Edit", edit_aircraft_consumable_record_path(@aircraft, r), class: "btn-secondary btn-sm" %><% end %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= empty_state "No oil or fuel records yet." %>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -0,0 +1,2 @@
|
||||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||||
<%= render "form", aircraft: @aircraft, record: @record %>
|
||||
Reference in new issue
Block a user