-
-
Notifications
You must be signed in to change notification settings - Fork 573
Expand file tree
/
Copy pathshow.html.erb
More file actions
188 lines (183 loc) · 8.08 KB
/
show.html.erb
File metadata and controls
188 lines (183 loc) · 8.08 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
<section class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<% content_for :title, "Storage Locations - #{@storage_location.name} - Inventory - #{current_organization.name}" %>
<h1>
Storage Location Info
<small>for <%= @storage_location.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"><%= link_to "Storage Locations", storage_locations_path %></li>
<li class="breadcrumb-item"><a href="#"><%= @storage_location.name %></a></li>
</ol>
</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>Storage Location</th>
<th>Address</th>
<th>Square Footage</th>
<th>Warehouse Type</th>
<th>Fair Market Value</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @storage_location.name %></td>
<td><%= @storage_location.address %></td>
<td><%= @storage_location.square_footage %></td>
<td><%= @storage_location.warehouse_type %></td>
<td><%= number_to_currency @storage_location.inventory_total_value_in_dollars %></td>
</tr>
</tbody>
</table>
</div>
<!-- /.card-body -->
<div class="card-footer">
<%= modal_button_to("#csvImportModal", { text: "Import Baseline Inventory", icon: "upload" }) if @storage_location.items.empty? %>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">
<!-- Default box -->
<div class="card card-primary card-outline card-outline-tabs">
<div class="card-header p-0 border-bottom-0">
<ul class="nav nav-tabs" id="custom-tabs-three-tab" role="tablist">
<li class="nav-item <%= params.dig(:filters, :date_range).nil? ? 'active' : '' %>">
<a class="nav-link <%= params.dig(:filters, :date_range).nil? ? 'active' : '' %>" id="custom-tabs-inventory-tab" data-bs-toggle="pill" href="#custom-tabs-inventory" role="tab" aria-controls="custom-tabs-one-home-tab" aria-selected="true">Inventory</a>
</li>
<li class="nav-item <%= params.dig(:filters, :date_range).present? ? 'active' : '' %>">
<a class="nav-link <%= params.dig(:filters, :date_range).present? ? 'active' : '' %>" id="custom-tabs-inventory-flow-tab" data-bs-toggle="pill" href="#custom-tabs-inventory-flow" role="tab" aria-controls="custom-tabs-two-home-tab" aria-selected="false">Inventory Flow</a>
</li>
</ul>
</div>
<div class="card-body">
<div class="tab-content" id="custom-tabs-three-tabContent">
<div class="tab-pane fade <%= params.dig(:filters, :date_range).nil? ? 'show active' : '' %>" id="custom-tabs-inventory" role="tabpanel" aria-labelledby="custom-tabs-one-home-tab">
<%= form_for @storage_location, method: :get do %>
Show Inventory at Date: <%= date_field_tag 'version_date', params[:version_date], min: InventoryItem::EARLIEST_VERSION, autocomplete: "on" %>
<%= filter_button(text: 'View') %>
<br><small>(historical data collected since <%= Date.parse(InventoryItem::EARLIEST_VERSION).strftime("%b %-d, %Y") %>)</small>
<% end %>
<br><br>
<table class="table">
<thead>
<tr>
<th>Item</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<% if @inventory %>
<% @inventory.items_for_location(@storage_location.id, include_omitted: true).each do |item| %>
<tr>
<td><%= link_to item.name, item_path(item.item_id) %></td>
<td><%= number_with_delimiter(item.quantity) %></td>
</tr>
<% end %>
<% elsif @legacy_inventory %>
<% @legacy_inventory.each do |item| %>
<tr>
<td><%= link_to item.name, item_path(item.item_id) %></td>
<td><%= number_with_delimiter(item.quantity) %></td>
</tr>
<% end %>
<% else %>
<% end %>
</tbody>
<tfoot>
<tr>
<td>Total</td>
<td>
<% if @inventory %>
<%= number_with_delimiter(@inventory.quantity_for(storage_location: @storage_location.id)) %>
<% elsif @legacy_inventory %>
<%= number_with_delimiter(@legacy_inventory.map(&:quantity).sum) %>
<% else %>
<%= number_with_delimiter(@storage_location.size) %>
<% end %>
</td>
</tr>
</tfoot>
</table>
</div><!-- /.box-body.table-responsive -->
<div class="tab-pane fade <%= params.dig(:filters, :date_range).present? ? 'show active' : '' %>" id="custom-tabs-inventory-flow" role="tabpanel" aria-labelledby="custom-two-home-tab">
<%= form_for @storage_location, method: :get do %>
<%= label_tag "Date Range" %>
<div class="row">
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
<%= render partial: "shared/date_range_picker", locals: {css_class: "form-control"} %>
</div>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
<%= filter_button %>
<%= clear_filter_button %>
</div>
</div>
<% end %>
<br><br>
<table class="table">
<thead>
<tr>
<th>Item</th>
<th>Quantity In</th>
<th>Quantity Out</th>
<th>Change</th>
</tr>
</thead>
<tbody>
<%= render partial: "item_row", collection: @items %>
</tbody>
<tfoot>
<tr>
<td>Total</td>
<td><%= @total_quantity_in %></td>
<td><%= @total_quantity_out %></td>
<% css_class = @total_quantity_change.negative? ? 'modal-body-warning-text' : '' %>
<td class="<%= css_class %>"><%= @total_quantity_change %></td>
</tr>
</tfoot>
</table>
</div><!-- /.box-body.table-responsive -->
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<%= render(
layout: "shared/csv_import_modal",
locals: {
import_type: 'Storage Locations Instructions',
csv_template_url: storage_location_path(@storage_location, format: :csv),
csv_import_url: import_inventory_storage_locations_path(storage_location: @storage_location.id)
}
) do %>
<li>Open the csv file with excel <br>or your favourite spreadsheet program.</li>
<li>Enter your quantities for each item.</li>
<li>Save the file as a csv file.</li>
<li>DO NOT CHANGE ANY ITEM NAME.</li>
<% end %>