-
-
Notifications
You must be signed in to change notification settings - Fork 527
/
Copy pathindex.html.erb
121 lines (119 loc) · 4.62 KB
/
index.html.erb
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
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<% content_for :title, "Purchases - #{current_organization.name}" %>
<h1>
Purchases
<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="#">Purchases</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">Purchase Filters</h3>
</div>
<!-- /.card-header -->
<!-- form start -->
<div class="card-body">
<%= form_tag(purchases_path, method: :get) do |f| %>
<div class="row">
<% if @storage_locations.present? %>
<div class="form-group col-lg-4 col-md-4 col-sm-6 col-xs-12">
<%= filter_select(label: "Filter by storage location", scope: :at_storage_location, collection: @storage_locations, selected: @selected_storage_location) %>
</div>
<% end %>
<% if @vendors.present? %>
<div class="form-group col-lg-4 col-md-4 col-sm-6 col-xs-12">
<%= filter_select(label: "Filter by vendor", scope: :from_vendor, collection: @vendors, value: :business_name, selected: @selected_vendor) %>
</div>
<% end %>
<div class="form-group col-lg-4 col-md-4 col-sm-6 col-xs-12">
<%= label_tag "Purchase Date Range" %>
<%= render partial: "shared/date_range_picker", locals: {css_class: "form-control"} %>
</div>
</div><!-- /.row -->
<div class="card-footer">
<%= filter_button %>
<%= cancel_button_to purchases_path, {text: "Clear Filters"} %>
<span class="float-right">
<%= download_button_to(purchases_path(format: :csv, filters: filter_params.merge(date_range: date_range_params)), {text: "Export Purchases", size: "md"}) if @purchases.any? %>
<%= new_button_to new_purchase_path, {text: "New Purchase"} %>
</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 p-0">
<table class="table">
<thead>
<tr>
<th class="text-left">Purchases from</th>
<th class="text-left">Storage Location</th>
<th class="text-left">Comments</th>
<th class="text-left">Quantity of Items</th>
<th class="text-left">Variety of Items</th>
<th class="text-left">Amount spent</th>
<th class="text-left">FMV</th>
<th class="text-left">Purchased Date</th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
<%= render partial: "purchase_row", collection: @paginated_purchases %>
</tbody>
<tfoot>
<tr>
<td colspan="2" style="text-align: left"><strong>Total</strong></td>
<td class="numeric">
<strong id="purchase_quantity">
<%= @purchases_quantity %> (Total)
</strong>
<br>
<%= @paginated_purchases_quantity %> (This page)
</td>
<td></td>
<td class="numeric"><strong><%= dollar_value(@total_value_all_purchases) %></strong></td>
<td></td>
</tr>
</tfoot>
</table>
</div>
<!-- /.card-body -->
<div class="card-footer clearfix">
<%= paginate @paginated_purchases %>
</div>
<!-- /.card-footer-->
</div>
<!-- /.card -->
</div>
</div>
</div>
</section>