Class: Workarea::Api::Admin::OrdersController
Instance Method Summary
collapse
#current_user, #sort_direction, #sort_field
Instance Method Details
#index ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'app/controllers/workarea/api/admin/orders_controller.rb', line 66
def index
criteria = Order.all
if params[:placed_at_greater_than].present?
criteria = criteria.where(:placed_at.gte => params[:placed_at_greater_than])
end
if params[:placed_at_less_than].present?
criteria = criteria.where(:placed_at.lt => params[:placed_at_less_than])
end
@orders =
criteria
.order_by(sort_field => sort_direction)
.page(params[:page].presence || 1)
respond_with orders: @orders
end
|
#show ⇒ Object
145
146
147
148
149
150
151
152
153
154
155
156
|
# File 'app/controllers/workarea/api/admin/orders_controller.rb', line 145
def show
@order = Order.find(params[:id])
@payment = Payment.find_or_initialize_by(id: @order.id)
@fulfillment = Fulfillment.find_or_initialize_by(id: @order.id)
@shippings = Shipping.where(order_id: @order.id).to_a
respond_with order: @order,
payment: @payment,
payment_transactions: @payment.transactions,
fulfillment: @fulfillment,
shippings: @shippings
end
|