update other multiple payments

This commit is contained in:
Aung Myo
2018-01-12 14:33:30 +06:30
parent 08c8fc438d
commit cc710a992f
5 changed files with 28 additions and 18 deletions

View File

@@ -96,6 +96,7 @@ class Ability
can :read, Order
can :update, Order
can :menage, Booking
can :manage, OrderQueueStation
can :read, Sale
can :update, Sale
can :get_customer, Customer

View File

@@ -390,7 +390,7 @@
<% if @status_sale == 'sale' %>
<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" 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="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
@@ -419,7 +419,7 @@
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
</div>
<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="Credit">Credit</option>
<% @payment_methods.each do |pay| %>
@@ -552,6 +552,8 @@
// Discount for Payment
$('#discount').click(function () {
if ($(this).attr('active')=== "true") {
var sale = $('#sale_id').val();
if (sale != "") {
var sale_id = sale
@@ -565,7 +567,9 @@
else {
swal ( "Oops" , "Please select an table!" , "warning" );
}
}else{
swal("Opps","You are not authorized for void","warning")
}
return false;
});
});

View File

@@ -34,11 +34,12 @@
}
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
if(payment_type) {
$(".others-payment").hide();
$("."+payment_type).show();
}
if(payment_type) {
$(".others-payment").hide();
$(payment_type).each(function(i){
$("."+payment_type[i]).show();
});
}
/* end check first bill or not*/
$('.others-payment').on('click',function(){

View File

@@ -310,16 +310,20 @@
receipt_no = ($("#receipt_no").html()).trim();
}
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
if(payment_type=="Cash"){
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
// console.log(jQuery.inArray("Credit", payment_type))
// console.log(payment_type)
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
$("#credit_payment").hide();
} 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();
$("#credit_payment").hide();
}else if(payment_type=="Credit"){
$("#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*/
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";

View File

@@ -393,7 +393,7 @@
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
</div>
<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>
<% @payment_methods.each do |pay| %>
<option value="<%= pay.payment_method %>">