Skip to content

Commit

Permalink
pledge shim functioning except clearing shopping cart
Browse files Browse the repository at this point in the history
  • Loading branch information
tamw-wnet committed Dec 19, 2024
1 parent 625d798 commit bd99a49
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions assets/js/everyaction_pledge_shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,28 @@

function set_required_amount() {
if (!required_donation_amount) {
console.log('no req amt set');
return;
}
required_installment_amount = (required_donation_amount/12);
required_installment_amount = Math.round((required_installment_amount + Number.EPSILON) * 100) / 100;
console.log(required_installment_amount);
console.log(required_donation_amount);
console.log(current_frequency);
if (current_frequency == 4) {
setTimeout(update_amount_values_display, 10);
}

let update_amount_values_display = function() {
if (current_frequency == 4) {
$("span.required_contribution").html(required_installment_amount + " per month for 12 months");
$("input[name='OtherAmount']").parent().prev().hide();
$("input[name='OtherAmount']").val(required_installment_amount);
$("span.required_contribution").html(required_installment_amount + " per month for 12 months");
} else {
$("input[name='OtherAmount']").val(required_donation_amount);
$("span.required_contribution").html(required_donation_amount);
$("span.required_contribution").html(required_donation_amount);
$("input[name='OtherAmount']").parent().prev().hide();
}
$("input[name='OtherAmount']").attr("readonly", true);
$("input[name='OtherAmount']").focus();
$("input[name='OtherAmount']").attr("readonly", true);
$("input[name='OtherAmount']").focus();
}

/* TK; A function to compare the required_donation_amount value
* (or if frequency is 4, required_installment_amount value)
* to each of the visible giving levels and disable any that are
* less than that value.
*/


/* TK: a function to to clear the shopping_cart cookie on successful form donation
*/
Expand Down

0 comments on commit bd99a49

Please sign in to comment.