| 1 | {* |
| 2 | +--------------------------------------------------------------------+ |
| 3 | | CiviCRM version 4.7 | |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC (c) 2004-2016 | |
| 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} |
| 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}</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} <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"> </div> |
| 122 | <div class="content"> |
| 123 | {$form.is_pledge.html} |
| 124 | {if $is_pledge_interval} |
| 125 | {$form.pledge_frequency_interval.html} |
| 126 | {/if} |
| 127 | {$form.pledge_frequency_unit.html}<span id="pledge_installments_num"> {ts}for{/ts} {$form.pledge_installments.html} {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"> </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 | {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> |
| 173 | </div> |
| 174 | <div class="clear"></div> |
| 175 | </div> |
| 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} |
| 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> |
| 191 | </div> |
| 192 | |
| 193 | <div class="crm-public-form-item crm-section"> |
| 194 | {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl"} |
| 195 | </div> |
| 196 | |
| 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> |
| 204 | |
| 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} |
| 211 | </div> |
| 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} |
| 226 | |
| 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> |
| 230 | |
| 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} |
| 237 | {$form.pcp_display_in_roll.label} |
| 238 | </div> |
| 239 | <div class="clear"></div> |
| 240 | </div> |
| 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> |
| 246 | </div> |
| 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> |
| 253 | </div> |
| 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> |
| 261 | </div> |
| 262 | </div> |
| 263 | </fieldset> |
| 264 | {/if} |
| 265 | |
| 266 | {* end of ccid loop *} |
| 267 | {/if} |
| 268 | |
| 269 | {if $form.payment_processor_id.label} |
| 270 | {* PP selection only works with JS enabled, so we hide it initially *} |
| 271 | <fieldset class="crm-public-form-item crm-group payment_options-group" style="display:none;"> |
| 272 | <legend>{ts}Payment Options{/ts}</legend> |
| 273 | <div class="crm-public-form-item crm-section payment_processor-section"> |
| 274 | <div class="label">{$form.payment_processor_id.label}</div> |
| 275 | <div class="content">{$form.payment_processor_id.html}</div> |
| 276 | <div class="clear"></div> |
| 277 | </div> |
| 278 | </fieldset> |
| 279 | {/if} |
| 280 | |
| 281 | {if $is_pay_later} |
| 282 | <fieldset class="crm-public-form-item crm-group pay_later-group"> |
| 283 | <legend>{ts}Payment Options{/ts}</legend> |
| 284 | <div class="crm-public-form-item crm-section pay_later_receipt-section"> |
| 285 | <div class="label"> </div> |
| 286 | <div class="content"> |
| 287 | [x] {$pay_later_text} |
| 288 | </div> |
| 289 | <div class="clear"></div> |
| 290 | </div> |
| 291 | </fieldset> |
| 292 | {/if} |
| 293 | |
| 294 | <div id="billing-payment-block"> |
| 295 | {include file="CRM/Financial/Form/Payment.tpl" snippet=4} |
| 296 | </div> |
| 297 | {include file="CRM/common/paymentBlock.tpl"} |
| 298 | |
| 299 | <div class="crm-public-form-item crm-group custom_post_profile-group"> |
| 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"> |
| 305 | <fieldset class="crm-public-form-item crm-group payment_notice-group"> |
| 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} |
| 313 | {include file='CRM/common/ReCAPTCHA.tpl'} |
| 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} |
| 319 | <div id="footer_text" class="crm-public-form-item crm-section contribution_footer_text-section"> |
| 320 | <p>{$footer_text}</p> |
| 321 | </div> |
| 322 | {/if} |
| 323 | </div> |
| 324 | <script type="text/javascript"> |
| 325 | {if $isHonor} |
| 326 | pcpAnonymous(); |
| 327 | {/if} |
| 328 | |
| 329 | {literal} |
| 330 | |
| 331 | cj('input[name="soft_credit_type_id"]').on('change', function() { |
| 332 | enableHonorType(); |
| 333 | }); |
| 334 | |
| 335 | function enableHonorType( ) { |
| 336 | var selectedValue = cj('input[name="soft_credit_type_id"]:checked'); |
| 337 | if ( selectedValue.val() > 0) { |
| 338 | cj('#honorType').show(); |
| 339 | } |
| 340 | else { |
| 341 | cj('#honorType').hide(); |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | cj('input[id="is_recur"]').on('change', function() { |
| 346 | toggleRecur(); |
| 347 | }); |
| 348 | |
| 349 | function toggleRecur( ) { |
| 350 | var isRecur = cj('input[id="is_recur"]:checked'); |
| 351 | var allowAutoRenew = {/literal}'{$allowAutoRenewMembership}'{literal}; |
| 352 | if ( allowAutoRenew && cj("#auto_renew") ) { |
| 353 | showHideAutoRenew( null ); |
| 354 | } |
| 355 | if (isRecur.val() > 0) { |
| 356 | cj('#recurHelp').show(); |
| 357 | cj('#amount_sum_label').text(ts('Regular amount')); |
| 358 | } |
| 359 | else { |
| 360 | cj('#recurHelp').hide(); |
| 361 | cj('#amount_sum_label').text(ts('Total amount')); |
| 362 | } |
| 363 | } |
| 364 | |
| 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 | |
| 389 | CRM.$(function($) { |
| 390 | enableHonorType(); |
| 391 | toggleRecur(); |
| 392 | skipPaymentMethod(); |
| 393 | }); |
| 394 | |
| 395 | CRM.$(function($) { |
| 396 | // highlight price sets |
| 397 | function updatePriceSetHighlight() { |
| 398 | $('#priceset .price-set-row span').removeClass('highlight'); |
| 399 | $('#priceset .price-set-row input:checked').parent().addClass('highlight'); |
| 400 | } |
| 401 | $('#priceset input[type="radio"]').change(updatePriceSetHighlight); |
| 402 | updatePriceSetHighlight(); |
| 403 | |
| 404 | // Update pledge contribution amount when pledge checkboxes change |
| 405 | $("input[name^='pledge_amount']").on('change', function() { |
| 406 | var total = 0; |
| 407 | $("input[name^='pledge_amount']:checked").each(function() { |
| 408 | total += Number($(this).attr('amount')); |
| 409 | }); |
| 410 | $("input[name^='price_']").val(total.toFixed(2)); |
| 411 | }); |
| 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"*} |