option to configure confirm screen
[civicrm-core.git] / templates / CRM / Event / Form / ManageEvent / Registration.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 {if $addProfileBottomAdd OR $addProfileBottom}
27 <td scope="row" class="label"
28 width="20%">{if $addProfileBottomAdd }{$form.additional_custom_post_id_multiple[$profileBottomNumAdd].label}
29 {else}{$form.custom_post_id[$profileBottomNum].label}{/if}</td>
30 <td>{if $addProfileBottomAdd }{$form.additional_custom_post_id_multiple[$profileBottomNumAdd].html}{else}{$form.custom_post_id_multiple[$profileBottomNum].html}{/if}
31 &nbsp;<span class='profile_bottom_link_remove'><a href="#" class="crm-hover-button crm-button-rem-profile"
32 data-addtlPartc="{$addProfileBottomAdd}"><span
33 class="icon ui-icon-trash"></span>{ts}remove profile{/ts}</a></span>&nbsp;&nbsp;<span
34 class='profile_bottom_link'>&nbsp;<a href="#" class="crm-hover-button crm-button-add-profile"><span
35 class="icon ui-icon-plus"></span>{ts}add profile{/ts}</a></span>
36 <br/>
37 {if $addProfileBottomAdd }
38 <span
39 class="description">{ts}Change this if you want to use a different profile for additional participants.{/ts}</span>
40 {else}
41 <span
42 class="description">{ts}Include additional fields on this registration form by configuring and selecting a CiviCRM Profile to be included at the bottom of the page.{/ts}</span>
43 {/if}
44 <br/><span class="profile-links"></span>
45 </td>
46 {else}
47 {assign var=eventID value=$id}
48 <div id="help">
49 {ts}If you want to provide an Online Registration page for this event, check the first box below and then complete the fields on this form.{/ts}
50 {help id="id-event-reg"}
51 </div>
52 <div class="crm-block crm-form-block crm-event-manage-registration-form-block">
53 <div class="crm-submit-buttons">
54 {include file="CRM/common/formButtons.tpl" location="top"}
55 </div>
56
57 <div id="register">
58 <table class="form-layout">
59 <tr class="crm-event-manage-registration-form-block-is_online_registration">
60 <td class="label">{$form.is_online_registration.label}</td>
61 <td>{$form.is_online_registration.html}
62 <span class="description">{ts}Online registration enabled?{/ts}</span>
63 </td>
64 </tr>
65 </table>
66 </div>
67 <div class="spacer"></div>
68 <div id="registration_blocks">
69 <table class="form-layout-compressed">
70
71 <tr class="crm-event-manage-registration-form-block-registration_link_text">
72 <td scope="row" class="label"
73 width="20%">{$form.registration_link_text.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='registration_link_text' id=$eventID}{/if}</td>
74 <td>{$form.registration_link_text.html} {help id="id-link_text"}</td>
75 </tr>
76 {if !$isTemplate}
77 <tr class="crm-event-manage-registration-form-block-registration_start_date">
78 <td scope="row" class="label" width="20%">{$form.registration_start_date.label}</td>
79 <td>{include file="CRM/common/jcalendar.tpl" elementName=registration_start_date}</td>
80 </tr>
81 <tr class="crm-event-manage-registration-form-block-registration_end_date">
82 <td scope="row" class="label" width="20%">{$form.registration_end_date.label}</td>
83 <td>{include file="CRM/common/jcalendar.tpl" elementName=registration_end_date}</td>
84 </tr>
85 {/if}
86 <tr class="crm-event-manage-registration-form-block-is_multiple_registrations">
87 <td scope="row" class="label" width="20%">{$form.is_multiple_registrations.label}</td>
88 <td>{$form.is_multiple_registrations.html} {help id="id-allow_multiple"}</td>
89 </tr>
90 <tr class="crm-event-manage-registration-form-block-allow_same_participant_emails">
91 <td scope="row" class="label" width="20%">{$form.allow_same_participant_emails.label}</td>
92 <td>{$form.allow_same_participant_emails.html} {help id="id-allow_same_email"}</td>
93 </tr>
94 <tr class="crm-event-manage-registration-form-block-requires_approval">
95 {if $form.requires_approval}
96 <td scope="row" class="label" width="20%">{$form.requires_approval.label}</td>
97 <td>{$form.requires_approval.html} {help id="id-requires_approval"}</td>
98 {/if}
99 </tr>
100 <tr id="id-approval-text" class="crm-event-manage-registration-form-block-approval_req_text">
101 {if $form.approval_req_text}
102 <td scope="row" class="label"
103 width="20%">{$form.approval_req_text.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='approval_req_text' id=$eventID}{/if}</td>
104 <td>{$form.approval_req_text.html}</td>
105 {/if}
106 </tr>
107 <tr class="crm-event-manage-registration-form-block-expiration_time">
108 <td scope="row" class="label" width="20%">{$form.expiration_time.label}</td>
109 <td>{$form.expiration_time.html|crmAddClass:four} {help id="id-expiration_time"}</td>
110 </tr>
111 </table>
112 <div class="spacer"></div>
113
114 {*Registration Block*}
115 <fieldset id="registration" class="crm-collapsible {if $defaultsEmpty}collapsed{/if}">
116 <legend class="collapsible-title">{ts}Registration Screen{/ts}</legend>
117 <div id="registration_screen">
118 <table class="form-layout-compressed">
119 <tr class="crm-event-manage-registration-form-block-intro_text">
120 <td scope="row" class="label"
121 width="20%">{$form.intro_text.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='intro_text' id=$eventID}{/if}</td>
122 <td>{$form.intro_text.html}
123 <div
124 class="description">{ts}Introductory message / instructions for online event registration page (may include HTML formatting tags).{/ts}</div>
125 </td>
126 </tr>
127 <tr class="crm-event-manage-registration-form-block-footer_text">
128 <td scope="row" class="label"
129 width="20%">{$form.footer_text.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='footer_text' id=$eventID}{/if}</td>
130 <td>{$form.footer_text.html}
131 <div class="description">{ts}Optional footer text for registration screen.{/ts}</div>
132 </td>
133 </tr>
134 </table>
135 <table class="form-layout-compressed">
136 <tr class="crm-event-manage-registration-form-block-custom_pre_id">
137 <td scope="row" class="label" width="20%">{$form.custom_pre_id.label}</td>
138 <td>{$form.custom_pre_id.html}<br/>
139 <span
140 class="description">{ts}Include additional fields on this registration form by configuring and selecting a CiviCRM Profile to be included at the top of the page (immediately after the introductory message).{/ts}{help id="event-profile"}</span><br/>
141 </td>
142 </tr>
143 <tr id="profile_post" class="crm-event-manage-registration-form-block-custom_post_id">
144 <td scope="row" class="label" width="20%">{$form.custom_post_id.label}</td>
145 <td>{$form.custom_post_id.html}
146 &nbsp;<span class='profile_bottom_link_main {if $profilePostMultiple}hiddenElement{/if}'>&nbsp;<a href="#"
147 class="crm-hover-button crm-button-add-profile"><span
148 class="icon ui-icon-plus"></span>{ts}add profile{/ts}</a></span>
149 <br/>
150 <span
151 class="description">{ts}Include additional fields on this registration form by configuring and selecting a CiviCRM Profile to be included at the bottom of the page.{/ts}</span>
152 </td>
153 </tr>
154
155 {if $profilePostMultiple}
156 {foreach from=$profilePostMultiple item=profilePostId key=profilePostNum name=profilePostIdName}
157 <tr id="custom_post_id_multiple_{$profilePostNum}_wrapper"
158 class='crm-event-manage-registration-form-block-custom_post_multiple'>
159 <td scope="row" class="label" width="20%">{$form.custom_post_id_multiple.$profilePostNum.label}</td>
160 <td>{$form.custom_post_id_multiple.$profilePostNum.html}
161 &nbsp;<span class='profile_bottom_link_remove'><a href="#"
162 class="crm-hover-button crm-button-rem-profile"><span
163 class="icon ui-icon-trash"></span>{ts}remove profile{/ts}</a></span>
164 {if $smarty.foreach.profilePostIdName.last}
165 &nbsp;&nbsp;
166 <span class='profile_bottom_link'><a href="#" class="crm-hover-button crm-button-add-profile"><span
167 class="icon ui-icon-plus"></span>{ts}add profile{/ts}</a></span>
168 {/if}
169 <br/><span class="profile-links"></span>
170 </td>
171 </tr>
172 {/foreach}
173 {/if}
174 </table>
175 <table class="form-layout-compressed">
176 <tr id="additional_profile_pre" class="crm-event-manage-registration-form-block-additional_custom_pre_id">
177 <td scope="row" class="label" width="20%">{$form.additional_custom_pre_id.label}</td>
178 <td>{$form.additional_custom_pre_id.html}<br/>
179 <span
180 class="description">{ts}Change this if you want to use a different profile for additional participants.{/ts}</span>
181 <br/><span class="profile-links"></span>
182 </td>
183 </tr>
184 <tr id="additional_profile_post" class="crm-event-manage-registration-form-block-additional_custom_post_id">
185 <td scope="row" class="label" width="20%">{$form.additional_custom_post_id.label}</td>
186 <td>{$form.additional_custom_post_id.html}
187 &nbsp;<span class='profile_bottom_add_link_main {if $profilePostMultipleAdd}hiddenElement{/if}'><a
188 href="#" class="crm-hover-button crm-button-add-profile"><span
189 class="icon ui-icon-plus"></span>{ts}add profile{/ts}</a></span>
190 <br/>
191 <span
192 class="description">{ts}Change this if you want to use a different profile for additional participants.{/ts}</span>
193 <br/><span class="profile-links"></span>
194 </td>
195 </tr>
196 {if $profilePostMultipleAdd}
197 {foreach from=$profilePostMultipleAdd item=profilePostIdA key=profilePostNumA name=profilePostIdAName}
198 <tr id='additional_custom_post_id_multiple_{$profilePostNumA}_wrapper'
199 class='crm-event-manage-registration-form-block-additional_custom_post_multiple'>
200 <td scope="row" class="label"
201 width="20%">{$form.additional_custom_post_id_multiple.$profilePostNumA.label}</td>
202 <td>{$form.additional_custom_post_id_multiple.$profilePostNumA.html}
203 &nbsp;<span class='profile_bottom_add_link_remove'><a href="#"
204 class="crm-hover-button crm-button-rem-profile"><span
205 class="icon ui-icon-trash"></span>{ts}remove profile{/ts}</a></span>
206 {if $smarty.foreach.profilePostIdAName.last}
207 &nbsp;&nbsp;
208 <span class='profile_bottom_add_link'><a href="#"
209 class="crm-hover-button crm-button-add-profile"><span
210 class="icon ui-icon-plus"></span>{ts}add profile{/ts}</a></span>
211 {/if}
212 <br/><span class="profile-links"></span>
213 </td>
214 </tr>
215 {/foreach}
216 {/if}
217 </table>
218 </div>
219 </fieldset>
220
221 {*Confirmation Block*}
222 <fieldset id="confirm" class="crm-collapsible {if $defaultsEmpty}collapsed{/if}">
223 <legend class="collapsible-title">{ts}Confirmation Screen{/ts}</legend>
224 <table class="form-layout-compressed">
225 <tr class="crm-event-manage-registration-form-block-is_confirm_enabled">
226 <td scope="row" class="label" width="20%">{$form.is_confirm_enabled.label}</td>
227 <td>{$form.is_confirm_enabled.html}
228 <div class="description">{ts}Optionally hide the confirmation screen for free events.{/ts}</div>
229 </td>
230 </tr>
231 </table>
232
233 <div id="confirm_screen_settings">
234 <table class="form-layout-compressed">
235 <tr class="crm-event-manage-registration-form-block-confirm_title">
236 <td scope="row" class="label" width="20%">{$form.confirm_title.label} <span
237 class="marker">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='confirm_title' id=$eventID}{/if}
238 </td>
239 <td>{$form.confirm_title.html}<br/>
240 <span
241 class="description">{ts}Page title for screen where user reviews and confirms their registration information.{/ts}</span>
242 </td>
243 </tr>
244 <tr class="crm-event-manage-registration-form-block-confirm_text">
245 <td scope="row" class="label"
246 width="20%">{$form.confirm_text.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='confirm_text' id=$eventID}{/if}</td>
247 <td>{$form.confirm_text.html}
248 <div class="description">{ts}Optional instructions / message for Confirmation screen.{/ts}</div>
249 </td>
250 </tr>
251 <tr class="crm-event-manage-registration-form-block-confirm_footer_text">
252 <td scope="row" class="label"
253 width="20%">{$form.confirm_footer_text.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='confirm_footer_text' id=$eventID}{/if}</td>
254 <td>{$form.confirm_footer_text.html}
255 <div class="description">{ts}Optional page footer text for Confirmation screen.{/ts}</div>
256 </td>
257 </tr>
258 </table>
259 </div>
260 </fieldset>
261
262 {*ThankYou Block*}
263 <fieldset id="thankyou" class="crm-collapsible {if $defaultsEmpty}collapsed{/if}">
264 <legend class="collapsible-title">{ts}Thank-you Screen{/ts}</legend>
265 <table class="form-layout-compressed">
266 <tr class="crm-event-manage-registration-form-block-confirm_thankyou_title">
267 <td scope="row" class="label" width="20%">{$form.thankyou_title.label} <span
268 class="marker">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='thankyou_title' id=$eventID}{/if}
269 </td>
270 <td>{$form.thankyou_title.html}
271 <div class="description">{ts}Page title for registration Thank-you screen.{/ts}</div>
272 </td>
273 </tr>
274 <tr class="crm-event-manage-registration-form-block-confirm_thankyou_text">
275 <td scope="row" class="label"
276 width="20%">{$form.thankyou_text.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='thankyou_text' id=$eventID}{/if}</td>
277 <td>{$form.thankyou_text.html}
278 <div
279 class="description">{ts}Optional message for Thank-you screen (may include HTML formatting).{/ts}</div>
280 </td>
281 </tr>
282 <tr class="crm-event-manage-registration-form-block-confirm_thankyou_footer_text">
283 <td scope="row" class="label"
284 width="20%">{$form.thankyou_footer_text.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='thankyou_footer_text' id=$eventID}{/if}</td>
285 <td>{$form.thankyou_footer_text.html}
286 <div
287 class="description">{ts}Optional footer text for Thank-you screen (often used to include links to other pages/activities on your site).{/ts}</div>
288 </td>
289 </tr>
290 </table>
291 </fieldset>
292
293 {* Confirmation Email Block *}
294 <fieldset id="mail" class="crm-collapsible {if $defaultsEmpty}collapsed{/if}">
295 <legend class="collapsible-title">{ts}Confirmation Email{/ts}</legend>
296 <div>
297 <table class="form-layout-compressed">
298 <tr class="crm-event-manage-registration-form-block-is_email_confirm">
299 <td scope="row" class="label" width="20%">{$form.is_email_confirm.label}</td>
300 <td>{$form.is_email_confirm.html}<br/>
301 <span
302 class="description">{ts}Do you want a registration confirmation email sent automatically to the user? This email includes event date(s), location and contact information. For paid events, this email is also a receipt for their payment.{/ts}</span>
303 </td>
304 </tr>
305 </table>
306 <div id="confirmEmail">
307 <table class="form-layout-compressed">
308 <tr class="crm-event-manage-registration-form-block-confirm_email_text">
309 <td scope="row" class="label"
310 width="20%">{$form.confirm_email_text.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='confirm_email_text' id=$eventID}{/if}</td>
311 <td>{$form.confirm_email_text.html}<br/>
312 <span
313 class="description">{ts}Additional message or instructions to include in confirmation email.{/ts}</span>
314 </td>
315 </tr>
316 <tr class="crm-event-manage-registration-form-block-confirm_from_name">
317 <td scope="row" class="label" width="20%">{$form.confirm_from_name.label} <span
318 class="marker">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='confirm_from_name' id=$eventID}{/if}
319 </td>
320 <td>{$form.confirm_from_name.html}<br/>
321 <span class="description">{ts}FROM name for email.{/ts}</span>
322 </td>
323 </tr>
324 <tr class="crm-event-manage-registration-form-block-confirm_from_email">
325 <td scope="row" class="label" width="20%">{$form.confirm_from_email.label} <span class="marker">*</span></td>
326 <td>{$form.confirm_from_email.html}<br/>
327 <span
328 class="description">{ts}FROM email address (this must be a valid email account with your SMTP email service provider).{/ts}</span>
329 </td>
330 </tr>
331 <tr class="crm-event-manage-registration-form-block-cc_confirm">
332 <td scope="row" class="label" width="20%">{$form.cc_confirm.label}</td>
333 <td>{$form.cc_confirm.html}<br/>
334 <span
335 class="description">{ts}You can notify event organizers of each online registration by specifying one or more email addresses to receive a carbon copy (cc). Multiple email addresses should be separated by a comma (e.g. jane@example.org, paula@example.org).{/ts}</span>
336 </td>
337 </tr>
338 <tr class="crm-event-manage-registration-form-block-bcc_confirm">
339 <td scope="row" class="label" width="20%">{$form.bcc_confirm.label}</td>
340 <td>{$form.bcc_confirm.html}<br/>
341 <span
342 class="description">{ts}You may specify one or more email addresses to receive a blind carbon copy (bcc) of the confirmation email. Multiple email addresses should be separated by a comma (e.g. jane@example.org, paula@example.org).{/ts}</span>
343 </td>
344 </tr>
345 </table>
346 </div>
347 </div>
348 </fieldset>
349 </div> {*end of div registration_blocks*}
350 </div>
351 <div class="crm-submit-buttons">
352 {include file="CRM/common/formButtons.tpl" location="bottom"}
353 </div>
354 {include file="CRM/common/showHide.tpl"}
355 {include file="CRM/common/showHideByFieldValue.tpl"
356 trigger_field_id ="is_online_registration"
357 trigger_value =""
358 target_element_id ="registration_blocks"
359 target_element_type ="block"
360 field_type ="radio"
361 invert = 0
362 }
363
364 {include file="CRM/common/showHideByFieldValue.tpl"
365 trigger_field_id ="is_confirm_enabled"
366 trigger_value =""
367 target_element_id ="confirm_screen_settings"
368 target_element_type ="block"
369 field_type ="radio"
370 invert = 0
371 }
372
373 {include file="CRM/common/showHideByFieldValue.tpl"
374 trigger_field_id ="is_email_confirm"
375 trigger_value =""
376 target_element_id ="confirmEmail"
377 target_element_type ="block"
378 field_type ="radio"
379 invert = 0
380 }
381 {include file="CRM/common/showHideByFieldValue.tpl"
382 trigger_field_id ="is_multiple_registrations"
383 trigger_value =""
384 target_element_id ="additional_profile_pre|additional_profile_post"
385 target_element_type ="table-row"
386 field_type ="radio"
387 invert = 0
388 }
389 {if $form.requires_approval}
390 {include file="CRM/common/showHideByFieldValue.tpl"
391 trigger_field_id ="requires_approval"
392 trigger_value =""
393 target_element_id ="id-approval-text"
394 target_element_type ="table-row"
395 field_type ="radio"
396 invert = 0
397 }
398 {/if}
399
400 {*include profile link function*}
401 {include file="CRM/common/buildProfileLink.tpl"}
402
403 <script type="text/javascript">
404 {literal} (function($, _) { // Generic Closure
405
406 function showRuleFields( ruleFields ) {
407 var msg1 = '{/literal}{ts 1="' + ruleFields + '"}Primary participants will be able to register additional participants using the same email address. The configured "Supervised" Dedupe Rule will use the following fields to prevent duplicate registrations: %1. First and Last Name will be used to check for matches among multiple participants.{/ts}{literal}';
408 var msg2 = '{/literal}{ts escape='js'}Primary participants will be allowed to register for this event multiple times. No duplicate registration checking will be performed.{/ts}{literal}';
409 var msg3 = '{/literal}{ts escape='js'}Primary participants will be able to register additional participants during registration.{/ts}{literal}';
410
411 // Display info
412 $('.ui-notify-message .ui-notify-close').click();
413 if ( $("#allow_same_participant_emails").prop('checked' ) && cj("#is_multiple_registrations").prop('checked' ) ) {
414 CRM.alert( msg1, '', 'info', {expires:0} );
415 } else if ( $("#allow_same_participant_emails").prop('checked' ) && !cj("#is_multiple_registrations").prop('checked' ) ) {
416 CRM.alert( msg2, '', 'info', {expires:0} );
417 } else if ( !$("#allow_same_participant_emails").prop('checked' ) && cj("#is_multiple_registrations").prop('checked' ) ) {
418 CRM.alert( msg3, '', 'info', {expires:0} );
419 }
420 }
421
422 var profileBottomCount = Number({/literal}{$profilePostMultiple|@count}{literal});
423 var profileBottomCountAdd = Number({/literal}{$profilePostMultipleAdd|@count}{literal});
424
425 function addBottomProfile( e ) {
426 e.preventDefault();
427
428 var addtlPartc = $(this).data('addtlPartc');
429
430 if (addtlPartc) {
431 profileBottomCount++;
432 urlPath = CRM.url('civicrm/event/manage/registration', { addProfileBottomAdd: 1, addProfileNumAdd: profileBottomCountAdd, snippet: 4 } ) ;
433 } else {
434 profileBottomCountAdd++;
435 urlPath = CRM.url('civicrm/event/manage/registration', { addProfileBottom: 1 , addProfileNum : profileBottomCount, snippet: 4 } ) ;
436 }
437
438 $(this).closest('tbody').append('<tr class="additional_profile"></tr>');
439 var $el = $(this).closest('tbody').find('tr:last');
440 $el.load(urlPath, function() { $(this).trigger('crmLoad') });
441 }
442
443 function removeBottomProfile( e ) {
444 e.preventDefault();
445
446 $(e.target).parents('tr').find('.crm-profile-selector').val('');
447 $(e.target).parents('tr').hide();
448 }
449
450 var strSameAs = ' - '+ts('same as for main contact')+' - ';
451 var strSelect = ' - '+ts('select')+' - ';
452
453 $('#crm-container').on('crmLoad', function() {
454 var $container = $("[id^='additional_profile_'],.additional_profile").not('.processed').addClass('processed');
455 $container.find(".crm-profile-selector-select select").each( function() {
456 var $select = $(this);
457 var selected = $select.find(':selected').val(); //cache the default
458 $select.find('option[value=""]').remove();
459 $select.prepend('<option value="">'+strSameAs+'</option>');
460 if ($select.closest('tr').is(':not([id*="_pre"])')) {
461 $select.prepend('<option value="">'+strSelect+'</option>');
462 }
463 $select.find('option[value="'+selected+'"]').attr('selected', 'selected'); //restore default
464 });
465 });
466
467 $(function($) {
468
469 showRuleFields( {/literal}{$ruleFields}{literal} );
470
471 var allow_multiple = $("#is_multiple_registrations");
472 if ( !allow_multiple.prop('checked') ) {
473 $('#additional_profile_pre,#additional_profile_post').hide();
474 }
475 allow_multiple.change( function( ) {
476 if ( !$(this).prop('checked') ) {
477 $("#additional_custom_pre_id,#additional_custom_post_id").val('');
478 $(".crm-event-manage-registration-form-block-additional_custom_post_multiple").hide();
479 $('#additional_profile_pre,#additional_profile_post').hide();
480 } else {
481 $(".crm-event-manage-registration-form-block-additional_custom_post_multiple").show();
482 $('#additional_profile_pre,#additional_profile_post').show();
483 }
484
485 showRuleFields({/literal}{$ruleFields}{literal});
486 });
487
488 $('#allow_same_participant_emails').change( function() { showRuleFields({/literal}{$ruleFields}{literal}) });
489
490 $('#registration_blocks').on('click', '.crm-button-add-profile', addBottomProfile);
491 $('#registration_blocks').on('click', '.crm-button-rem-profile', removeBottomProfile);
492
493 $('#crm-container').on('crmLoad', function(e) {
494 $('tr[id^="additional_profile"] input[id^="additional_custom_"]').change(function(e) {
495 $input = $(e.target);
496 if ( $input.val() == '') {
497 $selected = $input.closest('tr').find('.crm-profile-selector-select :selected');
498 if ($selected.text() == strSelect) { $input.val('none'); }
499 }
500 });
501 });
502
503 }); // END onReady
504 }(CRM.$, CRM._)); //Generic Closure
505 {/literal}
506 </script>
507 {/if}