improvement
This commit is contained in:
@@ -85,10 +85,10 @@
|
||||
font-size: 14px !important;
|
||||
font-weight:bold;
|
||||
}
|
||||
.sweet-alert {
|
||||
top :0;
|
||||
margin-top: 20px !important;
|
||||
}
|
||||
// .sweet-alert {
|
||||
// top :0;
|
||||
// margin-top: 20px !important;
|
||||
// }
|
||||
.add_to_charges{
|
||||
width:100%;
|
||||
padding:1rem;
|
||||
|
||||
@@ -114,28 +114,19 @@ class Api::OrdersController < Api::ApiController
|
||||
}
|
||||
#end extra time
|
||||
Order.transaction do
|
||||
@order =Order.create(source: params[:order_source],
|
||||
order_type: params[:order_type],
|
||||
customer_id: params[:customer_id].present? ? params[:customer_id] : Customer.walkin.customer_id, # for no customer id from mobile
|
||||
items: items_arr,
|
||||
guest: params[:guest_info],
|
||||
table_id: params[:table_id],
|
||||
new_booking: true,
|
||||
waiters: @user.name,
|
||||
employee_name: @user.name,
|
||||
is_extra_time: is_extra_time,
|
||||
extra_time: extra_time
|
||||
)
|
||||
# begin
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
@order.order_type = params[:order_type]
|
||||
@order.customer_id = params[:customer_id].present? ? params[:customer_id] : Customer.walkin.customer_id # for no customer id from mobile
|
||||
@order.items = items_arr
|
||||
@order.guest = params[:guest_info]
|
||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
||||
@order.new_booking = true
|
||||
@order.waiters = @user.name
|
||||
@order.employee_name = @user.name
|
||||
|
||||
@order.is_extra_time = is_extra_time
|
||||
@order.extra_time = extra_time
|
||||
|
||||
#Create Table Booking or Room Booking
|
||||
if booking.nil? || booking.sale_id.present? || booking.booking_status == 'moved'
|
||||
@order.new_booking = true
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = booking.booking_id
|
||||
end
|
||||
|
||||
@status, @booking = @order.generate
|
||||
|
||||
|
||||
@@ -61,32 +61,13 @@ class Api::PaymentsController < Api::ApiController
|
||||
end
|
||||
|
||||
# For Print
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
unique_code = "ReceiptBillPdf"
|
||||
print_settings = PrintSetting.all
|
||||
if !print_settings.nil?
|
||||
print_settings.each do |setting|
|
||||
if setting.unique_code == 'ReceiptBillPdf'
|
||||
unique_code = "ReceiptBillPdf"
|
||||
elsif setting.unique_code == 'ReceiptBillStarPdf'
|
||||
unique_code = "ReceiptBillStarPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
if Lookup.collection_of("print_settings").any? { |x| x == ["ReceiptBillA5Pdf", "1"] } #print_settings with name:ReceiptBillA5Pdf
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
else
|
||||
unique_code = PrintSetting.where("unique_code REGEXP ?", "receipt.*bill.*pdf").first.unique_code
|
||||
end
|
||||
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
# else
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
customer= Customer.find(sale.customer_id)
|
||||
customer = sale.customer
|
||||
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
|
||||
@@ -9,25 +9,15 @@ class Crm::CustomersController < BaseCrmController
|
||||
filter = params[:filter]
|
||||
filter_card_no = params[:filter_card_no]
|
||||
type = params[:type]
|
||||
puts "type :"
|
||||
puts type
|
||||
puts "filter :"
|
||||
puts filter
|
||||
puts "filter card no"
|
||||
puts filter_card_no
|
||||
@customer_update_phone_email_membertype =false
|
||||
if filter_card_no==""
|
||||
@crm_customers = Customer.all
|
||||
puts "Filter card no"
|
||||
elsif !filter_card_no.nil?
|
||||
@crm_customers=Customer.where("card_no=?",filter_card_no)
|
||||
puts "Null filter card no"
|
||||
elsif filter.nil? || filter_card_no==""
|
||||
@crm_customers = Customer.all
|
||||
puts "filter null filter card no nulll"
|
||||
else
|
||||
@crm_customers = Customer.search(filter)
|
||||
puts "else"
|
||||
# paymal_customer = Customer.search_paypar_account_no(filter)
|
||||
# search account no from paypar
|
||||
if type == "card"
|
||||
@@ -35,20 +25,21 @@ class Crm::CustomersController < BaseCrmController
|
||||
response = Customer.search_paypar_account_no(filter)
|
||||
if !@crm_customers.present?
|
||||
if response["status"] == true
|
||||
@crm_customers = Customer.new
|
||||
@crm_customers.name = response["customer_data"]["name"]
|
||||
@crm_customers.contact_no = response["customer_data"]["phone"]
|
||||
@crm_customers.email = response["customer_data"]["email"]
|
||||
@crm_customers.date_of_birth = response["customer_data"]["DOB"]
|
||||
@crm_customers.nrc_no = response["customer_data"]["NRC"]
|
||||
@crm_customers.address = response["customer_data"]["address"]
|
||||
@crm_customers.card_no = response["customer_data"]["customer_card_no"]
|
||||
@crm_customers.paypar_account_no = filter
|
||||
@crm_customers.membership_id = response["customer_data"]["id"]
|
||||
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
|
||||
@crm_customers.customer_type = "Dinein"
|
||||
@crm_customers.tax_profiles = ["1", "2"]
|
||||
@crm_customers.save
|
||||
tax_ids =[]
|
||||
TaxProfile.all.each {|tax| tax_ids << "#{tax.id}"}
|
||||
@crm_customers =Customer.create(name: response["customer_data"]["name"],
|
||||
contact_no: response["customer_data"]["phone"],
|
||||
email: response["customer_data"]["email"],
|
||||
date_of_birth: response["customer_data"]["DOB"],
|
||||
nrc_no: response["customer_data"]["NRC"],
|
||||
address: response["customer_data"]["address"],
|
||||
card_no: response["customer_data"]["customer_card_no"],
|
||||
paypar_account_no: filter,
|
||||
membership_id: response["customer_data"]["id"],
|
||||
membership_type: response["customer_data"]["member_group_id"],
|
||||
customer_type: "Dinein",
|
||||
tax_profiles: tax_ids
|
||||
)
|
||||
@crm_customers = Customer.search(filter)
|
||||
flash[:member_notice]='Customer was successfully created.'
|
||||
else
|
||||
@@ -207,7 +198,8 @@ class Crm::CustomersController < BaseCrmController
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
|
||||
rescue Errno::ECONNREFUSED
|
||||
response = {"status" => false, "message" => "No internet connection "}
|
||||
rescue HTTParty::Error
|
||||
response = {"status" => false, "message" => "No internet connection "}
|
||||
|
||||
@@ -307,7 +299,8 @@ class Crm::CustomersController < BaseCrmController
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
|
||||
rescue Errno::ECONNREFUSED
|
||||
response = {"status" => false, "message" => "No internet connection "}
|
||||
rescue HTTParty::Error
|
||||
response = {"status" => false, "message" => "No internet connection "}
|
||||
|
||||
@@ -457,6 +450,8 @@ class Crm::CustomersController < BaseCrmController
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Errno::ECONNREFUSED
|
||||
response = {"status" => false, "message" => "No internet connection "}
|
||||
rescue HTTParty::Error
|
||||
response = {"status" => false, "message" => "No internet connection "}
|
||||
|
||||
@@ -522,6 +517,8 @@ class Crm::CustomersController < BaseCrmController
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Errno::ECONNREFUSED
|
||||
response = {"status" => false, "message" => "No internet connection "}
|
||||
rescue HTTParty::Error
|
||||
response = {"status" => false, "message" => "No internet connection "}
|
||||
|
||||
@@ -593,11 +590,11 @@ class Crm::CustomersController < BaseCrmController
|
||||
@customer = Customer.find(params[:id])
|
||||
response = Customer.search_paypar_account_no(@customer.paypar_account_no)
|
||||
if response["status"] == true
|
||||
@customer.name =response["customer_data"]["name"]
|
||||
@customer.contact_no =response["customer_data"]["phone"]
|
||||
@customer.email =response["customer_data"]["email"]
|
||||
@customer.membership_type =response["customer_data"]["member_group_id"]
|
||||
@customer.save
|
||||
@customer.update_attributes(name: response["customer_data"]["name"],
|
||||
contact_no: response["customer_data"]["phone"],
|
||||
email: response["customer_data"]["email"],
|
||||
membership_type: response["customer_data"]["member_group_id"]
|
||||
)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to crm_customers_path }
|
||||
flash[:member_notice]='Membership was successfully updated'
|
||||
|
||||
@@ -87,6 +87,8 @@ class Foodcourt::AddordersController < BaseFoodcourtController
|
||||
end
|
||||
|
||||
def create
|
||||
new_booking =true
|
||||
booking_id =nil
|
||||
if params[:booking_id].present?
|
||||
booking = Booking.find(params[:booking_id])
|
||||
end
|
||||
@@ -124,27 +126,25 @@ class Foodcourt::AddordersController < BaseFoodcourtController
|
||||
else
|
||||
customer_id = params[:customer_id].present? ? params[:customer_id] : Customer.walkin.customer_id # for no customer id from mobile
|
||||
end
|
||||
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
@order.order_type = params[:order_type]
|
||||
@order.customer_id = customer_id
|
||||
@order.items = items_arr
|
||||
@order.guest = params[:guest_info]
|
||||
@order.table_id = params[:table_id] # this is dining facilities's id
|
||||
@order.new_booking = true
|
||||
@order.waiters = current_login_employee.name
|
||||
@order.employee_name = current_login_employee.name
|
||||
@order.is_extra_time = is_extra_time
|
||||
@order.extra_time = extra_time
|
||||
|
||||
if booking.nil? || booking.sale_id.present? || booking.booking_status == 'moved'
|
||||
@order.new_booking = true
|
||||
new_booking = true
|
||||
else
|
||||
@order.new_booking = false
|
||||
@order.booking_id = booking.booking_id
|
||||
new_booking = false
|
||||
booking_id = booking.booking_id
|
||||
end
|
||||
|
||||
@order =Order.create(source: params[:order_source],
|
||||
order_type: params[:order_type],
|
||||
customer_id: customer_id,
|
||||
items: items_arr,
|
||||
guest: params[:guest_info],
|
||||
table_id: params[:table_id],
|
||||
new_booking: new_booking,
|
||||
waiters: current_login_employee.name,
|
||||
employee_name: current_login_employee.name,
|
||||
is_extra_time: is_extra_time,
|
||||
extra_time: extra_time,
|
||||
booking_id: booking_id
|
||||
)
|
||||
@status, @booking = @order.generate
|
||||
|
||||
if @status && @booking
|
||||
@@ -162,8 +162,6 @@ class Foodcourt::AddordersController < BaseFoodcourtController
|
||||
end
|
||||
end
|
||||
|
||||
# Order.send_customer_view(@booking)
|
||||
|
||||
if current_user.role != "waiter" && params[:create_type] == "create_pay"
|
||||
if @status && @booking && (@order.source == 'quick_service') || (@order.source == 'food_court')
|
||||
|
||||
|
||||
@@ -64,32 +64,13 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
|
||||
|
||||
# For Print
|
||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
unique_code = "ReceiptBillPdf"
|
||||
print_settings = PrintSetting.all
|
||||
if !print_settings.nil?
|
||||
print_settings.each do |setting|
|
||||
if setting.unique_code == 'ReceiptBillPdf'
|
||||
unique_code = "ReceiptBillPdf"
|
||||
elsif setting.unique_code == 'ReceiptBillStarPdf'
|
||||
unique_code = "ReceiptBillStarPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
if Lookup.collection_of("print_settings").any? { |x| x == ["ReceiptBillA5Pdf", "1"] } #print_settings with name:ReceiptBillA5Pdf
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
else
|
||||
unique_code = PrintSetting.where("unique_code REGEXP ?", "receipt.*bill.*pdf").first.unique_code
|
||||
end
|
||||
|
||||
if !receipt_bill_a5_pdf.empty?
|
||||
receipt_bill_a5_pdf.each do |receipt_bilA5|
|
||||
if receipt_bilA5[0] == 'ReceiptBillA5Pdf'
|
||||
if receipt_bilA5[1] == '1'
|
||||
unique_code = "ReceiptBillA5Pdf"
|
||||
# else
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
customer = saleObj.customer
|
||||
|
||||
# get member information
|
||||
rebate = MembershipSetting.find_by_rebate(1)
|
||||
|
||||
@@ -169,8 +169,10 @@ class Customer < ApplicationRecord
|
||||
'Content-Type' => 'application/json',
|
||||
'Accept' => 'application/json; version=3'
|
||||
})
|
||||
rescue Errno::ECONNREFUSED
|
||||
response = {status: false, message: "Can't connect server" }
|
||||
rescue Net::OpenTimeout
|
||||
response = { status: false, message: "Server Time out" }
|
||||
response = { status: false, message: "Server Time out" }
|
||||
|
||||
rescue OpenURI::HTTPError
|
||||
response = { status: false, message: "Can't connect server"}
|
||||
@@ -359,6 +361,8 @@ class Customer < ApplicationRecord
|
||||
},
|
||||
:timeout => 10
|
||||
)
|
||||
rescue Errno::ECONNREFUSED
|
||||
response = {"status" => false, "message" => "No internet connection "}
|
||||
rescue HTTParty::Error
|
||||
response = {"status" => false, "message" => "No internet connection "}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
class ActionController::Base
|
||||
before_action :lookup_domain if Rails.env.production?
|
||||
before_action :set_locale
|
||||
before_action :lookup_domain, :set_locale
|
||||
|
||||
private
|
||||
|
||||
def lookup_domain
|
||||
if request.subdomains.last && request.subdomains.last != "www" && ENV["SERVER_MODE"] == "cloud"
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], request.host) # request.subdomain.downcase
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
||||
if (!@license.nil?)
|
||||
logger.info "Location - " + @license.dbschema
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
@@ -18,34 +18,26 @@ class ActionController::Base
|
||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||
end
|
||||
elsif request.subdomains.last && request.subdomains.last != "www" || ENV["SERVER_MODE"] == "application"
|
||||
else
|
||||
# check for license file
|
||||
if check_license(request.host)
|
||||
current_license(ENV["SX_PROVISION_URL"], request.host)
|
||||
if check_license
|
||||
current_license(ENV["SX_PROVISION_URL"])
|
||||
else
|
||||
redirect_to activate_path
|
||||
end
|
||||
else
|
||||
not_found
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def not_found
|
||||
respond_to do |format|
|
||||
format.html { render :file => "#{Rails.root}/public/404", :layout => false, :status => :not_found }
|
||||
format.json { head :not_found }
|
||||
end
|
||||
end
|
||||
|
||||
def current_license(url, lookup)
|
||||
@license = License.new(url, lookup)
|
||||
def current_license(url)
|
||||
@license = License.new(url)
|
||||
flag = @license.detail_with_local_file()
|
||||
if (flag == 0)
|
||||
flash[:notice] = 'Expired or No License!'
|
||||
elsif (flag == 2)
|
||||
flash[:notice] = 'Expiring! Please, License extend...'
|
||||
else
|
||||
Rails.logger.info "Run License"
|
||||
puts "RUN SAY BYAR"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,8 +51,8 @@ class ActionController::Base
|
||||
end
|
||||
end
|
||||
|
||||
def check_license(lookup)
|
||||
License.check_license_file(lookup)
|
||||
def check_license
|
||||
License.check_license_file
|
||||
end
|
||||
|
||||
def check_installation
|
||||
@@ -97,13 +89,14 @@ class ActionController::Base
|
||||
end
|
||||
|
||||
class ActionController::API
|
||||
before_action :lookup_domain if Rails.env.production?
|
||||
before_action :lookup_domain
|
||||
|
||||
private
|
||||
|
||||
def lookup_domain
|
||||
if request.subdomains.last && request.subdomains.last != "www" && ENV["SERVER_CODE"] == "cloud"
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], request.host) # request.subdomain.downcase
|
||||
if request.subdomain.present? && request.subdomain != "www"
|
||||
from = request.subdomain.downcase + "." + request.domain.downcase
|
||||
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
|
||||
if (!@license.nil?)
|
||||
logger.info "Location - " + @license.dbschema
|
||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||
|
||||
Reference in New Issue
Block a user