asxpio/views/invoice_public.erb
Sergei Poljanski eeac07ed34
invoices: cancel with stamped PDF, superuser-only hiding
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
2026-10-10 08:35:01 +04:00

30 lines
1.6 KiB
Text

<div class="header">
<h1>Invoice <%= @invoice.number %></h1>
<p class="tagline">from IE Sergei Poljanski</p>
</div>
<section class="section">
<dl class="kv">
<dt>Billed to</dt><dd><%= @invoice.client_name %></dd>
<dt>Issued</dt><dd class="mono"><%= @invoice.issued_on.strftime('%Y-%m-%d') %></dd>
<dt>Due</dt><dd class="mono"><%= @invoice.due_on.strftime('%Y-%m-%d') %></dd>
<dt>Total</dt><dd class="mono"><%= @invoice.currency %> <%= '%.2f' % @invoice.total %></dd>
<% unless @invoice.currency == 'GEL' %>
<dt>In GEL</dt><dd class="mono">GEL <%= '%.2f' % @invoice.total_gel %> <span class="optional">@ <%= fmt_rate(@invoice.gel_rate) %></span></dd>
<% end %>
<% if @invoice.crypto? && (amt = @invoice.crypto_amount_due) %>
<dt>In <%= @invoice.crypto_coin %></dt><dd class="mono"><%= fmt_crypto(amt) %> <%= @invoice.crypto_coin %><% if @invoice.crypto_rate %> <span class="optional">@ <%= fmt_rate(@invoice.crypto_rate) %> <%= @invoice.currency %></span><% end %></dd>
<% end %>
<dt>Status</dt><dd><span class="badge badge-<%= @invoice.status %>"><%= @invoice.status %></span><% if @invoice.cancelled? %> <span class="optional">This invoice was cancelled and is not payable.</span><% end %></dd>
</dl>
</section>
<section class="section">
<p style="text-align: center;">
<a href="/i/<%= @invoice.uuid %>/pdf" class="download-button">Download PDF</a>
</p>
</section>
<section class="section legal">
<p class="legal-intro">If anything looks wrong, reply to the invoice email or write to <a href="mailto:ie@asxp.io">ie@asxp.io</a>.</p>
</section>