Class: Shoppe::OrdersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/shoppe/orders_controller.rb

Instance Method Summary collapse

Instance Method Details

#acceptObject



16
17
18
19
# File 'app/controllers/shoppe/orders_controller.rb', line 16

def accept
  @order.accept!(current_user)
  redirect_to @order, :notice => "Order has been accepted successfully"
end

#indexObject



6
7
8
9
# File 'app/controllers/shoppe/orders_controller.rb', line 6

def index
  @query = Shoppe::Order.ordered.received.includes(:order_items => :product).page(params[:page]).search(params[:q])
  @orders = @query.result
end

#payObject



31
32
33
34
# File 'app/controllers/shoppe/orders_controller.rb', line 31

def pay
  @order.pay!(params[:payment_reference], 'Manual')
  redirect_to @order, :notice => "Order has been marked as paid successfully"
end

#rejectObject



21
22
23
24
# File 'app/controllers/shoppe/orders_controller.rb', line 21

def reject
  @order.reject!(current_user)
  redirect_to @order, :notice => "Order has been rejected successfully"
end

#searchObject



11
12
13
14
# File 'app/controllers/shoppe/orders_controller.rb', line 11

def search
  index
  render :action => "index"
end

#shipObject



26
27
28
29
# File 'app/controllers/shoppe/orders_controller.rb', line 26

def ship
  @order.ship!(current_user, params[:consignment_number])
  redirect_to @order, :notice => "Order has been shipped successfully"
end