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