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