mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
- 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>
73 lines
5.5 KiB
ERB
73 lines
5.5 KiB
ERB
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
|
<section class="card max-w-4xl">
|
|
<div class="card-header">
|
|
<h2 class="card-title"><%= t(".log_html", log_type: (LogbookEntry::LOG_TYPES[@entry.log_type]), date: (fmt_date(@entry.date))) %></h2>
|
|
<div class="flex gap-2">
|
|
<% if @entry.signed? %>
|
|
<%= link_to t(".print_for_logbook"), new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "btn-secondary btn-sm" %>
|
|
<% if owner? && !@entry.superseded? && !@entry.superseded_by %>
|
|
<%= more_menu(small: true) do %><%= link_to t(".correct_this_entry"), new_aircraft_logbook_entry_path(@aircraft, supersedes: @entry.id), class: "menu-item" %><% end %>
|
|
<% end %>
|
|
<% else %>
|
|
<%= link_to t(".sign"), new_aircraft_logbook_entry_signature_path(@aircraft, @entry), class: "btn-primary btn-sm" %>
|
|
<% if owner? %><%= link_to t(".edit"), edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "btn-secondary btn-sm" %><% end %>
|
|
<%= more_menu(small: true) do %>
|
|
<% if owner? %><%= link_to t(".ask_someone_to_sign"), new_aircraft_logbook_entry_signing_invitation_path(@aircraft, @entry), class: "menu-item" %><% end %>
|
|
<%= link_to t(".print_for_logbook"), new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "menu-item" %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<div class="card-body space-y-3">
|
|
<%= render "logbook_entries/draft_batch", entry: @entry %>
|
|
<% if @entry.signed? %><%= render "logbook_entries/signature", entry: @entry %>
|
|
<% elsif LogbookEntry::RECORD_TYPES.include?(@entry.entry_type) %>
|
|
<p class="rounded-md bg-slate-50 px-3 py-2 text-sm text-slate-600 ring-1 ring-slate-200"><%= t(".not_signed_electronically_sign_it_html", supersedes: (t(".pending_correction_of_the_entry", date: (fmt_date(@entry.supersedes.date))) if @entry.supersedes)) %></p>
|
|
<% end %>
|
|
<% unless @entry.verified? %>
|
|
<div class="flex flex-wrap items-center justify-between gap-2 rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-900 ring-1 ring-amber-200">
|
|
<span><%= t(".transcribed_by_claude_and_not_html", transcription_confidence: (t(".confidence", transcription_confidence: @entry.transcription_confidence) if @entry.transcription_confidence), logbook: (@entry.document ? "" : t(".or_the_paper_logbook"))) %></span>
|
|
<% if owner? %><%= button_to t(".matches_the_scan_mark_verified"), verify_aircraft_logbook_entry_path(@aircraft, @entry), method: :patch, class: "btn-secondary btn-sm" %><% end %>
|
|
</div>
|
|
<% end %>
|
|
<div class="flex flex-wrap gap-4 text-sm text-slate-600">
|
|
<span><%= t(".type_html", entry_type: (LogbookEntry::ENTRY_TYPES[@entry.entry_type])) %></span>
|
|
<span><%= t(".airframe_total_time_html", aircraft_hours_at_entry: (hours(@entry.aircraft_hours_at_entry))) %></span>
|
|
<% if (c = @entry.component) %>
|
|
<span><%= c %> <%= c.model %><%= " S/N #{c.serial_number}" if c.serial_number.present? %>:
|
|
<%= t(".total_html", component_hours_at_entry: (hours(@entry.component_hours_at_entry)), component_since_overhaul_at_entry: (hours(@entry.component_since_overhaul_at_entry)), since_overhaul_abbreviation: c.since_overhaul_abbreviation) %></span>
|
|
<% end %>
|
|
<% @entry.parts.each do |part| %>
|
|
<% pc = part.component %>
|
|
<span><%= pc %> <%= pc.model %><%= " S/N #{pc.serial_number}" if pc.serial_number.present? %>:
|
|
<%= t(".total_2_html", hours_at_entry: (hours(part.hours_at_entry)), since_overhaul_at_entry: (hours(part.since_overhaul_at_entry)), since_overhaul_abbreviation: pc.since_overhaul_abbreviation.downcase) %></span>
|
|
<% end %>
|
|
</div>
|
|
<div class="whitespace-pre-wrap rounded bg-slate-50 p-3 font-mono text-sm"><%= @entry.text %></div>
|
|
<div class="text-sm text-slate-600">
|
|
<%= t(".signed_off_html", signoff_person: (@entry.signoff_person.presence || "—")) %>
|
|
<%= ", #{@entry.certificate_label}" if @entry.certificate_label %><%= " ##{@entry.signoff_certificate_number}" if @entry.signoff_certificate_number %>
|
|
<%= "(#{@entry.signoff_location})" if @entry.signoff_location.present? %>
|
|
</div>
|
|
<% if @entry.inspection_result %><div class="text-sm text-slate-600"><%= t(".result_html", inspection_result_label: @entry.inspection_result_label) %></div><% end %>
|
|
<% if (missing = @entry.missing_record_items).any? %>
|
|
<p class="rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-900 ring-1 ring-amber-200">
|
|
<%= t(".missing_for_html", entry_type: (@entry.entry_type == "INSPECTION" ? "43.11" : "43.9"), items: missing.to_sentence) %>
|
|
<%= link_to(t(".fill_in"), edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "link") if owner? %>
|
|
<%= t(".check_against_the_signed_logbook") %>
|
|
</p>
|
|
<% end %>
|
|
<% if @entry.document %>
|
|
<p class="text-sm"><%= t(".scan_html", link: (link_to @entry.document.name, aircraft_document_path(@aircraft, @entry.document, page: @entry.page_number), class: "link"), page_number: (t(".page", page_number: @entry.page_number) if @entry.page_number)) %></p>
|
|
<% end %>
|
|
</div>
|
|
</section>
|
|
|
|
<% history = (@entry.versions.to_a + @entry.parts.flat_map { _1.versions.to_a } + (@entry.signature ? @entry.signature.versions.to_a : [])).sort_by(&:id).reverse %>
|
|
<% if history.any? %>
|
|
<details class="card mt-5 max-w-4xl">
|
|
<summary class="card-header cursor-pointer"><span class="card-title"><%= t(".change_history_html", history: history.size) %></span></summary>
|
|
<%= render "record_versions/list", versions: history %>
|
|
</details>
|
|
<% end %>
|