shop code

This commit is contained in:
Nweni
2019-12-04 10:49:46 +06:30
18 changed files with 108 additions and 120 deletions

View File

@@ -1,7 +1,10 @@
class Api::ApiController < ActionController::API
include MultiTenancy
include TokenVerification
include ActionView::Rendering
include ActionController::MimeResponds
include ActionView::Rendering
before_action :core_allow
helper_method :current_token, :current_login_employee, :get_cashier
@@ -15,6 +18,12 @@ class Api::ApiController < ActionController::API
private
# ActionView::Rendering override render_to_body breaks render :json,
# resulting in an ActionView::MissingTemplate error.
def render_to_body(options)
_render_to_body_with_renderer(options) || super
end
#this is base api base controller to need to inherit.
#all token authentication must be done here
#response format must be set to JSON

View File

@@ -62,8 +62,8 @@ class Api::OrdersController < Api::ApiController
def create
Rails.logger.debug "Order Source - " + params[:order_source].to_s
Rails.logger.debug "Table ID - " + params[:table_id].to_s
@shop = Shop.find_by_shop_code(params[:shop_code])
current_shift = ShiftSale.current_shift(@shop.shop_code)
# @shop = Shop.find_by_shop_code(params[:shop_code])
current_shift = ShiftSale.current_shift
if current_shift.nil?
@status = false
@message = "No Current Open Shift for This Employee"

View File

@@ -1,5 +1,6 @@
class ApplicationController < ActionController::Base
include LoginVerification, MultiTenancy
include MultiTenancy
include LoginVerification
#before_action :check_installation
protect_from_forgery with: :exception
@@ -17,5 +18,4 @@ class ApplicationController < ActionController::Base
flash[:warning] = exception.message
redirect_to root_path
end
end

View File

@@ -1,5 +1,8 @@
class BaseCrmController < ActionController::Base
include LoginVerification, MultiTenancy
include MultiTenancy
include LoginVerification
layout "CRM"
before_action :check_user

View File

@@ -1,5 +1,7 @@
class BaseInventoryController < ActionController::Base
include LoginVerification, MultiTenancy
include MultiTenancy
include LoginVerification
layout "inventory"
before_action :check_user

View File

@@ -1,5 +1,8 @@
class BaseOqsController < ActionController::Base
include LoginVerification, MultiTenancy
include MultiTenancy
include LoginVerification
layout "OQS"
before_action :check_user

View File

@@ -1,5 +1,7 @@
class BaseOrigamiController < ActionController::Base
include LoginVerification, MultiTenancy
include MultiTenancy
include LoginVerification
layout "origami"
before_action :check_user

View File

@@ -1,5 +1,7 @@
class BaseReportController < ActionController::Base
include LoginVerification, MultiTenancy
include MultiTenancy
include LoginVerification
layout "application"
before_action :check_user

View File

@@ -1,5 +1,7 @@
class BaseWaiterController < ActionController::Base
include LoginVerification, MultiTenancy
include MultiTenancy
include LoginVerification
layout "waiter"
before_action :check_user

View File

@@ -68,7 +68,7 @@ class Foodcourt::OrdersController < BaseFoodcourtController
.joins("JOIN orders ON orders.order_id=booking_orders.order_id")
.joins("JOIN order_items ON orders.order_id=order_items.order_id")
.joins("JOIN customers ON orders.customer_id=customers.customer_id")
.where("orders.source='app' and bookings.shop_code='#{@shop.shop_code}'").order("bookings.created_at desc").uniq
.where("orders.source='app'").order("bookings.created_at desc").uniq
end
def completed
customer =Customer.find_by_customer_id(params[:customer_id])

View File

@@ -4,9 +4,10 @@ class Origami::HomeController < BaseOrigamiController
def index
@webview = check_mobile
@shop = Shop.current_shop
@tables = Table.unscope(:order).all.active.order('status desc')
@rooms = Room.unscope(:order).all.active.order('status desc')
@tables = Table.unscope(:order).includes(:zone).all.active.order('status desc')
@rooms = Room.unscope(:order).includes(:zone).all.active.order('status desc')
@complete = Sale.completed_sale("cashier")
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@@ -21,9 +22,10 @@ class Origami::HomeController < BaseOrigamiController
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
@webview = check_mobile
@shop = Shop.current_shop
@tables = Table.unscope(:order).all.active.order('status desc')
@rooms = Room.unscope(:order).all.active.order('status desc')
@tables = Table.unscope(:order).includes(:zone).all.active.order('status desc')
@rooms = Room.unscope(:order).includes(:zone).all.active.order('status desc')
@complete = Sale.completed_sale("cashier")
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')

View File

@@ -176,14 +176,14 @@ class Origami::PaymentsController < BaseOrigamiController
# For Cashier by Zone
# bookings = Booking.where("sale_id='#{sale_id}'")
bookings = Booking.find_by_sale_id(sale_id)
bookings = saleObj.bookings[0]
shift = ShiftSale.current_open_shift(current_user)
if !shift.nil?
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
else
if bookings.dining_facility_id.to_i > 0
table = DiningFacility.find(bookings.dining_facility_id)
table = bookings.dining_facility
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)