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)
|
@pagy, @donations = pagy(completed_scope)
|
||||||
|
|
||||||
@stats = {
|
@stats = {
|
||||||
overall_sats: Donation.completed.sum("amount_sats"),
|
overall_sats: completed_scope.sum("amount_sats"),
|
||||||
donor_count: Donation.completed.count(:user_id)
|
donor_count: completed_scope.count(:user_id)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<%= render QuickstatsContainerComponent.new do %>
|
<%= render QuickstatsContainerComponent.new do %>
|
||||||
<%= render QuickstatsItemComponent.new(
|
<%= render QuickstatsItemComponent.new(
|
||||||
type: :number,
|
type: :number,
|
||||||
title: 'Overall',
|
title: 'Received',
|
||||||
value: @stats[:overall_sats],
|
value: @stats[:overall_sats],
|
||||||
unit: 'sats'
|
unit: 'sats'
|
||||||
) %>
|
) %>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
</section>
|
</section>
|
||||||
<% if @invitations_used.any? %>
|
<% if @invitations_used.any? %>
|
||||||
<section>
|
<section>
|
||||||
<h3>Recently Accepted</h3>
|
<h3>Accepted</h3>
|
||||||
<table class="divided mb-8">
|
<table class="divided mb-8">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -35,12 +35,25 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<td>
|
<td>
|
||||||
<% if @user.is_contributing_member? || @user.is_paying_member? %>
|
<% if @user.is_contributing_member? || @user.is_paying_member? %>
|
||||||
<%= @user.is_contributing_member? ? badge("contributor", :green) : "" %>
|
<%= @user.is_contributing_member? ? badge("contributor", :green) : "" %>
|
||||||
<%= @user.is_paying_member? ? badge("sustainer", :green) : "" %>
|
<%= @user.is_paying_member? ? badge("sustainer", :green) : "" %>
|
||||||
<% else %>
|
<% 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 %>
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
—
|
||||||
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user