diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 573f7c9e..7e91163f 100755 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -387,3 +387,15 @@ function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amoun function setHeaderBreadCrumb(params){ $("#others_payment").html(params); } + +//show hide nav bar for webview +function showHideNavbar(webview,page){ + // if(webview){ + $("nav.navbar").hide(); + // if(page=="index"){ + // $(".btn-lists").hide(); + // } + // }else{ + // $("nav.navbar").show(); + // } +} diff --git a/app/controllers/api/survey_controller.rb b/app/controllers/api/survey_controller.rb index 879c9ea7..23f9c699 100644 --- a/app/controllers/api/survey_controller.rb +++ b/app/controllers/api/survey_controller.rb @@ -1,5 +1,5 @@ class Api::SurveyController < Api::ApiController - skip_before_action :authenticate + # before_action :authenticate def index dining_facility = DiningFacility.find(params[:id]) diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index e14a6959..45b9434d 100755 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -33,5 +33,34 @@ class BaseOrigamiController < ActionController::Base def shop_detail @shop = Shop.first end + + #check webview + def check_mobile + status = false + if request.user_agent =~ /android|blackberry|iphone|ipad|ipod|iemobile|mobile|webos/i + status = true + end + return status + end + # protected + # # Authenticate the user with token based authentication + # def authenticate + # authenticate_token || render_unauthorized + # end + + # def authenticate_token + # authenticate_with_http_token do |token, options| + # Rails.logger.debug "token - " + token.to_s + # @user = Employee.authenticate_by_token(token) + # if @user + # return true + # end + # end + # end + + # def render_unauthorized(realm = "Application") + # request.headers["WWW-Authenticate"] = %(Token realm="#{realm.gsub(/"/, "")}") + # render json: 'Bad credentials', status: :unauthorized + # end end diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index 759cb1b6..2d19c9c5 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -3,6 +3,13 @@ class Origami::HomeController < BaseOrigamiController before_action :set_dining, only: [:show] def index + @webview = false + if check_mobile + puts "request data" + @webview = true + end + puts @webview == false + @tables = Table.all.active.order('status desc') @rooms = Room.all.active.order('status desc') @complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d')) diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index c50b92f9..2d7657f5 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -31,7 +31,7 @@