Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.79 KB | None | 0 0
  1. class DashboardController < ApplicationController
  2.  
  3.   before_filter :login_required
  4.  
  5.   def index
  6.     unless current_user.admin?
  7.       @users = current_user.company.users if current_user.company
  8.       @company = current_user.company
  9.       @orders = Order.paginate :all, :page => params[:page], :conditions => { :company_id => current_user.company.id, :status => 'draft' } unless current_user.company.nil?
  10.     else
  11.       if params[:date]
  12.         @date = Date.parse(params[:date])
  13.       else
  14.         @date = Date.today
  15.       end
  16.      
  17.       @deliveries = Order.find(:all, :conditions => ["delivery_date = ? AND status = ?", @date, 'confirmed_by_administration'])
  18.       @pickups = Order.find(:all, :conditions => ["delivery_date = ? AND status != ?", @date + 1, "draft"])
  19.     end
  20.   end
  21.  
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement