Merge pull request #10946 from mattwire/CRM-21037_activity_sendsms_unittests
[civicrm-core.git] / templates / CRM / Contribute / Form / Contribution / Main.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
fee14197 3 | CiviCRM version 5 |
6a488035 4 +--------------------------------------------------------------------+
8c9251b3 5 | Copyright CiviCRM LLC (c) 2004-2018 |
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
94788da9 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">
3265f683 94 {ts}Contribution Information{/ts}{if $display_name} &ndash; {$display_name}{/if}
58466af1 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>
7e649aa9 101 <td><span>{$form.total_amount.html|crmMoney}&nbsp;&nbsp;{if $taxAmount}{ts 1=$taxTerm 2=$taxAmount|crmMoney}(includes %1 of %2){/ts}{/if}</span></td>
58466af1 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">
6841f76b 165 {$recurringHelpText}
58466af1 166 </div>
33627071 167 </div>
58466af1 168 <div class="clear"></div>
6a488035 169 </div>
58466af1 170 {/if}
171 {if $pcpSupporterText}
172 <div class="crm-public-form-item crm-section pcpSupporterText-section">
173 <div class="label">&nbsp;</div>
174 <div class="content">{$pcpSupporterText}</div>
175 <div class="clear"></div>
176 </div>
177 {/if}
d08a6665
JP
178 {if $showMainEmail}
179 {assign var=n value=email-$bltID}
180 <div class="crm-public-form-item crm-section {$form.$n.name}-section">
181 <div class="label">{$form.$n.label}</div>
182 <div class="content">
183 {$form.$n.html}
184 </div>
185 <div class="clear"></div>
58466af1 186 </div>
d08a6665 187 {/if}
6a488035 188
d100f75c 189 <div id='onBehalfOfOrg' class="crm-public-form-item crm-section">
58466af1 190 {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl"}
191 </div>
6a488035 192
58466af1 193 {* User account registration option. Displays if enabled for one of the profiles on this page. *}
194 <div class="crm-public-form-item crm-section cms_user-section">
195 {include file="CRM/common/CMSUser.tpl"}
196 </div>
197 <div class="crm-public-form-item crm-section premium_block-section">
198 {include file="CRM/Contribute/Form/Contribution/PremiumBlock.tpl" context="makeContribution"}
199 </div>
6a488035 200
58466af1 201 {if $honoreeProfileFields|@count}
202 <fieldset class="crm-public-form-item crm-group honor_block-group">
203 {crmRegion name="contribution-soft-credit-block"}
204 <legend>{$honor_block_title}</legend>
205 <div class="crm-public-form-item crm-section honor_block_text-section">
206 {$honor_block_text}
cb804cd9 207 </div>
58466af1 208 {if $form.soft_credit_type_id.html}
209 <div class="crm-public-form-item crm-section {$form.soft_credit_type_id.name}-section">
210 <div class="content" >
211 {$form.soft_credit_type_id.html}
212 <div class="description">{ts}Select an option to reveal honoree information fields.{/ts}</div>
213 </div>
214 </div>
215 {/if}
216 {/crmRegion}
217 <div id="honorType" class="honoree-name-email-section">
218 {include file="CRM/UF/Form/Block.tpl" fields=$honoreeProfileFields mode=8 prefix='honor'}
219 </div>
220 </fieldset>
221 {/if}
6a488035 222
58466af1 223 <div class="crm-public-form-item crm-group custom_pre_profile-group">
224 {include file="CRM/UF/Form/Block.tpl" fields=$customPre}
225 </div>
6a488035 226
58466af1 227 {if $isHonor}
228 <fieldset class="crm-public-form-item crm-group pcp-group">
229 <div class="crm-public-form-item crm-section pcp-section">
230 <div class="crm-public-form-item crm-section display_in_roll-section">
231 <div class="content">
232 {$form.pcp_display_in_roll.html} &nbsp;
233 {$form.pcp_display_in_roll.label}
234 </div>
235 <div class="clear"></div>
6a488035 236 </div>
58466af1 237 <div id="nameID" class="crm-public-form-item crm-section is_anonymous-section">
238 <div class="content">
239 {$form.pcp_is_anonymous.html}
240 </div>
241 <div class="clear"></div>
6a488035 242 </div>
58466af1 243 <div id="nickID" class="crm-public-form-item crm-section pcp_roll_nickname-section">
244 <div class="label">{$form.pcp_roll_nickname.label}</div>
245 <div class="content">{$form.pcp_roll_nickname.html}
246 <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>
247 </div>
248 <div class="clear"></div>
6a488035 249 </div>
58466af1 250 <div id="personalNoteID" class="crm-public-form-item crm-section pcp_personal_note-section">
251 <div class="label">{$form.pcp_personal_note.label}</div>
252 <div class="content">
253 {$form.pcp_personal_note.html}
254 <div class="description">{ts}Enter a message to accompany this contribution.{/ts}</div>
255 </div>
256 <div class="clear"></div>
6a488035 257 </div>
6a488035 258 </div>
58466af1 259 </fieldset>
260 {/if}
261
262 {* end of ccid loop *}
6a488035
TO
263 {/if}
264
e02d7e96 265 {if $form.payment_processor_id.label}
6e56bbfc 266 {* PP selection only works with JS enabled, so we hide it initially *}
436d120c 267 <fieldset class="crm-public-form-item crm-group payment_options-group" style="display:none;">
6a488035 268 <legend>{ts}Payment Options{/ts}</legend>
436d120c 269 <div class="crm-public-form-item crm-section payment_processor-section">
e02d7e96
EM
270 <div class="label">{$form.payment_processor_id.label}</div>
271 <div class="content">{$form.payment_processor_id.html}</div>
6a488035
TO
272 <div class="clear"></div>
273 </div>
274 </fieldset>
275 {/if}
276
277 {if $is_pay_later}
436d120c 278 <fieldset class="crm-public-form-item crm-group pay_later-group">
6a488035 279 <legend>{ts}Payment Options{/ts}</legend>
436d120c 280 <div class="crm-public-form-item crm-section pay_later_receipt-section">
6a488035
TO
281 <div class="label">&nbsp;</div>
282 <div class="content">
283 [x] {$pay_later_text}
284 </div>
285 <div class="clear"></div>
286 </div>
287 </fieldset>
288 {/if}
289
7c8cc461 290 <div id="billing-payment-block">
2975161b 291 {include file="CRM/Financial/Form/Payment.tpl" snippet=4}
7c8cc461 292 </div>
6a488035
TO
293 {include file="CRM/common/paymentBlock.tpl"}
294
436d120c 295 <div class="crm-public-form-item crm-group custom_post_profile-group">
6a488035
TO
296 {include file="CRM/UF/Form/Block.tpl" fields=$customPost}
297 </div>
298
299 {if $is_monetary and $form.bank_account_number}
300 <div id="payment_notice">
436d120c 301 <fieldset class="crm-public-form-item crm-group payment_notice-group">
6a488035
TO
302 <legend>{ts}Agreement{/ts}</legend>
303 {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}
304 </fieldset>
305 </div>
306 {/if}
307
308 {if $isCaptcha}
71fc6ea4 309 {include file='CRM/common/ReCAPTCHA.tpl'}
6a488035
TO
310 {/if}
311 <div id="crm-submit-buttons" class="crm-submit-buttons">
312 {include file="CRM/common/formButtons.tpl" location="bottom"}
313 </div>
314 {if $footer_text}
436d120c 315 <div id="footer_text" class="crm-public-form-item crm-section contribution_footer_text-section">
6a488035
TO
316 <p>{$footer_text}</p>
317 </div>
318 {/if}
6a488035 319</div>
6a488035 320<script type="text/javascript">
4d327c2d 321 {if $isHonor}
6a488035
TO
322 pcpAnonymous();
323 {/if}
324
325 {literal}
6a488035 326
7f7fa13a
EM
327 cj('input[name="soft_credit_type_id"]').on('change', function() {
328 enableHonorType();
329 });
92ec1d7f 330
6a488035 331 function enableHonorType( ) {
92ec1d7f 332 var selectedValue = cj('input[name="soft_credit_type_id"]:checked');
458a8395 333 if ( selectedValue.val() > 0) {
6a488035 334 cj('#honorType').show();
6a488035
TO
335 }
336 else {
6a488035 337 cj('#honorType').hide();
6a488035
TO
338 }
339 }
340
7f7fa13a 341 cj('input[id="is_recur"]').on('change', function() {
3dafdf1f 342 toggleRecur();
7f7fa13a 343 });
33627071 344
3dafdf1f 345 function toggleRecur( ) {
346 var isRecur = cj('input[id="is_recur"]:checked');
347 var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
3ab6117c 348 var quickConfig = {/literal}{$quickConfig}{literal};
349 if ( allowAutoRenew && cj("#auto_renew") && quickConfig) {
de4cd6a2 350 showHideAutoRenew( null );
351 }
3dafdf1f 352 if (isRecur.val() > 0) {
33627071 353 cj('#recurHelp').show();
d117f93a 354 cj('#amount_sum_label').text('{/literal}{ts escape='js'}Regular amount{/ts}{literal}');
33627071
DG
355 }
356 else {
357 cj('#recurHelp').hide();
bc261e3f 358 cj('#amount_sum_label').text('{/literal}{ts escape='js'}Total Amount{/ts}{literal}');
33627071
DG
359 }
360 }
92ec1d7f 361
6a488035
TO
362 function pcpAnonymous( ) {
363 // clear nickname field if anonymous is true
364 if (document.getElementsByName("pcp_is_anonymous")[1].checked) {
365 document.getElementById('pcp_roll_nickname').value = '';
366 }
367 if (!document.getElementsByName("pcp_display_in_roll")[0].checked) {
368 cj('#nickID').hide();
369 cj('#nameID').hide();
370 cj('#personalNoteID').hide();
371 }
372 else {
373 if (document.getElementsByName("pcp_is_anonymous")[0].checked) {
374 cj('#nameID').show();
375 cj('#nickID').show();
376 cj('#personalNoteID').show();
377 }
378 else {
379 cj('#nameID').show();
380 cj('#nickID').hide();
381 cj('#personalNoteID').hide();
382 }
383 }
384 }
385
3cc60a06 386 CRM.$(function($) {
7f7fa13a 387 enableHonorType();
3dafdf1f 388 toggleRecur();
7c859cc3 389 skipPaymentMethod();
6a488035
TO
390 });
391
3cc60a06 392 CRM.$(function($) {
6a488035
TO
393 // highlight price sets
394 function updatePriceSetHighlight() {
7f94bfb8
MW
395 $('#priceset .price-set-row span').removeClass('highlight');
396 $('#priceset .price-set-row input:checked').parent().addClass('highlight');
6a488035 397 }
7f94bfb8 398 $('#priceset input[type="radio"]').change(updatePriceSetHighlight);
6a488035 399 updatePriceSetHighlight();
e6ac320a 400
26398922 401 // Update pledge contribution amount when pledge checkboxes change
7f94bfb8 402 $("input[name^='pledge_amount']").on('change', function() {
26398922 403 var total = 0;
7f94bfb8
MW
404 $("input[name^='pledge_amount']:checked").each(function() {
405 total += Number($(this).attr('amount'));
26398922 406 });
7f94bfb8 407 $("input[name^='price_']").val(total.toFixed(2));
26398922 408 });
6a488035
TO
409 });
410 {/literal}
411</script>
412{/if}
413
414{* jQuery validate *}
415{* disabled because more work needs to be done to conditionally require credit card fields *}
416{*include file="CRM/Form/validate.tpl"*}