add double click event for all payment

This commit is contained in:
phyusin
2017-12-08 11:20:30 +06:30
parent 2faf5ba386
commit deda2dd0c7
7 changed files with 33 additions and 3 deletions

View File

@@ -169,6 +169,7 @@
var amount = $('#amount').text(); var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_payment_credit_path %>", url: "<%= origami_payment_credit_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id, data: "amount="+ amount + "&sale_id="+ sale_id,
@@ -177,7 +178,11 @@
swal({ swal({
title: "Information!", title: "Information!",
text: "Payment Success", text: "Payment Success",
type: "success" type: "success",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/payment";
}); });

View File

@@ -161,6 +161,7 @@ $('#jcb_pay').on('click',function(){
var amount = $('#amount').text(); var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card //start member discount 5% by pay card
var sub_total = $('#sub-total').text(); var sub_total = $('#sub-total').text();
var member_id = $('#membership_id').text(); var member_id = $('#membership_id').text();
@@ -183,6 +184,10 @@ $('#jcb_pay').on('click',function(){
swal({ swal({
title: "Information!", title: "Information!",
text: "Payment Successfully", text: "Payment Successfully",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
},function () { },function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/payment";
}); });

View File

@@ -158,6 +158,7 @@
var amount = $('#amount').text(); var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card //start member discount 5% by pay card
var sub_total = $('#sub-total').text(); var sub_total = $('#sub-total').text();
var member_id = $('#membership_id').text(); var member_id = $('#membership_id').text();
@@ -180,6 +181,10 @@
swal({ swal({
title: "Information!", title: "Information!",
text: "Payment Successfully", text: "Payment Successfully",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
},function () { },function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/payment";
}); });

View File

@@ -161,6 +161,7 @@
var amount = $('#amount').text(); var amount = $('#amount').text();
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card //start member discount 5% by pay card
var sub_total = $('#sub-total').text(); var sub_total = $('#sub-total').text();
var member_id = $('#membership_id').text(); var member_id = $('#membership_id').text();
@@ -184,6 +185,10 @@
swal({ swal({
title: "Information!", title: "Information!",
text: "Payment Successfully", text: "Payment Successfully",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/payment";
}); });

View File

@@ -418,7 +418,7 @@
title: "Information!", title: "Information!",
text: 'Changed amount ' + $('#balance').text() * (-1), text: 'Changed amount ' + $('#balance').text() * (-1),
html: true, html: true,
closeOnConfirm: false, //It does close the popup when I click on close button closeOnConfirm: false,
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {
@@ -430,7 +430,7 @@
title: "Information!", title: "Information!",
text: 'Thank You !', text: 'Thank You !',
html: true, html: true,
closeOnConfirm: false, //It does close the popup when I click on close button closeOnConfirm: false,
closeOnCancel: false, closeOnCancel: false,
allowOutsideClick: false allowOutsideClick: false
}, function () { }, function () {

View File

@@ -169,6 +169,7 @@
swal ( "Oops" , "Insufficient Amount!" , "warning" ); swal ( "Oops" , "Insufficient Amount!" , "warning" );
}else{ }else{
if(redeem_amount <= "<%= @redeem_prices %>"){ if(redeem_amount <= "<%= @redeem_prices %>"){
$(this).off("click");
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<%=origami_payment_paypar_path%>", url: "<%=origami_payment_paypar_path%>",
@@ -179,6 +180,10 @@
swal({ swal({
title: "Information!", title: "Information!",
text: result.message, text: result.message,
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment" window.location.href = '/origami/sale/'+ sale_id + "/payment"
}); });

View File

@@ -160,6 +160,7 @@
console.log(amount); console.log(amount);
console.log($("#validamount").attr("value")); console.log($("#validamount").attr("value"));
if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){ if(parseFloat(amount) <= parseFloat($("#validamount").attr("value")) && amount > 0){
$(this).off("click");
//start member discount 5% by pay card //start member discount 5% by pay card
var sub_total = $('#sub-total').text(); var sub_total = $('#sub-total').text();
var member_id = $('#membership_id').text(); var member_id = $('#membership_id').text();
@@ -182,6 +183,10 @@
swal({ swal({
title: "Information!", title: "Information!",
text: "Payment Successfully", text: "Payment Successfully",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () { }, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"; window.location.href = '/origami/sale/'+ sale_id + "/payment";
}); });