diff --git a/app/views/origami/jcb/index.html.erb b/app/views/origami/jcb/index.html.erb
index 837c9f43..1fe49080 100755
--- a/app/views/origami/jcb/index.html.erb
+++ b/app/views/origami/jcb/index.html.erb
@@ -51,7 +51,8 @@
@@ -194,53 +195,60 @@ $(document).on('click', '.cashier_number', function(event){
$('#jcb_pay').on('click',function(){
var amount = $('#amount').text();
+ var reference_no = $('#reference_no').val();
var sale_id = "<%= @sale_id %>";
var receipt_no = "<%= @receipt_no %>";
var bank_integration = "<%= @bank_integration %>";
- if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
- $(this).off("click");
- //start member discount 5% by pay card
- // var sub_total = $('#sub-total').text();
- // var member_id = $('#membership_id').text();
- // var member_discount = $('#member_discount').text();
- // if (member_id && member_discount) {
- // $.ajax({
- // type: "POST",
- // url: "/origami/" + sale_id + "/member_discount",
- // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
- // success:function(result){
- // }
- // });
- // }
- //end member discount
- if(bank_integration == '1'){
- pay_withBank("SALE", "jcb", amount, sale_id, receipt_no);
+ $("#reference_no_Err").html("");
+ if(reference_no.length > 0){
+ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
+ $(this).off("click");
+ //start member discount 5% by pay card
+ // var sub_total = $('#sub-total').text();
+ // var member_id = $('#membership_id').text();
+ // var member_discount = $('#member_discount').text();
+ // if (member_id && member_discount) {
+ // $.ajax({
+ // type: "POST",
+ // url: "/origami/" + sale_id + "/member_discount",
+ // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
+ // success:function(result){
+ // }
+ // });
+ // }
+ //end member discount
+ if(bank_integration == '1'){
+ $("#reference_no").val("");
+ pay_withBank("SALE", "jcb", amount, sale_id, receipt_no);
+ }else{
+ $.ajax({type: "POST",
+ url: "<%= origami_payment_jcb_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 + "/"+cashier_type+"/payment";
+ });
+ }
+ }
+ });
+ }
}else{
- $.ajax({type: "POST",
- url: "<%= origami_payment_jcb_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 + "/"+cashier_type+"/payment";
- });
- }
- }
- });
+ if (amount>0) {
+ swal ( "Oops" , "Paid Amount is over!" , "error" );
+ }else{
+ swal ( "Oops" , "Enter Amount!" , "error" );
+ }
}
}else{
- if (amount>0) {
- swal ( "Oops" , "Paid Amount is over!" , "error" );
- }else{
- swal ( "Oops" , "Enter Amount!" , "error" );
- }
+ $("#reference_no_Err").html("can't be blank");
}
})
diff --git a/app/views/origami/master/index.html.erb b/app/views/origami/master/index.html.erb
index f5c8f06b..2e663b7a 100755
--- a/app/views/origami/master/index.html.erb
+++ b/app/views/origami/master/index.html.erb
@@ -52,7 +52,8 @@
@@ -192,53 +193,60 @@
});
$('#master_pay').on('click',function(){
var amount = $('#amount').text();
+ var reference_no = $('#reference_no').val();
var sale_id = "<%= @sale_id %>";
var receipt_no = "<%= @receipt_no %>";
var bank_integration = "<%= @bank_integration %>";
- if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
- $(this).off("click");
- //start member discount 5% by pay card
- // var sub_total = $('#sub-total').text();
- // var member_id = $('#membership_id').text();
- // var member_discount = $('#member_discount').text();
- // if (member_id && member_discount) {
- // $.ajax({
- // type: "POST",
- // url: "/origami/" + sale_id + "/member_discount",
- // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
- // // success:function(result){
- // // }
- // });
- // }
- //end member discount
- if(bank_integration == '1'){
- pay_withBank("SALE", "master", amount, sale_id, receipt_no);
- }else{
- $.ajax({type: "POST",
- url: "<%= origami_payment_master_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 + "/"+cashier_type+"/payment";
- });
+ $("#reference_no_Err").html("");
+ if(reference_no.length > 0){
+ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
+ $(this).off("click");
+ //start member discount 5% by pay card
+ // var sub_total = $('#sub-total').text();
+ // var member_id = $('#membership_id').text();
+ // var member_discount = $('#member_discount').text();
+ // if (member_id && member_discount) {
+ // $.ajax({
+ // type: "POST",
+ // url: "/origami/" + sale_id + "/member_discount",
+ // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
+ // // success:function(result){
+ // // }
+ // });
+ // }
+ //end member discount
+ if(bank_integration == '1'){
+ $("#reference_no").val("");
+ pay_withBank("SALE", "master", amount, sale_id, receipt_no);
+ }else{
+ $.ajax({type: "POST",
+ url: "<%= origami_payment_master_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 + "/"+cashier_type+"/payment";
+ });
+ }
}
- }
- });
+ });
+ }
+ }else{
+ if (amount>0) {
+ swal ( "Oops" , "Paid Amount is over!" , "error" );
+ }else{
+ swal ( "Oops" , "Enter Amount!" , "error" );
+ }
}
}else{
- if (amount>0) {
- swal ( "Oops" , "Paid Amount is over!" , "error" );
- }else{
- swal ( "Oops" , "Enter Amount!" , "error" );
- }
+ $("#reference_no_Err").html("can't be blank");
}
})
diff --git a/app/views/origami/mpu/index.html.erb b/app/views/origami/mpu/index.html.erb
index f40ce252..f95b3773 100755
--- a/app/views/origami/mpu/index.html.erb
+++ b/app/views/origami/mpu/index.html.erb
@@ -52,7 +52,8 @@
@@ -196,56 +197,62 @@
$('#mpu_pay').on('click',function(){
var amount = $('#amount').text();
+ var reference_no = $('#reference_no').val();
var sale_id = "<%= @sale_id %>";
var receipt_no = "<%= @receipt_no %>";
var bank_integration = "<%= @bank_integration %>";
var cashier_type = "<%= @cashier_type %>";
- if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
- $(this).off("click");
- //start member discount 5% by pay card
- // var sub_total = $('#sub-total').text();
- // var member_id = $('#membership_id').text();
- // var member_discount = $('#member_discount').text();
- // if (member_id && member_discount) {
- // $.ajax({
- // type: "POST",
- // url: "/origami/" + sale_id + "/member_discount",
- // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
- // success:function(result){
- // }
- // });
- // }
- //end member discount
- if(bank_integration == '1'){
- pay_withBank("SALE", "mpu", amount, sale_id, receipt_no);
- }else{
- $.ajax({type: "POST",
- url: "<%= origami_payment_mpu_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 +"/"+cashier_type+ "/payment";
- });
- }
- }
- });
- }
-
- }else{
- if (amount>0) {
- swal ( "Oops" , "Paid Amount is over!" , "error" );
+ $("#reference_no_Err").html("");
+ if(reference_no.length > 0){
+ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
+ $(this).off("click");
+ //start member discount 5% by pay card
+ // var sub_total = $('#sub-total').text();
+ // var member_id = $('#membership_id').text();
+ // var member_discount = $('#member_discount').text();
+ // if (member_id && member_discount) {
+ // $.ajax({
+ // type: "POST",
+ // url: "/origami/" + sale_id + "/member_discount",
+ // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
+ // success:function(result){
+ // }
+ // });
+ // }
+ //end member discount
+ if(bank_integration == '1'){
+ $("#reference_no").val("");
+ pay_withBank("SALE", "mpu", amount, sale_id, receipt_no);
+ }else{
+ $.ajax({type: "POST",
+ url: "<%= origami_payment_mpu_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 +"/"+cashier_type+ "/payment";
+ });
+ }
+ }
+ });
+ }
}else{
- swal ( "Oops" , "Enter Amount!" , "error" );
+ if (amount>0) {
+ swal ( "Oops" , "Paid Amount is over!" , "error" );
+ }else{
+ swal ( "Oops" , "Enter Amount!" , "error" );
+ }
}
- }
- })
+ }else{
+ $("#reference_no_Err").html("can't be blank");
+ }
+ })
diff --git a/app/views/origami/unionpay/index.html.erb b/app/views/origami/unionpay/index.html.erb
index 5dee20f1..8658f23c 100755
--- a/app/views/origami/unionpay/index.html.erb
+++ b/app/views/origami/unionpay/index.html.erb
@@ -52,7 +52,8 @@
@@ -196,54 +197,61 @@
});
$('#unionpay_pay').on('click',function(){
var amount = $('#amount').text();
+ var reference_no = $('#reference_no').val();
var sale_id = "<%= @sale_id %>";
var receipt_no = "<%= @receipt_no %>";
- if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
- $(this).off("click");
- //start member discount 5% by pay card
- // var sub_total = $('#sub-total').text();
- // var member_id = $('#membership_id').text();
- // var member_discount = $('#member_discount').text();
- // if (member_id && member_discount) {
- // $.ajax({
- // type: "POST",
- // url: "/origami/" + sale_id + "/member_discount",
- // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
- // success:function(result){
- // }
- // });
- // }
- //end member discount
- var bank_integration = "<%= @bank_integration %>";
- if(bank_integration == '1'){
- pay_withBank("SALE", "unionpay", amount, sale_id, receipt_no);
- }
- else{
- $.ajax({type: "POST",
- url: "<%= origami_payment_unionpay_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 + "/"+cashier_type+"/payment";
- });
+ $("#reference_no_Err").html("");
+ if(reference_no.length > 0){
+ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
+ $(this).off("click");
+ //start member discount 5% by pay card
+ // var sub_total = $('#sub-total').text();
+ // var member_id = $('#membership_id').text();
+ // var member_discount = $('#member_discount').text();
+ // if (member_id && member_discount) {
+ // $.ajax({
+ // type: "POST",
+ // url: "/origami/" + sale_id + "/member_discount",
+ // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
+ // success:function(result){
+ // }
+ // });
+ // }
+ //end member discount
+ var bank_integration = "<%= @bank_integration %>";
+ if(bank_integration == '1'){
+ $("#reference_no").val("");
+ pay_withBank("SALE", "unionpay", amount, sale_id, receipt_no);
+ }
+ else{
+ $.ajax({type: "POST",
+ url: "<%= origami_payment_unionpay_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 + "/"+cashier_type+"/payment";
+ });
+ }
}
- }
- });
+ });
+ }
+ }else{
+ if (amount>0) {
+ swal ( "Oops" , "Paid Amount is over!" , "error" );
+ }else{
+ swal ( "Oops" , "Enter Amount!" , "error" );
+ }
}
}else{
- if (amount>0) {
- swal ( "Oops" , "Paid Amount is over!" , "error" );
- }else{
- swal ( "Oops" , "Enter Amount!" , "error" );
- }
+ $("#reference_no_Err").html("can't be blank");
}
})
diff --git a/app/views/origami/visa/index.html.erb b/app/views/origami/visa/index.html.erb
index 2970ba44..60f62caa 100755
--- a/app/views/origami/visa/index.html.erb
+++ b/app/views/origami/visa/index.html.erb
@@ -52,7 +52,8 @@
@@ -195,56 +196,63 @@
});
$('#visa_pay').on('click',function(){
var amount = $('#amount').text();
+ var reference_no = $('#reference_no').val();
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){
- $(this).off("click");
- //start member discount 5% by pay card
- // var sub_total = $('#sub-total').text();
- // var member_id = $('#membership_id').text();
- // var member_discount = $('#member_discount').text();
- // if (member_id && member_discount) {
- // $.ajax({
- // type: "POST",
- // url: "/origami/" + sale_id + "/member_discount",
- // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
- // success:function(result){
- // }
- // });
- // }
- //end member discount
- var bank_integration = "<%= @bank_integration %>";
- if(bank_integration == '1'){
- pay_withBank("SALE", "visa", amount, sale_id, receipt_no);
- }
- else{
- $.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 + "/"+cashier_type+"/payment";
- });
+ $("#reference_no_Err").html("");
+ if(reference_no.length > 0){
+ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
+ $(this).off("click");
+ //start member discount 5% by pay card
+ // var sub_total = $('#sub-total').text();
+ // var member_id = $('#membership_id').text();
+ // var member_discount = $('#member_discount').text();
+ // if (member_id && member_discount) {
+ // $.ajax({
+ // type: "POST",
+ // url: "/origami/" + sale_id + "/member_discount",
+ // data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':true },
+ // success:function(result){
+ // }
+ // });
+ // }
+ //end member discount
+ var bank_integration = "<%= @bank_integration %>";
+ if(bank_integration == '1'){
+ $("#reference_no").val("");
+ pay_withBank("SALE", "visa", amount, sale_id, receipt_no);
+ }
+ else{
+ $.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 + "/"+cashier_type+"/payment";
+ });
+ }
}
- }
- });
+ });
+ }
+ }else{
+ if (amount>0) {
+ swal ( "Oops" , "Paid Amount is over!" , "error" );
+ }else{
+ swal ( "Oops" , "Enter Amount!" , "error" );
+ }
}
}else{
- if (amount>0) {
- swal ( "Oops" , "Paid Amount is over!" , "error" );
- }else{
- swal ( "Oops" , "Enter Amount!" , "error" );
- }
+ $("#reference_no_Err").html("can't be blank");
}
})