| 1 | {* |
| 2 | +--------------------------------------------------------------------+ |
| 3 | | CiviCRM version 4.3 | |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC (c) 2004-2013 | |
| 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: Load payment processor *} |
| 27 | {if $snippet} |
| 28 | {include file="CRM/Core/BillingBlock.tpl" context="front-end"} |
| 29 | |
| 30 | <div id="paypalExpress"> |
| 31 | {* Put PayPal Express button after customPost block since it's the submit button in this case. *} |
| 32 | {if $paymentProcessor.payment_processor_type EQ 'PayPal_Express'} |
| 33 | {assign var=expressButtonName value='_qf_Register_upload_express'} |
| 34 | <fieldset class="crm-group payPalExpress-group"><legend>{ts}Checkout with PayPal{/ts}</legend> |
| 35 | <div class="description">{ts}Click the PayPal button to continue.{/ts}</div> |
| 36 | <div>{$form.$expressButtonName.html} <span style="font-size:11px; font-family: Arial, Verdana;">Checkout securely. Pay without sharing your financial information. </span> |
| 37 | </div> |
| 38 | </fieldset> |
| 39 | {/if} |
| 40 | </div> |
| 41 | {else} |
| 42 | {if $action & 1024} |
| 43 | {include file="CRM/Event/Form/Registration/PreviewHeader.tpl"} |
| 44 | {/if} |
| 45 | |
| 46 | {include file="CRM/common/TrackingFields.tpl"} |
| 47 | |
| 48 | {capture assign='reqMark'}<span class="marker" title="{ts}This field is required.{/ts}">*</span>{/capture} |
| 49 | <div class="crm-block crm-event-register-form-block"> |
| 50 | |
| 51 | {* moved to tpl since need to show only for primary participant page *} |
| 52 | {if $requireApprovalMsg || $waitlistMsg} |
| 53 | <div id="id-waitlist-approval-msg" class="messages status no-popup"> |
| 54 | {if $requireApprovalMsg} |
| 55 | <div id="id-req-approval-msg">{$requireApprovalMsg}</div> |
| 56 | {/if} |
| 57 | {if $waitlistMsg} |
| 58 | <div id="id-waitlist-msg">{$waitlistMsg}</div> |
| 59 | {/if} |
| 60 | </div> |
| 61 | {/if} |
| 62 | |
| 63 | {if $contact_id} |
| 64 | <div class="messages status no-popup" id="crm-event-register-different"> |
| 65 | {ts 1=$display_name}Welcome %1{/ts}. (<a href="{crmURL p='civicrm/event/register' q="cid=0&reset=1&id=`$event.id`"}" title="{ts}Click here to register a different person for this event.{/ts}">{ts 1=$display_name}Not %1, or want to register a different person{/ts}</a>?)</div> |
| 66 | {/if} |
| 67 | {if $event.intro_text} |
| 68 | <div id="intro_text" class="crm-section intro_text-section"> |
| 69 | <p>{$event.intro_text}</p> |
| 70 | </div> |
| 71 | {/if} |
| 72 | |
| 73 | {if $pcpSupporterText} |
| 74 | <div class="crm-section pcpSupporterText-section"> |
| 75 | <div class="content">{$pcpSupporterText}</div> |
| 76 | </div> |
| 77 | {/if} |
| 78 | |
| 79 | {if $form.additional_participants.html} |
| 80 | <div class="crm-section additional_participants-section" id="noOfparticipants"> |
| 81 | <div class="label">{$form.additional_participants.label}</div> |
| 82 | <div class="content"> |
| 83 | {$form.additional_participants.html}{if $contact_id || $contact_id == NULL} ({ts}including yourself{/ts}){/if}<br /> |
| 84 | <span class="description">{ts}Fill in your registration information on this page. If you are registering additional people, you will be able to enter their registration information after you complete this page and click "Continue".{/ts}</span> |
| 85 | </div> |
| 86 | <div class="clear"></div> |
| 87 | </div> |
| 88 | {/if} |
| 89 | |
| 90 | {if $priceSet} |
| 91 | {if ! $quickConfig}<fieldset id="priceset" class="crm-group priceset-group"><legend>{$event.fee_label}</legend>{/if} |
| 92 | {include file="CRM/Price/Form/PriceSet.tpl" extends="Event"} |
| 93 | {include file="CRM/Price/Form/ParticipantCount.tpl"} |
| 94 | {if ! $quickConfig}</fieldset>{/if} |
| 95 | |
| 96 | {if $form.is_pay_later} |
| 97 | <div class="crm-section pay_later-section"> |
| 98 | <div class="label"> </div> |
| 99 | <div class="content">{$form.is_pay_later.html} {$form.is_pay_later.label}</div> |
| 100 | <div class="clear"></div> |
| 101 | </div> |
| 102 | {/if} |
| 103 | {/if} |
| 104 | {if $initialPayment} |
| 105 | {include file="CRM/Price/Form/InitialPayment.tpl" extends="Contribution" paymentMode='online'} |
| 106 | {/if} |
| 107 | {if $pcp && $is_honor_roll } |
| 108 | <fieldset class="crm-group pcp-group"> |
| 109 | <div class="crm-section pcp-section"> |
| 110 | <div class="crm-section display_in_roll-section"> |
| 111 | <div class="content"> |
| 112 | {$form.pcp_display_in_roll.html} |
| 113 | {$form.pcp_display_in_roll.label} |
| 114 | </div> |
| 115 | <div class="clear"></div> |
| 116 | </div> |
| 117 | <div id="nameID" class="crm-section is_anonymous-section"> |
| 118 | <div class="content"> |
| 119 | {$form.pcp_is_anonymous.html} |
| 120 | </div> |
| 121 | <div class="clear"></div> |
| 122 | </div> |
| 123 | <div id="nickID" class="crm-section pcp_roll_nickname-section"> |
| 124 | <div class="label">{$form.pcp_roll_nickname.label}</div> |
| 125 | <div class="content">{$form.pcp_roll_nickname.html} |
| 126 | <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> |
| 127 | </div> |
| 128 | <div class="clear"></div> |
| 129 | </div> |
| 130 | <div id="personalNoteID" class="crm-section pcp_personal_note-section"> |
| 131 | <div class="label">{$form.pcp_personal_note.label}</div> |
| 132 | <div class="content"> |
| 133 | {$form.pcp_personal_note.html} |
| 134 | <div class="description">{ts}Enter a message to accompany this contribution.{/ts}</div> |
| 135 | </div> |
| 136 | <div class="clear"></div> |
| 137 | </div> |
| 138 | </div> |
| 139 | </fieldset> |
| 140 | {/if} |
| 141 | |
| 142 | {* User account registration option. Displays if enabled for one of the profiles on this page. *} |
| 143 | {include file="CRM/common/CMSUser.tpl"} |
| 144 | |
| 145 | {include file="CRM/UF/Form/Block.tpl" fields=$customPre} |
| 146 | |
| 147 | {if $form.payment_processor.label} |
| 148 | <fieldset class="crm-group payment_options-group" style="display:none;"> |
| 149 | <legend>{ts}Payment Options{/ts}</legend> |
| 150 | <div class="crm-section payment_processor-section"> |
| 151 | <div class="label">{$form.payment_processor.label}</div> |
| 152 | <div class="content">{$form.payment_processor.html}</div> |
| 153 | <div class="clear"></div> |
| 154 | </div> |
| 155 | </fieldset> |
| 156 | {/if} |
| 157 | |
| 158 | <div id="billing-payment-block"> |
| 159 | {* If we have a payment processor, load it - otherwise it happens via ajax *} |
| 160 | {if $ppType} |
| 161 | {include file="CRM/Event/Form/Registration/Register.tpl" snippet=4} |
| 162 | {/if} |
| 163 | </div> |
| 164 | {include file="CRM/common/paymentBlock.tpl"} |
| 165 | |
| 166 | {include file="CRM/UF/Form/Block.tpl" fields=$customPost} |
| 167 | |
| 168 | {if $isCaptcha} |
| 169 | {include file='CRM/common/ReCAPTCHA.tpl'} |
| 170 | {/if} |
| 171 | |
| 172 | <div id="crm-submit-buttons" class="crm-submit-buttons"> |
| 173 | {include file="CRM/common/formButtons.tpl" location="bottom"} |
| 174 | </div> |
| 175 | |
| 176 | {if $event.footer_text} |
| 177 | <div id="footer_text" class="crm-section event_footer_text-section"> |
| 178 | <p>{$event.footer_text}</p> |
| 179 | </div> |
| 180 | {/if} |
| 181 | </div> |
| 182 | |
| 183 | <script type="text/javascript"> |
| 184 | {literal} |
| 185 | function toggleConfirmButton() { |
| 186 | var payPalExpressId = {/literal}{$payPalExpressId}{literal}; |
| 187 | var elementObj = cj('input[name="payment_processor"]'); |
| 188 | if ( elementObj.attr('type') == 'hidden' ) { |
| 189 | var processorTypeId = elementObj.val( ); |
| 190 | } else { |
| 191 | var processorTypeId = elementObj.filter(':checked').val(); |
| 192 | } |
| 193 | |
| 194 | if (payPalExpressId !=0 && payPalExpressId == processorTypeId) { |
| 195 | cj("#crm-submit-buttons").hide(); |
| 196 | } else { |
| 197 | cj("#crm-submit-buttons").show(); |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | cj('input[name="payment_processor"]').change( function() { |
| 202 | toggleConfirmButton(); |
| 203 | }); |
| 204 | |
| 205 | cj(function() { |
| 206 | toggleConfirmButton(); |
| 207 | }); |
| 208 | {/literal} |
| 209 | </script> |
| 210 | {/if} |
| 211 | {literal} |
| 212 | <script type="text/javascript"> |
| 213 | {/literal}{if $pcp && $is_honor_roll }pcpAnonymous();{/if}{literal} |
| 214 | |
| 215 | function allowParticipant( ) { |
| 216 | {/literal}{if $allowGroupOnWaitlist}{literal} |
| 217 | var additionalParticipants = cj('#additional_participants').val(); |
| 218 | var pricesetParticipantCount = 0; |
| 219 | {/literal}{if $priceSet}{literal} |
| 220 | pricesetParticipantCount = pPartiCount; |
| 221 | {/literal}{/if}{literal} |
| 222 | |
| 223 | allowGroupOnWaitlist( additionalParticipants, pricesetParticipantCount ); |
| 224 | {/literal}{/if}{literal} |
| 225 | } |
| 226 | |
| 227 | {/literal}{if ($form.is_pay_later or $bypassPayment) and $paymentProcessor.payment_processor_type EQ 'PayPal_Express'} |
| 228 | {literal} |
| 229 | showHidePayPalExpressOption( ); |
| 230 | {/literal}{/if}{literal} |
| 231 | |
| 232 | function showHidePayPalExpressOption( ) |
| 233 | { |
| 234 | var payLaterElement = {/literal}{if $form.is_pay_later}true{else}false{/if}{literal}; |
| 235 | if ( ( cj("#bypass_payment").val( ) == 1 ) || |
| 236 | ( payLaterElement && document.getElementsByName('is_pay_later')[0].checked ) ) { |
| 237 | cj("#crm-submit-buttons").show(); |
| 238 | cj("#paypalExpress").hide(); |
| 239 | } else { |
| 240 | cj("#paypalExpress").show(); |
| 241 | cj("#crm-submit-buttons").hide(); |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | {/literal}{if ($form.is_pay_later or $bypassPayment) and $showHidePaymentInformation}{literal} |
| 246 | showHidePaymentInfo( ); |
| 247 | {/literal} {/if}{literal} |
| 248 | |
| 249 | function showHidePaymentInfo( ) |
| 250 | { |
| 251 | var payLater = {/literal}{if $form.is_pay_later}true{else}false{/if}{literal}; |
| 252 | |
| 253 | if ( ( cj("#bypass_payment").val( ) == 1 ) || |
| 254 | ( payLater && document.getElementsByName('is_pay_later')[0].checked ) ) { |
| 255 | cj('#billing-payment-block').hide(); |
| 256 | } else { |
| 257 | cj('#billing-payment-block').show(); |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | {/literal}{if $allowGroupOnWaitlist}{literal} |
| 262 | allowGroupOnWaitlist( 0, 0 ); |
| 263 | {/literal}{/if}{literal} |
| 264 | |
| 265 | function allowGroupOnWaitlist( additionalParticipants, pricesetParticipantCount ) |
| 266 | { |
| 267 | {/literal}{if $isAdditionalParticipants}{literal} |
| 268 | if ( !additionalParticipants ) { |
| 269 | additionalParticipants = cj('#additional_participants').val(); |
| 270 | } |
| 271 | {/literal}{else}{literal} |
| 272 | additionalParticipants = 0; |
| 273 | {/literal}{/if}{literal} |
| 274 | |
| 275 | additionalParticipants = parseInt( additionalParticipants ); |
| 276 | if ( ! additionalParticipants ) { |
| 277 | additionalParticipants = 0; |
| 278 | } |
| 279 | |
| 280 | var availableRegistrations = {/literal}'{$availableRegistrations}'{literal}; |
| 281 | var totalParticipants = parseInt( additionalParticipants ) + 1; |
| 282 | |
| 283 | if ( pricesetParticipantCount ) { |
| 284 | // add priceset count if any |
| 285 | totalParticipants += parseInt(pricesetParticipantCount) - 1; |
| 286 | } |
| 287 | var isrequireApproval = {/literal}'{$requireApprovalMsg}'{literal}; |
| 288 | |
| 289 | if ( totalParticipants > availableRegistrations ) { |
| 290 | cj( "#id-waitlist-msg" ).show( ); |
| 291 | cj( "#id-waitlist-approval-msg" ).show( ); |
| 292 | |
| 293 | //set the value for hidden bypass payment. |
| 294 | cj( "#bypass_payment").val( 1 ); |
| 295 | |
| 296 | //hide pay later. |
| 297 | {/literal}{if $form.is_pay_later}{literal} |
| 298 | cj("#is-pay-later").hide( ); |
| 299 | {/literal} {/if}{literal} |
| 300 | |
| 301 | } else { |
| 302 | if ( isrequireApproval ) { |
| 303 | cj( "#id-waitlist-approval-msg" ).show( ); |
| 304 | cj( "#id-waitlist-msg" ).hide( ); |
| 305 | } else { |
| 306 | cj( "#id-waitlist-approval-msg" ).hide( ); |
| 307 | } |
| 308 | //reset value since user don't want or not eligible for waitlist |
| 309 | cj( "#bypass_payment").val( 0 ); |
| 310 | |
| 311 | //need to show paylater if exists. |
| 312 | {/literal}{if $form.is_pay_later}{literal} |
| 313 | cj("#is-pay-later").show( ); |
| 314 | {/literal} {/if}{literal} |
| 315 | } |
| 316 | |
| 317 | //now call showhide payment info. |
| 318 | {/literal} |
| 319 | {if ($form.is_pay_later or $bypassPayment) and $paymentProcessor.payment_processor_type EQ 'PayPal_Express'}{literal} |
| 320 | showHidePayPalExpressOption( ); |
| 321 | {/literal}{/if} |
| 322 | {literal} |
| 323 | |
| 324 | {/literal}{if ($form.is_pay_later or $bypassPayment) and $showHidePaymentInformation}{literal} |
| 325 | showHidePaymentInfo( ); |
| 326 | {/literal}{/if}{literal} |
| 327 | } |
| 328 | |
| 329 | {/literal}{if $pcp && $is_honor_roll }{literal} |
| 330 | function pcpAnonymous( ) { |
| 331 | // clear nickname field if anonymous is true |
| 332 | if ( document.getElementsByName("pcp_is_anonymous")[1].checked ) { |
| 333 | document.getElementById('pcp_roll_nickname').value = ''; |
| 334 | } |
| 335 | if ( ! document.getElementsByName("pcp_display_in_roll")[0].checked ) { |
| 336 | cj('#nickID, #nameID, #personalNoteID').hide(); |
| 337 | } else { |
| 338 | if ( document.getElementsByName("pcp_is_anonymous")[0].checked ) { |
| 339 | cj('#nameID, #nickID, #personalNoteID').show(); |
| 340 | } else { |
| 341 | cj('#nameID').show(); |
| 342 | cj('#nickID, #personalNoteID').hide(); |
| 343 | } |
| 344 | } |
| 345 | } |
| 346 | {/literal}{/if}{literal} |
| 347 | |
| 348 | </script> |
| 349 | {/literal} |