19 lines
546 B
Ruby
19 lines
546 B
Ruby
module Suppliers
|
|
class OrdersController < Suppliers::ApplicationController
|
|
# GET /tables
|
|
# GET /tables.json
|
|
def index
|
|
if params[:state] == 'active'
|
|
@orders = Order.active_for_supplier(current_supplier.id)
|
|
else
|
|
@orders = Order.for_supplier(current_supplier, page: params[:page], per_page: params['per_page'] || 10)
|
|
end
|
|
|
|
respond_to do |format|
|
|
format.html # index.html.erb
|
|
format.json { render json: {orders: @orders.map(&:with_products_as_json)} }
|
|
end
|
|
end
|
|
end
|
|
end
|