cc7f41c30e3d9981440dfff0d04483cf93f425f1
[civicrm-core.git] / templates / CRM / Event / Form / Registration / Register.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
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 <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>
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 {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">
49
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}
56 {if $waitlistMsg}
57 <div id="id-waitlist-msg">{$waitlistMsg}</div>
58 {/if}
59 </div>
60 {/if}
61
62 {if $contact_id}
63 <div class="messages status no-popup" id="crm-event-register-different">
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">
71 <p>{$event.intro_text}</p>
72 </div>
73 {/if}
74 {include file="CRM/common/cidzero.tpl"}
75 {if $pcpSupporterText}
76 <div class="crm-section pcpSupporterText-section">
77 <div class="content">{$pcpSupporterText}</div>
78 </div>
79 {/if}
80
81 {if $form.additional_participants.html}
82 <div class="crm-section additional_participants-section" id="noOfparticipants">
83 <div class="label">{$form.additional_participants.label}</div>
84 <div class="content">
85 {$form.additional_participants.html}{if $contact_id || $contact_id == NULL} &nbsp; ({ts}including yourself{/ts}){/if}
86 <br/>
87 <span
88 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 &quot;Continue&quot;.{/ts}</span>
89 </div>
90 <div class="clear"></div>
91 </div>
92 {/if}
93
94 {if $priceSet}
95 {if ! $quickConfig}<fieldset id="priceset" class="crm-group priceset-group">
96 <legend>{$event.fee_label}</legend>{/if}
97 {include file="CRM/Price/Form/PriceSet.tpl" extends="Event"}
98 {include file="CRM/Price/Form/ParticipantCount.tpl"}
99 {if ! $quickConfig}</fieldset>{/if}
100
101 {if $form.is_pay_later}
102 <div class="crm-section pay_later-section">
103 <div class="label">&nbsp;</div>
104 <div class="content">{$form.is_pay_later.html}&nbsp;{$form.is_pay_later.label}</div>
105 <div class="clear"></div>
106 </div>
107 {/if}
108 {/if}
109 {if $pcp && $is_honor_roll }
110 <fieldset class="crm-group pcp-group">
111 <div class="crm-section pcp-section">
112 <div class="crm-section display_in_roll-section">
113 <div class="content">
114 {$form.pcp_display_in_roll.html} &nbsp;
115 {$form.pcp_display_in_roll.label}
116 </div>
117 <div class="clear"></div>
118 </div>
119 <div id="nameID" class="crm-section is_anonymous-section">
120 <div class="content">
121 {$form.pcp_is_anonymous.html}
122 </div>
123 <div class="clear"></div>
124 </div>
125 <div id="nickID" class="crm-section pcp_roll_nickname-section">
126 <div class="label">{$form.pcp_roll_nickname.label}</div>
127 <div class="content">{$form.pcp_roll_nickname.html}
128 <div
129 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>
130 </div>
131 <div class="clear"></div>
132 </div>
133 <div id="personalNoteID" class="crm-section pcp_personal_note-section">
134 <div class="label">{$form.pcp_personal_note.label}</div>
135 <div class="content">
136 {$form.pcp_personal_note.html}
137 <div class="description">{ts}Enter a message to accompany this contribution.{/ts}</div>
138 </div>
139 <div class="clear"></div>
140 </div>
141 </div>
142 </fieldset>
143 {/if}
144
145 {* User account registration option. Displays if enabled for one of the profiles on this page. *}
146 {include file="CRM/common/CMSUser.tpl"}
147
148 {include file="CRM/UF/Form/Block.tpl" fields=$customPre}
149
150 {if $form.payment_processor.label}
151 <fieldset class="crm-group payment_options-group" style="display:none;">
152 <legend>{ts}Payment Options{/ts}</legend>
153 <div class="crm-section payment_processor-section">
154 <div class="label">{$form.payment_processor.label}</div>
155 <div class="content">{$form.payment_processor.html}</div>
156 <div class="clear"></div>
157 </div>
158 </fieldset>
159 {/if}
160
161 <div id="billing-payment-block">
162 {* If we have a payment processor, load it - otherwise it happens via ajax *}
163 {if $ppType}
164 {include file="CRM/Event/Form/Registration/Register.tpl" snippet=4}
165 {/if}
166 </div>
167 {include file="CRM/common/paymentBlock.tpl"}
168
169 {include file="CRM/UF/Form/Block.tpl" fields=$customPost}
170
171 {if $isCaptcha}
172 {include file='CRM/common/ReCAPTCHA.tpl'}
173 {/if}
174
175 <div id="crm-submit-buttons" class="crm-submit-buttons">
176 {include file="CRM/common/formButtons.tpl" location="bottom"}
177 </div>
178
179 {if $event.footer_text}
180 <div id="footer_text" class="crm-section event_footer_text-section">
181 <p>{$event.footer_text}</p>
182 </div>
183 {/if}
184 </div>
185 <script type="text/javascript">
186 {literal}
187 function toggleConfirmButton() {
188 var payPalExpressId = "{/literal}{$payPalExpressId}{literal}";
189 var elementObj = cj('input[name="payment_processor"]');
190 if (elementObj.attr('type') == 'hidden') {
191 var processorTypeId = elementObj.val();
192 }
193 else {
194 var processorTypeId = elementObj.filter(':checked').val();
195 }
196
197 if (payPalExpressId != 0 && payPalExpressId == processorTypeId) {
198 cj("#crm-submit-buttons").hide();
199 }
200 else {
201 cj("#crm-submit-buttons").show();
202 }
203 }
204
205 cj('input[name="payment_processor"]').change(function () {
206 toggleConfirmButton();
207 });
208
209 cj(function () {
210 toggleConfirmButton();
211 skipPaymentMethod();
212 });
213
214 function skipPaymentMethod() {
215 var symbol = '{/literal}{$currencySymbol}{literal}';
216 var isMultiple = '{/literal}{$event.is_multiple_registrations}{literal}';
217
218 var flag = 1;
219 if (isMultiple && cj("#additional_participants").val()) {
220 flag = 0;
221 }
222
223 cj('#priceset input').change(function () {
224 if (((cj(this).attr('data-amount') == 0) || (cj('#pricevalue').text() == symbol + " 0.00" )) && flag ) {
225 cj(".payment_options-group").hide();
226 cj("div.payment_processor-section").hide();
227 cj("div#payment_information").hide();
228 }
229 else {
230 cj(".payment_options-group").show();
231 cj("div.payment_processor-section").show();
232 cj("div#payment_information").show();
233 }
234
235 });
236 }
237 {/literal}
238 </script>
239 {/if}
240 {literal}
241 <script type="text/javascript">
242 {/literal}{if $pcp && $is_honor_roll }pcpAnonymous();
243 {/if}{literal}
244
245 function allowParticipant() {
246 {/literal}{if $allowGroupOnWaitlist}{literal}
247 var additionalParticipants = cj('#additional_participants').val();
248 var pricesetParticipantCount = 0;
249 {/literal}{if $priceSet}{literal}
250 pricesetParticipantCount = pPartiCount;
251 {/literal}{/if}{literal}
252
253 allowGroupOnWaitlist(additionalParticipants, pricesetParticipantCount);
254 {/literal}{/if}{literal}
255 }
256
257 {/literal}{if ($form.is_pay_later or $bypassPayment) and $paymentProcessor.payment_processor_type EQ 'PayPal_Express'}
258 {literal}
259 showHidePayPalExpressOption();
260 {/literal}{/if}{literal}
261
262 function showHidePayPalExpressOption() {
263 var payLaterElement = {/literal}{if $form.is_pay_later}true{else}false{/if}{literal};
264 if (( cj("#bypass_payment").val() == 1 ) ||
265 ( payLaterElement && document.getElementsByName('is_pay_later')[0].checked )) {
266 cj("#crm-submit-buttons").show();
267 cj("#paypalExpress").hide();
268 }
269 else {
270 cj("#paypalExpress").show();
271 cj("#crm-submit-buttons").hide();
272 }
273 }
274
275 {/literal}{if ($form.is_pay_later or $bypassPayment) and $showHidePaymentInformation}{literal}
276 showHidePaymentInfo();
277 {/literal} {/if}{literal}
278
279 function showHidePaymentInfo() {
280 var payLater = {/literal}{if $form.is_pay_later}true{else}false{/if}{literal};
281
282 if (( cj("#bypass_payment").val() == 1 ) ||
283 ( payLater && document.getElementsByName('is_pay_later')[0].checked )) {
284 cj('#billing-payment-block').hide();
285 }
286 else {
287 cj('#billing-payment-block').show();
288 }
289 }
290
291 {/literal}{if $allowGroupOnWaitlist}{literal}
292 allowGroupOnWaitlist(0, 0);
293 {/literal}{/if}{literal}
294
295 function allowGroupOnWaitlist(additionalParticipants, pricesetParticipantCount) {
296 {/literal}{if $isAdditionalParticipants}{literal}
297 if (!additionalParticipants) {
298 additionalParticipants = cj('#additional_participants').val();
299 }
300 {/literal}{else}{literal}
301 additionalParticipants = 0;
302 {/literal}{/if}{literal}
303
304 additionalParticipants = parseInt(additionalParticipants);
305 if (!additionalParticipants) {
306 additionalParticipants = 0;
307 }
308
309 var availableRegistrations = {/literal}'{$availableRegistrations}'{literal};
310 var totalParticipants = parseInt(additionalParticipants) + 1;
311
312 if (pricesetParticipantCount) {
313 // add priceset count if any
314 totalParticipants += parseInt(pricesetParticipantCount) - 1;
315 }
316 var isrequireApproval = {/literal}'{$requireApprovalMsg}'{literal};
317
318 if (totalParticipants > availableRegistrations) {
319 cj("#id-waitlist-msg").show();
320 cj("#id-waitlist-approval-msg").show();
321
322 //set the value for hidden bypass payment.
323 cj("#bypass_payment").val(1);
324
325 //hide pay later.
326 {/literal}{if $form.is_pay_later}{literal}
327 cj("#is-pay-later").hide();
328 {/literal} {/if}{literal}
329
330 }
331 else {
332 if (isrequireApproval) {
333 cj("#id-waitlist-approval-msg").show();
334 cj("#id-waitlist-msg").hide();
335 }
336 else {
337 cj("#id-waitlist-approval-msg").hide();
338 }
339 //reset value since user don't want or not eligible for waitlist
340 cj("#bypass_payment").val(0);
341
342 //need to show paylater if exists.
343 {/literal}{if $form.is_pay_later}{literal}
344 cj("#is-pay-later").show();
345 {/literal} {/if}{literal}
346 }
347
348 //now call showhide payment info.
349 {/literal}
350 {if ($form.is_pay_later or $bypassPayment) and $paymentProcessor.payment_processor_type EQ 'PayPal_Express'}{literal}
351 showHidePayPalExpressOption();
352 {/literal}{/if}
353 {literal}
354
355 {/literal}{if ($form.is_pay_later or $bypassPayment) and $showHidePaymentInformation}{literal}
356 showHidePaymentInfo();
357 {/literal}{/if}{literal}
358 }
359
360 {/literal}{if $pcp && $is_honor_roll }{literal}
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 = '';
365 }
366 if (!document.getElementsByName("pcp_display_in_roll")[0].checked) {
367 cj('#nickID, #nameID, #personalNoteID').hide();
368 }
369 else {
370 if (document.getElementsByName("pcp_is_anonymous")[0].checked) {
371 cj('#nameID, #nickID, #personalNoteID').show();
372 }
373 else {
374 cj('#nameID').show();
375 cj('#nickID, #personalNoteID').hide();
376 }
377 }
378 }
379 {/literal}{/if}{literal}
380
381 </script>
382 {/literal}