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