asxpio/views/admin/invoices/show.erb
Sergei Poljanski 0fbb6ee809
All checks were successful
Build and Deploy to Production / test (push) Successful in 18s
Build and Deploy to Production / build (push) Successful in 49s
Build and Deploy to Production / deploy (push) Successful in 31s
invoices: multi-crypto payment support
One asset per invoice from a registry (lib/crypto_asset.rb): BTC, LTC,
ETH, XMR, SOL, ALGO, USDT/USDC on ERC-20/TRC-20/BEP-20/Solana/Algorand.
Migration 003 generalizes the ltc_* columns to crypto_* + crypto_coin
(existing LTC invoices backfilled). QR payload adapts per asset: BIP21
amount URIs where supported, bare address for tokens with a network
hint on the PDF. Default addresses come from the CRYPTO_ADDRESSES
secret (JSON code=>address); LTC_ADDRESS still works as legacy.
2026-07-03 02:01:57 +04:00

53 lines
2.4 KiB
Text

<div class="header">
<h1><%= @invoice.number %></h1>
<p class="tagline"><a href="/admin/invoices">← all invoices</a></p>
</div>
<section class="section">
<dl class="kv">
<dt>Client</dt><dd><%= @invoice.client_name %> &lt;<%= @invoice.client_email %>&gt;</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 %><% unless @invoice.currency == 'GEL' %> · GEL <%= '%.2f' % @invoice.total_gel %><% end %></dd>
<dt>Status</dt><dd><span class="badge badge-<%= @invoice.status %>"><%= @invoice.status %></span></dd>
<% if @invoice.paid_at %>
<dt>Paid at</dt><dd class="mono"><%= @invoice.paid_at.utc.strftime('%Y-%m-%d %H:%M UTC') %></dd>
<% end %>
<% if @invoice.crypto? %>
<dt><%= @invoice.crypto_coin %></dt>
<dd class="mono">
<% if (amt = @invoice.crypto_amount_due) %><%= fmt_crypto(amt) %> <%= @invoice.crypto_coin %><% if @invoice.crypto_rate %> @ <%= fmt_rate(@invoice.crypto_rate) %> <%= @invoice.currency %><% end %><br /><% end %>
<span style="word-break:break-all;"><%= @invoice.crypto_address %></span>
</dd>
<% end %>
</dl>
</section>
<section class="section">
<h2>Actions</h2>
<p>
<a href="/i/<%= @invoice.uuid %>" target="_blank">Public landing page</a>
&nbsp;·&nbsp;
<a href="/i/<%= @invoice.uuid %>/pdf" target="_blank">Download PDF</a>
</p>
<p>
Share this URL with the client:<br />
<code class="mono">https://asxp.io/i/<%= @invoice.uuid %></code>
</p>
<form method="post" action="/admin/invoices/<%= @invoice.uuid %>/paid" style="margin-top: 14px;">
<input type="hidden" name="authenticity_token" value="<%= csrf_token %>" />
<button type="submit">
<% if @invoice.paid? %>Mark unpaid<% else %>Mark paid<% end %>
</button>
</form>
<p style="margin-top: 14px;">
<a href="/admin/invoices/<%= @invoice.uuid %>/duplicate">Use as template for a new invoice →</a>
</p>
</section>
<% unless @invoice.notes.to_s.strip.empty? %>
<section class="section">
<h2>Notes</h2>
<p style="white-space: pre-wrap;"><%= @invoice.notes %></p>
</section>
<% end %>