mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- Overview: "Coming due" (next 30 days or 10 hours) and "Last flight" (the most recent day's legs, meters at the end, fuel and oil left). - Component replace / TBO / inspect intervals, inspection types and ADs take a number and a days / months / years choice (CalendarInterval). Components gain month columns (years stored as 12 months; months land on the same date); inspection types and ADs keep end-of-month. ADs now honour days. - Due list: hours already run out count as overdue; a component covered by an inspection type no longer gets its own "Inspect every" item. - Loading calculator moved to a partial; no limit warnings until a load is entered. Header buttons don't wrap on phones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
2.3 KiB
ERB
30 lines
2.3 KiB
ERB
<%= 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.interval :recurring, label: "Every", hint: "Months and years are due at the end of the month." %>
|
|
<%= f.field :document_id, as: :select, label: "Reference document", collection: document_options(aircraft) %>
|
|
</div>
|
|
<%= f.field :document_url, label: "Link to AD document", placeholder: "https://…",
|
|
hint: "Filled in automatically from a DRS Excel export. In DRS, open the AD and copy its link." %>
|
|
<%= 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 %>
|