Add donations to user details, link to filtered list
This commit is contained in:
parent
04094efbdb
commit
c94a0e34d1
@ -18,8 +18,8 @@ class Admin::DonationsController < Admin::BaseController
|
||||
@pagy, @donations = pagy(completed_scope)
|
||||
|
||||
@stats = {
|
||||
overall_sats: Donation.completed.sum("amount_sats"),
|
||||
donor_count: Donation.completed.count(:user_id)
|
||||
overall_sats: completed_scope.sum("amount_sats"),
|
||||
donor_count: completed_scope.count(:user_id)
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<%= render QuickstatsContainerComponent.new do %>
|
||||
<%= render QuickstatsItemComponent.new(
|
||||
type: :number,
|
||||
title: 'Overall',
|
||||
title: 'Received',
|
||||
value: @stats[:overall_sats],
|
||||
unit: 'sats'
|
||||
) %>
|
||||
|
@ -23,7 +23,7 @@
|
||||
</section>
|
||||
<% if @invitations_used.any? %>
|
||||
<section>
|
||||
<h3>Recently Accepted</h3>
|
||||
<h3>Accepted</h3>
|
||||
<table class="divided mb-8">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -35,12 +35,25 @@
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<td>
|
||||
<% if @user.is_contributing_member? || @user.is_paying_member? %>
|
||||
<%= @user.is_contributing_member? ? badge("contributor", :green) : "" %>
|
||||
<%= @user.is_paying_member? ? badge("sustainer", :green) : "" %>
|
||||
<% else %>
|
||||
—
|
||||
<% if @user.is_contributing_member? || @user.is_paying_member? %>
|
||||
<%= @user.is_contributing_member? ? badge("contributor", :green) : "" %>
|
||||
<%= @user.is_paying_member? ? badge("sustainer", :green) : "" %>
|
||||
<% else %>
|
||||
—
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Donations</th>
|
||||
<td>
|
||||
<% if @user.donations.any? %>
|
||||
<%= link_to admin_donations_path(username: @user.cn), class: "ks-text-link" do %>
|
||||
<%= @user.donations.completed.count %> for
|
||||
<%= number_with_delimiter @user.donations.completed.sum("amount_sats") %> sats
|
||||
<% end %>
|
||||
<% else %>
|
||||
—
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user