Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
39de6fd5 | 3 | | CiviCRM version 4.6 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
819d0d41 | 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
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 | *} | |
7bf9cde2 | 26 | {* Callback snippet: Load payment processor *} |
f92fc7eb | 27 | {if $snippet} |
92ec1d7f | 28 | {include file="CRM/Core/BillingBlock.tpl"} |
f9c24028 | 29 | <div id="paypalExpress"> |
30 | {* Put PayPal Express button after customPost block since it's the submit button in this case. *} | |
31 | {if $paymentProcessor.payment_processor_type EQ 'PayPal_Express'} | |
32 | {assign var=expressButtonName value='_qf_Register_upload_express'} | |
33 | <fieldset class="crm-group payPalExpress-group"> | |
34 | <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> | |
6a488035 | 41 | {else} |
f9c24028 | 42 | {if $action & 1024} |
6a488035 | 43 | {include file="CRM/Event/Form/Registration/PreviewHeader.tpl"} |
f9c24028 | 44 | {/if} |
6a488035 | 45 | |
f9c24028 | 46 | {include file="CRM/common/TrackingFields.tpl"} |
47 | {capture assign='reqMark'}<span class="marker" title="{ts}This field is required.{/ts}">*</span>{/capture} | |
48 | <div class="crm-event-id-{$event.id} crm-block crm-event-register-form-block"> | |
6a488035 | 49 | |
f9c24028 | 50 | {* moved to tpl since need to show only for primary participant page *} |
51 | {if $requireApprovalMsg || $waitlistMsg} | |
52 | <div id="id-waitlist-approval-msg" class="messages status no-popup"> | |
53 | {if $requireApprovalMsg} | |
54 | <div id="id-req-approval-msg">{$requireApprovalMsg}</div> | |
55 | {/if} | |
6a488035 | 56 | {if $waitlistMsg} |
f9c24028 | 57 | <div id="id-waitlist-msg">{$waitlistMsg}</div> |
58 | {/if} | |
59 | </div> | |
60 | {/if} | |
6a488035 | 61 | |
f9c24028 | 62 | {if $contact_id} |
37326fa1 | 63 | <div class="messages status no-popup crm-not-you-message" id="crm-event-register-different"> |
f9c24028 | 64 | {ts 1=$display_name}Welcome %1{/ts}. (<a |
65 | href="{crmURL p='civicrm/event/register' q="cid=0&reset=1&id=`$event.id`"}" | |
66 | 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>?) | |
67 | </div> | |
68 | {/if} | |
69 | {if $event.intro_text} | |
70 | <div id="intro_text" class="crm-section intro_text-section"> | |
6a488035 | 71 | <p>{$event.intro_text}</p> |
f9c24028 | 72 | </div> |
73 | {/if} | |
d44019b2 | 74 | |
f9c24028 | 75 | {include file="CRM/common/cidzero.tpl"} |
76 | {if $pcpSupporterText} | |
77 | <div class="crm-section pcpSupporterText-section"> | |
6a488035 | 78 | <div class="content">{$pcpSupporterText}</div> |
f9c24028 | 79 | </div> |
80 | {/if} | |
6a488035 | 81 | |
f9c24028 | 82 | {if $form.additional_participants.html} |
83 | <div class="crm-section additional_participants-section" id="noOfparticipants"> | |
6a488035 TO |
84 | <div class="label">{$form.additional_participants.label}</div> |
85 | <div class="content"> | |
f9c24028 | 86 | {$form.additional_participants.html}{if $contact_id || $contact_id == NULL} ({ts}including yourself{/ts}){/if} |
87 | <br/> | |
88 | <span | |
89 | 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> | |
6a488035 TO |
90 | </div> |
91 | <div class="clear"></div> | |
f9c24028 | 92 | </div> |
93 | {/if} | |
6a488035 | 94 | |
e2f50aed BO |
95 | {* User account registration option. Displays if enabled for one of the profiles on this page. *} |
96 | {include file="CRM/common/CMSUser.tpl"} | |
97 | ||
98 | {* Display "Top of page" profile immediately after the introductory text *} | |
99 | {include file="CRM/UF/Form/Block.tpl" fields=$customPre} | |
100 | ||
f9c24028 | 101 | {if $priceSet} |
102 | {if ! $quickConfig}<fieldset id="priceset" class="crm-group priceset-group"> | |
103 | <legend>{$event.fee_label}</legend>{/if} | |
104 | {include file="CRM/Price/Form/PriceSet.tpl" extends="Event"} | |
105 | {include file="CRM/Price/Form/ParticipantCount.tpl"} | |
106 | {if ! $quickConfig}</fieldset>{/if} | |
6a488035 | 107 | {/if} |
f9c24028 | 108 | {if $pcp && $is_honor_roll } |
109 | <fieldset class="crm-group pcp-group"> | |
6a488035 | 110 | <div class="crm-section pcp-section"> |
f9c24028 | 111 | <div class="crm-section display_in_roll-section"> |
112 | <div class="content"> | |
113 | {$form.pcp_display_in_roll.html} | |
114 | {$form.pcp_display_in_roll.label} | |
6a488035 | 115 | </div> |
f9c24028 | 116 | <div class="clear"></div> |
117 | </div> | |
118 | <div id="nameID" class="crm-section is_anonymous-section"> | |
119 | <div class="content"> | |
120 | {$form.pcp_is_anonymous.html} | |
6a488035 | 121 | </div> |
f9c24028 | 122 | <div class="clear"></div> |
123 | </div> | |
124 | <div id="nickID" class="crm-section pcp_roll_nickname-section"> | |
125 | <div class="label">{$form.pcp_roll_nickname.label}</div> | |
126 | <div class="content">{$form.pcp_roll_nickname.html} | |
127 | <div | |
128 | 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> | |
6a488035 | 129 | </div> |
f9c24028 | 130 | <div class="clear"></div> |
131 | </div> | |
132 | <div id="personalNoteID" class="crm-section pcp_personal_note-section"> | |
133 | <div class="label">{$form.pcp_personal_note.label}</div> | |
134 | <div class="content"> | |
135 | {$form.pcp_personal_note.html} | |
136 | <div class="description">{ts}Enter a message to accompany this contribution.{/ts}</div> | |
6a488035 | 137 | </div> |
f9c24028 | 138 | <div class="clear"></div> |
139 | </div> | |
6a488035 | 140 | </div> |
f9c24028 | 141 | </fieldset> |
142 | {/if} | |
6a488035 | 143 | |
f9c24028 | 144 | {if $form.payment_processor.label} |
145 | <fieldset class="crm-group payment_options-group" style="display:none;"> | |
146 | <legend>{ts}Payment Options{/ts}</legend> | |
147 | <div class="crm-section payment_processor-section"> | |
148 | <div class="label">{$form.payment_processor.label}</div> | |
149 | <div class="content">{$form.payment_processor.html}</div> | |
150 | <div class="clear"></div> | |
151 | </div> | |
152 | </fieldset> | |
153 | {/if} | |
6a488035 | 154 | |
f9c24028 | 155 | <div id="billing-payment-block"> |
156 | {* If we have a payment processor, load it - otherwise it happens via ajax *} | |
2b3fa30d | 157 | {if $paymentProcessorID or $isBillingAddressRequiredForPayLater} |
f9c24028 | 158 | {include file="CRM/Event/Form/Registration/Register.tpl" snippet=4} |
159 | {/if} | |
160 | </div> | |
161 | {include file="CRM/common/paymentBlock.tpl"} | |
6a488035 | 162 | |
f9c24028 | 163 | {include file="CRM/UF/Form/Block.tpl" fields=$customPost} |
6a488035 | 164 | |
f9c24028 | 165 | {if $isCaptcha} |
166 | {include file='CRM/common/ReCAPTCHA.tpl'} | |
167 | {/if} | |
6a488035 | 168 | |
f9c24028 | 169 | <div id="crm-submit-buttons" class="crm-submit-buttons"> |
170 | {include file="CRM/common/formButtons.tpl" location="bottom"} | |
171 | </div> | |
6a488035 | 172 | |
f9c24028 | 173 | {if $event.footer_text} |
174 | <div id="footer_text" class="crm-section event_footer_text-section"> | |
6a488035 | 175 | <p>{$event.footer_text}</p> |
f9c24028 | 176 | </div> |
177 | {/if} | |
178 | </div> | |
179 | <script type="text/javascript"> | |
180 | {literal} | |
181 | function toggleConfirmButton() { | |
182 | var payPalExpressId = "{/literal}{$payPalExpressId}{literal}"; | |
183 | var elementObj = cj('input[name="payment_processor"]'); | |
184 | if (elementObj.attr('type') == 'hidden') { | |
185 | var processorTypeId = elementObj.val(); | |
186 | } | |
187 | else { | |
188 | var processorTypeId = elementObj.filter(':checked').val(); | |
189 | } | |
6a488035 | 190 | |
f9c24028 | 191 | if (payPalExpressId != 0 && payPalExpressId == processorTypeId) { |
192 | cj("#crm-submit-buttons").hide(); | |
193 | } | |
194 | else { | |
195 | cj("#crm-submit-buttons").show(); | |
196 | } | |
197 | } | |
6a488035 | 198 | |
f9c24028 | 199 | cj('input[name="payment_processor"]').change(function () { |
200 | toggleConfirmButton(); | |
201 | }); | |
202 | ||
461803d0 DG |
203 | cj("#additional_participants").change(function () { |
204 | skipPaymentMethod(); | |
205 | }); | |
206 | ||
3cc60a06 | 207 | CRM.$(function($) { |
f9c24028 | 208 | toggleConfirmButton(); |
209 | skipPaymentMethod(); | |
210 | }); | |
211 | ||
461803d0 DG |
212 | // Hides billing and payment options block - but only if a price set is used. |
213 | // Called from display() in Calculate.tpl, depends on display() having been called. | |
f9c24028 | 214 | function skipPaymentMethod() { |
461803d0 DG |
215 | // If we're in quick-config price set, we do not have the pricevalue hidden element, so just return. |
216 | if (cj('#pricevalue').length == 0) { | |
217 | return; | |
218 | } | |
219 | // CRM-15433 Remove currency symbol, decimal separator so we can check for zero numeric total regardless of localization. | |
220 | currentTotal = cj('#pricevalue').text().replace(/[^\/\d]/g,''); | |
e75336c4 | 221 | var isMultiple = '{/literal}{$event.is_multiple_registrations}{literal}'; |
222 | ||
223 | var flag = 1; | |
e85ea630 LS |
224 | var payment_options = cj(".payment_options-group"); |
225 | var payment_processor = cj("div.payment_processor-section"); | |
226 | var payment_information = cj("div#payment_information"); | |
227 | ||
461803d0 DG |
228 | // Do not hide billing and payment blocks if user is registering additional participants, since we do not know total owing. |
229 | if (isMultiple && cj("#additional_participants").val() && currentTotal == 0) { | |
e75336c4 | 230 | flag = 0; |
231 | } | |
232 | ||
461803d0 | 233 | if (currentTotal == 0 && flag) { |
e85ea630 LS |
234 | payment_options.hide(); |
235 | payment_processor.hide(); | |
236 | payment_information.hide(); | |
b69f7cd2 | 237 | // also unset selected payment methods |
238 | cj('input[name="payment_processor"]').removeProp('checked'); | |
239 | } | |
240 | else { | |
e85ea630 LS |
241 | payment_options.show(); |
242 | payment_processor.show(); | |
243 | payment_information.show(); | |
b69f7cd2 | 244 | } |
f9c24028 | 245 | } |
b69f7cd2 | 246 | |
f9c24028 | 247 | {/literal} |
248 | </script> | |
6a488035 TO |
249 | {/if} |
250 | {literal} | |
251 | <script type="text/javascript"> | |
f9c24028 | 252 | {/literal}{if $pcp && $is_honor_roll }pcpAnonymous(); |
253 | {/if}{literal} | |
6a488035 | 254 | |
f9c24028 | 255 | function allowParticipant() { |
256 | {/literal}{if $allowGroupOnWaitlist}{literal} | |
257 | var additionalParticipants = cj('#additional_participants').val(); | |
258 | var pricesetParticipantCount = 0; | |
259 | {/literal}{if $priceSet}{literal} | |
260 | pricesetParticipantCount = pPartiCount; | |
6a488035 TO |
261 | {/literal}{/if}{literal} |
262 | ||
f9c24028 | 263 | allowGroupOnWaitlist(additionalParticipants, pricesetParticipantCount); |
264 | {/literal}{/if}{literal} | |
6a488035 | 265 | } |
f9c24028 | 266 | |
fdf1844b | 267 | {/literal}{if ($bypassPayment) and $paymentProcessor.payment_processor_type EQ 'PayPal_Express'} |
f9c24028 | 268 | {literal} |
269 | showHidePayPalExpressOption(); | |
270 | {/literal}{/if}{literal} | |
271 | ||
272 | function showHidePayPalExpressOption() { | |
fdf1844b | 273 | if (( cj("#bypass_payment").val() == 1 )) { |
f9c24028 | 274 | cj("#crm-submit-buttons").show(); |
275 | cj("#paypalExpress").hide(); | |
276 | } | |
277 | else { | |
278 | cj("#paypalExpress").show(); | |
279 | cj("#crm-submit-buttons").hide(); | |
6a488035 | 280 | } |
f9c24028 | 281 | } |
6a488035 | 282 | |
fdf1844b | 283 | {/literal}{if ($bypassPayment and $showHidePaymentInformation)}{literal} |
f9c24028 | 284 | showHidePaymentInfo(); |
285 | {/literal} {/if}{literal} | |
6a488035 | 286 | |
f9c24028 | 287 | function showHidePaymentInfo() { |
fdf1844b | 288 | if (( cj("#bypass_payment").val() == 1 )) { |
f9c24028 | 289 | cj('#billing-payment-block').hide(); |
290 | } | |
291 | else { | |
6a488035 | 292 | cj('#billing-payment-block').show(); |
6a488035 | 293 | } |
f9c24028 | 294 | } |
6a488035 | 295 | |
f9c24028 | 296 | {/literal}{if $allowGroupOnWaitlist}{literal} |
297 | allowGroupOnWaitlist(0, 0); | |
298 | {/literal}{/if}{literal} | |
299 | ||
300 | function allowGroupOnWaitlist(additionalParticipants, pricesetParticipantCount) { | |
301 | {/literal}{if $isAdditionalParticipants}{literal} | |
302 | if (!additionalParticipants) { | |
303 | additionalParticipants = cj('#additional_participants').val(); | |
304 | } | |
305 | {/literal}{else}{literal} | |
306 | additionalParticipants = 0; | |
6a488035 TO |
307 | {/literal}{/if}{literal} |
308 | ||
f9c24028 | 309 | additionalParticipants = parseInt(additionalParticipants); |
310 | if (!additionalParticipants) { | |
311 | additionalParticipants = 0; | |
312 | } | |
6a488035 | 313 | |
f9c24028 | 314 | var availableRegistrations = {/literal}'{$availableRegistrations}'{literal}; |
315 | var totalParticipants = parseInt(additionalParticipants) + 1; | |
6a488035 | 316 | |
f9c24028 | 317 | if (pricesetParticipantCount) { |
318 | // add priceset count if any | |
319 | totalParticipants += parseInt(pricesetParticipantCount) - 1; | |
320 | } | |
321 | var isrequireApproval = {/literal}'{$requireApprovalMsg}'{literal}; | |
6a488035 | 322 | |
f9c24028 | 323 | if (totalParticipants > availableRegistrations) { |
324 | cj("#id-waitlist-msg").show(); | |
325 | cj("#id-waitlist-approval-msg").show(); | |
6a488035 | 326 | |
f9c24028 | 327 | //set the value for hidden bypass payment. |
328 | cj("#bypass_payment").val(1); | |
6a488035 | 329 | } |
f9c24028 | 330 | else { |
331 | if (isrequireApproval) { | |
332 | cj("#id-waitlist-approval-msg").show(); | |
333 | cj("#id-waitlist-msg").hide(); | |
334 | } | |
335 | else { | |
336 | cj("#id-waitlist-approval-msg").hide(); | |
337 | } | |
338 | //reset value since user don't want or not eligible for waitlist | |
339 | cj("#bypass_payment").val(0); | |
6a488035 | 340 | } |
f9c24028 | 341 | |
342 | //now call showhide payment info. | |
343 | {/literal} | |
fdf1844b | 344 | {if ($bypassPayment) and $paymentProcessor.payment_processor_type EQ 'PayPal_Express'}{literal} |
f9c24028 | 345 | showHidePayPalExpressOption(); |
346 | {/literal}{/if} | |
347 | {literal} | |
348 | ||
fdf1844b | 349 | {/literal}{if ($bypassPayment) and $showHidePaymentInformation}{literal} |
f9c24028 | 350 | showHidePaymentInfo(); |
6a488035 | 351 | {/literal}{/if}{literal} |
f9c24028 | 352 | } |
353 | ||
354 | {/literal}{if $pcp && $is_honor_roll }{literal} | |
355 | function pcpAnonymous() { | |
356 | // clear nickname field if anonymous is true | |
357 | if (document.getElementsByName("pcp_is_anonymous")[1].checked) { | |
358 | document.getElementById('pcp_roll_nickname').value = ''; | |
359 | } | |
360 | if (!document.getElementsByName("pcp_display_in_roll")[0].checked) { | |
361 | cj('#nickID, #nameID, #personalNoteID').hide(); | |
362 | } | |
363 | else { | |
364 | if (document.getElementsByName("pcp_is_anonymous")[0].checked) { | |
365 | cj('#nameID, #nickID, #personalNoteID').show(); | |
366 | } | |
367 | else { | |
368 | cj('#nameID').show(); | |
369 | cj('#nickID, #personalNoteID').hide(); | |
370 | } | |
371 | } | |
372 | } | |
373 | {/literal}{/if}{literal} | |
6a488035 TO |
374 | |
375 | </script> | |
376 | {/literal} |