Files
sx-fc/app/controllers/transactions/orders_controller.rb

45 lines
973 B
Ruby
Executable File

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")
else
orders = Order.search(filter,from,to,count)
end
if !orders.nil?
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(20)
else
@orders = []
end
@receipt_no = filter
@from = from
@to = to
respond_to do |format|
format.html # index.html.erb
format.json { render json: @orders }
end
end
def show
@order = Order.find(params[:id])
@dining = BookingOrder.find_by_order_id(@order.order_id).booking.dining_facility
respond_to do |format|
format.html # show.html.erb
format.json { render json: @order }
end
end
end