Merge pull request #4281 from colemanw/CRM-15394
[civicrm-core.git] / templates / CRM / Contribute / Form / Contribution.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 *}
26 {* this template is used for adding/editing/deleting contributions and pledge payments *}
27
28 {if $cdType}
29 {include file="CRM/Custom/Form/CustomData.tpl"}
30 {elseif $priceSetId}
31 {include file="CRM/Price/Form/PriceSet.tpl" context="standalone" extends="Contribution"}
32 {elseif $showAdditionalInfo and $formType }
33 {include file="CRM/Contribute/Form/AdditionalInfo/$formType.tpl"}
34 {else}
35
36 <div class="crm-block crm-form-block crm-contribution-form-block">
37
38 {if $contributionMode == 'test' }
39 {assign var=contribMode value="TEST"}
40 {elseif $contributionMode == 'live'}
41 {assign var=contribMode value="LIVE"}
42 {/if}
43
44 {if !$email and $action neq 8 and $context neq 'standalone'}
45 <div class="messages status no-popup">
46 <div class="icon inform-icon"></div>&nbsp;{ts}You will not be able to send an automatic email receipt for this contribution because there is no email address recorded for this contact. If you want a receipt to be sent when this contribution is recorded, click Cancel and then click Edit from the Summary tab to add an email address before recording the contribution.{/ts}
47 </div>
48 {/if}
49 {if $contributionMode}
50 <div id="help">
51 {if $contactId}
52 {ts 1=$displayName 2=$contribMode}Use this form to submit a new contribution on behalf of %1. <strong>A %2 transaction will be submitted</strong> using the selected payment processor.{/ts}
53 {else}
54 {ts 1=$displayName 2=$contribMode}Use this form to submit a new contribution. <strong>A %2 transaction will be submitted</strong> using the selected payment processor.{/ts}
55 {/if}
56 </div>
57 {/if}
58 {if $action eq 8}
59 <div class="messages status no-popup">
60 <div class="icon inform-icon"></div>
61 {ts}WARNING: Deleting this contribution will result in the loss of the associated financial transactions (if any).{/ts} {ts}Do you want to continue?{/ts}
62 </div>
63 {else}
64 {if $newCredit AND $action EQ 1 AND $contributionMode EQ null}
65 <div class="action-link css_right crm-link-credit-card-mode">
66 {if $contactId}
67 {capture assign=ccModeLink}{crmURL p='civicrm/contact/view/contribution' q="reset=1&action=add&cid=`$contactId`&context=`$context`&mode=live"}{/capture}
68 {else}
69 {capture assign=ccModeLink}{crmURL p='civicrm/contact/view/contribution' q="reset=1&action=add&context=standalone&mode=live"}{/capture}
70 {/if}
71 <a class="open-inline crm-hover-button action-item" href="{$ccModeLink}">&raquo; {ts}submit credit card contribution{/ts}</a>
72 </div>
73 {/if}
74 <div class="crm-submit-buttons">
75 {include file="CRM/common/formButtons.tpl"}
76 </div>
77 {if $isOnline}{assign var=valueStyle value=" class='view-value'"}{else}{assign var=valueStyle value=""}{/if}
78 <table class="form-layout-compressed">
79 {if $context neq 'standalone'}
80 <tr>
81 <td class="font-size12pt label"><strong><strong>{ts}Contributor{/ts}</strong></td><td class="font-size12pt"><strong>{$displayName}</strong></td>
82 </tr>
83 {else}
84 <td class="label">{$form.contact_id.label}</td>
85 <td>{$form.contact_id.html}</td>
86 {/if}
87 {if $contributionMode}
88 <tr class="crm-contribution-form-block-payment_processor_id"><td class="label nowrap">{$form.payment_processor_id.label}<span class="marker"> * </span></td><td>{$form.payment_processor_id.html}</td></tr>
89 {/if}
90 <tr class="crm-contribution-form-block-contribution_type_id crm-contribution-form-block-financial_type_id">
91 <td class="label">{$form.financial_type_id.label}</td><td{$valueStyle}>{$form.financial_type_id.html}&nbsp;
92 {if $is_test}
93 {ts}(test){/ts}
94 {/if} {help id="id-financial_type"}
95 </td>
96 </tr>
97 {if $action eq 2 and $lineItem and !$defaultContribution}
98 <tr>
99 <td class="label">{ts}Contribution Amount{/ts}</td>
100 <td>{include file="CRM/Price/Page/LineItem.tpl" context="Contribution"}</td>
101 </tr>
102 {else}
103 <tr class="crm-contribution-form-block-total_amount">
104 <td class="label">{$form.total_amount.label}</td>
105 <td {$valueStyle}>
106 <span id='totalAmount'>{$form.currency.html|crmAddClass:eight}&nbsp;{$form.total_amount.html|crmAddClass:eight}</span>
107 {if $hasPriceSets}
108 <span id='totalAmountORPriceSet'> {ts}OR{/ts}</span>
109 <span id='selectPriceSet'>{$form.price_set_id.html}</span>
110 <div id="priceset" class="hiddenElement"></div>
111 {/if}
112
113 {if $ppID}{ts}<a href='#' onclick='adjustPayment();'>adjust payment amount</a>{/ts}{help id="adjust-payment-amount"}{/if}
114 <br /><span class="description">{ts}Total amount of this contribution.{/ts}{if $hasPriceSets} {ts}Alternatively, you can use a price set.{/ts}{/if}</span>
115 </td>
116 </tr>
117
118 {if $buildRecurBlock && !$ppID}
119 <tr id='recurringPaymentBlock' class='hiddenElement'>
120 <td></td>
121 <td>
122 <strong>{$form.is_recur.html} {ts}every{/ts}
123 &nbsp;{$form.frequency_interval.html}
124 &nbsp;{$form.frequency_unit.html}&nbsp;
125 {ts}for{/ts}
126 &nbsp;{$form.installments.html}
127 &nbsp;{$form.installments.label}
128 </strong>
129 <br />
130 <span class="description">
131 {ts}Your recurring contribution will be processed automatically for the number of installments you specify. You can leave the number of installments blank if you want to make an open-ended commitment. In either case, you can choose to cancel at any time. You will receive an email receipt for each recurring contribution. The receipts will include a link you can use if you decide to modify or cancel your future contributions.{/ts}
132 </span>
133 </td>
134 </tr>
135 {/if}
136
137 <tr id="adjust-option-type" class="crm-contribution-form-block-option_type">
138 <td class="label"></td><td {$valueStyle}>{$form.option_type.html}</td>
139 </tr>
140 {/if}
141 {if $contributionMode && $processorSupportsFutureStartDate}
142 <tr id='start_date' class="crm-contribution-form-block-receive_date">
143 <td class="label">{ts}Start Date{/ts}</td>
144 <td {$valueStyle}>{if $hideCalender neq true}{include file="CRM/common/jcalendar.tpl" elementName=receive_date}{else}{$receive_date|crmDate}{/if}<br />
145 <span class="description">{ts}You can set a start date for recurring contributions and the first payment will be on that date. For a single post-dated contribution you must select recurring and choose one installment{/ts}</span>
146 </td>
147 </tr>
148 {/if}
149
150 <tr class="crm-contribution-form-block-source">
151 <td class="label">{$form.source.label}</td>
152 <td {$valueStyle}>{$form.source.html|crmAddClass:huge} {help id="id-contrib_source"}
153 </td>
154 </tr>
155
156 {* CRM-7362 --add campaign to contributions *}
157 {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" campaignTrClass="crm-contribution-form-block-campaign_id"}
158
159 {if $contributionMode}
160 {if $email and $outBound_option != 2}
161 <tr class="crm-contribution-form-block-is_email_receipt">
162 <td class="label">{$form.is_email_receipt.label}</td>
163 <td>{$form.is_email_receipt.html}&nbsp; <span class="description">{ts 1=$email}Automatically email a receipt for this contribution to %1?{/ts}</span>
164 </td>
165 </tr>
166 {elseif $context eq 'standalone' and $outBound_option != 2 }
167 <tr id="email-receipt" style="display:none;" class="crm-contribution-form-block-is_email_receipt"><td class="label">{$form.is_email_receipt.label}</td><td>{$form.is_email_receipt.html} <span class="description">{ts}Automatically email a receipt for this contribution to {/ts}<span id="email-address"></span>?</span></td></tr>
168 {/if}
169 <tr id="fromEmail" style="display:none;" >
170 <td class="label">{$form.from_email_address.label}</td>
171 <td>{$form.from_email_address.html}</td>
172 </tr>
173 <tr id="receiptDate" class="crm-contribution-form-block-receipt_date">
174 <td class="label">{$form.receipt_date.label}</td>
175 <td>{include file="CRM/common/jcalendar.tpl" elementName=receipt_date}<br />
176 <span class="description">{ts}Date that a receipt was sent to the contributor.{/ts}</span>
177 </td>
178 </tr>
179 {/if}
180 {if !$contributionMode}
181 <tr class="crm-contribution-form-block-contribution_status_id">
182 <td class="label">{$form.contribution_status_id.label}</td>
183 <td>{$form.contribution_status_id.html}
184 {if $contribution_status_id eq 2}{if $is_pay_later }: {ts}Pay Later{/ts} {else}: {ts}Incomplete Transaction{/ts}{/if}{/if}
185 </td>
186 </tr>
187
188 {* Cancellation / Refunded fields are hidden unless contribution status is set to Cancelled or Refunded*}
189 <tr id="cancelInfo" class="crm-contribution-form-block-cancelInfo">
190 <td>&nbsp;</td>
191 <td><fieldset><legend>{ts}Cancellation or Refund Information{/ts}</legend>
192 <table class="form-layout-compressed">
193 <tr id="cancelDate" class="crm-contribution-form-block-cancel_date">
194 <td class="label">{$form.cancel_date.label}</td>
195 <td>
196 {if $hideCalendar neq true}
197 {include file="CRM/common/jcalendar.tpl" elementName=cancel_date}
198 {else}
199 {$form.cancel_date.value|crmDate}
200 {/if}
201 </td>
202 </tr>
203 <tr id="cancelDescription" class="crm-contribution-form-block-cancel_reason">
204 <td class="label">&nbsp;</td>
205 <td class="description">{ts}Enter the cancellation or refunded date, or you can skip this field and the cancellation date or refunded date will be automatically set to TODAY.{/ts}</td>
206 </tr>
207 <tr id="cancelReason">
208 <td class="label" style="vertical-align: top;">{$form.cancel_reason.label}</td>
209 <td>{$form.cancel_reason.html}</td>
210 </tr>
211 </table>
212 </fieldset>
213 </td>
214 </tr>
215 {/if}
216
217 </table>
218 <!-- start of soft credit -->
219 <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed {if $noSoftCredit}collapsed{/if}" id="softCredit">
220 <div class="crm-accordion-header">
221 {ts}Soft Credit{/ts}&nbsp;{help id="id-soft_credit"}
222 </div>
223 <div class="crm-accordion-body">
224 <table class="form-layout-compressed">
225 <tr class="crm-contribution-form-block-soft_credit_to">
226 <td colspan="2">
227 {include file="CRM/Contribute/Form/SoftCredit.tpl"}
228 </td>
229 </tr>
230 </table>
231 </div>
232 </div>
233 <!-- end of soft credit -->
234
235 <!-- start of PCP -->
236 {if $siteHasPCPs}
237 <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed {if $noPCP}collapsed{/if}" id="softCredit">
238 <div class="crm-accordion-header">
239 {ts}Personal Campaign Page{/ts}&nbsp;{help id="id-pcp"}
240 </div>
241 <div class="crm-accordion-body">
242 <table class="form-layout-compressed">
243 <tr class="crm-contribution-pcp-block crm-contribution-form-block-pcp_made_through_id">
244 <td class="label">{$form.pcp_made_through_id.label}</td>
245 <td>
246 {$form.pcp_made_through_id.html} &nbsp;
247 <span class="description">{ts}Search for the Personal Campaign Page by the fund-raiser's last name or
248 email address.{/ts}</span>
249
250 <div class="spacer"></div>
251 <div class="crm-contribution-form-block-pcp_details">
252 <table class="crm-contribution-form-table-credit_to_pcp">
253 <tr id="pcpDisplayRollID" class="crm-contribution-form-block-pcp_display_in_roll">
254 <td class="label">{$form.pcp_display_in_roll.label}</td>
255 <td>{$form.pcp_display_in_roll.html}</td>
256 </tr>
257 <tr id="nickID" class="crm-contribution-form-block-pcp_roll_nickname">
258 <td class="label">{$form.pcp_roll_nickname.label}</td>
259 <td>{$form.pcp_roll_nickname.html|crmAddClass:big}<br/>
260 <span class="description">{ts}Name or nickname contributor wants to be displayed in the Honor
261 Roll. Enter "Anonymous" for anonymous contributions.{/ts}</span>
262 </td>
263 </tr>
264 <tr id="personalNoteID" class="crm-contribution-form-block-pcp_personal_note">
265 <td class="label" style="vertical-align: top">{$form.pcp_personal_note.label}</td>
266 <td>
267 {$form.pcp_personal_note.html}
268 <span
269 class="description">{ts}Personal message submitted by contributor for display in the Honor Roll.{/ts}</span>
270 </td>
271 </tr>
272 </table>
273 </div>
274 </td>
275 </tr>
276 </table>
277 </div>
278 </div>
279 {/if}
280 <!-- end of PCP -->
281
282 {if !$contributionMode}
283 <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed" id="paymentDetails_Information">
284 <div class="crm-accordion-header">
285 {ts}Payment Details{/ts}
286 </div>
287 <div class="crm-accordion-body">
288 <table class="form-layout-compressed" >
289 <tr class="crm-contribution-form-block-receive_date">
290 <td class="label">{$form.receive_date.label}</td>
291 <td {$valueStyle}>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}<br />
292 <span class="description">{ts}The date this contribution was received.{/ts}</span>
293 </td>
294 </tr>
295 <tr class="crm-contribution-form-block-payment_instrument_id">
296 <td class="label">{$form.payment_instrument_id.label}</td>
297 <td {$valueStyle}>{$form.payment_instrument_id.html} {help id="payment_instrument_id"}</td>
298 </td>
299 </tr>
300 {if $showCheckNumber || !$isOnline}
301 <tr id="checkNumber" class="crm-contribution-form-block-check_number">
302 <td class="label">{$form.check_number.label}</td>
303 <td>{$form.check_number.html}</td>
304 </tr>
305 {/if}
306 <tr class="crm-contribution-form-block-trxn_id">
307 <td class="label">{$form.trxn_id.label}</td>
308 <td {$valueStyle}>{$form.trxn_id.html} {help id="id-trans_id"}</td>
309 </tr>
310 {if $email and $outBound_option != 2}
311 <tr class="crm-contribution-form-block-is_email_receipt">
312 <td class="label">
313 {$form.is_email_receipt.label}</td><td>{$form.is_email_receipt.html}&nbsp;
314 <span class="description">{ts 1=$email}Automatically email a receipt for this payment to %1?{/ts}</span>
315 </td>
316 </tr>
317 {elseif $context eq 'standalone' and $outBound_option != 2 }
318 <tr id="email-receipt" style="display:none;" class="crm-contribution-form-block-is_email_receipt">
319 <td class="label">{$form.is_email_receipt.label}</td>
320 <td>{$form.is_email_receipt.html} <span class="description">{ts}Automatically email a receipt for this payment to {/ts}<span id="email-address"></span>?</span>
321 </td>
322 </tr>
323 {/if}
324 <tr id="receiptDate" class="crm-contribution-form-block-receipt_date">
325 <td class="label">{$form.receipt_date.label}</td>
326 <td>{include file="CRM/common/jcalendar.tpl" elementName=receipt_date}<br />
327 <span class="description">{ts}Date that a receipt was sent to the contributor.{/ts}</span>
328 </td>
329 </tr>
330 <tr id="fromEmail" class="crm-contribution-form-block-receipt_date" style="display:none;">
331 <td class="label">{$form.from_email_address.label}</td>
332 <td>{$form.from_email_address.html}</td>
333 </tr>
334 </table>
335 </div>
336 </div>
337 {/if}
338
339 <div id="customData" class="crm-contribution-form-block-customData"></div>
340
341 {*include custom data js file*}
342 {include file="CRM/common/customData.tpl"}
343
344 {literal}
345 <script type="text/javascript">
346 CRM.$(function($) {
347 {/literal}
348 CRM.buildCustomData( '{$customDataType}' );
349 {if $customDataSubType}
350 CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
351 {/if}
352
353 {if $buildPriceSet}{literal}buildAmount( );{/literal}{/if}
354 {literal}
355 });
356
357 // bind first click of accordion header to load crm-accordion-body with snippet
358 // everything else taken care of by cj().crm-accordions()
359 CRM.$(function($) {
360 cj('#adjust-option-type').hide();
361 cj('.crm-ajax-accordion .crm-accordion-header').one('click', function() {
362 loadPanes(cj(this).attr('id'));
363 });
364 cj('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(function(index) {
365 loadPanes(cj(this).attr('id'));
366 });
367 });
368 // load panes function calls for snippet based on id of crm-accordion-header
369 function loadPanes( id ) {
370 var url = "{/literal}{crmURL p='civicrm/contact/view/contribution' q='snippet=4&formType=' h=0}{literal}" + id;
371 {/literal}
372 {if $contributionMode}
373 url = url + "&mode={$contributionMode}";
374 {/if}
375 {if $qfKey}
376 url = url + "&qfKey={$qfKey}";
377 {/if}
378 {literal}
379 if (! cj('div.'+id).html()) {
380 var loading = '<img src="{/literal}{$config->resourceBase}i/loading.gif{literal}" alt="{/literal}{ts escape='js'}loading{/ts}{literal}" />&nbsp;{/literal}{ts escape='js'}Loading{/ts}{literal}...';
381 cj('div.'+id).html(loading);
382 cj.ajax({
383 url : url,
384 success: function(data) { cj('div.'+id).html(data).trigger('crmLoad'); }
385 });
386 }
387 }
388
389 var url = "{/literal}{$dataUrl}{literal}";
390
391 {/literal}
392 {if $context eq 'standalone' and $outBound_option != 2 }
393 {literal}
394 CRM.$(function($) {
395
396 var $form = $("form.{/literal}{$form.formClass}{literal}");
397 $("#contact_id", $form).change(checkEmail);
398 checkEmail( );
399
400 function checkEmail( ) {
401 var data = $("#contact_id", $form).select2('data');
402 if (data && data.extra && data.extra.email && data.extra.email.length) {
403 $("#email-receipt", $form).show();
404 $("#email-address", $form).html(data.extra.email);
405 }
406 else {
407 $("#email-receipt", $form).hide();
408 }
409 }
410
411 showHideByValue( 'is_email_receipt', '', 'receiptDate', 'table-row', 'radio', true);
412 showHideByValue( 'is_email_receipt', '', 'fromEmail', 'table-row', 'radio', false );
413 });
414
415 {/literal}
416 {/if}
417 </script>
418
419 <div class="accordion ui-accordion ui-widget ui-helper-reset">
420 {* Additional Detail / Honoree Information / Premium Information *}
421 {foreach from=$allPanes key=paneName item=paneValue}
422
423 <div class="crm-accordion-wrapper crm-ajax-accordion crm-{$paneValue.id}-accordion {if $paneValue.open neq 'true'}collapsed{/if}">
424 <div class="crm-accordion-header" id="{$paneValue.id}">
425
426 {$paneName}
427 </div><!-- /.crm-accordion-header -->
428 <div class="crm-accordion-body">
429
430 <div class="{$paneValue.id}"></div>
431 </div><!-- /.crm-accordion-body -->
432 </div><!-- /.crm-accordion-wrapper -->
433
434 {/foreach}
435 </div>
436
437 {/if}
438 <br />
439 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
440 </div>
441
442 {literal}
443 <script type="text/javascript">
444 function verify( ) {
445 if (cj('#is_email_receipt').prop('checked' )) {
446 var ok = confirm( '{/literal}{ts escape='js'}Click OK to save this contribution record AND send a receipt to the contributor now{/ts}{literal}.' );
447 if (!ok) {
448 return false;
449 }
450 }
451 }
452
453 function status() {
454 cj("#cancel_date").val('');
455 cj("#cancel_reason").val('');
456 }
457
458 </script>
459 {/literal}
460
461 {if $action neq 8}
462 {literal}
463 <script type="text/javascript">
464 CRM.$(function($) {
465 checkEmailDependancies( );
466 cj('#is_email_receipt').click( function( ) {
467 checkEmailDependancies( );
468 });
469 });
470
471 function checkEmailDependancies( ) {
472 if (cj('#is_email_receipt').prop('checked' )) {
473 cj('#fromEmail').show( );
474 cj('#receiptDate').hide( );
475 }
476 else {
477 cj('#fromEmail').hide( );
478 cj('#receiptDate').show( );
479 }
480 }
481
482 {/literal}{if !$contributionMode}{literal}
483 CRM.$(function($) {
484 showHideCancelInfo(cj('#contribution_status_id'));
485
486 cj('#contribution_status_id').change(function() {
487 showHideCancelInfo(cj('#contribution_status_id'));
488 }
489 );
490 });
491
492 function showHideCancelInfo(obj) {
493 if (obj.find(":selected").text() == 'Refunded' || obj.find(":selected").text() == 'Cancelled') {
494 cj('#cancelInfo').show( );
495 cj('#total_amount').attr('readonly', true);
496 }
497 else {
498 status();
499 cj('#cancelInfo').hide( );
500 cj("#total_amount").removeAttr('readonly');
501 }
502 }
503
504 {/literal}{/if}{literal}
505 </script>
506 {/literal}
507 {if !$contributionMode}
508 {include file="CRM/common/showHideByFieldValue.tpl"
509 trigger_field_id ="payment_instrument_id"
510 trigger_value = '4'
511 target_element_id ="checkNumber"
512 target_element_type ="table-row"
513 field_type ="select"
514 invert = 0
515 }
516 {/if}
517 {/if} {* not delete mode if*}
518
519 {/if} {* closing of main custom data if *}
520
521 {literal}
522 <script type="text/javascript">
523
524 {/literal}
525
526 // load form during form rule.
527 {if $buildPriceSet}{literal}buildAmount( );{/literal}{/if}
528
529 {literal}
530 function buildAmount( priceSetId ) {
531 if (!priceSetId) priceSetId = cj("#price_set_id").val( );
532
533 var fname = '#priceset';
534 if (!priceSetId) {
535 // hide price set fields.
536 cj(fname).hide( );
537
538 // show/hide price set amount and total amount.
539 cj("#totalAmountORPriceSet").show( );
540 cj("#totalAmount").show( );
541 var choose = "{/literal}{ts}Choose price set{/ts}{literal}";
542 cj("#price_set_id option[value='']").html( choose );
543
544 //we might want to build recur block.
545 if (cj("#is_recur")) buildRecurBlock( null );
546 return;
547 }
548
549 //don't allow recurring w/ priceset.
550 if ( cj( "#is_recur" ) && cj( 'input:radio[name="is_recur"]:checked').val( ) ) {
551 //reset the values of recur block.
552 cj("#installments").val('');
553 cj("#frequency_interval").val('');
554 cj('input:radio[name="is_recur"]')[0].checked = true;
555 cj("#recurringPaymentBlock").hide( );
556 }
557
558 var dataUrl = {/literal}"{crmURL h=0 q='snippet=4'}"{literal} + '&priceSetId=' + priceSetId;
559
560 var response = cj.ajax({
561 url: dataUrl,
562 async: false
563 }).responseText;
564
565 cj( fname ).show( ).html( response ).trigger('crmLoad');
566 // freeze total amount text field.
567 cj( "#total_amount").val('');
568
569 cj( "#totalAmountORPriceSet" ).hide( );
570 cj( "#totalAmount").hide( );
571 var manual = "{/literal}{ts}Manual contribution amount{/ts}{literal}";
572 cj("#price_set_id option[value='']").html( manual );
573 }
574
575 function adjustPayment( ) {
576 cj('#adjust-option-type').show();
577 cj("#total_amount").removeAttr("READONLY");
578 cj("#total_amount").css('background-color', '#ffffff');
579 }
580
581 {/literal}{if $processorSupportsFutureStartDate}{literal}
582 cj ('input:radio[name="is_recur"]').click( function( ) {
583 showStartDate( );
584 });
585
586 showStartDate( );
587
588 function showStartDate( ) {
589 if (cj( 'input:radio[name="is_recur"]:checked').val( ) == 0 ) {
590 cj('#start_date').hide( );
591 }
592 else {
593 cj('#start_date').show( );
594 }
595 }
596
597 {/literal}{/if}{literal}
598 cj('#fee_amount').change( function() {
599 var totalAmount = cj('#total_amount').val();
600 var feeAmount = cj('#fee_amount').val();
601 var netAmount = totalAmount.replace(/,/g, '') - feeAmount.replace(/,/g, '');
602 if (!cj('#net_amount').val()) {
603 cj('#net_amount').val(netAmount);
604 }
605 });
606 </script>
607 {/literal}