42 lines
870 B
Ruby
42 lines
870 B
Ruby
class Transactions::OrdersController < ApplicationController
|
|
load_and_authorize_resource except: [:create]
|
|
def index
|
|
|
|
filter = params[:filter]
|
|
count = params[:count]
|
|
from = params[:from]
|
|
to = params[:to]
|
|
|
|
if filter.nil? && from.nil? && to.nil? && count.nil?
|
|
orders = Order.order("order_id desc")
|
|
puts "ssssss"
|
|
else
|
|
orders = Order.search(filter,from,to,count)
|
|
puts "aaaaa"
|
|
|
|
end
|
|
|
|
if !orders.nil?
|
|
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(50)
|
|
else
|
|
@orders = []
|
|
end
|
|
puts @orders.to_json
|
|
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
|