-
-
Notifications
You must be signed in to change notification settings - Fork 573
Expand file tree
/
Copy pathindex.html.erb
More file actions
195 lines (191 loc) · 8.45 KB
/
index.html.erb
File metadata and controls
195 lines (191 loc) · 8.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<% content_for :title, "Donations - #{current_organization.name}" %>
<h1>
Donations
<small>for <%= current_organization.name %></small>
</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><%= link_to(dashboard_path) do %>
<i class="fa fa-dashboard"></i> Home
<% end %>
</li>
<li class="breadcrumb-item"><a href="#">Donations</a></li>
</ol>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<section class="content">
<div class="container-fluid">
<div class="row">
<!-- left column -->
<div class="col-12">
<!-- jquery validation -->
<div class="card card-primary">
<div class="card-header">
<h3 class="card-title">Donations Filters</h3>
</div>
<!-- /.card-header -->
<!-- form start -->
<div class="card-body">
<%= form_tag(donations_path, method: :get) do |f| %>
<div class="row">
<% if @donation_info.storage_locations.present? %>
<div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
<%= filter_select(label: "Filter by Storage Location",
scope: :at_storage_location,
collection: @donation_info.storage_locations,
selected: @donation_info.selected_storage_location) %>
</div>
<% end %>
<% if @donation_info.sources.present? %>
<div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
<% id = "filter_#{SecureRandom.uuid}" %>
<%= label_tag id, "Filter by Source" %>
<%= select_tag "filters[by_source]",
options_for_select(@donation_info.sources, @donation_info.selected_source),
{ include_blank: true, class: "form-control", id: id } %>
</div>
<% end %>
<% if @donation_info.product_drives.present? %>
<div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
<%= filter_select(scope: :by_product_drive,
collection: @donation_info.product_drives,
selected: @donation_info.selected_product_drive) %>
</div>
<% end %>
<% if @donation_info.product_drive_participants.present? %>
<div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
<%= filter_select(scope: :by_product_drive_participant,
collection: @donation_info.product_drive_participants,
value: :business_name,
selected: @donation_info.selected_product_drive_participant) %>
</div>
<% end %>
<% if @donation_info.manufacturers.present? %>
<div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
<%= filter_select(label: "Filter by manufacturer",
scope: :from_manufacturer,
collection: @donation_info.manufacturers,
selected: @donation_info.selected_manufacturer) %>
</div>
<% end %>
<% if @donation_info.donation_sites.present? %>
<div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
<%= filter_select(label: "Filter by Donation Site",
scope: :from_donation_site,
collection: @donation_info.donation_sites,
key: :id,
value: :name,
selected: @donation_info.selected_donation_site) %>
</div>
<% end %>
<% if @donation_info.items.present? %>
<div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
<%= filter_select(label: "Filter by Item", scope: :by_item_id, collection: @donation_info.items, selected: @donation_info.selected_item) %>
</div>
<% end %>
<% if @donation_info.item_categories.present? %>
<div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
<% id = "filter_#{SecureRandom.uuid}" %>
<%= label_tag id, "Filter by Category" %>
<%= select_tag "filters[by_category]",
options_for_select(@donation_info.item_categories, @donation_info.selected_item_category),
{ include_blank: true, class: "form-control", id: id } %>
</div>
<% end %>
<div class="form-group col-lg-3 col-md-4 col-sm-6 col-xs-12">
<%= label_tag "Date Range" %>
<%= render partial: "shared/date_range_picker", locals: {css_class: "form-control"} %>
</div>
</div><!-- /.row -->
<div class="card-footer">
<%= filter_button %>
<%= clear_filter_button %>
<span class="float-right">
<% if @donation_info.donations.any? %>
<%= download_button_to(donations_path(format: :csv,
filters: filter_params.merge(date_range: date_range_params)),
{text: "Export Donations", size: "md"}) %>
<% end %>
<%= new_button_to new_donation_path, {text: "New Donation"} %>
</span>
</div>
<% end %>
</div>
</div>
</div>
</div>
</div><!-- /.container-fluid -->
</section>
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<!-- Default box -->
<div class="card">
<div class="card-body table-responsive p-0">
<table class="table table-hover">
<thead>
<tr>
<th>Source</th>
<th>Date</th>
<th>Details</th>
<th>Storage Location</th>
<th class="text-right">Quantity of Items</th>
<th class="text-right">Money Raised</th>
<th class="text-right">In-kind Value</th>
<th>Comments</th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
<%= render partial: "donation_row", collection: @donation_info.paginated_donations %>
</tbody>
<tfoot>
<tr>
<td><strong>Total</strong></td>
<td></td>
<td></td>
<td></td>
<td class="numeric">
<%= @donation_info.paginated_donations_quantity %>
<br>
(This page)
<br>
<strong id="donation_quantity">
<%= @donation_info.donations_quantity %>
<br>
(Total)
</strong>
</td>
<td class="numeric"><strong><%= dollar_value(@donation_info.total_money_raised) %></strong></td>
<td class="numeric in-kind">
<%= dollar_value(@donation_info.paginated_in_kind_value) %>
<br>
(This page)
<br>
<strong>
<%= dollar_value(@donation_info.total_value_all_donations) %> (Total)
</strong>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- /.card-body -->
<div class="card-footer clearfix">
<%= paginate @donation_info.paginated_donations %>
</div>
<!-- /.card-footer-->
</div>
<!-- /.card -->
</div>
</div>
</div>
</section>