mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
49 lines
2.8 KiB
ERB
49 lines
2.8 KiB
ERB
<% content_for :title, "#{@aircraft.tail_number} Documents" %>
|
||
<%= render "shared/aircraft_header", aircraft: @aircraft %>
|
||
<div class="mb-4 flex flex-wrap justify-end gap-2">
|
||
<% if owner? %>
|
||
<%= link_to "+ Collection", new_aircraft_document_collection_path(@aircraft), class: "btn-secondary" %>
|
||
<%= link_to "Bulk Upload", new_bulk_aircraft_documents_path(@aircraft), class: "btn-secondary" %>
|
||
<%= link_to "+ Upload Document", new_aircraft_document_path(@aircraft), class: "btn-primary" %>
|
||
<% end %>
|
||
</div>
|
||
<% if @collections.empty? && @uncollected.empty? %>
|
||
<div class="card"><%= empty_state "No documents yet. Upload logbook scans, 337s, weight & balance, receipts…" %></div>
|
||
<% end %>
|
||
<div class="space-y-5">
|
||
<% @collections.each do |col| %>
|
||
<details class="card group document-collection">
|
||
<summary class="card-header cursor-pointer list-none border-b-0 group-open:border-b [&::-webkit-details-marker]:hidden">
|
||
<div class="flex min-w-0 items-start gap-2">
|
||
<span aria-hidden="true" class="mt-0.5 text-slate-400 transition group-open:rotate-90">›</span>
|
||
<div class="min-w-0">
|
||
<h2 class="card-title"><%= "★ " if col.starred? %><%= col.name %> <span class="text-sm font-normal text-slate-500">(<%= col.documents.size %>)</span></h2>
|
||
<% if col.description.present? %><p class="text-xs text-slate-500"><%= col.description %></p><% end %>
|
||
</div>
|
||
</div>
|
||
<div class="flex items-center gap-2">
|
||
<%= visibility_badge(col.visibility) %>
|
||
<% if owner? %>
|
||
<%= link_to "+ Document", new_aircraft_document_path(@aircraft, collection_id: col.id), class: "btn-secondary btn-sm" %>
|
||
<%= link_to "Edit", edit_aircraft_document_collection_path(@aircraft, col), class: "btn-secondary btn-sm" %>
|
||
<% end %>
|
||
</div>
|
||
</summary>
|
||
<% if col.documents.any? %>
|
||
<ul class="divide-y divide-slate-100"><% col.documents.sort_by(&:name).each do |doc| %><%= render "documents/doc_row", doc: doc, aircraft: @aircraft %><% end %></ul>
|
||
<% else %><%= empty_state "Empty collection." %><% end %>
|
||
</details>
|
||
<% end %>
|
||
<% if @uncollected.any? %>
|
||
<details class="card group document-collection">
|
||
<summary class="card-header cursor-pointer list-none border-b-0 group-open:border-b [&::-webkit-details-marker]:hidden">
|
||
<div class="flex items-start gap-2">
|
||
<span aria-hidden="true" class="mt-0.5 text-slate-400 transition group-open:rotate-90">›</span>
|
||
<h2 class="card-title">Uncollected <span class="text-sm font-normal text-slate-500">(<%= @uncollected.size %>)</span></h2>
|
||
</div>
|
||
</summary>
|
||
<ul class="divide-y divide-slate-100"><% @uncollected.each do |doc| %><%= render "documents/doc_row", doc: doc, aircraft: @aircraft %><% end %></ul>
|
||
</details>
|
||
<% end %>
|
||
</div>
|