From 45aa61e34f4e439ab655a1058a97d2ed3ed68e18 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 10 Jul 2019 09:32:32 -0400 Subject: [PATCH] Update for mark paid using square Destroy the Square payment object and remove the onclick event for the form. --- views/admin/billing/makePayment.html | 2 +- views/common/billing/paymentForm.html | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/views/admin/billing/makePayment.html b/views/admin/billing/makePayment.html index 1be2aeb..05ec2ee 100644 --- a/views/admin/billing/makePayment.html +++ b/views/admin/billing/makePayment.html @@ -55,7 +55,7 @@ {* Only if payments types are setup *} {include file='common/billing/paymentForm.html'} - + {else} You don't have any unpaid invoices! diff --git a/views/common/billing/paymentForm.html b/views/common/billing/paymentForm.html index a330b08..9b85df5 100644 --- a/views/common/billing/paymentForm.html +++ b/views/common/billing/paymentForm.html @@ -214,24 +214,33 @@ jQuery(document).ready(function($){ $('.payment_option').change(function(){ var payment_option = $('.payment_option:checked').val(); - console.log( 'payment_option: ', payment_option ); + // console.log( 'payment_option: ', payment_option ); if ( payment_option == 'pay_by_check' ) { {if $billing_settings.proc_methods == 4} $('.sq-payment-form').hide(); + paymentForm.destroy(); {else} $('.glm-billing-credit').hide(); $('.ccard').prop('disabled', true); + $('#billing-payment-button').prop( 'onclick', null ); {/if} } else if ( payment_option == 'mark_paid' ) { {if $billing_settings.proc_methods == 4} $('.sq-payment-form').hide(); + paymentForm.destroy(); + $('#billing-payment-button').prop( 'onclick', null ); {else} $('.glm-billing-credit').hide(); $('.ccard').prop('disabled', true); {/if} } else { {if $billing_settings.proc_methods == 4} - $('.sq-payment-form').show(); + if ( confirm( 'This will reload the page' ) ) { + $('.sq-payment-form').show(); + window.location.reload(); + } else { + $('.payment_option[value=mark_paid]').prop( 'checked', true ); + } {else} $('.glm-billing-credit').show(); $('.ccard').prop('disabled', false); -- 2.17.1