65 lines
2.3 KiB
Plaintext
65 lines
2.3 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">Sats</th>
|
|
<th class="text-right">Fiat Amount</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.cn, admin_user_path(donation.user.cn), class: 'ks-text-link' %></td>
|
|
<td class="text-right"><% if donation.amount_sats.present? %><%= number_with_delimiter donation.amount_sats %><% end %></td>
|
|
<td class="text-right"><% if donation.fiat_amount.present? %><%= number_to_currency donation.fiat_amount.to_f / 100, unit: "" %> <%= donation.fiat_currency %><% 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 %>
|