Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
This commit is contained in:
@@ -96,6 +96,7 @@ class Ability
|
|||||||
can :read, Order
|
can :read, Order
|
||||||
can :update, Order
|
can :update, Order
|
||||||
can :menage, Booking
|
can :menage, Booking
|
||||||
|
can :manage, OrderQueueStation
|
||||||
can :read, Sale
|
can :read, Sale
|
||||||
can :update, Sale
|
can :update, Sale
|
||||||
can :get_customer, Customer
|
can :get_customer, Customer
|
||||||
@@ -104,11 +105,11 @@ class Ability
|
|||||||
|
|
||||||
can :index, :other_charge
|
can :index, :other_charge
|
||||||
can :create, :other_charge
|
can :create, :other_charge
|
||||||
can :index, :discount
|
# can :index, :discount
|
||||||
can :create, :discount
|
# can :create, :discount
|
||||||
can :remove_discount_items, :discount
|
# can :remove_discount_items, :discount
|
||||||
can :remove_all_discount, :discount
|
# can :remove_all_discount, :discount
|
||||||
can :member_discount, :discount
|
# can :member_discount, :discount
|
||||||
|
|
||||||
can :first_bill, :payment
|
can :first_bill, :payment
|
||||||
can :show, :payment
|
can :show, :payment
|
||||||
|
|||||||
@@ -146,9 +146,10 @@ class Customer < ApplicationRecord
|
|||||||
if sale.customer.membership_id
|
if sale.customer.membership_id
|
||||||
response = self.rebat(Sale.find(sale.sale_id))
|
response = self.rebat(Sale.find(sale.sale_id))
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
|
if !response.nil?
|
||||||
remark = "UPdate Rebate Response - #{response} for Customer #{sale.customer_id} Sale Id [#{sale.sale_id}]| pay amount -> #{sale.amount_received} "
|
remark = "UPdate Rebate Response - #{response} for Customer #{sale.customer_id} Sale Id [#{sale.sale_id}]| pay amount -> #{sale.amount_received} "
|
||||||
sale_audit = SaleAudit.record_paymal(sale.sale_id, remark, 1)
|
sale_audit = SaleAudit.record_paymal(sale.sale_id, remark, 1)
|
||||||
|
end
|
||||||
if response["status"] == true
|
if response["status"] == true
|
||||||
status = sale.update_attributes(rebate_status: "true")
|
status = sale.update_attributes(rebate_status: "true")
|
||||||
end
|
end
|
||||||
@@ -159,8 +160,9 @@ class Customer < ApplicationRecord
|
|||||||
def self.rebat(sObj)
|
def self.rebat(sObj)
|
||||||
rebate_prices,campaign_method = SaleItem.calculate_rebate_by_account(sObj.sale_items)
|
rebate_prices,campaign_method = SaleItem.calculate_rebate_by_account(sObj.sale_items)
|
||||||
generic_customer_id = sObj.customer.membership_id
|
generic_customer_id = sObj.customer.membership_id
|
||||||
if generic_customer_id.present?
|
|
||||||
|
|
||||||
|
|
||||||
|
if generic_customer_id.present?
|
||||||
paypar = sObj.sale_payments
|
paypar = sObj.sale_payments
|
||||||
payparcost = 0
|
payparcost = 0
|
||||||
credit = 0
|
credit = 0
|
||||||
@@ -171,6 +173,7 @@ class Customer < ApplicationRecord
|
|||||||
end
|
end
|
||||||
if pp.payment_method == "creditnote"
|
if pp.payment_method == "creditnote"
|
||||||
credit = 1
|
credit = 1
|
||||||
|
sObj.update_attributes(rebate_status: nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
||||||
@@ -287,6 +290,7 @@ class Customer < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
puts "no Response"
|
||||||
response = { "status": "no_member", "message": "Not membership"}
|
response = { "status": "no_member", "message": "Not membership"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -390,7 +390,7 @@
|
|||||||
<% if @status_sale == 'sale' %>
|
<% if @status_sale == 'sale' %>
|
||||||
<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>
|
||||||
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' active="<%= can? :edit, :sale_edit %>">Edit</button>
|
<button type="button" class="btn btn-block bg-blue waves-effect" id='edit' active="<%= can? :edit, :sale_edit %>">Edit</button>
|
||||||
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect">Discount</button>
|
<button type="button" id="discount" class="btn btn-block bg-blue waves-effect" active="<%= can? :index, :discount %>">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>
|
||||||
|
|
||||||
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
||||||
@@ -419,7 +419,7 @@
|
|||||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<select class="form-control show-tick payment_method" id="payment_method" >
|
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
|
||||||
<option value="Cash">Cash</option>
|
<option value="Cash">Cash</option>
|
||||||
<option value="Credit">Credit</option>
|
<option value="Credit">Credit</option>
|
||||||
<% @payment_methods.each do |pay| %>
|
<% @payment_methods.each do |pay| %>
|
||||||
@@ -552,6 +552,8 @@
|
|||||||
|
|
||||||
// Discount for Payment
|
// Discount for Payment
|
||||||
$('#discount').click(function () {
|
$('#discount').click(function () {
|
||||||
|
|
||||||
|
if ($(this).attr('active')=== "true") {
|
||||||
var sale = $('#sale_id').val();
|
var sale = $('#sale_id').val();
|
||||||
if (sale != "") {
|
if (sale != "") {
|
||||||
var sale_id = sale
|
var sale_id = sale
|
||||||
@@ -565,7 +567,9 @@
|
|||||||
else {
|
else {
|
||||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
swal("Opps","You are not authorized for void","warning")
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -36,9 +36,10 @@
|
|||||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
|
||||||
if(payment_type) {
|
if(payment_type) {
|
||||||
$(".others-payment").hide();
|
$(".others-payment").hide();
|
||||||
$("."+payment_type).show();
|
$(payment_type).each(function(i){
|
||||||
|
$("."+payment_type[i]).show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* end check first bill or not*/
|
/* end check first bill or not*/
|
||||||
|
|
||||||
$('.others-payment').on('click',function(){
|
$('.others-payment').on('click',function(){
|
||||||
|
|||||||
@@ -311,14 +311,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
||||||
if(payment_type=="Cash"){
|
// console.log(jQuery.inArray("Credit", payment_type))
|
||||||
$("#card_payment").hide();
|
// console.log(payment_type)
|
||||||
|
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||||
$("#credit_payment").hide();
|
$("#credit_payment").hide();
|
||||||
}else if(payment_type=="Credit"){
|
} else{
|
||||||
|
$("#credit_payment").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(parseInt(jQuery.inArray("MPU", payment_type)) > 0 || parseInt(jQuery.inArray("VISA", payment_type)) > 0 || parseInt(jQuery.inArray("JCB", payment_type)) > 0 || parseInt(jQuery.inArray("Master", payment_type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) > 0 || parseInt(jQuery.inArray("Redeem", payment_type)) > 0){
|
||||||
|
$("#card_payment").show();
|
||||||
|
} else{
|
||||||
$("#card_payment").hide();
|
$("#card_payment").hide();
|
||||||
$("#others_payment").hide();
|
|
||||||
}else if(payment_type=="MPU"||payment_type=="VISA"||payment_type=="JCB"||payment_type=="Master" || payment_type=="UNIONPAY"){
|
|
||||||
$("#credit_payment").hide();
|
|
||||||
}
|
}
|
||||||
/* end check first bill or not*/
|
/* end check first bill or not*/
|
||||||
|
|
||||||
|
|||||||
@@ -393,7 +393,7 @@
|
|||||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<select class="form-control show-tick payment_method" id="payment_method" >
|
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
|
||||||
<option value="Cash">Cash</option>
|
<option value="Cash">Cash</option>
|
||||||
<% @payment_methods.each do |pay| %>
|
<% @payment_methods.each do |pay| %>
|
||||||
<option value="<%= pay.payment_method %>">
|
<option value="<%= pay.payment_method %>">
|
||||||
|
|||||||
Reference in New Issue
Block a user