ERP/templates/invoices/list.html
2026-02-06 17:35:29 +01:00

68 lines
3.7 KiB
HTML

{{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">Invoices</h1>
</div>
<!-- Status Filter -->
<div class="flex space-x-2">
<a href="/invoices"
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="/invoices?status=pending"
class="{{if eq .FilterStatus "pending"}}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">Pending</a>
<a href="/invoices?status=paid"
class="{{if eq .FilterStatus "paid"}}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">Paid</a>
</div>
<div id="invoice-table">
{{template "invoice-table" .}}
</div>
</div>
{{end}}
{{define "invoice-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">Invoice #</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">Status</th>
<th class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">Due Date</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 .Invoices}}
{{range .Invoices}}
<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="/invoices/{{.ID}}">{{.InvoiceNumber}}</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">{{statusBadge .Status}}</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{{formatDate .DueDate}}</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-900 text-right">{{formatMoney .Amount}}</td>
<td class="whitespace-nowrap px-3 py-4 text-sm">
<a href="/invoices/{{.ID}}" class="text-indigo-600 hover:text-indigo-900">View</a>
{{if eq .Status "pending"}}
<button class="ml-2 text-green-600 hover:text-green-900"
hx-post="/invoices/{{.ID}}/pay"
hx-confirm="Mark this invoice as paid?">Mark Paid</button>
{{end}}
</td>
</tr>
{{end}}
{{else}}
<tr>
<td colspan="6" class="px-3 py-8 text-center text-sm text-gray-500">No invoices found. Invoices are auto-generated when orders are fulfilled.</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}