Skip to content

Commit

Permalink
Fix tax receipt checkbox bug
Browse files Browse the repository at this point in the history
  • Loading branch information
naokipeter committed Aug 29, 2018
1 parent cc9900e commit 2b10ccc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
22 changes: 9 additions & 13 deletions assets/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ var frequency = 'once';
var monthlySupport = ['payment-stripe', 'payment-paypal', 'payment-banktransfer', 'payment-gocardless', 'payment-skrill'];
var raisePopup = null;
var gcPollTimer = null;
var taxDeductionDisabled = true;
var taxReceiptDisabled = true;
var interactionEventDispatched = false;
var checkoutEventDispatched = false;
var checkboxPreCheck = {};
var checkboxPreCheck = {};


// Preload Stripe image
Expand Down Expand Up @@ -914,7 +914,7 @@ function lockLastStep(locked) {

if (!locked) {
// Make sure tax deduction stays disabled when not possible
jQuery('#tax-receipt').prop('disabled', taxDeductionDisabled);
jQuery('#tax-receipt').prop('disabled', taxReceiptDisabled);

// Restore submit button
jQuery('button.confirm:last', '#wizard')
Expand Down Expand Up @@ -1221,21 +1221,17 @@ function updateCheckboxState(id, state, formObj) {
}

// Enable/disable checkbox
if (state && state.hasOwnProperty('disabled')) {
disabled = !!state.disabled;
var disabled = state && state.hasOwnProperty('disabled') && !!state.disabled;
if (id === 'tax-receipt') {
// Update global tax deduction variable
taxReceiptDisabled = disabled;

// Collapse address details if open
if (id === 'tax-receipt' && disabled && element.is(':checked')) {
if (disabled && element.is(':checked')) {
element.click();
}
element.prop('disabled', disabled);
} else {
// Enable checkbox
if (element.prop('disabled')) {
disabled = false;
element.prop('disabled', false);
}
}
element.prop('disabled', disabled);

// Update checkbox label
if (state && state.label) {
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
= 1.6 TBD =
* NEW: Coinbase integration
* FIX: Broken tax receipt checkbox
* FIX: Replace Object.assign by jQuery.extend
* IMPROVED: Update SDKs (Stripe and GoCardless)

= 1.5 July, 2018 =
* NEW: Tipping feature
Expand Down

0 comments on commit 2b10ccc

Please sign in to comment.