asxpio/views/admin/invoices/index.erb
Sergei Poljanski 1dd8f9081f
All checks were successful
Build and Deploy to Production / test (push) Successful in 26s
Build and Deploy to Production / build (push) Successful in 59s
Build and Deploy to Production / deploy (push) Successful in 38s
invoices: payout addresses in the database
Default crypto payout addresses lived in the CRYPTO_ADDRESSES and
LTC_ADDRESS Forgejo secrets, so changing one meant editing a secret and
redeploying. Keep them in a payout_addresses table edited at
/admin/invoices/payout-addresses (read to view, write to change, every
change audited), and prefill the new-invoice form from it.

The old env values are imported once on the first boot with an empty
table, so the current addresses carry over; after that the secrets can
be removed.

Assisted-by: Claude:opus-5
2026-10-10 08:36:32 +04:00

42 lines
1.7 KiB
Text

<%== erb :'admin/_nav', layout: false %>
<div class="header">
<h1>Invoices</h1>
<p class="tagline"><% if can?('invoices', 'write') %><a href="/admin/invoices/new">+ New invoice</a> · <% end %><a href="/admin/invoices/payout-addresses">payout addresses</a></p>
</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 %>