User ember progress

This commit is contained in:
2014-03-31 15:51:01 +02:00
parent 013a41b9f6
commit bbf1a11a2e
34 changed files with 261 additions and 71 deletions
+7 -3
View File
@@ -2,14 +2,18 @@ module Users
class OrdersController < Users::ApplicationController
respond_to :json
def create
render json: {}, status: :unprocessable_entity and return unless params[:order].present? && params[:order][:product_orders].present?
converted_order = params[:order][:product_orders].each_with_object({}){|po, o| o[po[:product_id]] = po[:quantity] }
unless list = current_user.active_list
if list = current_user.active_list
render json: {}, status: :not_acceptable and return unless list.supplier.open?
else
render json: {}, status: :unprocessable_entity and return unless params[:order][:table_id].present?
table = Table.find(params[:order][:table_id])
render json: {}, status: :not_acceptable and return unless table.supplier.open?
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
render json: {}, status: :not_acceptable and return
end
list = List.from_table( table, current_user )