mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- 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>
44 lines
3.4 KiB
ERB
44 lines
3.4 KiB
ERB
<% content_for :title, "#{@aircraft.tail_number} Logbook" %>
|
|
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
<section class="card">
|
|
<div class="card-header">
|
|
<h2 class="card-title">Maintenance Logbook</h2>
|
|
<div class="flex flex-wrap items-center gap-2">
|
|
<%= form_with url: aircraft_logbook_entries_path(@aircraft), method: :get, class: "flex w-full flex-wrap gap-2 sm:w-auto" do |f| %>
|
|
<%= f.search_field :q, value: @query, placeholder: "Search entries…", class: "input min-w-0 flex-1 sm:w-48 sm:flex-none" %>
|
|
<%= f.select :log_type, LogbookEntry::LOG_TYPES.invert, { include_blank: "All logs", selected: @log_type }, class: "input w-32" %>
|
|
<% if @unverified_count.positive? || @unverified_only %>
|
|
<label class="flex items-center gap-1 text-sm text-slate-700"><%= f.check_box :unverified, { checked: @unverified_only }, "1", nil %> Unverified (<%= @unverified_count %>)</label>
|
|
<% 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><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"><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>
|
|
<td class="max-w-xl"><%= e.text.truncate(220) %> <%= "📄" if e.document %>
|
|
<% unless e.verified? %><span class="badge-orange" title="Transcribed by Claude<%= " (#{e.transcription_confidence} confidence)" if e.transcription_confidence %>; check it against the scan">Unverified</span><% end %></td>
|
|
<td class="text-xs text-slate-500"><%= e.signoff_person %><%= " ##{e.signoff_certificate_number}" if e.signoff_certificate_number %><% if e.signoff_location.present? %><br><%= e.signoff_location %><% end %>
|
|
<% if (missing = e.missing_record_items).any? %><br><span class="badge-orange" title="Missing: <%= missing.to_sentence %>">Incomplete</span><% end %></td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<% else %>
|
|
<%= empty_state(@query.present? ? "No entries match “#{@query}”." : "No logbook entries yet.") %>
|
|
<% end %>
|
|
</section>
|