CB ECR Integration

This commit is contained in:
phyusin
2018-01-10 18:08:28 +06:30
parent 014a071637
commit 903dddd8cc
37 changed files with 807 additions and 92 deletions

View File

@@ -1,4 +1,7 @@
<div class="container-fluid">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>
<!-- <div class="page-header">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<%=origami_root_path %>"><%= t :home %></a></li>
@@ -17,6 +20,16 @@
<span class="hidden" id="sub-total"><%= @sub_total%></span>
<div class="card m-l-10 m-t-10" style="padding:0px 20px;">
<div class="rebate-form">
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label for="com_port_name">Select Device</label>
<select id="com_port_name" name="com_port_name" class="form-control select col-lg-7 col-md-7 col-sm-7">
</select>
</div>
<hr>
</div>
<div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12">
<label>You can pay up to </label>
@@ -106,10 +119,28 @@
</div>
<script>
$(document).ready(function() {
var sale_id = "<%= @sale_id %>";
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
else {
$('#validamount').attr("value",parseFloat("<%= @can_visa %>") - parseFloat(localStorage.getItem("cash")));
}
if(typeof code2lab != 'undefined'){
code2lab.getCommPorts(); //get comportlists from jade
}else{
swal({
title: 'Oops',
text: 'VISA is not available in here!',
type: 'error',
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment";
});
}
});
$(document).on('click', '.cashier_number', function(event){
event.stopPropagation();
@@ -157,6 +188,7 @@
$('#visa_pay').on('click',function(){
var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>";
var receipt_no = "<%= @receipt_no %>";
console.log(amount);
console.log($("#validamount").attr("value"));
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
@@ -175,24 +207,7 @@
// });
// }
//end member discount
$.ajax({type: "POST",
url: "<%= origami_payment_visa_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
swal({
title: "Information!",
text: "Payment Successfully",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment";
});
}
}
});
pay_withBank("SALE", "visa", amount, sale_id, receipt_no);
}else{
if (amount>0) {
swal ( "Oops" , "Paid Amount is over!" , "error" );