Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the date filter to the donation report [#3735] #4028

Merged
merged 1 commit into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 33 additions & 29 deletions app/views/reports/manufacturer_donations_summary/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
<%= render(
"shared/card",
id: "manufacturers",
gradient: "success",
title: "Manufacturer Donations",
subtitle: @selected_date_range,
footer_options: { class: "text-center" },
footer: link_to("See more...", donations_path(
filters: {
by_source: "Manufacturer"
}
)),
) do %>
<%= new_button_to new_donation_path, {text: "New Donation"} %>
<h3 class="text-center">
<span class="total_received_donations">
<%= number_with_delimiter(@recent_donations_from_manufacturers.sum { |d| d.line_items.total }) %>
</span>
items donated <%= @selected_date_range_label %>
by
<span class="num_manufacturers_donated">
<%= pluralize(@recent_donations_from_manufacturers.group_by(&:manufacturer).count, 'Manufacturer') %>
</span>
</h3>
<div class="box-body">
<h4>Top Manufacturer Donations</h4>
<%= render partial: "manufacturer", collection: @top_manufacturers, as: :manufacturer %>
</div>
<% end %>

<%= render(
"shared/filtered_card",
id: "manufacturers",
gradient: "success",
title: "Manufacturer Donations",
subtitle: @selected_date_range,
filter_url: reports_manufacturer_donations_summary_index_path,
footer_options: { class: "text-center" },
footer: link_to("See more...", donations_path(
filters: {
by_source: "Manufacturer"
}
)),
) do %>

<%= new_button_to new_donation_path, {text: "New Donation"} %>
<h3 class="text-center">
<span class="total_received_donations">
<%= number_with_delimiter(@recent_donations_from_manufacturers.sum { |d| d.line_items.total }) %>
</span>
items donated <%= @selected_date_range_label %>
by
<span class="num_manufacturers_donated">
<%= pluralize(@recent_donations_from_manufacturers.group_by(&:manufacturer).count, 'Manufacturer') %>
</span>
</h3>
<div class="box-body">
<h4>Top Manufacturer Donations</h4>
<%= render partial: "manufacturer", collection: @top_manufacturers, as: :manufacturer %>
</div>

<% end %>
6 changes: 3 additions & 3 deletions app/views/shared/_filtered_card.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<div class="row">
<div class="col-md-12">
<div class="description-block border-right">
<%= simple_form_for :filters, url: filter_url, method: :get do |f| %>
<%= render partial: "shared/date_range_picker", locals: {css_class: "form-control"} %><br>
<%= filter_button %>
<%= simple_form_for :filters, url: filter_url, method: :get, html: {class: 'd-flex'} do |f| %>
<%= render partial: "shared/date_range_picker", locals: {css_class: "form-control col-10"} %><br>
<%= filter_button class: 'col-2' %>
<% end %>
</div>
</div>
Expand Down
Loading