update add extra time

This commit is contained in:
Aung Myo
2018-01-02 12:30:57 +06:30
parent 26a11ebecd
commit b1fa5f1518
6 changed files with 54 additions and 27 deletions

View File

@@ -49,7 +49,25 @@ class Api::OrdersController < Api::ApiController
def create
Rails.logger.debug "Order Source - " + params[:order_source].to_s
Rails.logger.debug "Table ID - " + params[:table_id].to_s
#for extratime
is_extra_time = false
extra_time = ''
params[:order_items].each { |i|
if i["item_instance_code"] == 'Exti60' || i["item_instance_code"] == 'Exti30'
is_extra_time = true
if i["item_instance_code"] == 'Exti30'
t = Time.now
time = 30*60*i["quantity"].to_i
extra_time = Time.at(time)
else
t = Time.now
time = 60*60*i["quantity"].to_i
extra_time = Time.at(time)
end
end
}
#end extra time
# begin
@order = Order.new
@order.source = params[:order_source]
@@ -61,6 +79,9 @@ class Api::OrdersController < Api::ApiController
@order.new_booking = true
@order.waiters = current_login_employee.name
@order.employee_name = current_login_employee.name
@order.is_extra_time = is_extra_time
@order.extra_time = extra_time
#Create Table Booking or Room Booking
if !params["booking_id"].nil?
# check booking id is already completed.