Files
simple-aircraft-manager-rails/app/views/logbook_entries/_draft_batch.html.erb
T
rickyandClaude Opus 5.5 e4c27c6ff7 API: draft logbook entries for signing
- POST /aircraft/:id/draft_batches turns a visit's work items into one
  unsigned entry per logbook, signed in the app (by a user with a
  certificate, or a mechanic through a returned or emailed invitation link).
- The squawks they resolve and inspections they complete (with their result)
  are held until every entry is signed, then applied, attributed to the last
  signer; draft_batch.completed webhook. A draft never clears a squawk alone.
- Drafts are for owners (integrations act for one, drafts:write scope);
  unsigned drafts can be withdrawn; lookup by external_ref.
- The signing and entry pages show where a draft came from and what signing
  will do.
- The suggested recordkeeping procedures describe the API once it's in use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 19:11:38 -05:00

17 lines
1.1 KiB
ERB

<%# An entry sent through the API as a draft: where it came from and what
signing will do (held until every entry of the draft is signed). Locals: entry. %>
<% batch = entry.draft_batch %>
<% if batch %>
<% effects = batch.awaiting? ? batch.held_effects_for(entry) : { squawks: [], inspections: [] } %>
<div class="rounded-md bg-sky-50 px-3 py-2 text-sm text-sky-900 ring-1 ring-sky-200">
<p><%= t(".from", name: batch.api_token&.name || t(".the_api"), person: batch.created_by&.display_name || "—", ref: batch.external_ref.presence || "—") %></p>
<% if effects[:squawks].any? || effects[:inspections].any? %>
<p class="mt-1 font-medium"><%= t(batch.entries.size > 1 ? ".when_all_signed" : ".when_signed", count: batch.entries.size) %></p>
<ul class="mt-1 list-disc pl-5">
<% effects[:squawks].each do |s| %><li><%= t(".resolves", issue: s.issue_reported.truncate(120)) %></li><% end %>
<% effects[:inspections].each do |type| %><li><%= t(".completes", name: type.name) %></li><% end %>
</ul>
<% end %>
</div>
<% end %>