Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes

This commit is contained in:
phyusin
2018-03-20 17:16:41 +06:30
9 changed files with 67 additions and 18 deletions

View File

@@ -2,6 +2,8 @@ class BaseCrmController < ActionController::Base
include LoginVerification
layout "CRM"
before_action :check_user
#before_action :check_installation
protect_from_forgery with: :exception
@@ -22,8 +24,10 @@ class BaseCrmController < ActionController::Base
{ locale: I18n.locale }
end
def current_user
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
def check_user
if current_user.nil?
redirect_to root_path
end
end
#Shop Name in Navbor

View File

@@ -2,6 +2,8 @@ class BaseInventoryController < ActionController::Base
include LoginVerification
layout "inventory"
before_action :check_user
#before_action :check_installation
protect_from_forgery with: :exception
@@ -12,8 +14,10 @@ class BaseInventoryController < ActionController::Base
redirect_to root_path
end
def current_user
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
def check_user
if current_user.nil?
redirect_to root_path
end
end
#Shop Name in Navbor

View File

@@ -2,6 +2,8 @@ class BaseOqsController < ActionController::Base
include LoginVerification
layout "OQS"
before_action :check_user
#before_action :check_installation
protect_from_forgery with: :exception
@@ -21,9 +23,11 @@ class BaseOqsController < ActionController::Base
def default_url_options
{ locale: I18n.locale }
end
def current_user
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
def check_user
if current_user.nil?
redirect_to root_path
end
end
#Shop Name in Navbor

View File

@@ -2,7 +2,7 @@ class BaseOrigamiController < ActionController::Base
include LoginVerification
layout "origami"
# before_action :checkin_process
before_action :check_user
#before_action :check_installation
protect_from_forgery with: :exception
@@ -14,8 +14,10 @@ class BaseOrigamiController < ActionController::Base
redirect_to origami_dashboard_path
end
def current_user
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
def check_user
if current_user.nil?
redirect_to root_path
end
end
# def checkin_process

View File

@@ -2,6 +2,8 @@ class BaseReportController < ActionController::Base
include LoginVerification
layout "application"
before_action :check_user
#before_action :check_installation
protect_from_forgery with: :exception
@@ -83,6 +85,12 @@ class BaseReportController < ActionController::Base
return from, to
end
def check_user
if current_user.nil?
redirect_to root_path
end
end
#Shop Name in Navbor
def shop_detail
@shop = Shop.first

View File

@@ -2,13 +2,21 @@ class BaseWaiterController < ActionController::Base
include LoginVerification
layout "waiter"
before_action :check_user
#before_action :check_installation
protect_from_forgery with: :exception
helper_method :shop_detail
#Shop Name in Navbor
def shop_detail
@shop = Shop.first
end
def check_user
if current_user.nil?
redirect_to root_path
end
end
#Shop Name in Navbor
def shop_detail
@shop = Shop.first
end
end

View File

@@ -33,10 +33,10 @@ module LoginVerification
protected
# Authenticate the user with token based authentication
def authenticate
authenticate_session_token || render_unauthorized
authenticate_session_token || render_unauthorized
end
def authenticate_session_token
def authenticate_session_token
token = session[:session_token]
if (token)
#@current_user = User.find_by(api_key: token)
@@ -50,7 +50,7 @@ module LoginVerification
end
end
def render_unauthorized()
def render_unauthorized
redirect_to root_path
end

View File

@@ -2,8 +2,21 @@ class HomeController < ApplicationController
# layout "application", except: [:index, :show]
# skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
before_action :check_user, only: :dashboard
helper_method :shop_detail
# Special check for only dashboard
def check_user
if current_user.nil?
redirect_to root_path
end
end
def current_user
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
end
def index
# @employees = Employee.all_emp_except_waiter.order("name asc")
@employees = Employee.all.order("name asc")

View File

@@ -715,6 +715,7 @@
$("#first_bill").on('click', function () {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
var server_mode =
$.ajax({
type: "GET",
@@ -723,12 +724,17 @@
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,"");
// For Server Print - from jade
if ($("#server_mode").val() == "cloud") {
code2lab.printFile(result.filepath, result.printer_url);
}
// console.log(result);
// code2lab.printBill(result.filepath, result.printer_model, result.printer_url);
location.reload();
}
});
});
});
$(".choose_payment").on('click', function () {