X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=templates%2FCRM%2FContribute%2FForm%2FContribution.tpl;h=57ec505d76c7acc514563694cb52ca81eb9828b2;hb=24f8127938dec80960d388e50fd5b89aa450b494;hp=7c5597dac574956f2111d2311d2797a13d7848cd;hpb=cea2b87d0584406d003579ec2ff034646c5d54cb;p=civicrm-core.git diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl index 7c5597dac5..57ec505d76 100644 --- a/templates/CRM/Contribute/Form/Contribution.tpl +++ b/templates/CRM/Contribute/Form/Contribution.tpl @@ -119,6 +119,7 @@ {if $ppID}{ts}adjust payment amount{/ts}{help id="adjust-payment-amount"}{/if}
{ts}Total amount of this contribution.{/ts}{if $hasPriceSets} {ts}Alternatively, you can use a price set.{/ts}{/if} +
@@ -203,7 +204,7 @@ {if $hideCalendar neq true} {include file="CRM/common/jcalendar.tpl" elementName=cancel_date} {else} - {$form.cancel_date.html|crmDate} + {$form.cancel_date.value|crmDate} {/if} @@ -371,6 +372,7 @@ cj('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(function(index) { loadPanes(cj(this).attr('id')); }); + cj('#total_amount').trigger("change"); }); // load panes function calls for snippet based on id of crm-accordion-header function loadPanes( id ) { @@ -399,7 +401,7 @@ {if $context eq 'standalone' and $outBound_option != 2 } {literal} CRM.$(function($) { - cj("#contact_1").blur( function( ) { + cj("#contact_id").change( function( ) { checkEmail( ); }); checkEmail( ); @@ -408,7 +410,7 @@ }); function checkEmail( ) { - var contactID = cj("input[name='contact_select_id[1]']").val(); + var contactID = cj("#contact_id").val(); if (contactID) { var postUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' h=0}{literal}"; cj.post( postUrl, {contact_id: contactID}, @@ -621,5 +623,38 @@ cj('#fee_amount').change( function() { cj('#net_amount').val(netAmount); } }); + +cj("#financial_type_id").on("change",function(){ + cj('#total_amount').trigger("change"); +}) + +cj("#currency").on("change",function(){ + cj('#total_amount').trigger("change"); +}) + +cj('#total_amount').on("change",function(event) { + if (event.handled !== true) { + var financialType = cj('#financial_type_id').val(); + var taxRates = '{/literal}{$taxRates}{literal}'; + var taxRates = JSON.parse(taxRates); + var currencies = '{/literal}{$currencies}{literal}'; + var currencies = JSON.parse(currencies); + var currencySelect = cj('#currency').val(); + var currencySymbol = currencies[currencySelect]; + var re= /\((.*?)\)/g; + for(m = re.exec(currencySymbol); m; m = re.exec(currencySymbol)){ + var currencySymbol = m[1]; + } + var taxRate = taxRates[financialType]; + if (!taxRate) { + taxRate = 0; + } + var totalAmount = cj('#total_amount').val(); + var totalTaxAmount = parseFloat(Number((taxRate/100)*totalAmount)+Number(totalAmount)).toFixed(2); + cj( "#totalTaxAmount" ).html('Total Amount : ' + currencySymbol + ' '+ totalTaxAmount); + event.handled = true; + } + return false; +}); {/literal}