Changed Index title of dashboard for admins

This commit is contained in:
Okechi Onyeje 2017-01-20 02:16:45 -05:00
parent 82876d7e4d
commit ace1290a76

View File

@ -84,11 +84,18 @@
</div>
</div> -->
<% if current_user.admin? %>
<h2 class="sub-header">Recent Results From All Companies</h2>
<% else %>
<h2 class="sub-header">Recent Results</h2>
<% end %>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<% if current_user.admin? %>
<th>Company</th>
<% end %>
<th>Run Date</th>
<th>Location</th>
<th>Harvest Time</th>
@ -99,6 +106,59 @@
</tr>
</thead>
<tbody>
<% if current_user.admin? %>
<% @results.each_slice(1) do |row| %>
<tr>
<% row.each do |result|
run = Run.find(result.id)
#company = Company.find(run.company_id)
%>
<!-- company name -->
<td>
<%= #company.company_name
"Fake Industries" %>
</td>
<!-- run date -->
<td>
<%= run.runDate %>
</td>
<!-- location -->
<td>
<%= run.location ? run.location : "" %>
</td>
<!-- harvest time -->
<td>
<%= "" %>
</td>
<!-- supplier -->
<td>
<%= run.supplier ? run.supplier : "" %>
</td>
<!-- distributor -->
<td>
<%= run.distributor ? run.distributor : "" %>
</td>
<!-- total processed -->
<td>
<%= result.total %>
</td>
<!-- other -->
<td>
<%= run.other ? run.other : "" %>
</td>
<% end %>
</tr>
<% end %>
<% else %>
<% @results.each_slice(1) do |row| %>
<tr>
<% row.each do |result|
@ -141,6 +201,7 @@
<% end %>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<div class="center-block">