Merge pull request #9246 from eileenmcnaughton/bjorn
[civicrm-core.git] / templates / CRM / Contribute / Form / Contribution / Main.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
2c4c49ca 3 | CiviCRM version 4.7 |
6a488035 4 +--------------------------------------------------------------------+
fa938177 5 | Copyright CiviCRM LLC (c) 2004-2016 |
6a488035
TO
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*}
ab234a8a 26{* Callback snippet: On-behalf profile *}
58466af1 27{if $snippet and !empty($isOnBehalfCallback) and !$ccid}
436d120c
GC
28 <div class="crm-public-form-item crm-section">
29 {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl" context="front-end"}
30 </div>
6a488035
TO
31{else}
32 {literal}
33 <script type="text/javascript">
34
35 // Putting these functions directly in template so they are available for standalone forms
36 function useAmountOther() {
37 var priceset = {/literal}{if $contriPriceset}'{$contriPriceset}'{else}0{/if}{literal};
38
39 for( i=0; i < document.Main.elements.length; i++ ) {
40 element = document.Main.elements[i];
41 if ( element.type == 'radio' && element.name == priceset ) {
42 if (element.value == '0' ) {
43 element.click();
44 }
45 else {
46 element.checked = false;
47 }
48 }
49 }
50 }
51
52 function clearAmountOther() {
53 var priceset = {/literal}{if $priceset}'#{$priceset}'{else}0{/if}{literal}
54 if( priceset ){
55 cj(priceset).val('');
56 cj(priceset).blur();
57 }
58 if (document.Main.amount_other == null) return; // other_amt field not present; do nothing
59 document.Main.amount_other.value = "";
60 }
61
62 </script>
63 {/literal}
64
65 {if $action & 1024}
66 {include file="CRM/Contribute/Form/Contribution/PreviewHeader.tpl"}
67 {/if}
68
69 {include file="CRM/common/TrackingFields.tpl"}
70
696a8ad6 71 <div class="crm-contribution-page-id-{$contributionPageID} crm-block crm-contribution-main-form-block">
37326fa1 72
58466af1 73 {if $contact_id && !$ccid}
37326fa1
DG
74 <div class="messages status no-popup crm-not-you-message">
75 {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>?)
76 </div>
77 {/if}
78
436d120c 79 <div id="intro_text" class="crm-public-form-item crm-section intro_text-section">
6a488035
TO
80 {$intro_text}
81 </div>
596bff78 82 {include file="CRM/common/cidzero.tpl"}
6a488035 83 {if $islifetime or $ispricelifetime }
f6eedce7 84 <div class="help">{ts}You have a current Lifetime Membership which does not need to be renewed.{/ts}</div>
6a488035
TO
85 {/if}
86
58466af1 87 {if !empty($useForMember) && !$ccid}
88 <div class="crm-public-form-item crm-section">
89 {include file="CRM/Contribute/Form/Contribution/MembershipBlock.tpl" context="makeContribution"}
90 </div>
91 {elseif !empty($ccid)}
92 {if $lineItem && $priceSetID && !$is_quick_config}
93 <div class="header-dark">
94 {ts}Contribution Information{/ts}
95 </div>
96 {assign var="totalAmount" value=$pendingAmount}
97 {include file="CRM/Price/Page/LineItem.tpl" context="Contribution"}
6a488035 98 {else}
58466af1 99 <div class="display-block">
100 <td class="label">{$form.total_amount.label}</td>
101 <td><span>{$form.total_amount.html|crmMoney}</span></td>
102 </div>
103 {/if}
104 {else}
105 <div id="priceset-div">
106 {include file="CRM/Price/Form/PriceSet.tpl" extends="Contribution"}
107 </div>
6a488035
TO
108 {/if}
109
58466af1 110 {if !$ccid}
111 {crmRegion name='contribution-main-pledge-block'}
b3bb9ae5 112 {if $pledgeBlock}
113 {if $is_pledge_payment}
114 <div class="crm-public-form-item crm-section {$form.pledge_amount.name}-section">
115 <div class="label">{$form.pledge_amount.label}&nbsp;<span class="crm-marker">*</span></div>
116 <div class="content">{$form.pledge_amount.html}</div>
117 <div class="clear"></div>
6a488035 118 </div>
58466af1 119 {else}
120 <div class="crm-public-form-item crm-section {$form.is_pledge.name}-section">
121 <div class="label">&nbsp;</div>
122 <div class="content">
123 {$form.is_pledge.html}&nbsp;
124 {if $is_pledge_interval}
125 {$form.pledge_frequency_interval.html}&nbsp;
126 {/if}
127 {$form.pledge_frequency_unit.html}<span id="pledge_installments_num">&nbsp;{ts}for{/ts}&nbsp;{$form.pledge_installments.html}&nbsp;{ts}installments.{/ts}</span>
128 </div>
129 <div class="clear"></div>
130 {if $start_date_editable}
131 {if $is_date}
132 <div class="label">{$form.start_date.label}</div><div class="content">{include file="CRM/common/jcalendar.tpl" elementName=start_date}</div>
133 {else}
134 <div class="label">{$form.start_date.label}</div><div class="content">{$form.start_date.html}</div>
135 {/if}
136 {else}
137 <div class="label">{$form.start_date.label}</div>
138 <div class="content">{$start_date_display|date_format}</div>
b3bb9ae5 139 {/if}
b3bb9ae5 140 <div class="clear"></div>
58466af1 141 </div>
b3bb9ae5 142 {/if}
6a488035 143 {/if}
58466af1 144 {/crmRegion}
145
146 {if $form.is_recur}
147 <div class="crm-public-form-item crm-section {$form.is_recur.name}-section">
148 <div class="label">&nbsp;</div>
149 <div class="content">
150 {$form.is_recur.html} {$form.is_recur.label} {ts}every{/ts}
151 {if $is_recur_interval}
152 {$form.frequency_interval.html}
7f7fa13a 153 {/if}
58466af1 154 {if $one_frequency_unit}
155 {$frequency_unit}
156 {else}
157 {$form.frequency_unit.html}
33627071 158 {/if}
58466af1 159 {if $is_recur_installments}
160 <span id="recur_installments_num">
161 {ts}for{/ts} {$form.installments.html} {$form.installments.label}
162 </span>
163 {/if}
164 <div id="recurHelp" class="description">
165 {ts}Your recurring contribution will be processed automatically.{/ts}
166 {if $is_recur_installments}
167 {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}
168 {/if}
169 {if $is_email_receipt}
170 {ts}You will receive an email receipt for each recurring contribution.{/ts}
171 {/if}
172 </div>
33627071 173 </div>
58466af1 174 <div class="clear"></div>
6a488035 175 </div>
58466af1 176 {/if}
177 {if $pcpSupporterText}
178 <div class="crm-public-form-item crm-section pcpSupporterText-section">
179 <div class="label">&nbsp;</div>
180 <div class="content">{$pcpSupporterText}</div>
181 <div class="clear"></div>
182 </div>
183 {/if}
184 {assign var=n value=email-$bltID}
185 <div class="crm-public-form-item crm-section {$form.$n.name}-section">
186 <div class="label">{$form.$n.label}</div>
187 <div class="content">
188 {$form.$n.html}
189 </div>
190 <div class="clear"></div>
6a488035 191 </div>
6a488035 192
58466af1 193 <div class="crm-public-form-item crm-section">
194 {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl"}
195 </div>
6a488035 196
58466af1 197 {* User account registration option. Displays if enabled for one of the profiles on this page. *}
198 <div class="crm-public-form-item crm-section cms_user-section">
199 {include file="CRM/common/CMSUser.tpl"}
200 </div>
201 <div class="crm-public-form-item crm-section premium_block-section">
202 {include file="CRM/Contribute/Form/Contribution/PremiumBlock.tpl" context="makeContribution"}
203 </div>
6a488035 204
58466af1 205 {if $honoreeProfileFields|@count}
206 <fieldset class="crm-public-form-item crm-group honor_block-group">
207 {crmRegion name="contribution-soft-credit-block"}
208 <legend>{$honor_block_title}</legend>
209 <div class="crm-public-form-item crm-section honor_block_text-section">
210 {$honor_block_text}
cb804cd9 211 </div>
58466af1 212 {if $form.soft_credit_type_id.html}
213 <div class="crm-public-form-item crm-section {$form.soft_credit_type_id.name}-section">
214 <div class="content" >
215 {$form.soft_credit_type_id.html}
216 <div class="description">{ts}Select an option to reveal honoree information fields.{/ts}</div>
217 </div>
218 </div>
219 {/if}
220 {/crmRegion}
221 <div id="honorType" class="honoree-name-email-section">
222 {include file="CRM/UF/Form/Block.tpl" fields=$honoreeProfileFields mode=8 prefix='honor'}
223 </div>
224 </fieldset>
225 {/if}
6a488035 226
58466af1 227 <div class="crm-public-form-item crm-group custom_pre_profile-group">
228 {include file="CRM/UF/Form/Block.tpl" fields=$customPre}
229 </div>
6a488035 230
58466af1 231 {if $isHonor}
232 <fieldset class="crm-public-form-item crm-group pcp-group">
233 <div class="crm-public-form-item crm-section pcp-section">
234 <div class="crm-public-form-item crm-section display_in_roll-section">
235 <div class="content">
236 {$form.pcp_display_in_roll.html} &nbsp;
237 {$form.pcp_display_in_roll.label}
238 </div>
239 <div class="clear"></div>
6a488035 240 </div>
58466af1 241 <div id="nameID" class="crm-public-form-item crm-section is_anonymous-section">
242 <div class="content">
243 {$form.pcp_is_anonymous.html}
244 </div>
245 <div class="clear"></div>
6a488035 246 </div>
58466af1 247 <div id="nickID" class="crm-public-form-item crm-section pcp_roll_nickname-section">
248 <div class="label">{$form.pcp_roll_nickname.label}</div>
249 <div class="content">{$form.pcp_roll_nickname.html}
250 <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>
251 </div>
252 <div class="clear"></div>
6a488035 253 </div>
58466af1 254 <div id="personalNoteID" class="crm-public-form-item crm-section pcp_personal_note-section">
255 <div class="label">{$form.pcp_personal_note.label}</div>
256 <div class="content">
257 {$form.pcp_personal_note.html}
258 <div class="description">{ts}Enter a message to accompany this contribution.{/ts}</div>
259 </div>
260 <div class="clear"></div>
6a488035 261 </div>
6a488035 262 </div>
58466af1 263 </fieldset>
264 {/if}
265
266 {* end of ccid loop *}
6a488035
TO
267 {/if}
268
e02d7e96 269 {if $form.payment_processor_id.label}
6e56bbfc 270 {* PP selection only works with JS enabled, so we hide it initially *}
436d120c 271 <fieldset class="crm-public-form-item crm-group payment_options-group" style="display:none;">
6a488035 272 <legend>{ts}Payment Options{/ts}</legend>
436d120c 273 <div class="crm-public-form-item crm-section payment_processor-section">
e02d7e96
EM
274 <div class="label">{$form.payment_processor_id.label}</div>
275 <div class="content">{$form.payment_processor_id.html}</div>
6a488035
TO
276 <div class="clear"></div>
277 </div>
278 </fieldset>
279 {/if}
280
281 {if $is_pay_later}
436d120c 282 <fieldset class="crm-public-form-item crm-group pay_later-group">
6a488035 283 <legend>{ts}Payment Options{/ts}</legend>
436d120c 284 <div class="crm-public-form-item crm-section pay_later_receipt-section">
6a488035
TO
285 <div class="label">&nbsp;</div>
286 <div class="content">
287 [x] {$pay_later_text}
288 </div>
289 <div class="clear"></div>
290 </div>
291 </fieldset>
292 {/if}
293
7c8cc461 294 <div id="billing-payment-block">
2975161b 295 {include file="CRM/Financial/Form/Payment.tpl" snippet=4}
7c8cc461 296 </div>
6a488035
TO
297 {include file="CRM/common/paymentBlock.tpl"}
298
436d120c 299 <div class="crm-public-form-item crm-group custom_post_profile-group">
6a488035
TO
300 {include file="CRM/UF/Form/Block.tpl" fields=$customPost}
301 </div>
302
303 {if $is_monetary and $form.bank_account_number}
304 <div id="payment_notice">
436d120c 305 <fieldset class="crm-public-form-item crm-group payment_notice-group">
6a488035
TO
306 <legend>{ts}Agreement{/ts}</legend>
307 {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}
308 </fieldset>
309 </div>
310 {/if}
311
312 {if $isCaptcha}
71fc6ea4 313 {include file='CRM/common/ReCAPTCHA.tpl'}
6a488035
TO
314 {/if}
315 <div id="crm-submit-buttons" class="crm-submit-buttons">
316 {include file="CRM/common/formButtons.tpl" location="bottom"}
317 </div>
318 {if $footer_text}
436d120c 319 <div id="footer_text" class="crm-public-form-item crm-section contribution_footer_text-section">
6a488035
TO
320 <p>{$footer_text}</p>
321 </div>
322 {/if}
6a488035 323</div>
6a488035 324<script type="text/javascript">
4d327c2d 325 {if $isHonor}
6a488035
TO
326 pcpAnonymous();
327 {/if}
328
329 {literal}
6a488035 330
7f7fa13a
EM
331 cj('input[name="soft_credit_type_id"]').on('change', function() {
332 enableHonorType();
333 });
92ec1d7f 334
6a488035 335 function enableHonorType( ) {
92ec1d7f 336 var selectedValue = cj('input[name="soft_credit_type_id"]:checked');
458a8395 337 if ( selectedValue.val() > 0) {
6a488035 338 cj('#honorType').show();
6a488035
TO
339 }
340 else {
6a488035 341 cj('#honorType').hide();
6a488035
TO
342 }
343 }
344
7f7fa13a 345 cj('input[id="is_recur"]').on('change', function() {
3dafdf1f 346 toggleRecur();
7f7fa13a 347 });
33627071 348
3dafdf1f 349 function toggleRecur( ) {
350 var isRecur = cj('input[id="is_recur"]:checked');
351 var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
de4cd6a2 352 if ( allowAutoRenew && cj("#auto_renew") ) {
353 showHideAutoRenew( null );
354 }
3dafdf1f 355 if (isRecur.val() > 0) {
33627071 356 cj('#recurHelp').show();
3dafdf1f 357 cj('#amount_sum_label').text(ts('Regular amount'));
33627071
DG
358 }
359 else {
360 cj('#recurHelp').hide();
3dafdf1f 361 cj('#amount_sum_label').text(ts('Total amount'));
33627071
DG
362 }
363 }
92ec1d7f 364
6a488035
TO
365 function pcpAnonymous( ) {
366 // clear nickname field if anonymous is true
367 if (document.getElementsByName("pcp_is_anonymous")[1].checked) {
368 document.getElementById('pcp_roll_nickname').value = '';
369 }
370 if (!document.getElementsByName("pcp_display_in_roll")[0].checked) {
371 cj('#nickID').hide();
372 cj('#nameID').hide();
373 cj('#personalNoteID').hide();
374 }
375 else {
376 if (document.getElementsByName("pcp_is_anonymous")[0].checked) {
377 cj('#nameID').show();
378 cj('#nickID').show();
379 cj('#personalNoteID').show();
380 }
381 else {
382 cj('#nameID').show();
383 cj('#nickID').hide();
384 cj('#personalNoteID').hide();
385 }
386 }
387 }
388
3cc60a06 389 CRM.$(function($) {
7f7fa13a 390 enableHonorType();
3dafdf1f 391 toggleRecur();
7c859cc3 392 skipPaymentMethod();
6a488035
TO
393 });
394
3cc60a06 395 CRM.$(function($) {
6a488035
TO
396 // highlight price sets
397 function updatePriceSetHighlight() {
7f94bfb8
MW
398 $('#priceset .price-set-row span').removeClass('highlight');
399 $('#priceset .price-set-row input:checked').parent().addClass('highlight');
6a488035 400 }
7f94bfb8 401 $('#priceset input[type="radio"]').change(updatePriceSetHighlight);
6a488035 402 updatePriceSetHighlight();
e6ac320a 403
26398922 404 // Update pledge contribution amount when pledge checkboxes change
7f94bfb8 405 $("input[name^='pledge_amount']").on('change', function() {
26398922 406 var total = 0;
7f94bfb8
MW
407 $("input[name^='pledge_amount']:checked").each(function() {
408 total += Number($(this).attr('amount'));
26398922 409 });
7f94bfb8 410 $("input[name^='price_']").val(total.toFixed(2));
26398922 411 });
6a488035
TO
412 });
413 {/literal}
414</script>
415{/if}
416
417{* jQuery validate *}
418{* disabled because more work needs to be done to conditionally require credit card fields *}
419{*include file="CRM/Form/validate.tpl"*}