Fix incorrect marker class
[civicrm-core.git] / templates / CRM / Contribute / Form / Contribution / Main.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.6 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2015 |
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 {* Callback snippet: On-behalf profile *}
27 {if $snippet and !empty($isOnBehalfCallback)}
28 {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl" context="front-end"}
29
30 {else}
31 {literal}
32 <script type="text/javascript">
33
34 // Putting these functions directly in template so they are available for standalone forms
35 function useAmountOther() {
36 var priceset = {/literal}{if $contriPriceset}'{$contriPriceset}'{else}0{/if}{literal};
37
38 for( i=0; i < document.Main.elements.length; i++ ) {
39 element = document.Main.elements[i];
40 if ( element.type == 'radio' && element.name == priceset ) {
41 if (element.value == '0' ) {
42 element.click();
43 }
44 else {
45 element.checked = false;
46 }
47 }
48 }
49 }
50
51 function clearAmountOther() {
52 var priceset = {/literal}{if $priceset}'#{$priceset}'{else}0{/if}{literal}
53 if( priceset ){
54 cj(priceset).val('');
55 cj(priceset).blur();
56 }
57 if (document.Main.amount_other == null) return; // other_amt field not present; do nothing
58 document.Main.amount_other.value = "";
59 }
60
61 </script>
62 {/literal}
63
64 {if $action & 1024}
65 {include file="CRM/Contribute/Form/Contribution/PreviewHeader.tpl"}
66 {/if}
67
68 {include file="CRM/common/TrackingFields.tpl"}
69
70 <div class="crm-contribution-page-id-{$contributionPageID} crm-block crm-contribution-main-form-block">
71
72 {if $contact_id}
73 <div class="messages status no-popup crm-not-you-message">
74 {ts 1=$display_name}Welcome %1{/ts}. (<a href="{crmURL p='civicrm/contribute/transact' q="cid=0&reset=1&id=`$contributionPageID`"}" title="{ts}Click here to do this for a different person.{/ts}">{ts 1=$display_name}Not %1, or want to do this for a different person{/ts}</a>?)
75 </div>
76 {/if}
77
78 <div id="intro_text" class="crm-section intro_text-section">
79 {$intro_text}
80 </div>
81 {include file="CRM/common/cidzero.tpl"}
82 {if $islifetime or $ispricelifetime }
83 <div id="help">{ts}You have a current Lifetime Membership which does not need to be renewed.{/ts}</div>
84 {/if}
85
86 {if !empty($useForMember)}
87 {include file="CRM/Contribute/Form/Contribution/MembershipBlock.tpl" context="makeContribution"}
88 {else}
89 <div id="priceset-div">
90 {include file="CRM/Price/Form/PriceSet.tpl" extends="Contribution"}
91 </div>
92 {/if}
93
94 {if $pledgeBlock}
95 {if $is_pledge_payment}
96 <div class="crm-section {$form.pledge_amount.name}-section">
97 <div class="label">{$form.pledge_amount.label}&nbsp;<span class="crm-marker">*</span></div>
98 <div class="content">{$form.pledge_amount.html}</div>
99 <div class="clear"></div>
100 </div>
101 {else}
102 <div class="crm-section {$form.is_pledge.name}-section">
103 <div class="label">&nbsp;</div>
104 <div class="content">
105 {$form.is_pledge.html}&nbsp;
106 {if $is_pledge_interval}
107 {$form.pledge_frequency_interval.html}&nbsp;
108 {/if}
109 {$form.pledge_frequency_unit.html}<span id="pledge_installments_num">&nbsp;{ts}for{/ts}&nbsp;{$form.pledge_installments.html}&nbsp;{ts}installments.{/ts}</span>
110 </div>
111 <div class="clear"></div>
112 </div>
113 {/if}
114 {/if}
115
116 {if $form.is_recur}
117 <div class="crm-section {$form.is_recur.name}-section">
118 <div class="label">&nbsp;</div>
119 <div class="content">
120 {$form.is_recur.html} {$form.is_recur.label} {ts}every{/ts}
121 {if $is_recur_interval}
122 {$form.frequency_interval.html}
123 {/if}
124 {if $one_frequency_unit}
125 {$frequency_unit}
126 {else}
127 {$form.frequency_unit.html}
128 {/if}
129 {if $is_recur_installments}
130 <span id="recur_installments_num">
131 {ts}for{/ts} {$form.installments.html} {$form.installments.label}
132 </span>
133 {/if}
134 <div id="recurHelp" class="description">
135 {ts}Your recurring contribution will be processed automatically.{/ts}
136 {if $is_recur_installments}
137 {ts}You can specify the number of installments, or 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.{/ts}
138 {/if}
139 {if $is_email_receipt}
140 {ts}You will receive an email receipt for each recurring contribution.{/ts}
141 {/if}
142 </div>
143 </div>
144 <div class="clear"></div>
145 </div>
146 {/if}
147 {if $pcpSupporterText}
148 <div class="crm-section pcpSupporterText-section">
149 <div class="label">&nbsp;</div>
150 <div class="content">{$pcpSupporterText}</div>
151 <div class="clear"></div>
152 </div>
153 {/if}
154 {assign var=n value=email-$bltID}
155 <div class="crm-section {$form.$n.name}-section">
156 <div class="label">{$form.$n.label}</div>
157 <div class="content">
158 {$form.$n.html}
159 </div>
160 <div class="clear"></div>
161 </div>
162
163 {if $form.is_for_organization}
164 <div class="crm-section {$form.is_for_organization.name}-section">
165 <div class="label">&nbsp;</div>
166 <div class="content">
167 {$form.is_for_organization.html}&nbsp;{$form.is_for_organization.label}
168 </div>
169 <div class="clear"></div>
170 </div>
171 {/if}
172
173 {if $is_for_organization}
174 <div id='onBehalfOfOrg' class="crm-section">
175 {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl"}
176 </div>
177 {/if}
178
179 {* User account registration option. Displays if enabled for one of the profiles on this page. *}
180 {include file="CRM/common/CMSUser.tpl"}
181 {include file="CRM/Contribute/Form/Contribution/PremiumBlock.tpl" context="makeContribution"}
182
183 {if $honor_block_is_active}
184 <fieldset class="crm-group honor_block-group">
185 {include file="CRM/Contribute/Form/SoftCredit.tpl"}
186 <div id="honorType" class="honoree-name-email-section">
187 {include file="CRM/UF/Form/Block.tpl" fields=$honoreeProfileFields mode=8 prefix='honor'}
188 </div>
189 </fieldset>
190 {/if}
191
192 <div class="crm-group custom_pre_profile-group">
193 {include file="CRM/UF/Form/Block.tpl" fields=$customPre}
194 </div>
195
196 {if $isHonor}
197 <fieldset class="crm-group pcp-group">
198 <div class="crm-section pcp-section">
199 <div class="crm-section display_in_roll-section">
200 <div class="content">
201 {$form.pcp_display_in_roll.html} &nbsp;
202 {$form.pcp_display_in_roll.label}
203 </div>
204 <div class="clear"></div>
205 </div>
206 <div id="nameID" class="crm-section is_anonymous-section">
207 <div class="content">
208 {$form.pcp_is_anonymous.html}
209 </div>
210 <div class="clear"></div>
211 </div>
212 <div id="nickID" class="crm-section pcp_roll_nickname-section">
213 <div class="label">{$form.pcp_roll_nickname.label}</div>
214 <div class="content">{$form.pcp_roll_nickname.html}
215 <div class="description">{ts}Enter the name you want listed with this contribution. You can use a nick name like 'The Jones Family' or 'Sarah and Sam'.{/ts}</div>
216 </div>
217 <div class="clear"></div>
218 </div>
219 <div id="personalNoteID" class="crm-section pcp_personal_note-section">
220 <div class="label">{$form.pcp_personal_note.label}</div>
221 <div class="content">
222 {$form.pcp_personal_note.html}
223 <div class="description">{ts}Enter a message to accompany this contribution.{/ts}</div>
224 </div>
225 <div class="clear"></div>
226 </div>
227 </div>
228 </fieldset>
229 {/if}
230
231 {if $form.payment_processor_id.label}
232 {* PP selection only works with JS enabled, so we hide it initially *}
233 <fieldset class="crm-group payment_options-group" style="display:none;">
234 <legend>{ts}Payment Options{/ts}</legend>
235 <div class="crm-section payment_processor-section">
236 <div class="label">{$form.payment_processor_id.label}</div>
237 <div class="content">{$form.payment_processor_id.html}</div>
238 <div class="clear"></div>
239 </div>
240 </fieldset>
241 {/if}
242
243 {if $is_pay_later}
244 <fieldset class="crm-group pay_later-group">
245 <legend>{ts}Payment Options{/ts}</legend>
246 <div class="crm-section pay_later_receipt-section">
247 <div class="label">&nbsp;</div>
248 <div class="content">
249 [x] {$pay_later_text}
250 </div>
251 <div class="clear"></div>
252 </div>
253 </fieldset>
254 {/if}
255
256 <div id="billing-payment-block">
257 {* If we have a payment processor, load it - otherwise it happens via ajax *}
258 {if $paymentProcessorID or $isBillingAddressRequiredForPayLater}
259 {include file="CRM/Financial/Form/Payment.tpl" snippet=4}
260 {/if}
261 </div>
262 {include file="CRM/common/paymentBlock.tpl"}
263
264 <div class="crm-group custom_post_profile-group">
265 {include file="CRM/UF/Form/Block.tpl" fields=$customPost}
266 </div>
267
268 {if $is_monetary and $form.bank_account_number}
269 <div id="payment_notice">
270 <fieldset class="crm-group payment_notice-group">
271 <legend>{ts}Agreement{/ts}</legend>
272 {ts}Your account data will be used to charge your bank account via direct debit. While submitting this form you agree to the charging of your bank account via direct debit.{/ts}
273 </fieldset>
274 </div>
275 {/if}
276
277 {if $isCaptcha}
278 {include file='CRM/common/ReCAPTCHA.tpl'}
279 {/if}
280 <div id="crm-submit-buttons" class="crm-submit-buttons">
281 {include file="CRM/common/formButtons.tpl" location="bottom"}
282 </div>
283 {if $footer_text}
284 <div id="footer_text" class="crm-section contribution_footer_text-section">
285 <p>{$footer_text}</p>
286 </div>
287 {/if}
288 </div>
289
290 <script type="text/javascript">
291 {if $isHonor}
292 pcpAnonymous();
293 {/if}
294
295 {literal}
296 if ({/literal}"{$form.is_recur}"{literal}) {
297 if (document.getElementsByName("is_recur")[0].checked == true) {
298 window.onload = function() {
299 enablePeriod();
300 }
301 }
302 }
303
304 function enablePeriod ( ) {
305 var frqInt = {/literal}"{$form.frequency_interval}"{literal};
306 if ( document.getElementsByName("is_recur")[0].checked == true ) {
307 //get back to auto renew settings.
308 var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
309 if ( allowAutoRenew && cj("#auto_renew") ) {
310 showHideAutoRenew( null );
311 }
312 }
313 else {
314 //disabled auto renew settings.
315 var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
316 if ( allowAutoRenew && cj("#auto_renew") ) {
317 cj("#auto_renew").prop('checked', false );
318 cj('#allow_auto_renew').hide( );
319 }
320 }
321 }
322
323 {/literal}
324 {if $relatedOrganizationFound and $reset}
325 cj( "#is_for_organization" ).prop('checked', true );
326 showOnBehalf(false);
327 {elseif $onBehalfRequired}
328 showOnBehalf(true);
329 {/if}
330 {literal}
331
332 cj('input[name="soft_credit_type_id"]').on('change', function() {
333 enableHonorType();
334 });
335
336 function enableHonorType( ) {
337 var selectedValue = cj('input[name="soft_credit_type_id"]:checked');
338 if ( selectedValue.val() > 0) {
339 cj('#honorType').show();
340 }
341 else {
342 cj('#honorType').hide();
343 }
344 }
345
346 cj('input[id="is_recur"]').on('change', function() {
347 showRecurHelp();
348 });
349
350 function showRecurHelp( ) {
351 var showHelp = cj('input[id="is_recur"]:checked');
352 if ( showHelp.val() > 0) {
353 cj('#recurHelp').show();
354 }
355 else {
356 cj('#recurHelp').hide();
357 }
358 }
359
360 function pcpAnonymous( ) {
361 // clear nickname field if anonymous is true
362 if (document.getElementsByName("pcp_is_anonymous")[1].checked) {
363 document.getElementById('pcp_roll_nickname').value = '';
364 }
365 if (!document.getElementsByName("pcp_display_in_roll")[0].checked) {
366 cj('#nickID').hide();
367 cj('#nameID').hide();
368 cj('#personalNoteID').hide();
369 }
370 else {
371 if (document.getElementsByName("pcp_is_anonymous")[0].checked) {
372 cj('#nameID').show();
373 cj('#nickID').show();
374 cj('#personalNoteID').show();
375 }
376 else {
377 cj('#nameID').show();
378 cj('#nickID').hide();
379 cj('#personalNoteID').hide();
380 }
381 }
382 }
383
384 {/literal}
385 {if $form.is_pay_later and $paymentProcessor.payment_processor_type EQ 'PayPal_Express'}
386 showHidePayPalExpressOption();
387 {/if}
388 {literal}
389
390 CRM.$(function($) {
391 enableHonorType();
392 showRecurHelp();
393 skipPaymentMethod();
394 });
395
396 function showHidePayPalExpressOption() {
397 if (cj('input[name="is_pay_later"]').is(':checked')) {
398 cj("#crm-submit-buttons").show();
399 cj("#paypalExpress").hide();
400 }
401 else {
402 cj("#paypalExpress").show();
403 cj("#crm-submit-buttons").hide();
404 }
405 }
406
407 function showHidePayment(flag) {
408 var payment_options = cj(".payment_options-group");
409 var payment_processor = cj("div.payment_processor-section");
410 var payment_information = cj("div#payment_information");
411 if (flag) {
412 payment_options.hide();
413 payment_processor.hide();
414 payment_information.hide();
415 // also unset selected payment methods
416 cj('input[name="payment_processor"]').removeProp('checked');
417 }
418 else {
419 payment_options.show();
420 payment_processor.show();
421 payment_information.show();
422 }
423 }
424
425 function skipPaymentMethod() {
426 var flag = false;
427 cj('.price-set-option-content input[data-amount]').each( function(){
428 currentTotal = cj(this).attr('data-amount').replace(/[^\/\d]/g,'');
429 if( cj(this).is(':checked') && currentTotal == 0 ) {
430 flag = true;
431 }
432 });
433
434 cj('.price-set-option-content input[data-amount]').change( function () {
435 if (cj(this).attr('data-amount').replace(/[^\/\d]/g,'') == 0 ) {
436 flag = true;
437 } else {
438 flag = false;
439 }
440 showHidePayment(flag);
441 });
442 showHidePayment(flag);
443 }
444
445 CRM.$(function($) {
446 // highlight price sets
447 function updatePriceSetHighlight() {
448 cj('#priceset .price-set-row span').removeClass('highlight');
449 cj('#priceset .price-set-row input:checked').parent().addClass('highlight');
450 }
451 cj('#priceset input[type="radio"]').change(updatePriceSetHighlight);
452 updatePriceSetHighlight();
453
454 function toggleBillingBlockIfFree(){
455 var total_amount_tmp = $(this).data('raw-total');
456 // Hide billing questions if this is free
457 if (total_amount_tmp == 0){
458 cj("#billing-payment-block").hide();
459 cj(".payment_options-group").hide();
460 }
461 else {
462 cj("#billing-payment-block").show();
463 cj(".payment_options-group").show();
464 }
465 }
466
467 $('#pricevalue').each(toggleBillingBlockIfFree).on('change', toggleBillingBlockIfFree);
468 });
469 {/literal}
470 </script>
471 {/if}
472
473 {* jQuery validate *}
474 {* disabled because more work needs to be done to conditionally require credit card fields *}
475 {*include file="CRM/Form/validate.tpl"*}