7e69599a06ae44ca56a046c8648637435293d1f6
[civicrm-core.git] / templates / CRM / Event / Form / Registration / Register.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
4 | |
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
8 +--------------------------------------------------------------------+
9 *}
10 {if call_user_func(array('CRM_Core_Permission','check'), 'administer CiviCRM') }
11 {capture assign="buttonTitle"}{ts}Configure Event{/ts}{/capture}
12 {crmButton target="_blank" p="civicrm/event/manage/settings" q="reset=1&action=update&id=`$event.id`" fb=1 title="$buttonTitle" icon="fa-wrench"}{ts}Configure{/ts}{/crmButton}
13 <div class='clear'></div>
14 {/if}
15 {* Callback snippet: Load payment processor *}
16 {if $action & 1024}
17 {include file="CRM/Event/Form/Registration/PreviewHeader.tpl"}
18 {/if}
19
20 {include file="CRM/common/TrackingFields.tpl"}
21
22 <div class="crm-event-id-{$event.id} crm-block crm-event-register-form-block">
23
24 {* moved to tpl since need to show only for primary participant page *}
25 {if $requireApprovalMsg || $waitlistMsg}
26 <div id="id-waitlist-approval-msg" class="messages status no-popup">
27 {if $requireApprovalMsg}
28 <div id="id-req-approval-msg">{$requireApprovalMsg}</div>
29 {/if}
30 {if $waitlistMsg}
31 <div id="id-waitlist-msg">{$waitlistMsg}</div>
32 {/if}
33 </div>
34 {/if}
35
36 {crmRegion name='event-register-not-you-block'}
37 {if $contact_id}
38 <div class="messages status no-popup crm-not-you-message" id="crm-event-register-different">
39 {ts 1=$display_name}Welcome %1{/ts}. (<a
40 href="{crmURL p='civicrm/event/register' q="cid=0&reset=1&id=`$event.id`"}"
41 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>?)
42 </div>
43 {/if}
44 {/crmRegion}
45
46 {if $event.intro_text}
47 <div id="intro_text" class="crm-public-form-item crm-section intro_text-section">
48 <p>{$event.intro_text}</p>
49 </div>
50 {/if}
51
52 {include file="CRM/common/cidzero.tpl"}
53 {if $pcpSupporterText}
54 <div class="crm-public-form-item crm-section pcpSupporterText-section">
55 <div class="content">{$pcpSupporterText}</div>
56 </div>
57 {/if}
58
59 {if !empty($form.additional_participants.html)}
60 <div class="crm-public-form-item crm-section additional_participants-section" id="noOfparticipants">
61 <div class="label">{$form.additional_participants.label} <span class="crm-marker" title="{ts}This field is required.{/ts}">*</span></div>
62 <div class="content">
63 {$form.additional_participants.html}{if $contact_id || $contact_id == NULL}{ts}(including yourself){/ts}{/if}
64 <br/>
65 <span
66 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;Review your registration&quot;.{/ts}</span>
67 </div>
68 <div class="clear"></div>
69 </div>
70 {/if}
71
72 <div class="crm-public-form-item crm-section cms_user-section">
73 {* User account registration option. Displays if enabled for one of the profiles on this page. *}
74 {include file="CRM/common/CMSUser.tpl"}
75 </div>
76
77 <div class="crm-public-form-item crm-section custom_pre-section">
78 {* Display "Top of page" profile immediately after the introductory text *}
79 {include file="CRM/UF/Form/Block.tpl" fields=$customPre}
80 </div>
81
82 {if $priceSet}
83 {if ! $quickConfig}<fieldset id="priceset" class="crm-public-form-item crm-group priceset-group">
84 <legend>{$event.fee_label}</legend>{/if}
85 {include file="CRM/Price/Form/PriceSet.tpl" extends="Event"}
86 {include file="CRM/Price/Form/ParticipantCount.tpl"}
87 {if ! $quickConfig}</fieldset>{/if}
88 {/if}
89 {if $pcp && $is_honor_roll }
90 <fieldset class="crm-public-form-item crm-group pcp-group">
91 <div class="crm-public-form-item crm-section pcp-section">
92 <div class="crm-public-form-item crm-section display_in_roll-section">
93 <div class="content">
94 {$form.pcp_display_in_roll.html} &nbsp;
95 {$form.pcp_display_in_roll.label}
96 </div>
97 <div class="clear"></div>
98 </div>
99 <div id="nameID" class="crm-public-form-item crm-section is_anonymous-section">
100 <div class="content">
101 {$form.pcp_is_anonymous.html}
102 </div>
103 <div class="clear"></div>
104 </div>
105 <div id="nickID" class="crm-public-form-item crm-section pcp_roll_nickname-section">
106 <div class="label">{$form.pcp_roll_nickname.label}</div>
107 <div class="content">{$form.pcp_roll_nickname.html}
108 <div
109 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>
110 </div>
111 <div class="clear"></div>
112 </div>
113 <div id="personalNoteID" class="crm-public-form-item crm-section pcp_personal_note-section">
114 <div class="label">{$form.pcp_personal_note.label}</div>
115 <div class="content">
116 {$form.pcp_personal_note.html}
117 <div class="description">{ts}Enter a message to accompany this contribution.{/ts}</div>
118 </div>
119 <div class="clear"></div>
120 </div>
121 </div>
122 </fieldset>
123 {/if}
124
125 {if !empty($form.payment_processor_id.label)}
126 <fieldset class="crm-public-form-item crm-group payment_options-group" style="display:none;">
127 <legend>{ts}Payment Options{/ts}</legend>
128 <div class="crm-section payment_processor-section">
129 <div class="label">{$form.payment_processor_id.label}</div>
130 <div class="content">{$form.payment_processor_id.html}</div>
131 <div class="clear"></div>
132 </div>
133 </fieldset>
134 {/if}
135
136 {if $priceSet}
137 {include file='CRM/Core/BillingBlockWrapper.tpl'}
138 {/if}
139
140 <div class="crm-public-form-item crm-section custom_post-section">
141 {include file="CRM/UF/Form/Block.tpl" fields=$customPost}
142 </div>
143
144 {if $isCaptcha}
145 {include file='CRM/common/ReCAPTCHA.tpl'}
146 {/if}
147
148 <div id="crm-submit-buttons" class="crm-submit-buttons">
149 {include file="CRM/common/formButtons.tpl" location="bottom"}
150 </div>
151
152 {if $event.footer_text}
153 <div id="footer_text" class="crm-public-form-item crm-section event_footer_text-section">
154 <p>{$event.footer_text}</p>
155 </div>
156 {/if}
157 </div>
158 <script type="text/javascript">
159 {literal}
160
161 cj("#additional_participants").change(function () {
162 if (typeof skipPaymentMethod == 'function') {
163 // For free event there is no involvement of payment processor, hence
164 // this function is not available. if above condition not present
165 // then you will receive JS Error in case you change multiple
166 // registrant option.
167 skipPaymentMethod();
168 }
169 });
170
171 {/literal}
172 {if $pcp && $is_honor_roll }
173 pcpAnonymous();
174 {/if}
175 {literal}
176
177 function allowParticipant() {
178 {/literal}{if $allowGroupOnWaitlist}{literal}
179 var additionalParticipants = cj('#additional_participants').val();
180 var pricesetParticipantCount = 0;
181 {/literal}{if $priceSet}{literal}
182 pricesetParticipantCount = pPartiCount;
183 {/literal}{/if}{literal}
184
185 allowGroupOnWaitlist(additionalParticipants, pricesetParticipantCount);
186 {/literal}{/if}{literal}
187 }
188
189 {/literal}{if $allowGroupOnWaitlist}{literal}
190 allowGroupOnWaitlist(0, 0);
191 {/literal}{/if}{literal}
192
193 function allowGroupOnWaitlist(additionalParticipants, pricesetParticipantCount) {
194 {/literal}{if $isAdditionalParticipants}{literal}
195 if (!additionalParticipants) {
196 additionalParticipants = cj('#additional_participants').val();
197 }
198 {/literal}{else}{literal}
199 additionalParticipants = 0;
200 {/literal}{/if}{literal}
201
202 additionalParticipants = parseInt(additionalParticipants);
203 if (!additionalParticipants) {
204 additionalParticipants = 0;
205 }
206
207 var availableRegistrations = {/literal}'{$availableRegistrations}'{literal};
208 var totalParticipants = parseInt(additionalParticipants) + 1;
209
210 if (pricesetParticipantCount) {
211 // add priceset count if any
212 totalParticipants += parseInt(pricesetParticipantCount) - 1;
213 }
214 var isrequireApproval = {/literal}'{$requireApprovalMsg}'{literal};
215
216 if (totalParticipants > availableRegistrations) {
217 cj("#id-waitlist-msg").show();
218 cj("#id-waitlist-approval-msg").show();
219
220 //set the value for hidden bypass payment.
221 cj("#bypass_payment").val(1);
222 }
223 else {
224 if (isrequireApproval) {
225 cj("#id-waitlist-approval-msg").show();
226 cj("#id-waitlist-msg").hide();
227 cj("#bypass_payment").val(1);
228 }
229 else {
230 cj("#id-waitlist-approval-msg").hide();
231 cj("#bypass_payment").val(0);
232 }
233 //reset value since user don't want or not eligible for waitlist
234 if (typeof skipPaymentMethod == 'function') {
235 // For free event there is no involvement of payment processor, hence
236 // this function is not available. if above condition not present
237 // then you will receive JS Error in case register multiple participants
238 // enabled and require approval.
239 skipPaymentMethod();
240 }
241 }
242 }
243
244 {/literal}
245 {if $pcp && $is_honor_roll }{literal}
246 function pcpAnonymous() {
247 // clear nickname field if anonymous is true
248 if (document.getElementsByName("pcp_is_anonymous")[1].checked) {
249 document.getElementById('pcp_roll_nickname').value = '';
250 }
251 if (!document.getElementsByName("pcp_display_in_roll")[0].checked) {
252 cj('#nickID, #nameID, #personalNoteID').hide();
253 }
254 else {
255 if (document.getElementsByName("pcp_is_anonymous")[0].checked) {
256 cj('#nameID, #nickID, #personalNoteID').show();
257 }
258 else {
259 cj('#nameID').show();
260 cj('#nickID, #personalNoteID').hide();
261 }
262 }
263 }
264 {/literal}
265 {/if}
266 {literal}
267
268 </script>
269 {/literal}
270 {include file="CRM/Form/validate.tpl"}