An invoice issued by mistake could only be left pending or marked paid. Add cancel (with an optional reason) and reinstate. Cancelling renders a third PDF variant with a diagonal CANCELLED stamp and the date/reason, and it becomes the current one, so the client's link and download show the invoice as void. Cancelled wins over paid in the status, and marking a cancelled invoice paid is refused. Superusers can also hide an invoice: it disappears from the admin list, dashboard and invoice pages for every other user, while the client's public link keeps working. Assisted-by: Claude:opus-5
42 lines
1.7 KiB
Text
42 lines
1.7 KiB
Text
<%== erb :'admin/_nav', layout: false %>
|
|
<div class="header">
|
|
<h1>Invoices</h1>
|
|
<% if can?('invoices', 'write') %><p class="tagline"><a href="/admin/invoices/new">+ New invoice</a></p><% end %>
|
|
</div>
|
|
|
|
<% if @invoices.empty? %>
|
|
<section class="section">
|
|
<p>No invoices yet.<% if can?('invoices', 'write') %> <a href="/admin/invoices/new">Create the first one</a>.<% end %></p>
|
|
</section>
|
|
<% else %>
|
|
<section class="section">
|
|
<table class="invoice-list">
|
|
<thead>
|
|
<tr>
|
|
<th>Number</th>
|
|
<th>Client</th>
|
|
<th>Issued</th>
|
|
<th class="num">Total</th>
|
|
<th>Status</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @invoices.each do |inv| %>
|
|
<tr>
|
|
<td class="mono"><%= inv.number %><% if inv.hidden %> <span class="badge badge-hidden">hidden</span><% end %></td>
|
|
<td><%= inv.client_name %></td>
|
|
<td class="mono"><%= inv.issued_on.strftime('%Y-%m-%d') %></td>
|
|
<td class="num mono"><%= inv.currency %> <%= '%.2f' % inv.total %></td>
|
|
<td>
|
|
<span class="badge badge-<%= inv.status %>"><%= inv.status %></span>
|
|
</td>
|
|
<td class="actions">
|
|
<a href="/admin/invoices/<%= inv.uuid %>">view</a>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
<% end %>
|