diff --git a/app/assets/javascripts/order_reservation.js b/app/assets/javascripts/order_reservation.js index c60accdf..0f438831 100644 --- a/app/assets/javascripts/order_reservation.js +++ b/app/assets/javascripts/order_reservation.js @@ -68,11 +68,13 @@ $(function() { if(waiting_time.getTime() < requested_time.getTime()){ var time_diff = (requested_time.getTime() - waiting_time.getTime()); var expected_time = (Math.floor(time_diff) / 1000) / 60; - callback_url(callback,ref_no,order_id,status,expected_time,waiting_time); }else{ - $("#waiting_time").val(""); - $("#waiting_timeErr").text("Expected waiting time is greater than requested time!"); + var time_diff = (waiting_time.getTime() - requested_time.getTime()); + var expected_time = (Math.floor(time_diff) / 1000) / 60; + // $("#waiting_time").val(""); + // $("#waiting_timeErr").text("Expected waiting time is greater than requested time!"); } + callback_url(callback,ref_no,order_id,status,expected_time,waiting_time); }); }); diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index 3cb1eacc..61cbac84 100755 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -5,6 +5,7 @@ class BaseOrigamiController < ActionController::Base before_action :check_user #before_action :check_installation + protect_from_forgery with: :exception helper_method :shop_detail, :current_token @@ -14,18 +15,14 @@ class BaseOrigamiController < ActionController::Base redirect_to origami_dashboard_path end - def check_user + def check_user if check_mobile if current_user.nil? return render status: 401, json: { message: "User using other device!" }.to_json end - else - if ENV["SERVER_MODE"] != 'cloud' - protect_from_forgery with: :exception - end - + else if current_user.nil? redirect_to root_path end diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb index 28ab2c06..4b94990b 100755 --- a/app/controllers/origami/other_charges_controller.rb +++ b/app/controllers/origami/other_charges_controller.rb @@ -15,12 +15,11 @@ class Origami::OtherChargesController < BaseOrigamiController @table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id) else @table = nil - end - + end end end - def create + def create sale_id = params[:sale_id] other_charges_items = JSON.parse(params[:other_charges_items]) sub_total = params[:sub_total] @@ -79,8 +78,6 @@ class Origami::OtherChargesController < BaseOrigamiController if !table.nil? dining = {:table_id => table_id, :table_type => table.type } render :json => dining.to_json - end - - end - + end + end end \ No newline at end of file diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 4f1413c4..e0eb7455 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -8,7 +8,7 @@ class ActionController::Base from = request.subdomain.downcase + "." + request.domain.downcase @license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase if (!@license.nil?) - logger.info "Location - " + @license.dbhost + logger.info "Location - " + @license.dbschema ActiveRecord::Base.establish_connection(website_connection(@license)) # authenticate_session_token # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema @@ -97,7 +97,7 @@ class ActionController::API from = request.subdomain.downcase + "." + request.domain.downcase @license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase if (!@license.nil?) - # logger.info "Location - " + @license.dbhost + logger.info "Location - " + @license.dbschema ActiveRecord::Base.establish_connection(website_connection(@license)) # authenticate_session_token # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema diff --git a/config/schedule.rb b/config/schedule.rb index 8f151e3d..fc38bc2a 100755 --- a/config/schedule.rb +++ b/config/schedule.rb @@ -14,14 +14,14 @@ every 1.minutes do runner "DiningFacility.checkin_time" end -every 3.minutes do +every 10.minutes do runner "OrderReservation.check_new_order" end -every 5.minutes do +every 10.minutes do runner "OrderReservation.check_order_send_to_kitchen" end -every 5.minutes do +every 10.minutes do runner "OrderReservation.check_order_ready_to_delivery" end \ No newline at end of file