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