67 lines
2.4 KiB
Plaintext
67 lines
2.4 KiB
Plaintext
<%= render HeaderComponent.new(title: "Donations") %>
|
|
|
|
<%= render MainSimpleComponent.new do %>
|
|
<section>
|
|
<%= render QuickstatsContainerComponent.new do %>
|
|
<%= render QuickstatsItemComponent.new(
|
|
type: :number,
|
|
title: 'Overall',
|
|
value: @stats[:overall_sats],
|
|
unit: 'sats'
|
|
) %>
|
|
<%= render QuickstatsItemComponent.new(
|
|
type: :number,
|
|
title: 'Donors',
|
|
value: @stats[:donor_count],
|
|
meta: "/ #{User.count} users"
|
|
) %>
|
|
<% end %>
|
|
</section>
|
|
|
|
<section>
|
|
<% if @donations.any? %>
|
|
<h3>Recent Donations</h3>
|
|
<table class="divided mb-8">
|
|
<thead>
|
|
<tr>
|
|
<th>User</th>
|
|
<th class="text-right">Amount BTC</th>
|
|
<th class="text-right">in EUR</th>
|
|
<th class="text-right">in USD</th>
|
|
<th class="pl-2">Public name</th>
|
|
<th>Date</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @donations.each do |donation| %>
|
|
<tr>
|
|
<td><%= link_to donation.user.address, admin_user_path(donation.user.address), class: 'ks-text-link' %></td>
|
|
<td class="text-right"><%= sats_to_btc donation.amount_sats %></td>
|
|
<td class="text-right"><% if donation.amount_eur.present? %><%= number_to_currency donation.amount_eur / 100, unit: "" %><% end %></td>
|
|
<td class="text-right"><% if donation.amount_usd.present? %><%= number_to_currency donation.amount_usd / 100, unit: "" %><% end %></td>
|
|
<td class="pl-2"><%= donation.public_name %></td>
|
|
<td><%= donation.paid_at ? donation.paid_at.strftime("%Y-%m-%d (%H:%M UTC)") : "" %></td>
|
|
<td class="text-right">
|
|
<%= link_to 'Show', admin_donation_path(donation), class: 'btn btn-sm btn-gray' %>
|
|
<%= link_to 'Edit', edit_admin_donation_path(donation), class: 'btn btn-sm btn-gray' %>
|
|
<%= link_to 'Destroy', admin_donation_path(donation), class: 'btn btn-sm btn-red',
|
|
data: { turbo_method: :delete, turbo_confirm: 'Are you sure?' } %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
<%== pagy_nav @pagy %>
|
|
<% else %>
|
|
<p>
|
|
No donations yet.
|
|
</p>
|
|
<% end %>
|
|
</section>
|
|
|
|
<p class="mt-12">
|
|
<%= link_to 'Record an out-of-system donation', new_admin_donation_path, class: 'btn-md btn-gray' %>
|
|
</p>
|
|
<% end %>
|