ERP/templates/orders/list.html

108 lines
6.5 KiB
HTML
Raw Permalink Normal View History

2026-02-06 17:35:29 +01:00
{{define "content"}}
<div class="space-y-6">
<div class="sm:flex sm:items-center sm:justify-between">
<h1 class="text-2xl font-bold text-gray-900">Orders</h1>
<a href="/orders/new" class="inline-flex items-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500">
+ New Order
</a>
</div>
<!-- Status Filter -->
<div class="flex space-x-2">
<a href="/orders"
class="{{if eq .FilterStatus ""}}bg-indigo-100 text-indigo-700{{else}}bg-white text-gray-700 hover:bg-gray-50{{end}} rounded-md px-3 py-1.5 text-sm font-medium ring-1 ring-inset ring-gray-300">All</a>
<a href="/orders?status=draft"
class="{{if eq .FilterStatus "draft"}}bg-indigo-100 text-indigo-700{{else}}bg-white text-gray-700 hover:bg-gray-50{{end}} rounded-md px-3 py-1.5 text-sm font-medium ring-1 ring-inset ring-gray-300">Draft</a>
<a href="/orders?status=confirmed"
class="{{if eq .FilterStatus "confirmed"}}bg-indigo-100 text-indigo-700{{else}}bg-white text-gray-700 hover:bg-gray-50{{end}} rounded-md px-3 py-1.5 text-sm font-medium ring-1 ring-inset ring-gray-300">Confirmed</a>
<a href="/orders?status=fulfilled"
class="{{if eq .FilterStatus "fulfilled"}}bg-indigo-100 text-indigo-700{{else}}bg-white text-gray-700 hover:bg-gray-50{{end}} rounded-md px-3 py-1.5 text-sm font-medium ring-1 ring-inset ring-gray-300">Fulfilled</a>
<a href="/orders?status=cancelled"
class="{{if eq .FilterStatus "cancelled"}}bg-indigo-100 text-indigo-700{{else}}bg-white text-gray-700 hover:bg-gray-50{{end}} rounded-md px-3 py-1.5 text-sm font-medium ring-1 ring-inset ring-gray-300">Cancelled</a>
</div>
<div id="order-table">
{{template "order-table" .}}
</div>
</div>
{{end}}
{{define "order-table"}}
<div class="overflow-hidden bg-white shadow ring-1 ring-black ring-opacity-5 sm:rounded-lg">
<table class="min-w-full divide-y divide-gray-300">
<thead class="bg-gray-50">
<tr>
<th class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900">Order #</th>
<th class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Customer</th>
<th class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Date</th>
<th class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Status</th>
<th class="px-3 py-3.5 text-right text-sm font-semibold text-gray-900">Amount</th>
<th class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 bg-white">
{{if .Orders}}
{{range .Orders}}
<tr class="hover:bg-gray-50">
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-indigo-600">
<a href="/orders/{{.ID}}">#{{.ID}}</a>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900">
<a href="/customers/{{.CustomerID}}" class="hover:text-indigo-600">{{.CustomerName}}</a>
</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{{formatDate .OrderDate}}</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">{{statusBadge .Status}}</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900 text-right">{{formatMoney .TotalAmount}}</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<a href="/orders/{{.ID}}" class="text-indigo-600 hover:text-indigo-900">View</a>
</td>
</tr>
{{end}}
{{else}}
<tr>
<td colspan="6" class="px-3 py-8 text-center text-sm text-gray-500">No orders found. <a href="/orders/new" class="text-indigo-600 hover:text-indigo-500">Create one</a>.</td>
</tr>
{{end}}
</tbody>
</table>
</div>
2026-02-07 07:47:20 +01:00
<div class="mt-4 flex items-center justify-between border-t border-gray-200 bg-white px-4 py-3 sm:px-6">
<div class="hidden sm:flex sm:flex-1 sm:items-center sm:justify-between">
<div>
<p class="text-sm text-gray-700">
Page <span class="font-medium">{{.Page}}</span> of <span class="font-medium">{{.TotalPages}}</span>
</p>
</div>
<div>
<nav class="isolate inline-flex -space-x-px rounded-md shadow-sm" aria-label="Pagination">
{{if .HasPrev}}
<button
hx-get="/orders?page={{.PrevPage}}{{if .FilterStatus}}&status={{.FilterStatus}}{{end}}&partial=true"
hx-push-url="/orders?page={{.PrevPage}}{{if .FilterStatus}}&status={{.FilterStatus}}{{end}}"
2026-02-07 07:47:20 +01:00
hx-target="#order-table"
class="relative inline-flex items-center rounded-l-md px-2 py-2 text-gray-400 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
<span class="sr-only">Previous</span>
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z" clip-rule="evenodd" />
</svg>
</button>
{{end}}
{{if .HasNext}}
<button
hx-get="/orders?page={{.NextPage}}{{if .FilterStatus}}&status={{.FilterStatus}}{{end}}&partial=true"
hx-push-url="/orders?page={{.NextPage}}{{if .FilterStatus}}&status={{.FilterStatus}}{{end}}"
2026-02-07 07:47:20 +01:00
hx-target="#order-table"
class="relative inline-flex items-center rounded-r-md px-2 py-2 text-gray-400 ring-1 ring-inset ring-gray-300 hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
<span class="sr-only">Next</span>
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z" clip-rule="evenodd" />
</svg>
</button>
{{end}}
</nav>
</div>
</div>
</div>
2026-02-06 17:35:29 +01:00
{{end}}