diff --git a/Pearlception/app/controllers/dashboard_controller.rb b/Pearlception/app/controllers/dashboard_controller.rb index 10a757e..047b1ce 100644 --- a/Pearlception/app/controllers/dashboard_controller.rb +++ b/Pearlception/app/controllers/dashboard_controller.rb @@ -2,7 +2,22 @@ class DashboardController < ApplicationController before_filter :deny_to_visitors def index - @results = Result.page(params[:page]).per(5) + #This is a temporary fix until runs and results models are properly discussed with bobby + #@results = Result.page(params[:page]).per(5) + if current_user.admin? + @results = Hash.new + names = (Company.pluck :company_name) - ["IVA"] + names.map!{|tenant| tenant.gsub(/'/,'').gsub(/\s/,'')} + names.each do + |name| + + Apartment::Tenant.switch!(name.gsub(/'/,'').gsub(/\s/,'')) + @results[name.gsub(/'/,'').gsub(/\s/,'')] = Run.page(params[:page]).per(5) + end + Apartment::Tenant.switch! + else + @results = Run.page(params[:page]).per(5) + end end diff --git a/Pearlception/app/views/dashboard/index.html.erb b/Pearlception/app/views/dashboard/index.html.erb index 4cbdef9..46aa466 100644 --- a/Pearlception/app/views/dashboard/index.html.erb +++ b/Pearlception/app/views/dashboard/index.html.erb @@ -87,142 +87,174 @@ <% if current_user.admin? %>
| Run Date | +Location | +Harvest Time | +Supplier | +Distributor | +Total Processed | +Other | +Oyster Info | +
|---|---|---|---|---|---|---|---|
| + <%= run.runDate %> + | + + ++ <%= run.location ? run.location : "" %> + | + + ++ <%= "" %> + | + + ++ + <%= run.supplier ? run.supplier : "" %> + | + + ++ <%= run.distributor ? run.distributor : "" %> + | + + ++ "result" + | + + ++ <%= run.other ? run.other : "" %> + | ++ <%= link_to "Show", oysters_index_path( :result_id => result.id, :page_num => params[:page]), :class => "btn btn-primary" %> + | + <% end %> +
| Company | +
|---|
| Run Date | +Location | +Harvest Time | +Supplier | +Distributor | +Total Processed | +Other | +Oyster Info | +
|---|---|---|---|---|---|---|---|
| + <%= run.runDate %> + | + + ++ <%= run.location ? run.location : "" %> + | + + ++ <%= "" %> + | + + ++ + <%= run.supplier ? run.supplier : "" %> + | + + ++ <%= run.distributor ? run.distributor : "" %> + | + + ++ "result" + | + + ++ <%= run.other ? run.other : "" %> + | ++ <%= link_to "Show", oysters_index_path( :result_id => result.id, :page_num => params[:page]), :class => "btn btn-primary" %> + | + <% end %> +Run Date | -Location | -Harvest Time | -Supplier | -Distributor | -Total Processed | -Other | -Oyster Info | - - + +