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
@@ -12,17 +12,19 @@
|
||||
<% end %>
|
||||
<%= f.submit "Filter", class: "btn-secondary" %>
|
||||
<% end %>
|
||||
<% if @entries.any? %><button type="submit" form="print-entries" class="btn-secondary" title="Print the ticked entries on labels or pages for the paper logbook">Print selected</button><% end %>
|
||||
<% if owner? %><%= link_to "Import scans", new_aircraft_logbook_import_path(@aircraft), class: "btn-secondary" %><%= link_to "+ New Entry", new_aircraft_logbook_entry_path(@aircraft), class: "btn-primary" %><% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% if @entries.any? %>
|
||||
<%= form_with url: new_aircraft_logbook_print_path(@aircraft), method: :get, id: "print-entries" do %><% end %>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table">
|
||||
<thead><tr><th>Date</th><th>Log</th><th>Type</th><th class="text-right">Hours</th><th>Entry</th><th>Signed off</th></tr></thead>
|
||||
<thead><tr><th><input type="checkbox" class="mr-1 align-middle" aria-label="Select all entries" data-check-all> Date</th><th>Log</th><th>Type</th><th class="text-right">Hours</th><th>Entry</th><th>Signed off</th></tr></thead>
|
||||
<tbody>
|
||||
<% @entries.each do |e| %>
|
||||
<tr>
|
||||
<td class="whitespace-nowrap"><%= link_to e.date, aircraft_logbook_entry_path(@aircraft, e), class: "link" %></td>
|
||||
<td class="whitespace-nowrap"><input type="checkbox" name="ids[]" value="<%= e.id %>" form="print-entries" class="mr-1 align-middle" aria-label="Select the <%= e.date %> entry"><%= link_to e.date, aircraft_logbook_entry_path(@aircraft, e), class: "link" %></td>
|
||||
<td><span class="badge-gray"><%= LogbookEntry::LOG_TYPES[e.log_type] %></span></td>
|
||||
<td class="text-xs"><%= LogbookEntry::ENTRY_TYPES[e.entry_type] %></td>
|
||||
<td class="text-right tabular-nums"><%= hours(e.aircraft_hours_at_entry) %></td>
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
<section class="card max-w-4xl">
|
||||
<div class="card-header">
|
||||
<h2 class="card-title"><%= LogbookEntry::LOG_TYPES[@entry.log_type] %> log — <%= fmt_date(@entry.date) %></h2>
|
||||
<% if owner? %><%= link_to "Edit", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "btn-secondary btn-sm" %><% end %>
|
||||
<div class="flex gap-2">
|
||||
<%= link_to "Print for logbook", new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "btn-secondary btn-sm" %>
|
||||
<% if owner? %><%= link_to "Edit", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "btn-secondary btn-sm" %><% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body space-y-3">
|
||||
<% unless @entry.verified? %>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<% content_for :title, "Print logbook entries" %>
|
||||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||||
<%= form_with url: aircraft_logbook_print_path(@aircraft, format: :pdf), method: :get, class: "card card-body max-w-2xl space-y-4",
|
||||
data: { turbo: false }, html: { target: "_blank" } do %>
|
||||
<div>
|
||||
<h2 class="card-title">Print for the logbook</h2>
|
||||
<p class="mt-1 text-sm text-slate-600">A PDF of <%= pluralize(@entries.size, "entry") %> to print on adhesive labels or paper and put in <%= @aircraft.tail_number %>'s logbook. Each one has a blank line to sign by hand: a printed entry isn't valid until it's signed.</p>
|
||||
</div>
|
||||
<% @entries.each do |e| %><%= hidden_field_tag "ids[]", e.id, id: nil %><% end %>
|
||||
<ul class="max-h-48 space-y-1 overflow-y-auto rounded-md bg-slate-50 p-3 text-sm">
|
||||
<% @entries.each do |e| %>
|
||||
<li><span class="font-medium"><%= e.date %></span> · <%= LogbookEntry::LOG_TYPES[e.log_type] %> · <%= e.text.truncate(90) %>
|
||||
<% if (missing = e.missing_record_items).any? %><span class="text-xs text-amber-700">(missing <%= missing.to_sentence %>)</span><% end %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<fieldset class="space-y-2 text-sm">
|
||||
<legend class="label">Paper</legend>
|
||||
<% LogbookEntryPdf::LAYOUTS.each do |l| %>
|
||||
<label class="flex items-center gap-2"><%= radio_button_tag :layout, l.key, @layout == l.key %> <%= l.label %></label>
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<div class="max-w-xs">
|
||||
<%= label_tag :start_at, "Start at label", class: "label" %>
|
||||
<%= number_field_tag :start_at, 1, min: 1, max: 10, class: "input w-24" %>
|
||||
<p class="hint">On a partly used label sheet, the first free label, counting across then down.</p>
|
||||
</div>
|
||||
<p class="hint">Print at 100% (“Actual size”), not “Fit to page”, so labels line up. Try a plain sheet first and hold it against the labels.</p>
|
||||
<div class="flex gap-2"><%= submit_tag "Open PDF", class: "btn-primary" %><%= link_to "Back", aircraft_logbook_entries_path(@aircraft), class: "btn-secondary" %></div>
|
||||
<% end %>
|
||||
Reference in new issue
Block a user