Merge branch 'quick_service' of bitbucket.org:code2lab/sxrestaurant into split_bill
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
include LoginVerification
|
include LicenseVerification
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
# lookup domain for db from provision
|
# lookup domain for db from provision
|
||||||
before_action :lookup_domain, :set_locale
|
before_action :set_locale
|
||||||
|
|
||||||
helper_method :current_company,:current_login_employee,:current_user,:shop_detail
|
helper_method :current_company,:current_login_employee,:current_user,:shop_detail
|
||||||
# alias_method :current_user, :current_login_employee,:current_user
|
# alias_method :current_user, :current_login_employee,:current_user
|
||||||
@@ -22,67 +23,6 @@ class ApplicationController < ActionController::Base
|
|||||||
{ locale: I18n.locale }
|
{ locale: I18n.locale }
|
||||||
end
|
end
|
||||||
|
|
||||||
def lookup_domain
|
|
||||||
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.name
|
|
||||||
ActiveRecord::Base.establish_connection(website_connection(@license))
|
|
||||||
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
|
||||||
else
|
|
||||||
# reconnect_default_db
|
|
||||||
logger.info 'License is nil'
|
|
||||||
# redirect_to root_url(:host => request.domain) + "store_error"
|
|
||||||
render :json => [{ status: false, message: 'Invalid Access!'}]
|
|
||||||
end
|
|
||||||
else
|
|
||||||
# check for license file
|
|
||||||
# if check_license
|
|
||||||
# current_license(ENV["SX_PROVISION_URL"])
|
|
||||||
# else
|
|
||||||
# redirect_to activate_path
|
|
||||||
# end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
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
|
|
||||||
puts "RUN SAY BYAR"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def cache_license(url, lookup)
|
|
||||||
@license = License.new(url, lookup)
|
|
||||||
|
|
||||||
if (@license.detail_with_local_cache(lookup) == true)
|
|
||||||
return @license
|
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def website_connection(license)
|
|
||||||
default_connection.dup.update(:host => license.dbhost, :database => license.dbschema.to_s.downcase,
|
|
||||||
:username => license.dbusername, :password => license.dbpassword)
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def reconnect_default_db
|
|
||||||
ActiveRecord::Base.establish_connection(Rails.env)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Regular database.yml configuration hash
|
|
||||||
def default_connection
|
|
||||||
@default_config ||= ActiveRecord::Base.connection.instance_variable_get("@config").dup
|
|
||||||
end
|
|
||||||
|
|
||||||
rescue_from CanCan::AccessDenied do |exception|
|
rescue_from CanCan::AccessDenied do |exception|
|
||||||
flash[:warning] = exception.message
|
flash[:warning] = exception.message
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
@@ -115,14 +55,6 @@ class ApplicationController < ActionController::Base
|
|||||||
@employee = Employee.find_by_token_session(session[:session_token])
|
@employee = Employee.find_by_token_session(session[:session_token])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
def check_license
|
|
||||||
if License.check_license_file
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class BaseCrmController < ActionController::Base
|
class BaseCrmController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "CRM"
|
layout "CRM"
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class BaseInventoryController < ActionController::Base
|
class BaseInventoryController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "inventory"
|
layout "inventory"
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class BaseOqsController < ActionController::Base
|
class BaseOqsController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "OQS"
|
layout "OQS"
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class BaseOrigamiController < ActionController::Base
|
class BaseOrigamiController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "origami"
|
layout "origami"
|
||||||
|
|
||||||
# before_action :checkin_process
|
# before_action :checkin_process
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class BaseReportController < ActionController::Base
|
class BaseReportController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "application"
|
layout "application"
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
class BaseWaiterController < ActionController::Base
|
class BaseWaiterController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "waiter"
|
layout "waiter"
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
protect_from_forgery with: :exception
|
protect_from_forgery with: :exception
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
83
app/controllers/concerns/license_verification.rb
Normal file
83
app/controllers/concerns/license_verification.rb
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
module LicenseVerification
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
before_action :lookup_domain
|
||||||
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
def lookup_domain
|
||||||
|
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.name
|
||||||
|
ActiveRecord::Base.establish_connection(website_connection(@license))
|
||||||
|
authenticate_session_token
|
||||||
|
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
||||||
|
else
|
||||||
|
# reconnect_default_db
|
||||||
|
logger.info 'License is nil'
|
||||||
|
# redirect_to root_url(:host => request.domain) + "store_error"
|
||||||
|
render :json => [{ status: false, message: 'Invalid Access!'}]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
# check for license file
|
||||||
|
# if check_license
|
||||||
|
# current_license(ENV["SX_PROVISION_URL"])
|
||||||
|
# else
|
||||||
|
# redirect_to activate_path
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def authenticate_session_token
|
||||||
|
token = session[:session_token]
|
||||||
|
if (token)
|
||||||
|
#@current_user = User.find_by(api_key: token)
|
||||||
|
#Rails.logger.debug "token - " + token.to_s
|
||||||
|
|
||||||
|
@user = Employee.authenticate_by_token(token)
|
||||||
|
if !@user
|
||||||
|
flash[:notice] = 'Invalid Access!'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
puts "RUN SAY BYAR"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def cache_license(url, lookup)
|
||||||
|
@license = License.new(url, lookup)
|
||||||
|
|
||||||
|
if (@license.detail_with_local_cache(lookup) == true)
|
||||||
|
return @license
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def website_connection(license)
|
||||||
|
default_connection.dup.update(:host => license.dbhost, :database => license.dbschema.to_s.downcase,
|
||||||
|
:username => license.dbusername, :password => license.dbpassword)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def reconnect_default_db
|
||||||
|
ActiveRecord::Base.establish_connection(Rails.env)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Regular database.yml configuration hash
|
||||||
|
def default_connection
|
||||||
|
@default_config ||= ActiveRecord::Base.connection.instance_variable_get("@config").dup
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -4,7 +4,6 @@ module LoginVerification
|
|||||||
included do
|
included do
|
||||||
before_action :authenticate
|
before_action :authenticate
|
||||||
helper_method :current_company,:current_login_employee
|
helper_method :current_company,:current_login_employee
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -18,12 +17,14 @@ module LoginVerification
|
|||||||
token = session[:session_token]
|
token = session[:session_token]
|
||||||
if (token)
|
if (token)
|
||||||
#@current_user = User.find_by(api_key: token)
|
#@current_user = User.find_by(api_key: token)
|
||||||
Rails.logger.debug "token - " + token.to_s
|
#Rails.logger.debug "token - " + token.to_s
|
||||||
|
|
||||||
@user = Employee.authenticate_by_token(token)
|
@user = Employee.authenticate_by_token(token)
|
||||||
if @user
|
if @user
|
||||||
return true
|
return true
|
||||||
#Maybe log - login?
|
#Maybe log - login?
|
||||||
|
else
|
||||||
|
flash[:notice] = 'Invalid Access!'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -50,6 +51,10 @@ module LoginVerification
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
def check_license
|
||||||
|
License.check_license_file
|
||||||
|
end
|
||||||
|
|
||||||
def check_installation
|
def check_installation
|
||||||
if current_company.nil?
|
if current_company.nil?
|
||||||
redirect_to install_path
|
redirect_to install_path
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class HomeController < ApplicationController
|
class HomeController < ApplicationController
|
||||||
# layout "application", except: [:index, :show]
|
# layout "application", except: [:index, :show]
|
||||||
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
# skip_before_action only: [:index, :show, :create, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
# @employees = Employee.all_emp_except_waiter.order("name asc")
|
# @employees = Employee.all_emp_except_waiter.order("name asc")
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
#end rounding adjustment
|
#end rounding adjustment
|
||||||
|
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
sale_payment.process_payment(saleObj, @usercurrent_user.name, cash, "cash")
|
||||||
|
|
||||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error "})
|
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error "})
|
||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
@@ -350,6 +350,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
cash = params[:cash]
|
cash = params[:cash]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
sub_total = params[:sub_total]
|
sub_total = params[:sub_total]
|
||||||
|
remark = params[:remark]
|
||||||
member_info = nil
|
member_info = nil
|
||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
current_balance = nil
|
current_balance = nil
|
||||||
@@ -363,7 +364,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
sale_payment = SalePayment.new
|
sale_payment = SalePayment.new
|
||||||
sale_payment.process_payment(saleObj, @user, cash, "foc")
|
sale_payment.process_payment(saleObj, current_user.name, cash, "foc" ,remark)
|
||||||
|
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
def overall_void
|
def overall_void
|
||||||
|
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
|
remark = params[:remark]
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
sale = Sale.find_by_sale_id(sale_id)
|
sale = Sale.find_by_sale_id(sale_id)
|
||||||
|
|
||||||
@@ -69,12 +69,8 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# FOr Sale Audit
|
# FOr Sale Audit
|
||||||
action_by = current_user.id
|
action_by = current_user.name
|
||||||
if table.nil?
|
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||||
remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table -> nil"
|
|
||||||
else
|
|
||||||
remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
|
||||||
end
|
|
||||||
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" )
|
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" )
|
||||||
|
|
||||||
# For Print
|
# For Print
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ class SaleAudit < ApplicationRecord
|
|||||||
sale_audit.sale_id = sale_id
|
sale_audit.sale_id = sale_id
|
||||||
sale_audit.action = "SALECOMPLETE"
|
sale_audit.action = "SALECOMPLETE"
|
||||||
sale_audit.action_at = DateTime.now.utc
|
sale_audit.action_at = DateTime.now.utc
|
||||||
sale_audit.action_by = action_by
|
sale_audit.action_by = Sale.find(sale_id).cashier_id
|
||||||
sale_audit.remark = remark
|
sale_audit.remark = remark
|
||||||
sale_audit.approved_by = Time.now
|
sale_audit.approved_by = action_by
|
||||||
sale_audit.save!
|
sale_audit.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -72,9 +72,9 @@ class SaleAudit < ApplicationRecord
|
|||||||
sale_audit.sale_id = sale_id
|
sale_audit.sale_id = sale_id
|
||||||
sale_audit.action = "SALEPAYMENT"
|
sale_audit.action = "SALEPAYMENT"
|
||||||
sale_audit.action_at = DateTime.now.utc
|
sale_audit.action_at = DateTime.now.utc
|
||||||
sale_audit.action_by = action_by
|
sale_audit.action_by = Sale.find(sale_id).cashier_id
|
||||||
sale_audit.remark = remark
|
sale_audit.remark = remark
|
||||||
sale_audit.approved_by = Time.now
|
sale_audit.approved_by = action_by
|
||||||
sale_audit.save!
|
sale_audit.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -83,9 +83,9 @@ class SaleAudit < ApplicationRecord
|
|||||||
sale_audit.sale_id = sale_id
|
sale_audit.sale_id = sale_id
|
||||||
sale_audit.action = "PAYMAL"
|
sale_audit.action = "PAYMAL"
|
||||||
sale_audit.action_at = DateTime.now.utc
|
sale_audit.action_at = DateTime.now.utc
|
||||||
sale_audit.action_by = action_by
|
sale_audit.action_by = Sale.find(sale_id).cashier_id
|
||||||
sale_audit.remark = remark
|
sale_audit.remark = remark
|
||||||
sale_audit.approved_by = Time.now
|
sale_audit.approved_by = action_by
|
||||||
sale_audit.save!
|
sale_audit.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status
|
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status
|
||||||
|
|
||||||
def process_payment(invoice, action_by, cash_amount, payment_method)
|
def process_payment(invoice, action_by, cash_amount, payment_method,remark=nil)
|
||||||
self.sale = invoice
|
self.sale = invoice
|
||||||
self.received_amount = cash_amount
|
self.received_amount = cash_amount
|
||||||
amount_due = invoice.grand_total
|
amount_due = invoice.grand_total
|
||||||
@@ -53,7 +53,7 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
|
# remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
|
||||||
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
||||||
|
|
||||||
# update complete order items in oqs
|
# update complete order items in oqs
|
||||||
@@ -67,7 +67,7 @@ class SalePayment < ApplicationRecord
|
|||||||
return true, self.save
|
return true, self.save
|
||||||
else
|
else
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
# remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
|
||||||
sale_audit = SaleAudit.record_payment(invoice.id, remark,action_by)
|
sale_audit = SaleAudit.record_payment(invoice.id, remark,action_by)
|
||||||
|
|
||||||
return false, "No outstanding Amount"
|
return false, "No outstanding Amount"
|
||||||
|
|||||||
@@ -473,7 +473,8 @@
|
|||||||
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
|
<button type="button" id="customer" class="btn btn-block bg-blue waves-effect">Customer</button>
|
||||||
<% if current_login_employee.role != "waiter" %>
|
<% if current_login_employee.role != "waiter" %>
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' <%= (can? :edit, :sale_edit)? ' ': 'disabled=' %> active="true">Edit</button>
|
||||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> active="true"> Void</button>
|
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void</button>
|
||||||
|
|
||||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" <%= (can? :index, :discount)? ' ': 'disabled=' %> active="true">Discount</button>
|
||||||
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
<button type="button" id="other-charges" class="btn btn-block bg-blue waves-effect">Charges</button>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -536,6 +537,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer ">
|
||||||
|
<div class="row p-r-20">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-red waves-effect " id="void" active="true">VOID</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
cashier_type = "cashier"
|
cashier_type = "cashier"
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
@@ -868,9 +893,12 @@
|
|||||||
if (isConfirm) {
|
if (isConfirm) {
|
||||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||||
|
var remark = $("#remark").val();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
|
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||||
success: function () {
|
success: function () {
|
||||||
window.location.href = '/origami/';
|
window.location.href = '/origami/';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -324,8 +324,12 @@
|
|||||||
<i class="material-icons">reply</i>
|
<i class="material-icons">reply</i>
|
||||||
Back
|
Back
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn bg-deep-purple btn-block" id="foc" active="<%= can? :foc, :payment %>"> FOC </button>
|
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||||
<button type="button" class="btn bg-red btn-block" id="void" active="<%= can? :overall_void, :void %>"> Void </button>
|
<i class="material-icons">reply</i>
|
||||||
|
Back
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn bg-deep-purple btn-block" data-toggle="modal" data-target="#focModal" <%= (can? :foc, :payment)? ' ': 'disabled=' %> active="true"> FOC </button>
|
||||||
|
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
|
||||||
<% if @cashier_type=="quick_service" %>
|
<% if @cashier_type=="quick_service" %>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@@ -339,8 +343,52 @@
|
|||||||
</div>
|
</div>
|
||||||
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
<input type="hidden" id="server_mode" value="<%= ENV["SERVER_MODE"] %>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="modal fade" id="voidModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="voidModalLabel">Please Enter Reason for Void</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="remark">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer ">
|
||||||
|
<div class="row p-r-20">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-red waves-effect " id="void" active="true">VOID</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link p-t-5 p-b-5 bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal fade" id="focModal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="focModalLabel">Please Enter Reason for FOC</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<input type="textarea" name="remark" class="form-control col-md-12 remark" id="foc_remark">
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer ">
|
||||||
|
<div class="row p-r-20">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-red waves-effect " id="foc" active="true">FOC</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-5">
|
||||||
|
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var cashier_type = "<%= @cashier_type %>";
|
var cashier_type = "<%= @cashier_type %>";
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
@@ -649,30 +697,59 @@ console.log("fffffffffffff")
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#void').on('click',function () {
|
// $('#void').on('click',function () {
|
||||||
if ($(this).attr('active') === "true") {
|
// if ($(this).attr('active') === "true") {
|
||||||
|
// var sale_id = $('#sale_id').text();
|
||||||
|
// var remark = $("#remark").val();
|
||||||
|
// var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||||
|
// $.ajax({
|
||||||
|
// type: 'POST',
|
||||||
|
// url: ajax_url,
|
||||||
|
// data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||||
|
// success: function () {
|
||||||
|
// window.location.href = '/origami/';
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }else{
|
||||||
|
// swal("Opps","You are not authorized for void","warning")
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
$('#void').on('click', function () {
|
||||||
|
if ($(this).attr('active')=== "true") {
|
||||||
swal({
|
swal({
|
||||||
title: "Information!",
|
title: "Alert",
|
||||||
text: 'Are you sure want to Void !',
|
text: "Are you sure want to Void?",
|
||||||
}, function () {
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, void it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
|
var remark = $("#remark").val();
|
||||||
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
|
data: "remark="+ remark + "&sale_id=" + sale_id,
|
||||||
success: function () {
|
success: function () {
|
||||||
|
<<<<<<< HEAD
|
||||||
if (cashier_type=="cashier") {
|
if (cashier_type=="cashier") {
|
||||||
window.location.href = '/origami';
|
window.location.href = '/origami';
|
||||||
}else{
|
}else{
|
||||||
window.location.href = '/origami/quick_service';
|
window.location.href = '/origami/quick_service';
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
window.location.href = '/origami/';
|
||||||
|
>>>>>>> 77a66d726bc48a7c5d8be7c12728c1d0a9a5621e
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
swal("Oops","You are not authorized for void","warning")
|
swal("Oops","You are not authorized for void","warning")
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -698,12 +775,14 @@ console.log("fffffffffffff")
|
|||||||
$('#foc').click(function() {
|
$('#foc').click(function() {
|
||||||
//$( "#loading_wrapper" ).show();
|
//$( "#loading_wrapper" ).show();
|
||||||
// payment
|
// payment
|
||||||
|
var remark = $("#foc_remark").val();
|
||||||
var cash = $('#grand_total').text();
|
var cash = $('#grand_total').text();
|
||||||
var sub_total = $('#sub-total').text();
|
var sub_total = $('#sub-total').text();
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total };
|
var params = { 'cash':cash,'sale_id':sale_id,'sub_total':sub_total,'remark':remark };
|
||||||
|
|
||||||
if ($(this).attr('active')=== "true") {
|
if ($(this).attr('active')=== "true") {
|
||||||
|
<<<<<<< HEAD
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<%= origami_payment_foc_path %>",
|
url: "<%= origami_payment_foc_path %>",
|
||||||
@@ -725,8 +804,36 @@ console.log("fffffffffffff")
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=======
|
||||||
|
swal({
|
||||||
|
title: "Alert",
|
||||||
|
text: "Are you sure want to FOC This Receipt?",
|
||||||
|
type: "warning",
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonColor: "#DD6B55",
|
||||||
|
confirmButtonText: "Yes, FOC it!",
|
||||||
|
closeOnConfirm: false
|
||||||
|
}, function (isConfirm) {
|
||||||
|
if (isConfirm) {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "<%= origami_payment_foc_path %>",
|
||||||
|
data: params,
|
||||||
|
success:function(result){
|
||||||
|
if (cash >= 0) {
|
||||||
|
swal({
|
||||||
|
title: "Information!",
|
||||||
|
text: 'Thank You !',
|
||||||
|
}, function () {
|
||||||
|
window.location.href = '/origami';
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
>>>>>>> 77a66d726bc48a7c5d8be7c12728c1d0a9a5621e
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
swal("Oops","You are not authorized for foc","warning")
|
swal("Oops","You are not authorized for foc","warning")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
development:
|
development:
|
||||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||||
sx_provision_url: connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
sx_provision_url: 192.168.1.125:3002/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
||||||
server_mode: application
|
server_mode: cloud
|
||||||
cipher_type: AES-256-CBC
|
cipher_type: AES-256-CBC
|
||||||
sx_key: Wh@t1$C2L
|
sx_key: Wh@t1$C2L
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
{
|
{
|
||||||
"data": []
|
"data": [
|
||||||
|
{
|
||||||
|
"lookup": "chromis-1.zsai.ws",
|
||||||
|
"value": {
|
||||||
|
"key": "877eY5iPvpVzaYnIkc2FgIy0U85FtqpTpQGqoM/RCG0=\n",
|
||||||
|
"iv": "qSVQaKzOm3TYmRP3DhHdig==\n"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lookup": "gw2a-13.zsai.dev",
|
||||||
|
"value": {
|
||||||
|
"key": "R0uRkGlvCD5DGaPV4SkhGlwaMR0ohYBBmNna+tpRXMc=\n",
|
||||||
|
"iv": "AP5iuLM36oJmnvLsWCo9+Q==\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user