mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Workflow polish: setup checklist, next leg, grouped component limits
- Setup checklist on a new aircraft's Overview (owners): components, standard inspections, DRS AD import, registration/airworthiness certificate, weight and balance; hideable per device - Log Flight: "Save and log next leg" reopens the form on the same date, starting where the leg ended - Component form: limits in two collapsible groups (replacement and expiry; overhaul and TBO), open when in use - Squawk form warns what "Ground Aircraft" does - Logbook entry form: inspection result only for inspection entries (show-when controller); document names default from the file - Dates in pickers, the activity log, airworthiness lines, search, audits and transcription notes use the app format - No duplicate Report Squawk button on Squawks; "Record service" label Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3452a35896
commit
03b9ad65cb
34 files changed
+303
-77
No files matched your search
@@ -0,0 +1,28 @@
|
||||
<%# Shown to owners until the aircraft is set up; Hide keeps it hidden on this device. %>
|
||||
<% steps = setup_steps(aircraft) %>
|
||||
<% if steps.any? { !_2 } %>
|
||||
<section class="card" data-controller="dismiss" data-dismiss-key-value="sam-setup-hidden-<%= aircraft.id %>">
|
||||
<div class="card-header">
|
||||
<div>
|
||||
<h2 class="card-title"><%= t(".title", tail_number: aircraft.tail_number) %></h2>
|
||||
<p class="text-xs text-slate-500"><%= t(".progress", done: steps.count { _2 }, total: steps.size) %></p>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary btn-sm" data-action="dismiss#hide"><%= t(".hide") %></button>
|
||||
</div>
|
||||
<ol class="divide-y divide-slate-100">
|
||||
<% steps.each do |key, done, path| %>
|
||||
<li class="flex items-start gap-3 px-4 py-3">
|
||||
<span aria-hidden="true" class="<%= done ? "text-emerald-600" : "text-slate-400" %>"><%= done ? "✓" : "○" %></span>
|
||||
<div class="min-w-0 flex-1 text-sm">
|
||||
<% if done %>
|
||||
<span class="text-slate-500 line-through"><%= t(".#{key}.title") %></span>
|
||||
<% else %>
|
||||
<%= link_to t(".#{key}.title"), path, class: "link font-medium" %>
|
||||
<p class="hint"><%= t(".#{key}.why") %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ol>
|
||||
</section>
|
||||
<% end %>
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<div class="grid gap-5 lg:grid-cols-3">
|
||||
<div class="space-y-5 lg:col-span-2">
|
||||
<% if owner? %><%= render "aircraft/setup", aircraft: @aircraft %><% end %>
|
||||
<section class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title"><%= t(".airworthiness") %></h2>
|
||||
|
||||
@@ -21,30 +21,40 @@
|
||||
<%= f.field :hours_in_service, as: :number, step: 0.1, label: t(".total_time_hours") %>
|
||||
<%= f.field :overhaul_date, as: :date, label: t(".last_overhaul_service") %>
|
||||
<%= f.field :hours_since_overhaul, as: :number, step: 0.1, label: t(".hours_since_oh_service") %>
|
||||
<%= f.field :overhaul_kind, as: :select, label: t(".overhaul_type"), include_blank: "—", collection: Component::OVERHAUL_KINDS.invert,
|
||||
wrapper: { class: "sm:col-span-2" }, hint: t(".for_engines_and_propellers_printed") %>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="grid gap-4 sm:grid-cols-3">
|
||||
<legend class="mb-2 text-sm font-semibold text-slate-900"><%= t(".limits") %></legend>
|
||||
<%= f.field :replacement_hours, as: :number, label: t(".replace_every_hrs") %>
|
||||
<%= f.interval :replacement, label: t(".replace_every") %>
|
||||
<%= f.field :replacement_from_install, as: :select, label: t(".replacement_counts_from"),
|
||||
collection: [ [ t(".last_service"), false ], [ t(".installation_life_limit"), true ] ],
|
||||
hint: t(".installation_for_a_part_that") %>
|
||||
<%= f.field :replacement_critical, as: :checkbox, label: t(".replacement_critical"), hint: t(".overdue_replacement_or_expiry_grounds") %>
|
||||
<%= f.field :expires_on, as: :date, label: t(".expires_on"),
|
||||
hint: t(".the_date_marked_on_the") %>
|
||||
<%= f.field :tbo_hours, as: :number, label: t(".tbo_hrs") %>
|
||||
<%= f.interval :tbo, label: t(".tbo_calendar") %>
|
||||
<div class="space-y-2">
|
||||
<%= f.field :tbo_critical, as: :checkbox, label: t(".treat_tbo_as_a_hard"),
|
||||
hint: t(".under_part_91_tbo_is") %>
|
||||
<%= f.field :on_condition, as: :checkbox, label: t(".on_condition_part_91"),
|
||||
hint: t(".run_past_tbo_based_on") %>
|
||||
<%# Limits, in two groups that open when they're in use (most parts need one or neither). %>
|
||||
<% c = component %>
|
||||
<% replacement_open = c.replacement_hours.present? || c.replacement_calendar? || c.replacement_critical? || c.expires_on.present? ||
|
||||
%i[replacement_hours replacement_every expires_on].any? { c.errors[_1].any? } %>
|
||||
<% tbo_open = c.tbo_hours.present? || c.tbo_calendar? || c.overhaul_kind.present? || c.on_condition? || %i[tbo_hours tbo_every].any? { c.errors[_1].any? } %>
|
||||
<details class="rounded-md ring-1 ring-slate-200" <%= "open" if replacement_open %>>
|
||||
<summary class="cursor-pointer px-3 py-2 text-sm font-semibold text-slate-900"><%= t(".replacement_group") %>
|
||||
<span class="font-normal text-slate-500"><%= t(".replacement_group_hint") %></span></summary>
|
||||
<div class="grid gap-4 border-t border-slate-200 p-3 sm:grid-cols-3">
|
||||
<%= f.field :replacement_hours, as: :number, label: t(".replace_every_hrs") %>
|
||||
<%= f.interval :replacement, label: t(".replace_every") %>
|
||||
<%= f.field :replacement_from_install, as: :select, label: t(".replacement_counts_from"),
|
||||
collection: [ [ t(".last_service"), false ], [ t(".installation_life_limit"), true ] ],
|
||||
hint: t(".installation_for_a_part_that") %>
|
||||
<%= f.field :replacement_critical, as: :checkbox, label: t(".replacement_critical"), hint: t(".overdue_replacement_or_expiry_grounds") %>
|
||||
<%= f.field :expires_on, as: :date, label: t(".expires_on"),
|
||||
hint: t(".the_date_marked_on_the") %>
|
||||
</div>
|
||||
<p class="hint sm:col-span-3"><%= t(".recurring_inspections_of_this_part") %></p>
|
||||
</fieldset>
|
||||
</details>
|
||||
<details class="rounded-md ring-1 ring-slate-200" <%= "open" if tbo_open %>>
|
||||
<summary class="cursor-pointer px-3 py-2 text-sm font-semibold text-slate-900"><%= t(".tbo_group") %>
|
||||
<span class="font-normal text-slate-500"><%= t(".tbo_group_hint") %></span></summary>
|
||||
<div class="grid gap-4 border-t border-slate-200 p-3 sm:grid-cols-3">
|
||||
<%= f.field :tbo_hours, as: :number, label: t(".tbo_hrs") %>
|
||||
<%= f.interval :tbo, label: t(".tbo_calendar") %>
|
||||
<%= f.field :overhaul_kind, as: :select, label: t(".overhaul_type"), include_blank: "—", collection: Component::OVERHAUL_KINDS.invert,
|
||||
hint: t(".for_engines_and_propellers_printed") %>
|
||||
<%= f.field :tbo_critical, as: :checkbox, label: t(".treat_tbo_as_a_hard"), hint: t(".under_part_91_tbo_is") %>
|
||||
<%= f.field :on_condition, as: :checkbox, label: t(".on_condition_part_91"), hint: t(".run_past_tbo_based_on") %>
|
||||
</div>
|
||||
</details>
|
||||
<p class="hint"><%= t(".recurring_inspections_of_this_part") %></p>
|
||||
|
||||
<%= f.field :notes, as: :textarea, rows: 3 %>
|
||||
<div class="flex gap-2">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<%= form_with model: [aircraft, document], class: "card card-body space-y-4 max-w-3xl", multipart: true do |f| %>
|
||||
<%= form_with model: [aircraft, document], class: "card card-body space-y-4 max-w-3xl", multipart: true, data: { controller: "name-from-file" } do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<%= f.field :name, required: true %>
|
||||
<%= f.field :name, required: true, data: { name_from_file_target: "name" } %>
|
||||
<%= f.field :doc_type, as: :select, label: t(".type"), collection: Document::TYPES.invert %>
|
||||
<%= f.field :document_collection_id, as: :select, label: t(".collection"),
|
||||
collection: [[t(".none"), nil]] + aircraft.document_collections.ordered.map { [_1.name, _1.id] } %>
|
||||
@@ -14,7 +14,7 @@
|
||||
hint: t(".optional_registration_good_for_7") %>
|
||||
<%= f.field :description, as: :textarea, rows: 2 %>
|
||||
<%= f.field :pages, as: :file, multiple: true, label: document.persisted? ? t(".add_files") : t(".files"),
|
||||
hint: t(".images_pdfs_or_text_up", max_upload_mb: Setting.max_upload_mb) %>
|
||||
hint: t(".images_pdfs_or_text_up", max_upload_mb: Setting.max_upload_mb), data: { name_from_file_target: "file", action: "name-from-file#fill" } %>
|
||||
<% if document.persisted? && document.pages.any? %>
|
||||
<div>
|
||||
<p class="label"><%= t(".remove_existing_files") %></p>
|
||||
|
||||
@@ -39,5 +39,9 @@
|
||||
<%= f.field :engine_data, as: :file, label: t(".engine_monitor_data"), hint: t(".cgr_30p_cgr_30c_flight"), accept: ".csv,text/csv" %>
|
||||
</div>
|
||||
<p class="hint"><%= t(".saving_adds_the_tach_time") %></p>
|
||||
<div class="flex gap-2"><%= f.submit t(".log_flight") %><%= link_to t(".cancel"), aircraft_flight_logs_path(@aircraft), class: "btn-secondary" %></div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<%= f.submit t(".log_flight") %>
|
||||
<%= f.submit t(".log_and_next_leg"), name: "next_leg", class: "btn-secondary", title: t(".log_and_next_leg_title") %>
|
||||
<%= link_to t(".cancel"), aircraft_flight_logs_path(@aircraft), class: "btn-secondary" %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= form_with model: [aircraft, entry], class: "card card-body space-y-4 max-w-3xl", data: { controller: "entry-template signer component-times", component_times_aircraft_hours_value: aircraft.current_hours.to_f } do |f| %>
|
||||
<%= form_with model: [aircraft, entry], class: "card card-body space-y-4 max-w-3xl", data: { controller: "entry-template signer component-times show-when", component_times_aircraft_hours_value: aircraft.current_hours.to_f } do |f| %>
|
||||
<%= f.errors_summary %>
|
||||
<% if entry.supersedes %>
|
||||
<%= f.hidden_field :supersedes_id %>
|
||||
@@ -25,7 +25,8 @@
|
||||
<%= f.field :date, as: :date %>
|
||||
<%= f.field :log_type, as: :select, label: t(".logbook"), collection: LogbookEntry::LOG_TYPES.invert,
|
||||
data: { component_times_target: "logType", entry_template_target: "logType", action: "component-times#logTypeChanged" } %>
|
||||
<%= f.field :entry_type, as: :select, label: t(".entry_type"), collection: LogbookEntry::ENTRY_TYPES.invert, data: { entry_template_target: "entryType" } %>
|
||||
<%= f.field :entry_type, as: :select, label: t(".entry_type"), collection: LogbookEntry::ENTRY_TYPES.invert,
|
||||
data: { entry_template_target: "entryType", show_when_target: "source", action: "show-when#update" } %>
|
||||
<%= f.field :aircraft_hours_at_entry, as: :number, step: 0.1, label: t(".airframe_total_time"),
|
||||
data: { component_times_target: "airframe", action: "input->component-times#airframeChanged" } %>
|
||||
</div>
|
||||
@@ -57,8 +58,10 @@
|
||||
<%= f.field :signoff_certificate_number, label: t(".certificate_number"), placeholder: "e.g. 1234567", data: { signer_target: "number" } %>
|
||||
</div>
|
||||
<div class="grid gap-4 sm:grid-cols-2">
|
||||
<%= f.field :inspection_result, as: :select, label: t(".inspection_result"), include_blank: t(".not_an_inspection"),
|
||||
collection: LogbookEntry::INSPECTION_RESULTS.invert, hint: t(".for_inspection_entries_43_11") %>
|
||||
<div data-show-when-target="item" data-show-when-value="INSPECTION">
|
||||
<%= f.field :inspection_result, as: :select, label: t(".inspection_result"), include_blank: t(".not_an_inspection"),
|
||||
collection: LogbookEntry::INSPECTION_RESULTS.invert, hint: t(".for_inspection_entries_43_11") %>
|
||||
</div>
|
||||
<%= f.field :signoff_location, label: t(".location_shop") %>
|
||||
<%= f.field :document_id, as: :select, label: t(".scanned_page_document"), collection: document_options(aircraft) %>
|
||||
<%= f.field :page_number, as: :number, label: t(".page_in_document") %>
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
<%= form_with model: [aircraft, squawk], multipart: true, class: "card card-body space-y-4 max-w-2xl",
|
||||
data: (squawk.new_record? ? { controller: "offline-form", offline_form_kind_value: "squawk", offline_form_tail_value: aircraft.tail_number,
|
||||
action: "submit->offline-form#submit turbo:submit-start->offline-form#remember turbo:fetch-request-error->offline-form#networkFailed turbo:before-fetch-response->offline-form#gatewayFailed" } : {}) do |f| %>
|
||||
data: (squawk.new_record? ? { controller: "offline-form show-when", offline_form_kind_value: "squawk", offline_form_tail_value: aircraft.tail_number,
|
||||
action: "submit->offline-form#submit turbo:submit-start->offline-form#remember turbo:fetch-request-error->offline-form#networkFailed turbo:before-fetch-response->offline-form#gatewayFailed" } : { controller: "show-when" }) do |f| %>
|
||||
<% if squawk.new_record? %>
|
||||
<%= f.hidden_field :client_key, data: { offline_form_target: "key" } %>
|
||||
<div class="hidden rounded-md bg-sky-50 px-3 py-2 text-sm text-sky-900 ring-1 ring-sky-200" data-offline-form-target="notice" role="status"></div>
|
||||
<% end %>
|
||||
<%= f.errors_summary %>
|
||||
<%= f.field :priority, as: :select, collection: Squawk::PRIORITIES.invert, hint: t(".ground_aircraft_makes_the_aircraft") %>
|
||||
<%= f.field :priority, as: :select, collection: Squawk::PRIORITIES.invert, hint: t(".ground_aircraft_makes_the_aircraft"),
|
||||
data: { show_when_target: "source", action: "show-when#update" } %>
|
||||
<p class="rounded-md bg-red-50 px-3 py-2 text-sm text-red-800 ring-1 ring-red-200" role="alert" data-show-when-target="item" data-show-when-value="0" hidden>
|
||||
<%= t(".grounding_warning", tail_number: aircraft.tail_number) %>
|
||||
</p>
|
||||
<%= f.field :issue_reported, as: :textarea, label: t(".issue"), required: true, autofocus: true %>
|
||||
<%= f.field :component_id, as: :select, label: t(".component_optional"), collection: component_options(aircraft) %>
|
||||
<%= f.field :attachments, as: :file, multiple: true, label: squawk.attachments.attached? ? t(".add_photos_files") : t(".photos_files"),
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<section class="card">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title"><%= t(".open_squawks") %></h2>
|
||||
<%= link_to t(".report_squawk"), new_aircraft_squawk_path(@aircraft), class: "btn-primary" %>
|
||||
</div>
|
||||
<% if @active.any? %><%= render "squawks/table", squawks: @active, aircraft: @aircraft %><% else %><%= empty_state t(".no_open_squawks") %><% end %>
|
||||
</section>
|
||||
|
||||
Reference in new issue
Block a user