class HomeController < ApplicationController
  skip_before_filter  :verify_authenticity_token 
  before_action :authenticate_member!

	def index		
      redirect_to new_member_session_path
	end
	def dashboard
		today= Date.today.strftime("%Y-%m-%d")    
		@users=User.all
		@batches=Batch.joins('inner join users on users.id=batches.user_id')
					  .where("to_char(batches.created_at,'YYYY-mm-dd')=?",today)
    				  .select('batches.*,users.name as user_name').order('batches.id desc')

    	@batchLineItems=BatchLineItem.joins('inner join batches on batches.id=batch_line_items.batch_id').select('batch_line_items.*,batches.order_ref as batch_name')
    								 .where("to_char(batches.created_at,'YYYY-mm-dd')=?",today)
    								 .page(params[:page]).per(5)
	end
end
