Merge pull request #17981 from eileenmcnaughton/merge_form
[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`" 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 {if $contact_id}
37 <div class="messages status no-popup crm-not-you-message" id="crm-event-register-different">
38 {ts 1=$display_name}Welcome %1{/ts}. (<a
39 href="{crmURL p='civicrm/event/register' q="cid=0&reset=1&id=`$event.id`"}"
40 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>?)
41 </div>
42 {/if}
43 {if $event.intro_text}
44 <div id="intro_text" class="crm-public-form-item crm-section intro_text-section">
45 <p>{$event.intro_text}</p>
46 </div>
47 {/if}
48
49 {include file="CRM/common/cidzero.tpl"}
50 {if $pcpSupporterText}
51 <div class="crm-public-form-item crm-section pcpSupporterText-section">
52 <div class="content">{$pcpSupporterText}</div>
53 </div>
54 {/if}
55
56 {if $form.additional_participants.html}
57 <div class="crm-public-form-item crm-section additional_participants-section" id="noOfparticipants">
58 <div class="label">{$form.additional_participants.label} <span class="crm-marker" title="{ts}This field is required.{/ts}">*</span></div>
59 <div class="content">
60 {$form.additional_participants.html}{if $contact_id || $contact_id == NULL}{ts}(including yourself){/ts}{/if}
61 <br/>
62 <span
63 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>
64 </div>
65 <div class="clear"></div>
66 </div>
67 {/if}
68
69 <div class="crm-public-form-item crm-section cms_user-section">
70 {* User account registration option. Displays if enabled for one of the profiles on this page. *}
71 {include file="CRM/common/CMSUser.tpl"}
72 </div>
73
74 <div class="crm-public-form-item crm-section custom_pre-section">
75 {* Display "Top of page" profile immediately after the introductory text *}
76 {include file="CRM/UF/Form/Block.tpl" fields=$customPre}
77 </div>
78
79 {if $priceSet}
80 {if ! $quickConfig}<fieldset id="priceset" class="crm-public-form-item crm-group priceset-group">
81 <legend>{$event.fee_label}</legend>{/if}
82 {include file="CRM/Price/Form/PriceSet.tpl" extends="Event"}
83 {include file="CRM/Price/Form/ParticipantCount.tpl"}
84 {if ! $quickConfig}</fieldset>{/if}
85 {/if}
86 {if $pcp && $is_honor_roll }
87 <fieldset class="crm-public-form-item crm-group pcp-group">
88 <div class="crm-public-form-item crm-section pcp-section">
89 <div class="crm-public-form-item crm-section display_in_roll-section">
90 <div class="content">
91 {$form.pcp_display_in_roll.html} &nbsp;
92 {$form.pcp_display_in_roll.label}
93 </div>
94 <div class="clear"></div>
95 </div>
96 <div id="nameID" class="crm-public-form-item crm-section is_anonymous-section">
97 <div class="content">
98 {$form.pcp_is_anonymous.html}
99 </div>
100 <div class="clear"></div>
101 </div>
102 <div id="nickID" class="crm-public-form-item crm-section pcp_roll_nickname-section">
103 <div class="label">{$form.pcp_roll_nickname.label}</div>
104 <div class="content">{$form.pcp_roll_nickname.html}
105 <div
106 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>
107 </div>
108 <div class="clear"></div>
109 </div>
110 <div id="personalNoteID" class="crm-public-form-item crm-section pcp_personal_note-section">
111 <div class="label">{$form.pcp_personal_note.label}</div>
112 <div class="content">
113 {$form.pcp_personal_note.html}
114 <div class="description">{ts}Enter a message to accompany this contribution.{/ts}</div>
115 </div>
116 <div class="clear"></div>
117 </div>
118 </div>
119 </fieldset>
120 {/if}
121
122 {if $form.payment_processor_id.label}
123 <fieldset class="crm-public-form-item crm-group payment_options-group" style="display:none;">
124 <legend>{ts}Payment Options{/ts}</legend>
125 <div class="crm-section payment_processor-section">
126 <div class="label">{$form.payment_processor_id.label}</div>
127 <div class="content">{$form.payment_processor_id.html}</div>
128 <div class="clear"></div>
129 </div>
130 </fieldset>
131 {/if}
132
133 {if $priceSet}
134 {include file='CRM/Core/BillingBlockWrapper.tpl'}
135 {/if}
136
137 <div class="crm-public-form-item crm-section custom_post-section">
138 {include file="CRM/UF/Form/Block.tpl" fields=$customPost}
139 </div>
140
141 {if $isCaptcha}
142 {include file='CRM/common/ReCAPTCHA.tpl'}
143 {/if}
144
145 <div id="crm-submit-buttons" class="crm-submit-buttons">
146 {include file="CRM/common/formButtons.tpl" location="bottom"}
147 </div>
148
149 {if $event.footer_text}
150 <div id="footer_text" class="crm-public-form-item crm-section event_footer_text-section">
151 <p>{$event.footer_text}</p>
152 </div>
153 {/if}
154 </div>
155 <script type="text/javascript">
156 {literal}
157
158 cj("#additional_participants").change(function () {
159 skipPaymentMethod();
160 });
161
162 {/literal}
163 {if $pcp && $is_honor_roll }
164 pcpAnonymous();
165 {/if}
166 {literal}
167
168 function allowParticipant() {
169 {/literal}{if $allowGroupOnWaitlist}{literal}
170 var additionalParticipants = cj('#additional_participants').val();
171 var pricesetParticipantCount = 0;
172 {/literal}{if $priceSet}{literal}
173 pricesetParticipantCount = pPartiCount;
174 {/literal}{/if}{literal}
175
176 allowGroupOnWaitlist(additionalParticipants, pricesetParticipantCount);
177 {/literal}{/if}{literal}
178 }
179
180 {/literal}{if $allowGroupOnWaitlist}{literal}
181 allowGroupOnWaitlist(0, 0);
182 {/literal}{/if}{literal}
183
184 function allowGroupOnWaitlist(additionalParticipants, pricesetParticipantCount) {
185 {/literal}{if $isAdditionalParticipants}{literal}
186 if (!additionalParticipants) {
187 additionalParticipants = cj('#additional_participants').val();
188 }
189 {/literal}{else}{literal}
190 additionalParticipants = 0;
191 {/literal}{/if}{literal}
192
193 additionalParticipants = parseInt(additionalParticipants);
194 if (!additionalParticipants) {
195 additionalParticipants = 0;
196 }
197
198 var availableRegistrations = {/literal}'{$availableRegistrations}'{literal};
199 var totalParticipants = parseInt(additionalParticipants) + 1;
200
201 if (pricesetParticipantCount) {
202 // add priceset count if any
203 totalParticipants += parseInt(pricesetParticipantCount) - 1;
204 }
205 var isrequireApproval = {/literal}'{$requireApprovalMsg}'{literal};
206
207 if (totalParticipants > availableRegistrations) {
208 cj("#id-waitlist-msg").show();
209 cj("#id-waitlist-approval-msg").show();
210
211 //set the value for hidden bypass payment.
212 cj("#bypass_payment").val(1);
213 }
214 else {
215 if (isrequireApproval) {
216 cj("#id-waitlist-approval-msg").show();
217 cj("#id-waitlist-msg").hide();
218 cj("#bypass_payment").val(1);
219 }
220 else {
221 cj("#id-waitlist-approval-msg").hide();
222 cj("#bypass_payment").val(0);
223 }
224 //reset value since user don't want or not eligible for waitlist
225 skipPaymentMethod();
226 }
227 }
228
229 {/literal}
230 {if $pcp && $is_honor_roll }{literal}
231 function pcpAnonymous() {
232 // clear nickname field if anonymous is true
233 if (document.getElementsByName("pcp_is_anonymous")[1].checked) {
234 document.getElementById('pcp_roll_nickname').value = '';
235 }
236 if (!document.getElementsByName("pcp_display_in_roll")[0].checked) {
237 cj('#nickID, #nameID, #personalNoteID').hide();
238 }
239 else {
240 if (document.getElementsByName("pcp_is_anonymous")[0].checked) {
241 cj('#nameID, #nickID, #personalNoteID').show();
242 }
243 else {
244 cj('#nameID').show();
245 cj('#nickID, #personalNoteID').hide();
246 }
247 }
248 }
249 {/literal}
250 {/if}
251 {literal}
252
253 </script>
254 {/literal}
255 {include file="CRM/Form/validate.tpl"}