Merge pull request #11199 from twomice/CRM-21348_joomla_edit_link
[civicrm-core.git] / templates / CRM / Contribute / Form / Contribution / Main.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2018 |
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) and !$ccid}
28 <div class="crm-public-form-item crm-section">
29 {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl" context="front-end"}
30 </div>
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
71 <div class="crm-contribution-page-id-{$contributionPageID} crm-block crm-contribution-main-form-block">
72
73 {if $contact_id && !$ccid}
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
79 <div id="intro_text" class="crm-public-form-item crm-section intro_text-section">
80 {$intro_text}
81 </div>
82 {include file="CRM/common/cidzero.tpl"}
83 {if $islifetime or $ispricelifetime }
84 <div class="help">{ts}You have a current Lifetime Membership which does not need to be renewed.{/ts}</div>
85 {/if}
86
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}{if $display_name} &ndash; {$display_name}{/if}
95 </div>
96 {assign var="totalAmount" value=$pendingAmount}
97 {include file="CRM/Price/Page/LineItem.tpl" context="Contribution"}
98 {else}
99 <div class="display-block">
100 <td class="label">{$form.total_amount.label}</td>
101 <td><span>{$form.total_amount.html|crmMoney}&nbsp;&nbsp;{if $taxAmount}(includes {$taxTerm} of {$taxAmount|crmMoney}){/if}</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>
108 {/if}
109
110 {if !$ccid}
111 {crmRegion name='contribution-main-pledge-block'}
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>
118 </div>
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>
139 {/if}
140 <div class="clear"></div>
141 </div>
142 {/if}
143 {/if}
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}
153 {/if}
154 {if $one_frequency_unit}
155 {$frequency_unit}
156 {else}
157 {$form.frequency_unit.html}
158 {/if}
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 {$recurringHelpText}
166 </div>
167 </div>
168 <div class="clear"></div>
169 </div>
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}
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>
186 </div>
187 {/if}
188
189 <div id='onBehalfOfOrg' class="crm-public-form-item crm-section">
190 {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl"}
191 </div>
192
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>
200
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}
207 </div>
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}
222
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>
226
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>
236 </div>
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>
242 </div>
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>
249 </div>
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>
257 </div>
258 </div>
259 </fieldset>
260 {/if}
261
262 {* end of ccid loop *}
263 {/if}
264
265 {if $form.payment_processor_id.label}
266 {* PP selection only works with JS enabled, so we hide it initially *}
267 <fieldset class="crm-public-form-item crm-group payment_options-group" style="display:none;">
268 <legend>{ts}Payment Options{/ts}</legend>
269 <div class="crm-public-form-item crm-section payment_processor-section">
270 <div class="label">{$form.payment_processor_id.label}</div>
271 <div class="content">{$form.payment_processor_id.html}</div>
272 <div class="clear"></div>
273 </div>
274 </fieldset>
275 {/if}
276
277 {if $is_pay_later}
278 <fieldset class="crm-public-form-item crm-group pay_later-group">
279 <legend>{ts}Payment Options{/ts}</legend>
280 <div class="crm-public-form-item crm-section pay_later_receipt-section">
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
290 <div id="billing-payment-block">
291 {include file="CRM/Financial/Form/Payment.tpl" snippet=4}
292 </div>
293 {include file="CRM/common/paymentBlock.tpl"}
294
295 <div class="crm-public-form-item crm-group custom_post_profile-group">
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">
301 <fieldset class="crm-public-form-item crm-group payment_notice-group">
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}
309 {include file='CRM/common/ReCAPTCHA.tpl'}
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}
315 <div id="footer_text" class="crm-public-form-item crm-section contribution_footer_text-section">
316 <p>{$footer_text}</p>
317 </div>
318 {/if}
319 </div>
320 <script type="text/javascript">
321 {if $isHonor}
322 pcpAnonymous();
323 {/if}
324
325 {literal}
326
327 cj('input[name="soft_credit_type_id"]').on('change', function() {
328 enableHonorType();
329 });
330
331 function enableHonorType( ) {
332 var selectedValue = cj('input[name="soft_credit_type_id"]:checked');
333 if ( selectedValue.val() > 0) {
334 cj('#honorType').show();
335 }
336 else {
337 cj('#honorType').hide();
338 }
339 }
340
341 cj('input[id="is_recur"]').on('change', function() {
342 toggleRecur();
343 });
344
345 function toggleRecur( ) {
346 var isRecur = cj('input[id="is_recur"]:checked');
347 var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal};
348 var quickConfig = {/literal}{$quickConfig}{literal};
349 if ( allowAutoRenew && cj("#auto_renew") && quickConfig) {
350 showHideAutoRenew( null );
351 }
352 if (isRecur.val() > 0) {
353 cj('#recurHelp').show();
354 cj('#amount_sum_label').text('{/literal}{ts escape='js'}Regular amount{/ts}{literal}');
355 }
356 else {
357 cj('#recurHelp').hide();
358 cj('#amount_sum_label').text('{/literal}{ts escape='js'}Total Amount{/ts}{literal}');
359 }
360 }
361
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
386 CRM.$(function($) {
387 enableHonorType();
388 toggleRecur();
389 skipPaymentMethod();
390 });
391
392 CRM.$(function($) {
393 // highlight price sets
394 function updatePriceSetHighlight() {
395 $('#priceset .price-set-row span').removeClass('highlight');
396 $('#priceset .price-set-row input:checked').parent().addClass('highlight');
397 }
398 $('#priceset input[type="radio"]').change(updatePriceSetHighlight);
399 updatePriceSetHighlight();
400
401 // Update pledge contribution amount when pledge checkboxes change
402 $("input[name^='pledge_amount']").on('change', function() {
403 var total = 0;
404 $("input[name^='pledge_amount']:checked").each(function() {
405 total += Number($(this).attr('amount'));
406 });
407 $("input[name^='price_']").val(total.toFixed(2));
408 });
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"*}