mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fix bug when using Braintree and terms checkbox
This commit is contained in:
parent
72cbea9a0c
commit
b4437c645b
@ -67,7 +67,12 @@
|
|||||||
});
|
});
|
||||||
paypalLink.click(function(e){
|
paypalLink.click(function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
checkout.paypal.initAuthFlow();
|
@if ($account->requiresAuthorization($invoice))
|
||||||
|
window.pendingPaymentFunction = checkout.paypal.initAuthFlow;
|
||||||
|
showAuthorizationModal();
|
||||||
|
@else
|
||||||
|
checkout.paypal.initAuthFlow();
|
||||||
|
@endif
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -212,19 +217,11 @@
|
|||||||
$('#paymentButtons a').on('click', function(e) {
|
$('#paymentButtons a').on('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.pendingPaymentHref = $(this).attr('href');
|
window.pendingPaymentHref = $(this).attr('href');
|
||||||
@if ($account->showSignature($invoice))
|
showAuthorizationModal();
|
||||||
if (window.pendingPaymentInit) {
|
|
||||||
$("#signature").jSignature('reset');
|
|
||||||
}
|
|
||||||
@endif
|
|
||||||
@if ($account->showAcceptTerms($invoice))
|
|
||||||
$('#termsCheckbox').attr('checked', false);
|
|
||||||
@endif
|
|
||||||
$('#authenticationModal').modal('show');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@if ($account->showSignature($invoice))
|
@if ($account->showSignature($invoice))
|
||||||
$('#authenticationModal').on('shown.bs.modal', function () {
|
$('#authorizationModal').on('shown.bs.modal', function () {
|
||||||
if ( ! window.pendingPaymentInit) {
|
if ( ! window.pendingPaymentInit) {
|
||||||
window.pendingPaymentInit = true;
|
window.pendingPaymentInit = true;
|
||||||
$("#signature").jSignature().bind('change', function(e) {
|
$("#signature").jSignature().bind('change', function(e) {
|
||||||
@ -236,6 +233,18 @@
|
|||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function showAuthorizationModal() {
|
||||||
|
@if ($account->showSignature($invoice))
|
||||||
|
if (window.pendingPaymentInit) {
|
||||||
|
$("#signature").jSignature('reset');
|
||||||
|
}
|
||||||
|
@endif
|
||||||
|
@if ($account->showAcceptTerms($invoice))
|
||||||
|
$('#termsCheckbox').attr('checked', false);
|
||||||
|
@endif
|
||||||
|
$('#authorizationModal').modal('show');
|
||||||
|
}
|
||||||
|
|
||||||
function onDownloadClick() {
|
function onDownloadClick() {
|
||||||
try {
|
try {
|
||||||
var doc = generatePDF(invoice, invoice.invoice_design.javascript, true);
|
var doc = generatePDF(invoice, invoice.invoice_design.javascript, true);
|
||||||
@ -274,8 +283,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function redirectToPayment() {
|
function redirectToPayment() {
|
||||||
$('#authenticationModal').modal('hide');
|
$('#authorizationModal').modal('hide');
|
||||||
location.href = window.pendingPaymentHref;
|
if (window.pendingPaymentFunction) {
|
||||||
|
window.pendingPaymentFunction();
|
||||||
|
} else {
|
||||||
|
location.href = window.pendingPaymentHref;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setModalPayNowEnabled() {
|
function setModalPayNowEnabled() {
|
||||||
@ -328,7 +341,7 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if ($account->requiresAuthorization($invoice))
|
@if ($account->requiresAuthorization($invoice))
|
||||||
<div class="modal fade" id="authenticationModal" tabindex="-1" role="dialog" aria-labelledby="authenticationModalLabel" aria-hidden="true">
|
<div class="modal fade" id="authorizationModal" tabindex="-1" role="dialog" aria-labelledby="authorizationModalLabel" aria-hidden="true">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user