credit payment function

This commit is contained in:
phyusin
2018-07-10 18:12:25 +06:30
parent d0118d2cfc
commit bf0f76ebc7
29 changed files with 879 additions and 462 deletions

View File

@@ -116,7 +116,7 @@
</div>
<input type="hidden" id="sale_id" value="<%= @sale_id %>">
<div class="col-md-1 col-lg-1 col-sm-1">
<button type="button" class="btn bg-default btn-block" onclick="window.location.href = '/origami/sale/<%= @sale_id %>/<%= @cashier_type %>/payment/others_payment';"><i class="material-icons m-t--5">reply</i> Back </button>
<button type="button" class="btn bg-default btn-block" id="back"><i class="material-icons m-t--5">reply</i> Back </button>
</div>
</div>
@@ -146,7 +146,11 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment/others_payment";
var url_param = "payment";
if(location.pathname.includes("credit_payment")){
url_param = "credit_payment";
}
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/"+url_param+"/others_payment";
});
}
}
@@ -181,8 +185,8 @@
$('#amount').html("0.0");
break;
case 'del' :
var cash=$('#amount').text();
$('#amount').text(cash.substr(0,cash.length-1));
var cash=$('#amount').text() > 0 ? $('#amount').text() : 0;
$('#amount').text((cash > 0 && cash.substr(0,cash.length-1) > 0) ? cash.substr(0,cash.length-1) : 0);
break;
case 'nett':
var remain_amount = $('#validamount').val();
@@ -223,8 +227,14 @@
if(bank_integration == '1'){
pay_withBank("SALE", "alipay", amount, sale_id, receipt_no,cashier_type);
}else{
if(location.pathname.includes("credit_payment")){
var url = "<%= origami_credit_payment_alipay_path %>";
}else{
var url = "<%= origami_payment_alipay_path %>";
}
$.ajax({type: "POST",
url: "<%= origami_payment_alipay_path %>",
url: url,
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
@@ -236,7 +246,11 @@
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/payment";
var url_param = "payment";
if(location.pathname.includes("credit_payment")){
url_param = "credit_payment";
}
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+ "/"+url_param;
});
}
}
@@ -250,6 +264,15 @@
swal ( "Oops" , "Enter Amount!" , "error" );
}
}
})
});
$('#back').on('click',function(){
var url_param = "payment";
if(location.pathname.includes("credit_payment")){
url_param = "credit_payment";
}
window.location.href = '/origami/sale/'+'<%= @sale_id %>'+'/<%= @cashier_type %>/'+url_param;
// window.location.href = '/origami/sale/' + sale_id + "/cashier/payment";
});
</script>