Merge pull request #4410 from eileenmcnaughton/CRM-15297
[civicrm-core.git] / templates / CRM / Event / Form / Registration / Register.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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
75 {include file="CRM/common/cidzero.tpl"}
76 {if $pcpSupporterText}
77 <div class="crm-section pcpSupporterText-section">
78 <div class="content">{$pcpSupporterText}</div>
79 </div>
80 {/if}
81
82 {if $form.additional_participants.html}
83 <div class="crm-section additional_participants-section" id="noOfparticipants">
84 <div class="label">{$form.additional_participants.label}</div>
85 <div class="content">
86 {$form.additional_participants.html}{if $contact_id || $contact_id == NULL} &nbsp; ({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 &quot;Continue&quot;.{/ts}</span>
90 </div>
91 <div class="clear"></div>
92 </div>
93 {/if}
94
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
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}
107 {/if}
108 {if $pcp && $is_honor_roll }
109 <fieldset class="crm-group pcp-group">
110 <div class="crm-section pcp-section">
111 <div class="crm-section display_in_roll-section">
112 <div class="content">
113 {$form.pcp_display_in_roll.html} &nbsp;
114 {$form.pcp_display_in_roll.label}
115 </div>
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}
121 </div>
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>
129 </div>
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>
137 </div>
138 <div class="clear"></div>
139 </div>
140 </div>
141 </fieldset>
142 {/if}
143
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}
154
155 <div id="billing-payment-block">
156 {* If we have a payment processor, load it - otherwise it happens via ajax *}
157 {if $ppType or $isBillingAddressRequiredForPayLater}
158 {include file="CRM/Event/Form/Registration/Register.tpl" snippet=4}
159 {/if}
160 </div>
161 {include file="CRM/common/paymentBlock.tpl"}
162
163 {include file="CRM/UF/Form/Block.tpl" fields=$customPost}
164
165 {if $isCaptcha}
166 {include file='CRM/common/ReCAPTCHA.tpl'}
167 {/if}
168
169 <div id="crm-submit-buttons" class="crm-submit-buttons">
170 {include file="CRM/common/formButtons.tpl" location="bottom"}
171 </div>
172
173 {if $event.footer_text}
174 <div id="footer_text" class="crm-section event_footer_text-section">
175 <p>{$event.footer_text}</p>
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 }
190
191 if (payPalExpressId != 0 && payPalExpressId == processorTypeId) {
192 cj("#crm-submit-buttons").hide();
193 }
194 else {
195 cj("#crm-submit-buttons").show();
196 }
197 }
198
199 cj('input[name="payment_processor"]').change(function () {
200 toggleConfirmButton();
201 });
202
203 CRM.$(function($) {
204 toggleConfirmButton();
205 skipPaymentMethod();
206 });
207
208 // Called from display() in Calculate.tpl, depends on display() having been called
209 function skipPaymentMethod() {
210 var symbol = '{/literal}{$currencySymbol}{literal}';
211 var isMultiple = '{/literal}{$event.is_multiple_registrations}{literal}';
212
213 var flag = 1;
214 var payment_options = cj(".payment_options-group");
215 var payment_processor = cj("div.payment_processor-section");
216 var payment_information = cj("div#payment_information");
217
218 if (isMultiple && cj("#additional_participants").val() && cj('#pricevalue').text() !== symbol + " 0.00") {
219 flag = 0;
220 }
221
222 if ((cj('#pricevalue').text() == symbol + " 0.00") && flag) {
223 payment_options.hide();
224 payment_processor.hide();
225 payment_information.hide();
226 // also unset selected payment methods
227 cj('input[name="payment_processor"]').removeProp('checked');
228 }
229 else {
230 payment_options.show();
231 payment_processor.show();
232 payment_information.show();
233 }
234 }
235
236 {/literal}
237 </script>
238 {/if}
239 {literal}
240 <script type="text/javascript">
241 {/literal}{if $pcp && $is_honor_roll }pcpAnonymous();
242 {/if}{literal}
243
244 function allowParticipant() {
245 {/literal}{if $allowGroupOnWaitlist}{literal}
246 var additionalParticipants = cj('#additional_participants').val();
247 var pricesetParticipantCount = 0;
248 {/literal}{if $priceSet}{literal}
249 pricesetParticipantCount = pPartiCount;
250 {/literal}{/if}{literal}
251
252 allowGroupOnWaitlist(additionalParticipants, pricesetParticipantCount);
253 {/literal}{/if}{literal}
254 }
255
256 {/literal}{if ($bypassPayment) and $paymentProcessor.payment_processor_type EQ 'PayPal_Express'}
257 {literal}
258 showHidePayPalExpressOption();
259 {/literal}{/if}{literal}
260
261 function showHidePayPalExpressOption() {
262 if (( cj("#bypass_payment").val() == 1 )) {
263 cj("#crm-submit-buttons").show();
264 cj("#paypalExpress").hide();
265 }
266 else {
267 cj("#paypalExpress").show();
268 cj("#crm-submit-buttons").hide();
269 }
270 }
271
272 {/literal}{if ($bypassPayment and $showHidePaymentInformation)}{literal}
273 showHidePaymentInfo();
274 {/literal} {/if}{literal}
275
276 function showHidePaymentInfo() {
277 if (( cj("#bypass_payment").val() == 1 )) {
278 cj('#billing-payment-block').hide();
279 }
280 else {
281 cj('#billing-payment-block').show();
282 }
283 }
284
285 {/literal}{if $allowGroupOnWaitlist}{literal}
286 allowGroupOnWaitlist(0, 0);
287 {/literal}{/if}{literal}
288
289 function allowGroupOnWaitlist(additionalParticipants, pricesetParticipantCount) {
290 {/literal}{if $isAdditionalParticipants}{literal}
291 if (!additionalParticipants) {
292 additionalParticipants = cj('#additional_participants').val();
293 }
294 {/literal}{else}{literal}
295 additionalParticipants = 0;
296 {/literal}{/if}{literal}
297
298 additionalParticipants = parseInt(additionalParticipants);
299 if (!additionalParticipants) {
300 additionalParticipants = 0;
301 }
302
303 var availableRegistrations = {/literal}'{$availableRegistrations}'{literal};
304 var totalParticipants = parseInt(additionalParticipants) + 1;
305
306 if (pricesetParticipantCount) {
307 // add priceset count if any
308 totalParticipants += parseInt(pricesetParticipantCount) - 1;
309 }
310 var isrequireApproval = {/literal}'{$requireApprovalMsg}'{literal};
311
312 if (totalParticipants > availableRegistrations) {
313 cj("#id-waitlist-msg").show();
314 cj("#id-waitlist-approval-msg").show();
315
316 //set the value for hidden bypass payment.
317 cj("#bypass_payment").val(1);
318 }
319 else {
320 if (isrequireApproval) {
321 cj("#id-waitlist-approval-msg").show();
322 cj("#id-waitlist-msg").hide();
323 }
324 else {
325 cj("#id-waitlist-approval-msg").hide();
326 }
327 //reset value since user don't want or not eligible for waitlist
328 cj("#bypass_payment").val(0);
329 }
330
331 //now call showhide payment info.
332 {/literal}
333 {if ($bypassPayment) and $paymentProcessor.payment_processor_type EQ 'PayPal_Express'}{literal}
334 showHidePayPalExpressOption();
335 {/literal}{/if}
336 {literal}
337
338 {/literal}{if ($bypassPayment) and $showHidePaymentInformation}{literal}
339 showHidePaymentInfo();
340 {/literal}{/if}{literal}
341 }
342
343 {/literal}{if $pcp && $is_honor_roll }{literal}
344 function pcpAnonymous() {
345 // clear nickname field if anonymous is true
346 if (document.getElementsByName("pcp_is_anonymous")[1].checked) {
347 document.getElementById('pcp_roll_nickname').value = '';
348 }
349 if (!document.getElementsByName("pcp_display_in_roll")[0].checked) {
350 cj('#nickID, #nameID, #personalNoteID').hide();
351 }
352 else {
353 if (document.getElementsByName("pcp_is_anonymous")[0].checked) {
354 cj('#nameID, #nickID, #personalNoteID').show();
355 }
356 else {
357 cj('#nameID').show();
358 cj('#nickID, #personalNoteID').hide();
359 }
360 }
361 }
362 {/literal}{/if}{literal}
363
364 </script>
365 {/literal}