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