theseus/app/views/warehouse/purchase_orders/index.html.erb
2026-01-15 18:10:35 -05:00

58 lines
2.5 KiB
Text

<% content_for :title, "Purchase Orders" %>
<div class="page-header mb-8 flex justify-between items-center">
<h1 class="text-2xl font-bold">Purchase Orders</h1>
<div class="actions">
<%= success_link_to "Create New Purchase Order", new_warehouse_purchase_order_path do %>
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
</svg>
Create New Purchase Order
<% end %>
</div>
</div>
<div class="orders-container">
<div class="bg-gray-100 rounded-lg border border-gray-200">
<div class="border-b border-gray-200 p-4">
<h2 class="text-xl font-medium">All Purchase Orders</h2>
</div>
<div class="p-6">
<% if @purchase_orders.any? %>
<table class="table-fixed w-full text-left border border-gray-300 border-collapse">
<thead>
<tr>
<th class="border border-gray-300 p-2">ID</th>
<th class="border border-gray-300 p-2">Supplier</th>
<th class="border border-gray-300 p-2">Order #</th>
<th class="border border-gray-300 p-2">Required By</th>
<th class="border border-gray-300 p-2">Status</th>
<th class="border border-gray-300 p-2">Created By</th>
<th class="border border-gray-300 p-2">Created At</th>
</tr>
</thead>
<tbody>
<% @purchase_orders.each do |po| %>
<tr>
<td class="border border-gray-400 p-2">
<%= link_to po.id, warehouse_purchase_order_path(po) %>
</td>
<td class="border border-gray-400 p-2"><%= po.supplier_name %></td>
<td class="border border-gray-400 p-2"><%= po.order_number %></td>
<td class="border border-gray-400 p-2"><%= po.required_by_date&.strftime("%b %d, %Y") %></td>
<td class="border border-gray-400 p-2">
<%= render 'status_badge', purchase_order: po %>
</td>
<td class="border border-gray-400 p-2"><%= po.user&.email %></td>
<td class="border border-gray-400 p-2"><%= po.created_at.strftime("%b %d, %Y") %></td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="text-center py-8">
<p class="text-gray-500">No purchase orders found.</p>
</div>
<% end %>
</div>
</div>
</div>