Save progress
This commit is contained in:
@@ -2,8 +2,18 @@ module Users
|
||||
class OrdersController < Users::ApplicationController
|
||||
respond_to :json
|
||||
def create
|
||||
|
||||
converted_order = params[:order][:product_orders].each_with_object({}){|po, o| o[po[:product_id]] = po[:quantity] }
|
||||
list = current_user.active_list
|
||||
unless list = current_user.active_list
|
||||
table = Table.find(params[:order][:table_id])
|
||||
|
||||
if table.occupied?
|
||||
#render json: json_alert('messages.table_is_occupied', location: :join_occupied_table, location_params: {table_id: @table.id})
|
||||
render status: :not_acceptable and return
|
||||
end
|
||||
|
||||
list = List.from_table( table, current_user )
|
||||
end
|
||||
order = list.place_order converted_order
|
||||
render json: order, serializer: OrderSerializer
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user