Pull From Master

This commit is contained in:
San Wai Lwin
2018-04-06 13:42:11 +06:30
34 changed files with 277 additions and 76 deletions

View File

@@ -1,5 +1,6 @@
class Api::SurveyController < Api::ApiController
skip_before_action :authenticate
# before_action :authenticate
def index
dining_facility = DiningFacility.find(params[:id])

View File

@@ -7,7 +7,8 @@ class BaseOrigamiController < ActionController::Base
#before_action :check_installation
protect_from_forgery with: :exception
helper_method :shop_detail
helper_method :shop_detail, :current_token
rescue_from CanCan::AccessDenied do |exception|
flash[:warning] = exception.message
# redirect_to origami_root_path
@@ -33,5 +34,21 @@ class BaseOrigamiController < ActionController::Base
def shop_detail
@shop = Shop.first
end
#check webview
def check_mobile
status = false
authenticate_with_http_token do |token, options|
if token
session[:webview] = true
end
session[:session_token] = token
end
if session[:webview] && request.user_agent =~ /android|blackberry|iphone|ipad|ipod|iemobile|mobile|webos/i
status = true
end
return status
end
end

View File

@@ -2,13 +2,23 @@ class Origami::AddordersController < BaseOrigamiController
# before_action :set_dining, only: [:detail]
def index
@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')
@webview = false
if check_mobile
@webview = true
end
@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
@webview = false
if check_mobile
@webview = true
end
today = DateTime.now
day = Date.today.wday
@menus = Menu.all

View File

@@ -9,7 +9,6 @@ class Origami::CustomersController < BaseOrigamiController
end
def get_customer
filter = params[:filter]
type = params[:type]
@@ -47,7 +46,11 @@ class Origami::CustomersController < BaseOrigamiController
end
def add_customer
@webview = false
if check_mobile
@webview = true
end
@sale_id = params[:sale_id]
@cashier_type = params[:type]
@page = params[:page]

View File

@@ -3,6 +3,11 @@ class Origami::DiscountsController < BaseOrigamiController
#discount page show from origami index with selected order
def index
@webview = false
if check_mobile
@webview = true
end
sale_id = params[:id]
@cashier_type = params[:type]
if Sale.exists?(sale_id)

View File

@@ -1,8 +1,13 @@
class Origami::HomeController < BaseOrigamiController
authorize_resource :class => false
before_action :set_dining, only: [:show]
before_action :set_dining, only: [:show]
def index
@webview = false
if check_mobile
@webview = true
end
@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'))
@@ -14,6 +19,11 @@ class Origami::HomeController < BaseOrigamiController
# origami table detail
def show
@webview = false
if check_mobile
@webview = true
end
@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'))

View File

@@ -1,5 +1,10 @@
class Origami::OrdersController < BaseOrigamiController
def show
@webview = false
if check_mobile
@webview = true
end
@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'))

View File

@@ -2,6 +2,11 @@ class Origami::OtherChargesController < BaseOrigamiController
authorize_resource :class => false
def index
@webview = false
if check_mobile
@webview = true
end
sale_id = params[:sale_id]
@cashier_type = params[:type]
if Sale.exists?(sale_id)

View File

@@ -5,9 +5,18 @@ class Origami::RoomsController < BaseOrigamiController
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
# @shift = ShiftSale.current_open_shift(current_user.id)
@webview = false
if check_mobile
@webview = true
end
end
def show
@webview = false
if check_mobile
@webview = true
end
@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'))

View File

@@ -2,6 +2,11 @@ class Origami::SplitBillController < BaseOrigamiController
authorize_resource :class => false
def index
@webview = false
if check_mobile
@webview = true
end
dining_id = params[:dining_id]
@cashier_type = params[:type]
@table = DiningFacility.find(dining_id)

View File

@@ -1,6 +1,10 @@
class Origami::SurveysController < BaseOrigamiController
def new
@webview = false
if check_mobile
@webview = true
end
@survey = Survey.new
@id = params[:id]
@cashier_type = params[:type]

View File

@@ -18,10 +18,12 @@ class PrintSettingsController < ApplicationController
# GET /print_settings/new
def new
@print_setting = PrintSetting.new
@server_mode = ENV["SERVER_MODE"]
end
# GET /print_settings/1/edit
def edit
@server_mode = ENV["SERVER_MODE"]
end
# POST /print_settings