order submission and order queue submission basic done

This commit is contained in:
Min Zeya Phyo
2017-04-16 16:52:04 +06:30
parent 63c5c97f24
commit 30774b4efd
11 changed files with 89 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
class Api::Restaurant::OrdersController < ActionController::API
class Api::OrdersController < ActionController::API
#before :authenticate_token
#Description
@@ -19,13 +19,15 @@ class Api::Restaurant::OrdersController < ActionController::API
# Output Params
# Status [Success | Error | System Error] , order_id, error_message (*)
def create
Rails.logger.debug "Order Source - " + params[:order_source]
Rails.logger.debug "Table ID - " + params[:table_id]
# begin
@order = Order.new
@order.source = params[:order_source]
@order.order_type = params[:order_type]
@order.customer_id = params[:customer_id]
json_hash = params[:order_items]
@order.items = json_hash
@order.items = params[:order_items]
@order.guest = params[:guest_info]
@order.table_id = params[:table_id]
@order.new_booking = true
@@ -38,7 +40,8 @@ class Api::Restaurant::OrdersController < ActionController::API
@order.booking_id = params[:booking_id]
end
@status = @order.generate
@status = @order.generate
# rescue Exception => error
# @status = false
# @error_messages = "Exception has occurs on System"
@@ -59,5 +62,9 @@ class Api::Restaurant::OrdersController < ActionController::API
end
def order_params
params.permits(:order_source, :booking_id,:order_type,
:customer_id,:guest_info, :table_id, :room_id,
order_items: [:item_code, :qty, :option, :remark])
end
end