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,27 @@
|
||||
<%= form_with model: ad, url: ad.new_record? ? aircraft_airworthiness_directives_path(aircraft) : aircraft_airworthiness_directive_path(aircraft, ad), class: "card card-body space-y-4 max-w-3xl" do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<div class="grid gap-4 sm:grid-cols-3">
|
||||
<%= f.field :name, label: "Number", required: true, placeholder: "2011-10-09" %>
|
||||
<%= f.field :bulletin_type, as: :select, label: "Type", collection: AirworthinessDirective::BULLETIN_TYPES.invert %>
|
||||
<%= f.field :compliance_type, as: :select, label: "Compliance", collection: AirworthinessDirective::COMPLIANCE_TYPES.invert,
|
||||
hint: "Conditional ADs only apply when a trigger occurs and don't affect airworthiness." %>
|
||||
</div>
|
||||
<%= f.field :short_description, required: true %>
|
||||
<%= f.field :required_action, as: :textarea, rows: 3 %>
|
||||
<%= f.field :trigger_condition, as: :textarea, rows: 2, hint: "For conditional ADs (e.g. “on prop strike”)." %>
|
||||
<div class="flex gap-6">
|
||||
<%= f.field :mandatory, as: :checkbox, label: "Mandatory" %>
|
||||
<%= f.field :recurring, as: :checkbox, label: "Recurring" %>
|
||||
</div>
|
||||
<div class="grid gap-4 sm:grid-cols-3">
|
||||
<%= f.field :recurring_hours, as: :number, step: 0.1, label: "Every (hours)" %>
|
||||
<%= f.field :recurring_months, as: :number, label: "Every (months)" %>
|
||||
<%= f.field :document_id, as: :select, label: "Reference document", collection: document_options(aircraft) %>
|
||||
</div>
|
||||
<%= render "shared/applicability_fields", aircraft: aircraft, record: ad, applies_to_airframe: @applies_to_airframe %>
|
||||
<% if ad.persisted? && (ad.aircraft.count + ad.components.where.not(aircraft_id: aircraft.id).count) > 1 %>
|
||||
<p class="rounded bg-amber-50 p-2 text-xs text-amber-800">This AD is shared with other aircraft; edits affect them too.</p>
|
||||
<% end %>
|
||||
<div class="flex gap-2"><%= f.submit "Save" %><%= link_to "Cancel", aircraft_airworthiness_directives_path(aircraft), class: "btn-secondary" %></div>
|
||||
<% end %>
|
||||
<% if ad.persisted? %><div class="mt-4"><%= delete_button "Remove from #{aircraft.tail_number}", aircraft_airworthiness_directive_path(aircraft, ad) %></div><% end %>
|
||||
@@ -0,0 +1,2 @@
|
||||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||||
<%= render "form", aircraft: @aircraft, ad: @ad %>
|
||||
@@ -0,0 +1,70 @@
|
||||
<% content_for :title, "#{@aircraft.tail_number} ADs" %>
|
||||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||||
<section class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title">Airworthiness Directives & Bulletins</h2>
|
||||
<% if owner? %>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<% if @attachable.any? %>
|
||||
<%= form_with url: attach_aircraft_airworthiness_directives_path(@aircraft), class: "flex gap-2" do |f| %>
|
||||
<%= f.select :airworthiness_directive_id, @attachable.map { ["#{_1.name} – #{_1.short_description.truncate(40)}", _1.id] }, {}, class: "input w-64" %>
|
||||
<%= f.submit "Link existing", class: "btn-secondary" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= link_to "+ New AD", new_aircraft_airworthiness_directive_path(@aircraft), class: "btn-primary" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if @rows.any? %>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table">
|
||||
<thead><tr><th>AD / Bulletin</th><th>Description</th><th>Recurrence</th><th>Last complied</th><th>Next due</th><th>Status</th><th></th></tr></thead>
|
||||
<tbody>
|
||||
<% @rows.each do |row| ad = row.ad %>
|
||||
<tr>
|
||||
<td class="whitespace-nowrap font-medium"><span class="badge-gray mr-1"><%= ad.bulletin_label %></span><%= ad.name %>
|
||||
<% unless ad.mandatory? %><div class="text-xs text-slate-400">not mandatory</div><% end %></td>
|
||||
<td class="max-w-sm text-xs"><%= ad.short_description %>
|
||||
<% if ad.conditional? && ad.trigger_condition.present? %><div class="text-slate-500">Trigger: <%= ad.trigger_condition %></div><% end %></td>
|
||||
<td class="text-xs"><%= ad.recurring? ? [ad.recurring_hours.to_f > 0 && "#{hours(ad.recurring_hours)} h", ad.recurring_months > 0 && "#{ad.recurring_months} mo"].select(&:itself).join(" / ") : "One-time" %></td>
|
||||
<td class="text-xs"><%= row.latest ? "#{row.latest.date_complied}#{' (permanent)' if row.latest.permanent?}" : "—" %></td>
|
||||
<td class="text-xs"><%= [row.next_due_date&.strftime("%b %Y"), row.next_due_hours && "#{hours(row.next_due_hours)} h"].compact.join(" / ").presence || "—" %></td>
|
||||
<td><%= compliance_badge(row.status) %></td>
|
||||
<td class="whitespace-nowrap text-right">
|
||||
<% if owner? %>
|
||||
<%= link_to "Comply", new_aircraft_ad_compliance_path(@aircraft, ad_id: ad.id), class: "btn-secondary btn-sm" %>
|
||||
<%= link_to "Edit", edit_aircraft_airworthiness_directive_path(@aircraft, ad), class: "btn-secondary btn-sm" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= empty_state "No ADs tracked for this aircraft." %>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<section class="card mt-5">
|
||||
<div class="card-header"><h2 class="card-title">Compliance History</h2></div>
|
||||
<% if @history.any? %>
|
||||
<table class="table">
|
||||
<thead><tr><th>Date</th><th>AD</th><th class="text-right">Hours</th><th>Next due (hrs)</th><th>Notes</th><th></th></tr></thead>
|
||||
<tbody>
|
||||
<% @history.each do |c| %>
|
||||
<tr>
|
||||
<td class="whitespace-nowrap"><%= c.date_complied %></td>
|
||||
<td><%= c.airworthiness_directive.name %><%= " (#{c.component})" if c.component %></td>
|
||||
<td class="text-right"><%= hours(c.aircraft_hours_at_compliance) %></td>
|
||||
<td><%= c.permanent? ? "Permanent" : (c.next_due_at_time.to_f > 0 ? hours(c.next_due_at_time) : "—") %></td>
|
||||
<td class="max-w-md text-xs"><%= c.compliance_notes %></td>
|
||||
<td class="text-right"><% if owner? %><%= link_to "Edit", edit_aircraft_ad_compliance_path(@aircraft, c), class: "btn-secondary btn-sm" %><% end %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<%= empty_state "No compliance records." %>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -0,0 +1,2 @@
|
||||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||||
<%= render "form", aircraft: @aircraft, ad: @ad %>
|
||||
Reference in new issue
Block a user