mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Printable logbook entries (PDF) for the paper logbook
- Print one entry or several (tick them on the logbook list) as a PDF: Avery 5164/8164 or 5163/8163 adhesive labels (start at any label on a partly used sheet), or half-letter / letter pages - Each entry has the aircraft and serial, log, date, total time in service, the work, the signer's name and certificate, and a blank line to sign by hand; inspection entries with a recorded result get the 43.11(a)(5) statement unless the text already certifies - Labels: long entries shrink to fit, then continue on the next label. Pages: entries follow one another with their signature lines, numbered - Generated with Prawn (built-in fonts; unsupported characters become ?) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6cab81332e
commit
5584ad59c5
10 files changed
+366
-8
No files matched your search
@@ -0,0 +1,24 @@
|
||||
# Logbook entries as a PDF to print on labels or pages and put in the paper
|
||||
# logbook (where they're signed by hand).
|
||||
class LogbookPrintsController < ApplicationController
|
||||
include AircraftScoped
|
||||
before_action :set_entries
|
||||
|
||||
def new
|
||||
@layout = params[:layout].presence || "avery_5164"
|
||||
end
|
||||
|
||||
def show
|
||||
pdf = LogbookEntryPdf.new(@aircraft, @entries, layout: params[:layout], start_at: params[:start_at])
|
||||
log_event("logbook", "Logbook entries printed (#{@entries.size})")
|
||||
send_data pdf.render, filename: pdf.filename, type: "application/pdf", disposition: "inline"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
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
|
||||
redirect_to aircraft_logbook_entries_path(@aircraft), alert: "Choose the entries to print." if @entries.empty?
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user