pull from master 23.5.2018
This commit is contained in:
@@ -7,7 +7,10 @@ class Api::Restaurant::MenuController < Api::ApiController
|
||||
# checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp
|
||||
|
||||
all_menu = Menu.all
|
||||
|
||||
@request_url = ''
|
||||
if ENV["SERVER_MODE"] == "cloud"
|
||||
@request_url = request.subdomain + "." + request.domain #local_url => 'http://0.0.0.0:3000'
|
||||
end
|
||||
# to hash
|
||||
menu_array = []
|
||||
all_menu.each do |m|
|
||||
|
||||
@@ -19,7 +19,7 @@ class HomeController < ApplicationController
|
||||
|
||||
def index
|
||||
# @employees = Employee.all_emp_except_waiter.order("name asc")
|
||||
@employees = Employee.all.order("name asc")
|
||||
@employees = Employee.all.where("is_active = true").order("name asc")
|
||||
@login_form = LoginForm.new()
|
||||
render "layouts/login_dashboard", layout: false
|
||||
end
|
||||
@@ -52,29 +52,33 @@ class HomeController < ApplicationController
|
||||
@employee = Employee.login(@login_form.emp_id, @login_form.password)
|
||||
|
||||
if @employee != nil
|
||||
if @employee.role == "administrator"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
elsif @employee.role == "cashier"
|
||||
session[:session_token] = @employee.token_session
|
||||
route_by_role(@employee)
|
||||
elsif @employee.role == "manager"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
elsif @employee.role == "supervisor"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_root_path
|
||||
elsif @employee.role == "waiter"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_dashboard_path
|
||||
elsif @employee.role == "account"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to reports_dailysale_index_path
|
||||
elsif @employee.role == "kitchen"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to oqs_root_path
|
||||
if @employee.is_active
|
||||
if @employee.role == "administrator"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
elsif @employee.role == "cashier"
|
||||
session[:session_token] = @employee.token_session
|
||||
route_by_role(@employee)
|
||||
elsif @employee.role == "manager"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to dashboard_path
|
||||
elsif @employee.role == "supervisor"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_root_path
|
||||
elsif @employee.role == "waiter"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to origami_dashboard_path
|
||||
elsif @employee.role == "account"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to reports_dailysale_index_path
|
||||
elsif @employee.role == "kitchen"
|
||||
session[:session_token] = @employee.token_session
|
||||
redirect_to oqs_root_path
|
||||
else
|
||||
render :index
|
||||
end
|
||||
else
|
||||
render :index
|
||||
redirect_to root_path, :notice => "This Employee is not active"
|
||||
end
|
||||
else
|
||||
redirect_to root_path, :notice => "Username and Password doesn't match!"
|
||||
|
||||
@@ -18,42 +18,42 @@ class Origami::DashboardController < BaseOrigamiController
|
||||
# .sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)')
|
||||
# @inventories = StockJournal.inventory_balances(today).sum(:balance)
|
||||
|
||||
@total_sale = Sale.total_sale(today)
|
||||
@total_count = Sale.total_count(today)
|
||||
@total_card = Sale.total_card_sale(today)
|
||||
@total_credit = Sale.credit_payment(today)
|
||||
@total_sale = Sale.total_sale(today,current_user)
|
||||
@total_count = Sale.total_count(today,current_user)
|
||||
@total_card = Sale.total_card_sale(today,current_user)
|
||||
@total_credit = Sale.credit_payment(today,current_user)
|
||||
|
||||
@sale_data = Array.new
|
||||
@total_payment_methods = Sale.total_payment_methods(today)
|
||||
@total_payment_methods = Sale.total_payment_methods(today,current_user)
|
||||
|
||||
@total_payment_methods.each do |payment|
|
||||
if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb"
|
||||
pay = Sale.payment_sale('card', today)
|
||||
pay = Sale.payment_sale('card', today, current_user)
|
||||
@sale_data.push({'card' => pay.payment_amount})
|
||||
else
|
||||
pay = Sale.payment_sale(payment.payment_method, today)
|
||||
pay = Sale.payment_sale(payment.payment_method, today, current_user)
|
||||
@sale_data.push({payment.payment_method => pay.payment_amount})
|
||||
end
|
||||
end
|
||||
@summ_sale = Sale.summary_sale_receipt(today)
|
||||
@total_customer = Sale.total_customer(today)
|
||||
@total_dinein = Sale.total_dinein(today)
|
||||
@total_takeaway = Sale.total_takeaway(today)
|
||||
@total_other_customer = Sale.total_other_customer(today)
|
||||
@total_membership = Sale.total_membership(today)
|
||||
@summ_sale = Sale.summary_sale_receipt(today,current_user)
|
||||
@total_customer = Sale.total_customer(today,current_user)
|
||||
@total_dinein = Sale.total_dinein(today,current_user)
|
||||
@total_takeaway = Sale.total_takeaway(today,current_user)
|
||||
@total_other_customer = Sale.total_other_customer(today,current_user)
|
||||
@total_membership = Sale.total_membership(today,current_user)
|
||||
|
||||
@total_order = Sale.total_order(today)
|
||||
@total_accounts = Sale.total_account(today)
|
||||
@total_order = Sale.total_order(today,current_user)
|
||||
@total_accounts = Sale.total_account(today,current_user)
|
||||
@account_data = Array.new
|
||||
@total_accounts.each do |account|
|
||||
acc = Sale.account_data(account.account_id, today)
|
||||
acc = Sale.account_data(account.account_id, today,current_user)
|
||||
if !acc.nil?
|
||||
@account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc})
|
||||
end
|
||||
end
|
||||
|
||||
@top_items = Sale.top_items(today)
|
||||
@total_foc_items = Sale.total_foc_items(today)
|
||||
@top_items = Sale.top_items(today,current_user)
|
||||
@total_foc_items = Sale.total_foc_items(today,current_user)
|
||||
|
||||
# get printer info
|
||||
@print_settings = PrintSetting.get_precision_delimiter()
|
||||
|
||||
@@ -68,6 +68,6 @@ class Settings::EmployeesController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def employee_params
|
||||
params.require(:employee).permit(:name, :role, :emp_id, :password, :image_path)
|
||||
params.require(:employee).permit(:name, :role, :is_active, :emp_id, :password, :image_path)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user