class Transactions::OrdersController < ApplicationController
	load_and_authorize_resource except: [:create]
	def index

		filter = params[:filter]     
		if filter.nil?
		    orders = Order.order("order_id desc")
		else
		    order = Order.search(filter)
		    if order.count > 0
		      orders = order 
		    else
		      orders = Order.order("order_id desc")
		        
		    end    
		end    
		    @orders = Kaminari.paginate_array(orders).page(params[:page]).per(50)
			    respond_to do |format|
			    format.html # index.html.erb
			    format.json { render json: @orders }
		    end
	end
	
	def show

	    @order = Order.find(params[:id])

	    respond_to do |format|
	      format.html # show.html.erb
	      format.json { render json: @order }
	    end
	end

end
