current shop

This commit is contained in:
Nweni
2019-12-03 14:54:53 +06:30
parent 23b5d0d344
commit 78838a7718
17 changed files with 44 additions and 43 deletions

View File

@@ -7,10 +7,10 @@ class Foodcourt::AddordersController < BaseFoodcourtController
@webview = true
end
@tables = Table.all.active.where("shop_code='#{@shop.shop_code}'").order('zone_id asc').group("zone_id")
@rooms = Room.all.active.where("shop_code='#{@shop.shop_code}'").order('zone_id asc').group("zone_id")
@all_table = Table.all.where("shop_code='#{@shop.shop_code}'").active.order('status desc')
@all_room = Room.all.where("shop_code='#{@shop.shop_code}'").active.order('status desc')
@tables = Table.all.active.order('zone_id asc').group("zone_id")
@rooms = Room.all.active.order('zone_id asc').group("zone_id")
@all_table = Table.all.active.order('status desc')
@all_room = Room.all.active.order('status desc')
end
def detail
@@ -19,7 +19,7 @@ class Foodcourt::AddordersController < BaseFoodcourtController
if check_mobile
@webview = true
end
display_type = Lookup.find_by_lookup_type_and_shop_code("display_type",@shop.shop_code)
display_type = Lookup.find_by_lookup_type("display_type")
if !display_type.nil? && display_type.value.to_i ==2
@display_type = display_type.value
else
@@ -233,7 +233,7 @@ class Foodcourt::AddordersController < BaseFoodcourtController
#Send to background job for processing
order = Order.find(order_id)
sidekiq = Lookup.find_by_lookup_type_and_shop_code("sidekiq",@shop.shop_code)
sidekiq = Lookup.find_by_lookup_type("sidekiq")
if ENV["SERVER_MODE"] != 'cloud'
cup_status = `#{"sudo service cups status"}`
print_status = check_cup_status(cup_status)

View File

@@ -15,13 +15,13 @@ class Foodcourt::CashInsController < BaseFoodcourtController
p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user)
shift = ShiftSale.current_open_shift(current_user)
current_shift = ShiftSale.current_shift(@shop.shop_code)
current_shift = ShiftSale.current_shift(Shop.current_shopshop_code)
# set cashier
if shift != nil
shift = shift
else
open_cashier = Employee.where("shop_code='#{@shop.shop_code}' and role = 'cashier' AND token_session <> ''")
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
if open_cashier.count>0
shift = ShiftSale.current_open_shift(open_cashier[0])

View File

@@ -10,13 +10,13 @@ class Foodcourt::CashOutsController < BaseFoodcourtController
p_jour.cash_out(reference, remark, amount, current_user)
shift = ShiftSale.current_open_shift(current_user)
current_shift = ShiftSale.current_shift(@shop.shop_code)
current_shift = ShiftSale.current_shift(Shop.current_shop.shop_code)
# set cashier
if shift != nil
shift = shift
else
open_cashier = Employee.where("shop_code='#{@shop.shop_code}' and role = 'cashier' AND token_session <> ''")
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
if open_cashier.count>0
shift = ShiftSale.current_open_shift(open_cashier[0])

View File

@@ -3,9 +3,10 @@ class Foodcourt::DashboardController < BaseFoodcourtController
def index
today = DateTime.now.strftime('%Y-%m-%d')
@display_type = Lookup.where("shop_code='#{@shop.shop_code}'").find_by_lookup_type("display_type")
@display_type = Lookup.find_by_lookup_type("display_type")
@sale_data = Array.new
@shop = Shop.current_shop
@total_payment_methods = Sale.total_payment_methods(@shop,today,current_user)
if !@total_payment_methods.nil?
@total_payment_methods.each do |payment|

View File

@@ -21,8 +21,8 @@ class Foodcourt::DiscountsController < BaseFoodcourtController
end
end
@member_discount = MembershipSetting.find_by_discount_and_shop_code(1,@shop.shop_code)
@accounts = Account.where("shop_code='#{@shop.shop_code}'")
@member_discount = MembershipSetting.find_by_discount(1)
@accounts = Account.where("shop_code='#{Shop.current_shop.shop_code}'")
end
#discount page show from origami index with selected order

View File

@@ -157,7 +157,7 @@ class Foodcourt::FoodCourtController < ApplicationController
end
def get_all_product()
@product = Product..where("shop_code='#{@shop.shop_code}'")
@product = Product.where("shop_code='#{Shop.current_shop.shop_code}'")
end
# render json for http status code

View File

@@ -4,6 +4,7 @@ class Foodcourt::HomeController < BaseFoodcourtController
def index
@webview = check_mobile
@shop = Shop.current_shop
@tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@complete = Sale.completed_sale("cashier",@shop.shop_code)
@@ -19,7 +20,7 @@ class Foodcourt::HomeController < BaseFoodcourtController
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
@webview = check_mobile
@shop = Shop.current_shop
@tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc')
@complete = Sale.completed_sale("cashier",@shop.shop_code)