|
36 | 36 | <div class="card-body">
|
37 | 37 | <%= form_tag(donations_path, method: :get) do |f| %>
|
38 | 38 | <div class="row">
|
39 |
| - <% if @storage_locations.present? %> |
| 39 | + <% if @donation_info.storage_locations.present? %> |
40 | 40 | <div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
|
41 |
| - <%= filter_select(label: "Filter by Storage Location", scope: :at_storage_location, collection: @storage_locations, selected: @selected_storage_location) %> |
| 41 | + <%= filter_select(label: "Filter by Storage Location", |
| 42 | + scope: :at_storage_location, |
| 43 | + collection: @donation_info.storage_locations, |
| 44 | + selected: @donation_info.selected_storage_location) %> |
42 | 45 | </div>
|
43 | 46 | <% end %>
|
44 |
| - <% if @sources.present? %> |
| 47 | + <% if @donation_info.sources.present? %> |
45 | 48 | <div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
|
46 | 49 | <% id = "filter_#{SecureRandom.uuid}" %>
|
47 | 50 | <%= label_tag id, "Filter by Source" %>
|
48 | 51 | <%= select_tag "filters[by_source]",
|
49 |
| - options_for_select(@sources, @selected_source), |
| 52 | + options_for_select(@donation_info.sources, @donation_info.selected_source), |
50 | 53 | { include_blank: true, class: "form-control", id: id } %>
|
51 | 54 | </div>
|
52 | 55 | <% end %>
|
53 |
| - <% if @product_drives.present? %> |
| 56 | + <% if @donation_info.product_drives.present? %> |
54 | 57 | <div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
|
55 |
| - <%= filter_select(scope: :by_product_drive, collection: @product_drives, selected: @selected_product_drive) %> |
| 58 | + <%= filter_select(scope: :by_product_drive, |
| 59 | + collection: @donation_info.product_drives, |
| 60 | + selected: @donation_info.selected_product_drive) %> |
56 | 61 |
|
57 | 62 | </div>
|
58 | 63 | <% end %>
|
59 |
| - <% if @product_drive_participants.present? %> |
| 64 | + <% if @donation_info.product_drive_participants.present? %> |
60 | 65 | <div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
|
61 |
| - <%= filter_select(scope: :by_product_drive_participant, collection: @product_drive_participants, value: :business_name, selected: @selected_product_drive_participant) %> |
| 66 | + <%= filter_select(scope: :by_product_drive_participant, |
| 67 | + collection: @donation_info.product_drive_participants, |
| 68 | + value: :business_name, |
| 69 | + selected: @donation_info.selected_product_drive_participant) %> |
62 | 70 | </div>
|
63 | 71 | <% end %>
|
64 |
| - <% if @manufacturers.present? %> |
| 72 | + <% if @donation_info.manufacturers.present? %> |
65 | 73 | <div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
|
66 |
| - <%= filter_select(label: "Filter by manufacturer", scope: :from_manufacturer, collection: @manufacturers, selected: @selected_manufacturer) %> |
| 74 | + <%= filter_select(label: "Filter by manufacturer", |
| 75 | + scope: :from_manufacturer, |
| 76 | + collection: @donation_info.manufacturers, |
| 77 | + selected: @donation_info.selected_manufacturer) %> |
67 | 78 | </div>
|
68 | 79 | <% end %>
|
69 |
| - <% if @donation_sites.present? %> |
| 80 | + <% if @donation_info.donation_sites.present? %> |
70 | 81 | <div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
|
71 |
| - <%= filter_select(label: "Filter by Donation Site", scope: :from_donation_site, collection: @donation_sites, key: :id, value: :name, selected: @selected_donation_site) %> |
| 82 | + <%= filter_select(label: "Filter by Donation Site", |
| 83 | + scope: :from_donation_site, |
| 84 | + collection: @donation_info.donation_sites, |
| 85 | + key: :id, |
| 86 | + value: :name, |
| 87 | + selected: @donation_info.selected_donation_site) %> |
72 | 88 | </div>
|
73 | 89 | <% end %>
|
74 |
| - <% if @item_categories.present? %> |
| 90 | + <% if @donation_info.item_categories.present? %> |
75 | 91 | <div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
|
76 | 92 | <% id = "filter_#{SecureRandom.uuid}" %>
|
77 | 93 | <%= label_tag id, "Filter by Category" %>
|
78 | 94 | <%= select_tag "filters[by_category]",
|
79 |
| - options_for_select(@item_categories, @selected_item_category), |
| 95 | + options_for_select(@donation_info.item_categories, @donation_info.selected_item_category), |
80 | 96 | { include_blank: true, class: "form-control", id: id } %>
|
81 | 97 | </div>
|
82 | 98 | <% end %>
|
|
89 | 105 | <%= filter_button %>
|
90 | 106 | <%= clear_filter_button %>
|
91 | 107 | <span class="float-right">
|
92 |
| - <%= download_button_to(donations_path(format: :csv, filters: filter_params.merge(date_range: date_range_params)), {text: "Export Donations", size: "md"}) if @donations.any? %> |
| 108 | + <% if @donation_info.donations.any? %> |
| 109 | + <%= download_button_to(donations_path(format: :csv, |
| 110 | + filters: filter_params.merge(date_range: date_range_params)), |
| 111 | + {text: "Export Donations", size: "md"}) %> |
| 112 | + <% end %> |
93 | 113 | <%= new_button_to new_donation_path, {text: "New Donation"} %>
|
94 | 114 | </span>
|
95 | 115 | </div>
|
|
124 | 144 | </tr>
|
125 | 145 | </thead>
|
126 | 146 | <tbody>
|
127 |
| - <%= render partial: "donation_row", collection: @paginated_donations %> |
| 147 | + <%= render partial: "donation_row", collection: @donation_info.paginated_donations %> |
128 | 148 | </tbody>
|
129 | 149 | <tfoot>
|
130 | 150 | <tr>
|
|
133 | 153 | <td></td>
|
134 | 154 | <td></td>
|
135 | 155 | <td class="numeric">
|
136 |
| - <%= @paginated_donations_quantity %> |
| 156 | + <%= @donation_info.paginated_donations_quantity %> |
137 | 157 | <br>
|
138 | 158 | (This page)
|
139 | 159 | <br>
|
140 | 160 | <strong id="donation_quantity">
|
141 |
| - <%= @donations_quantity %> |
| 161 | + <%= @donation_info.donations_quantity %> |
142 | 162 | <br>
|
143 | 163 | (Total)
|
144 | 164 | </strong>
|
145 | 165 | </td>
|
146 |
| - <td class="numeric"><strong><%= dollar_value(@total_money_raised) %></strong></td> |
| 166 | + <td class="numeric"><strong><%= dollar_value(@donation_info.total_money_raised) %></strong></td> |
147 | 167 | <td class="numeric in-kind">
|
148 |
| - <%= dollar_value(@paginated_in_kind_value) %> |
| 168 | + <%= dollar_value(@donation_info.paginated_in_kind_value) %> |
149 | 169 | <br>
|
150 | 170 | (This page)
|
151 | 171 | <br>
|
152 | 172 | <strong>
|
153 |
| - <%= dollar_value(@total_value_all_donations) %> (Total) |
| 173 | + <%= dollar_value(@donation_info.total_value_all_donations) %> (Total) |
154 | 174 | </strong>
|
155 | 175 | </td>
|
156 | 176 | </tr>
|
|
159 | 179 | </div>
|
160 | 180 | <!-- /.card-body -->
|
161 | 181 | <div class="card-footer clearfix">
|
162 |
| - <%= paginate @paginated_donations %> |
| 182 | + <%= paginate @donation_info.paginated_donations %> |
163 | 183 | </div>
|
164 | 184 | <!-- /.card-footer-->
|
165 | 185 | </div>
|
|
0 commit comments