mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
Logbook entries link a component and its times; boxed page printouts
- An entry can link a component (engine, propeller…) and records its total time and time since overhaul at the entry; picking the engine or prop log selects that component and fills its current times (editable). Squawk fixes carry the squawk's component - Components have an overhaul type (major, factory overhaul, factory new), shown as SMOH / SFOH / SNEW - Printouts: engine and propeller entries add the serial number, total time and SMOH/SFOH (blanks when no component is linked); airframe total time is labelled as such; full-page layouts draw a box around each entry - Archives carry the entry's component and times (the original format's components / component_hours), no longer dropped on import Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aa262065b2
commit
a51f78ebf3
21 files changed
+265
-83
No files matched your search
@@ -76,7 +76,7 @@ class ComponentsController < ApplicationController
|
||||
params.require(:component).permit(
|
||||
:component_type_id, :parent_component_id, :manufacturer, :model, :serial_number,
|
||||
:install_location, :notes, :status, :date_in_service, :hours_in_service,
|
||||
:hours_since_overhaul, :overhaul_date, :tbo_hours, :tbo_days, :inspection_hours,
|
||||
:hours_since_overhaul, :overhaul_date, :overhaul_kind, :tbo_hours, :tbo_days, :inspection_hours,
|
||||
:inspection_days, :replacement_hours, :replacement_days, :tbo_critical, :on_condition,
|
||||
:inspection_critical, :replacement_critical, :expires_on
|
||||
).tap do |p|
|
||||
|
||||
@@ -63,8 +63,10 @@ class LogbookEntriesController < ApplicationController
|
||||
def entry_params
|
||||
p = params.require(:logbook_entry).permit(:log_type, :entry_type, :date, :text, :signoff_person,
|
||||
:signoff_location, :aircraft_hours_at_entry, :document_id, :page_number,
|
||||
:signoff_certificate_type, :signoff_certificate_number, :inspection_result, :verified)
|
||||
:signoff_certificate_type, :signoff_certificate_number, :inspection_result, :verified,
|
||||
:component_id, :component_hours_at_entry, :component_since_overhaul_at_entry)
|
||||
p[:document_id] = scoped_id(@aircraft.documents, p[:document_id])
|
||||
p[:component_id] = scoped_id(@aircraft.components, p[:component_id]) if p.key?(:component_id)
|
||||
p
|
||||
end
|
||||
end
|
||||
@@ -18,7 +18,7 @@ class LogbookPrintsController < ApplicationController
|
||||
|
||||
def set_entries
|
||||
ids = Array(params[:ids]).map(&:to_i).first(200)
|
||||
@entries = @aircraft.logbook_entries.where(id: ids).includes(inspection_records: :inspection_type).order(:date, :id).to_a
|
||||
@entries = @aircraft.logbook_entries.where(id: ids).includes(:component, inspection_records: :inspection_type).order(:date, :id).to_a
|
||||
redirect_to aircraft_logbook_entries_path(@aircraft), alert: "Choose the entries to print." if @entries.empty?
|
||||
end
|
||||
end
|
||||
@@ -42,7 +42,11 @@ class SquawksController < ApplicationController
|
||||
def resolution
|
||||
@entry = @aircraft.logbook_entries.new(date: Date.current, entry_type: "MAINTENANCE", log_type: "AC",
|
||||
aircraft_hours_at_entry: @aircraft.current_hours,
|
||||
text: "Corrected: #{@squawk.issue_reported}")
|
||||
text: "Corrected: #{@squawk.issue_reported}", component: @squawk.component,
|
||||
component_hours_at_entry: @squawk.component&.hours_in_service,
|
||||
component_since_overhaul_at_entry: @squawk.component&.hours_since_overhaul)
|
||||
@entry.log_type = "ENG" if @squawk.component&.engine?
|
||||
@entry.log_type = "PROP" if @squawk.component&.propeller?
|
||||
end
|
||||
|
||||
def resolve
|
||||
@@ -95,8 +99,11 @@ class SquawksController < ApplicationController
|
||||
def set_squawk = @squawk = @aircraft.squawks.find(params[:id])
|
||||
|
||||
def resolution_entry_params
|
||||
params.require(:logbook_entry).permit(:date, :log_type, :text, :aircraft_hours_at_entry, :signoff_person,
|
||||
:signoff_certificate_type, :signoff_certificate_number, :signoff_location)
|
||||
p = params.require(:logbook_entry).permit(:date, :log_type, :text, :aircraft_hours_at_entry, :signoff_person,
|
||||
:signoff_certificate_type, :signoff_certificate_number, :signoff_location,
|
||||
:component_id, :component_hours_at_entry, :component_since_overhaul_at_entry)
|
||||
p[:component_id] = scoped_id(@aircraft.components, p[:component_id]) if p.key?(:component_id)
|
||||
p
|
||||
end
|
||||
|
||||
# Adds uploads and drops ticked files in one change, so nothing is saved
|
||||
|
||||
Reference in new issue
Block a user