Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
3 | | CiviCRM version 4.3 | | |
4 | +--------------------------------------------------------------------+ | |
5 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 | {* This template is used for adding/editing/deleting offline Event Registrations *} | |
27 | {if $showFeeBlock } | |
28 | {if $priceSet} | |
29 | <div id='validate_pricefield' class='messages crm-error hiddenElement'></div> | |
30 | {literal} | |
31 | <script type="text/javascript"> | |
32 | ||
33 | var fieldOptionsFull = new Array( ); | |
34 | {/literal} | |
35 | {foreach from=$priceSet.fields item=fldElement key=fldId} | |
36 | {if $fldElement.options} | |
37 | {foreach from=$fldElement.options item=fldOptions key=opId} | |
38 | {if $fldOptions.is_full} | |
39 | {literal} | |
40 | fieldOptionsFull[{/literal}{$fldId}{literal}] = new Array( ); | |
41 | fieldOptionsFull[{/literal}{$fldId}{literal}][{/literal}{$opId}{literal}] = 1; | |
42 | {/literal} | |
43 | {/if} | |
44 | {/foreach} | |
45 | {/if} | |
46 | {/foreach} | |
47 | {literal} | |
48 | ||
49 | if ( fieldOptionsFull.length > 0 ) { | |
50 | cj(function() { | |
51 | cj("input,#priceset select,#priceset").each(function () { | |
52 | if ( cj(this).attr('price') ) { | |
53 | switch( cj(this).attr('type') ) { | |
54 | case 'checkbox': | |
55 | case 'radio': | |
56 | cj(this).click( function() { | |
57 | validatePriceField(this); | |
58 | }); | |
59 | break; | |
60 | ||
61 | case 'select-one': | |
62 | cj(this).change( function() { | |
63 | validatePriceField(this); | |
64 | }); | |
65 | break; | |
66 | case 'text': | |
67 | cj(this).bind( 'keyup', function() { validatePriceField(this) }); | |
68 | break; | |
69 | } | |
70 | } | |
71 | }); | |
72 | }); | |
73 | ||
74 | function validatePriceField( obj ) { | |
75 | var namePart = cj(obj).attr('name').split('_'); | |
76 | var fldVal = cj(obj).val(); | |
77 | if ( cj(obj).attr('type') == 'checkbox') { | |
78 | var eleIdpart = namePart[1].split('['); | |
79 | var eleId = eleIdpart[0]; | |
80 | } | |
81 | else { | |
82 | var eleId = namePart[1]; | |
83 | } | |
84 | var showError = false; | |
85 | ||
86 | switch( cj(obj).attr('type') ) { | |
87 | case 'text': | |
88 | if ( fieldOptionsFull[eleId] && fldVal ) { | |
89 | showError = true; | |
90 | cj(obj).parent( ).parent( ).children('.label').addClass('crm-error'); | |
91 | } | |
92 | else { | |
93 | cj(obj).parent( ).parent( ).children('.label').removeClass('crm-error'); | |
94 | cj('#validate_pricefield').hide( ).html(''); | |
95 | } | |
96 | break; | |
97 | ||
98 | case 'checkbox': | |
99 | var checkBoxValue = eleIdpart[1].split(']'); | |
100 | if ( cj(obj).attr("checked") == true && | |
101 | fieldOptionsFull[eleId] && | |
102 | fieldOptionsFull[eleId][checkBoxValue[0]]) { | |
103 | showError = true; | |
104 | cj(obj).parent( ).addClass('crm-error'); | |
105 | } | |
106 | else { | |
107 | cj(obj).parent( ).removeClass('crm-error'); | |
108 | } | |
109 | break; | |
110 | ||
111 | default: | |
112 | if ( fieldOptionsFull[eleId] && | |
113 | fieldOptionsFull[eleId][fldVal] ) { | |
114 | showError = true; | |
115 | cj(obj).parent( ).addClass('crm-error'); | |
116 | } | |
117 | else { | |
118 | cj(obj).parent( ).removeClass('crm-error'); | |
119 | } | |
120 | } | |
121 | ||
122 | if ( showError ) { | |
123 | cj('#validate_pricefield').show().html("<span class='icon red-icon alert-icon'></span>{/literal}{ts escape='js'}This Option is already full for this event.{/ts}{literal}"); | |
124 | } | |
125 | else { | |
126 | cj('#validate_pricefield').hide( ).html(''); | |
127 | } | |
128 | } | |
129 | } | |
130 | </script> | |
131 | {/literal} | |
132 | {/if} | |
133 | {include file="CRM/Event/Form/EventFees.tpl"} | |
134 | ||
135 | {elseif $cdType } | |
136 | {include file="CRM/Custom/Form/CustomData.tpl"} | |
137 | {else} | |
138 | {if $participantMode == 'test' } | |
139 | {assign var=registerMode value="TEST"} | |
140 | {elseif $participantMode == 'live'} | |
141 | {assign var=registerMode value="LIVE"} | |
142 | {/if} | |
143 | <h3>{if $action eq 1}{ts}New Event Registration{/ts}{elseif $action eq 8}{ts}Delete Event Registration{/ts}{else}{ts}Edit Event Registration{/ts}{/if}</h3> | |
144 | <div class="crm-block crm-form-block crm-participant-form-block"> | |
145 | <div class="view-content"> | |
146 | {if $participantMode} | |
147 | <div id="help"> | |
148 | {ts 1=$displayName 2=$registerMode}Use this form to submit an event registration on behalf of %1. <strong>A %2 transaction will be submitted</strong> using the selected payment processor.{/ts} | |
149 | </div> | |
150 | {/if} | |
151 | <div id="eventFullMsg" class="messages status no-popup" style="display:none;"></div> | |
152 | ||
153 | ||
154 | {if $action eq 1 AND $paid} | |
155 | <div id="help"> | |
156 | {ts}If you are accepting offline payment from this participant, check <strong>Record Payment</strong>. You will be able to fill in the payment information, and optionally send a receipt.{/ts} | |
157 | </div> | |
158 | {/if} | |
159 | ||
160 | {if $action eq 8} {* If action is Delete *} | |
161 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
162 | <div class="crm-participant-form-block-delete messages status no-popup"> | |
163 | <div class="crm-content"> | |
164 | <div class="icon inform-icon"></div> | |
165 | {ts}WARNING: Deleting this registration will result in the loss of related payment records (if any).{/ts} {ts}Do you want to continue?{/ts} | |
166 | </div> | |
167 | {if $additionalParticipant} | |
168 | <div class="crm-content"> | |
169 | {ts 1=$additionalParticipant} There are %1 more Participant(s) registered by this participant.{/ts} | |
170 | </div> | |
171 | {/if} | |
172 | </div> | |
173 | {if $additionalParticipant} | |
174 | {$form.delete_participant.html} | |
175 | {/if} | |
176 | {else} {* If action is other than Delete *} | |
177 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
178 | <table class="form-layout-compressed"> | |
179 | {if $single and $context neq 'standalone'} | |
180 | <tr class="crm-participant-form-block-displayName"> | |
181 | <td class="label font-size12pt"><label>{ts}Participant{/ts}</label></td> | |
182 | <td class="font-size12pt view-value">{$displayName} </td> | |
183 | </tr> | |
184 | {else} | |
185 | {if !$participantMode and !$email and $outBound_option != 2 } | |
186 | {assign var='profileCreateCallback' value=1} | |
187 | {/if} | |
188 | {include file="CRM/Contact/Form/NewContact.tpl"} | |
189 | {/if} | |
190 | {if $action EQ 2} | |
191 | {if $additionalParticipants} {* Display others registered by this participant *} | |
192 | <tr class="crm-participant-form-block-additionalParticipants"> | |
193 | <td class="label"><label>{ts}Also Registered by this Participant{/ts}</label></td> | |
194 | <td> | |
195 | {foreach from=$additionalParticipants key=apName item=apURL} | |
196 | <a href="{$apURL}" title="{ts}view additional participant{/ts}">{$apName}</a><br /> | |
197 | {/foreach} | |
198 | </td> | |
199 | </tr> | |
200 | {/if} | |
201 | {if $registered_by_contact_id} | |
202 | <tr class="crm-participant-form-block-registered-by"> | |
203 | <td class="label"><label>{ts}Registered By{/ts}</label></td> | |
204 | <td class="view-value"> | |
205 | <a href="{crmURL p='civicrm/contact/view/participant' q="reset=1&id=$participant_registered_by_id&cid=$registered_by_contact_id&action=view"}" | |
206 | title="{ts}view primary participant{/ts}">{$registered_by_display_name}</a> | |
207 | </td> | |
208 | </tr> | |
209 | {/if} | |
210 | {/if} | |
211 | {if $participantMode} | |
212 | <tr class="crm-participant-form-block-payment_processor_id"> | |
213 | <td class="label nowrap">{$form.payment_processor_id.label}</td> | |
214 | <td>{$form.payment_processor_id.html}</td> | |
215 | </tr> | |
216 | {/if} | |
217 | <tr class="crm-participant-form-block-event_id"> | |
218 | <td class="label">{$form.event_id.label}</td><td class="view-value bold">{$form.event_id.html} | |
219 | {if $action eq 1 && !$past } | |
b7054e52 | 220 | <br /><a href="#" onclick="buildSelect('event_id'); return false;" |
6a488035 TO |
221 | id='past-event'>» {ts}Include past event(s) in this select list.{/ts}</a> |
222 | {/if} | |
223 | {if $is_test} | |
224 | {ts}(test){/ts} | |
225 | {/if} | |
226 | </td> | |
227 | </tr> | |
228 | ||
229 | {* CRM-7362 --add campaign *} | |
230 | {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" | |
231 | campaignTrClass="crm-participant-form-block-campaign_id"} | |
232 | ||
233 | <tr class="crm-participant-form-block-role_id"> | |
234 | <td class="label">{$form.role_id.label}</td> | |
235 | <td>{$form.role_id.html}</td> | |
236 | </tr> | |
237 | <tr class="crm-participant-form-block-register_date"> | |
238 | <td class="label">{$form.register_date.label}</td> | |
239 | <td> | |
240 | {if $hideCalendar neq true} | |
241 | {include file="CRM/common/jcalendar.tpl" elementName=register_date} | |
242 | {else} | |
243 | {$form.register_date.html|crmDate} | |
244 | {/if} | |
245 | </td> | |
246 | </tr> | |
247 | <tr class="crm-participant-form-block-status_id"> | |
248 | <td class="label">{$form.status_id.label}</td> | |
249 | <td>{$form.status_id.html}{if $event_is_test} {ts}(test){/ts}{/if} | |
250 | <div id="notify">{$form.is_notify.html}{$form.is_notify.label}</div> | |
251 | </td> | |
252 | </tr> | |
253 | <tr class="crm-participant-form-block-source"> | |
254 | <td class="label">{$form.source.label}</td><td>{$form.source.html|crmAddClass:huge}<br /> | |
255 | <span class="description">{ts}Source for this registration (if applicable).{/ts}</span></td> | |
256 | </tr> | |
257 | </table> | |
258 | ||
259 | {* Fee block (EventFees.tpl) is injected here when an event is selected. *} | |
260 | <div id="feeBlock"></div> | |
261 | <fieldset> | |
262 | <table class="form-layout"> | |
263 | <tr class="crm-participant-form-block-note"> | |
264 | <td class="label">{$form.note.label}</td><td>{$form.note.html}</td> | |
265 | </tr> | |
266 | </table> | |
267 | </fieldset> | |
268 | ||
269 | <div class="crm-participant-form-block-customData"> | |
270 | <div id="customData" class="crm-customData-block"></div> {* Participant Custom data *} | |
271 | <div id="customData{$eventNameCustomDataTypeID}" class="crm-customData-block"></div> {* Event Custom Data *} | |
272 | <div id="customData{$roleCustomDataTypeID}" class="crm-customData-block"></div> {* Role Custom Data *} | |
273 | <div id="customData{$eventTypeCustomDataTypeID}" class="crm-customData-block"></div> {* Role Custom Data *} | |
274 | </div> | |
275 | {/if} | |
276 | ||
277 | {if $accessContribution and $action eq 2 and $rows.0.contribution_id} | |
278 | {include file="CRM/Contribute/Form/Selector.tpl" context="Search"} | |
279 | {/if} | |
280 | ||
281 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | |
282 | </div> | |
283 | </div> | |
284 | {if $action eq 1 or $action eq 2} | |
285 | {literal} | |
286 | <script type="text/javascript"> | |
287 | // event select | |
288 | function buildSelect( selectID ) { | |
289 | var elementID = '#' + selectID; | |
290 | cj( elementID ).html(''); | |
291 | var postUrl = "{/literal}{crmURL p='civicrm/ajax/eventlist' h=0}{literal}"; | |
292 | cj.post( postUrl, null, function ( response ) { | |
293 | response = eval( response ); | |
294 | for (i = 0; i < response.length; i++) { | |
295 | cj( elementID ).get(0).add(new Option(response[i].name, response[i].value), document.all ? i : null); | |
296 | } | |
297 | cj('#past-event').hide( ); | |
298 | cj('input[name="past_event"]').val(1); | |
299 | cj("#feeBlock").html( '' ); | |
300 | }); | |
301 | } | |
302 | {/literal} | |
303 | ||
304 | {if $preloadJSSnippet} | |
305 | {$preloadJSSnippet} | |
306 | {else} | |
307 | //build fee block | |
308 | buildFeeBlock( ); | |
309 | {/if} | |
310 | ||
311 | {literal} | |
312 | //build discount block | |
313 | if ( document.getElementById('discount_id') ) { | |
314 | var discountId = document.getElementById('discount_id').value; | |
315 | if ( discountId ) { | |
316 | var eventId = document.getElementById('event_id').value; | |
317 | buildFeeBlock( eventId, discountId ); | |
318 | } | |
319 | } | |
320 | ||
321 | function buildFeeBlock( eventId, discountId ) { | |
322 | var dataUrl = {/literal}"{crmURL p=$urlPath h=0 q='snippet=4'}"; | |
323 | dataUrl = dataUrl + '&qfKey=' + '{$qfKey}' | |
324 | ||
325 | {if $urlPathVar} | |
326 | dataUrl = dataUrl + '&' + '{$urlPathVar}' | |
327 | {/if} | |
328 | ||
329 | {literal} | |
330 | if ( !eventId ) { | |
331 | var eventId = document.getElementById('event_id').value; | |
332 | } | |
333 | ||
334 | if ( eventId) { | |
335 | dataUrl = dataUrl + '&eventId=' + eventId; | |
336 | } | |
337 | else { | |
338 | cj('#eventFullMsg').hide( ); | |
339 | cj('#feeBlock').html(''); | |
340 | return; | |
341 | } | |
342 | ||
343 | var participantId = "{/literal}{$participantId}{literal}"; | |
344 | ||
345 | if ( participantId ) { | |
346 | dataUrl = dataUrl + '&participantId=' + participantId; | |
347 | } | |
348 | ||
349 | if ( discountId ) { | |
350 | dataUrl = dataUrl + '&discountId=' + discountId; | |
351 | } | |
352 | ||
353 | cj.ajax({ | |
354 | url: dataUrl, | |
355 | async: false, | |
356 | global: false, | |
357 | success: function ( html ) { | |
358 | cj("#feeBlock").html( html ); | |
359 | } | |
360 | }); | |
361 | ||
362 | cj("#feeBlock").ajaxStart(function(){ | |
363 | cj(".disable-buttons input").attr('disabled', true); | |
364 | }); | |
365 | ||
366 | cj("#feeBlock").ajaxStop(function(){ | |
367 | cj(".disable-buttons input").attr('disabled', false); | |
368 | }); | |
369 | ||
370 | //show event real full as well as waiting list message. | |
371 | if ( cj("#hidden_eventFullMsg").val( ) ) { | |
372 | cj( "#eventFullMsg" ).show( ).html( cj("#hidden_eventFullMsg" ).val( ) ); | |
373 | } | |
374 | else { | |
375 | cj( "#eventFullMsg" ).hide( ); | |
376 | } | |
377 | } | |
378 | ||
379 | </script> | |
380 | {/literal} | |
381 | ||
382 | {*include custom data js file*} | |
383 | {include file="CRM/common/customData.tpl"} | |
384 | {literal} | |
385 | <script type="text/javascript"> | |
386 | var roleGroupMapper = new Array( ); | |
387 | {/literal} | |
388 | {foreach from=$participantRoleIds item="grps" key="rlId"} | |
389 | {literal} | |
390 | roleGroupMapper[{/literal}{$rlId}{literal}] = '{/literal}{$grps}{literal}'; | |
391 | {/literal} | |
392 | {/foreach} | |
393 | {literal} | |
394 | ||
395 | function buildParticipantRole( eventID ) { | |
396 | var dataUrl = "{/literal}{crmURL p='civicrm/ajax/rest' q='className=CRM_Event_Page_AJAX&fnName=participantRole&json=1&context=participant' h=0 }"{literal}; | |
397 | ||
398 | if ( !eventId ) { | |
399 | var eventId = document.getElementById( 'event_id' ).value; | |
400 | } | |
401 | ||
402 | if ( eventId ) { | |
403 | dataUrl = dataUrl + '&eventId=' + eventID; | |
404 | } | |
405 | ||
406 | cj.ajax({ | |
407 | url: dataUrl, | |
408 | async: false, | |
409 | global: false, | |
410 | dataType: "json", | |
411 | success: function ( response ) { | |
412 | if ( response.role ) { | |
413 | for ( var i in roleGroupMapper ) { | |
414 | if ( i != 0 ) { | |
415 | if ( i == response.role ) { | |
416 | document.getElementById("role_id_" +i ).checked = true; | |
417 | } | |
418 | else { | |
419 | document.getElementById("role_id_" +i ).checked = false; | |
420 | } | |
421 | showCustomData( 'Participant', i, {/literal} {$roleCustomDataTypeID} {literal} ); | |
422 | } | |
423 | } | |
424 | } | |
425 | } | |
426 | }); | |
427 | } | |
428 | ||
429 | function showCustomData( type, subType, subName ) { | |
430 | var dataUrl = {/literal}"{crmURL p=$urlPath h=0 q='snippet=4&type='}"{literal} + type; | |
431 | var roleid = "role_id_"+subType; | |
432 | var loadData = false; | |
433 | ||
434 | if ( document.getElementById( roleid ).checked == true ) { | |
435 | if ( roleGroupMapper[subType] ) { | |
436 | var splitGroup = roleGroupMapper[subType].split(","); | |
437 | for ( i = 0; i < splitGroup.length; i++ ) { | |
438 | var roleCustomGroupId = splitGroup[i]; | |
439 | if ( cj( '#'+roleCustomGroupId ).length > 0 ) { | |
440 | cj( '#'+roleCustomGroupId ).remove( ); | |
441 | } | |
442 | } | |
443 | loadData = true; | |
444 | } | |
445 | ||
446 | if ( loadData && roleGroupMapper[0] ) { | |
447 | var splitGroup = roleGroupMapper[0].split(","); | |
448 | for ( i = 0; i < splitGroup.length; i++ ) { | |
449 | var roleCustomGroupId = splitGroup[i]; | |
450 | if ( cj( '#'+roleCustomGroupId ).length > 0 ) { | |
451 | cj( '#'+roleCustomGroupId ).remove( ); | |
452 | } | |
453 | } | |
454 | } | |
455 | } | |
456 | else { | |
457 | var groupUnload = new Array( ); | |
458 | var x = 0; | |
459 | ||
460 | if ( roleGroupMapper[0] ) { | |
461 | var splitGroup = roleGroupMapper[0].split(","); | |
462 | for ( x = 0; x < splitGroup.length; x++ ) { | |
463 | groupUnload[x] = splitGroup[x]; | |
464 | } | |
465 | } | |
466 | ||
467 | for ( var i in roleGroupMapper ) { | |
468 | if ( ( i > 0 ) && ( document.getElementById( "role_id_"+i ).checked ) ) { | |
469 | var splitGroup = roleGroupMapper[i].split(","); | |
470 | for ( j = 0; j < splitGroup.length; j++ ) { | |
471 | groupUnload[x+j+1] = splitGroup[j]; | |
472 | } | |
473 | } | |
474 | } | |
475 | ||
476 | if ( roleGroupMapper[subType] ) { | |
477 | var splitGroup = roleGroupMapper[subType].split(","); | |
478 | for ( i = 0; i < splitGroup.length; i++ ) { | |
479 | var roleCustomGroupId = splitGroup[i]; | |
480 | if ( cj( '#'+roleCustomGroupId ).length > 0 ) { | |
481 | if ( cj.inArray( roleCustomGroupId, groupUnload ) == -1 ) { | |
482 | cj( '#'+roleCustomGroupId ).remove( ); | |
483 | } | |
484 | } | |
485 | } | |
486 | } | |
487 | } | |
488 | ||
489 | if ( !( loadData ) ) { | |
490 | return false; | |
491 | } | |
492 | ||
493 | if ( subType ) { | |
494 | dataUrl = dataUrl + '&subType=' + subType; | |
495 | } | |
496 | ||
497 | if ( subName ) { | |
498 | dataUrl = dataUrl + '&subName=' + subName; | |
499 | cj( '#customData' + subName ).show( ); | |
500 | } | |
501 | else { | |
502 | cj( '#customData' ).show( ); | |
503 | } | |
504 | ||
505 | {/literal} | |
506 | {if $urlPathVar} | |
507 | dataUrl = dataUrl + '&' + '{$urlPathVar}' | |
508 | {/if} | |
509 | {if $groupID} | |
510 | dataUrl = dataUrl + '&groupID=' + '{$groupID}' | |
511 | {/if} | |
512 | {if $qfKey} | |
513 | dataUrl = dataUrl + '&qfKey=' + '{$qfKey}' | |
514 | {/if} | |
515 | {if $entityID} | |
516 | dataUrl = dataUrl + '&entityID=' + '{$entityID}' | |
517 | {/if} | |
518 | ||
519 | {literal} | |
520 | ||
521 | if ( subName && subName != 'null' ) { | |
522 | var fname = '#customData' + subName; | |
523 | } | |
524 | else { | |
525 | var fname = '#customData'; | |
526 | } | |
527 | ||
528 | var response = cj.ajax({url: dataUrl, | |
529 | async: false | |
530 | }).responseText; | |
531 | ||
532 | if ( subType != 'null' ) { | |
533 | if ( document.getElementById(roleid).checked == true ) { | |
534 | var response_text = '<div style="display:block;" id = '+subType+'_chk >'+response+'</div>'; | |
535 | cj( fname ).append(response_text); | |
536 | } | |
537 | else { | |
538 | cj('#'+subType+'_chk').remove(); | |
539 | } | |
540 | } | |
541 | } | |
542 | ||
543 | cj(function() { | |
544 | {/literal} | |
545 | CRM.buildCustomData( '{$customDataType}', 'null', 'null' ); | |
546 | {literal} | |
547 | for ( var i in roleGroupMapper ) { | |
548 | if ( ( i > 0 ) && ( document.getElementById( "role_id_"+i ).checked ) ) { | |
549 | {/literal} | |
550 | showCustomData( '{$customDataType}', i, {$roleCustomDataTypeID} ); | |
551 | {literal} | |
552 | } | |
553 | } | |
554 | {/literal} | |
555 | {if $eventID} | |
556 | CRM.buildCustomData( '{$customDataType}', {$eventID}, {$eventNameCustomDataTypeID} ); | |
557 | {/if} | |
558 | {if $eventTypeID} | |
559 | CRM.buildCustomData( '{$customDataType}', {$eventTypeID}, {$eventTypeCustomDataTypeID} ); | |
560 | {/if} | |
561 | {literal} | |
562 | ||
563 | //call pane js | |
564 | cj().crmAccordions(); | |
565 | }); | |
566 | </script> | |
567 | {/literal} | |
568 | ||
569 | {/if} | |
570 | ||
571 | {* include jscript to warn if unsaved form field changes *} | |
572 | {include file="CRM/common/formNavigate.tpl"} | |
573 | ||
574 | {/if} {* end of eventshow condition*} | |
575 | ||
576 | <script type="text/javascript"> | |
577 | {literal} | |
578 | if(cj("#priceset").length == 0) { | |
579 | cj('.initial-payment').hide(); | |
580 | }else { | |
581 | cj('.initial-payment').show(); | |
582 | } | |
583 | sendNotification(); | |
584 | cj("#notify").hide(); | |
585 | function sendNotification( ) { | |
586 | var status = cj("select#status_id option:selected").text(); | |
587 | cj("#notify").hide(); | |
588 | ||
589 | if ( status == 'Cancelled' || | |
590 | status == 'Pending from waitlist' || | |
591 | status == 'Pending from approval' || | |
592 | status == 'Expired' ) { | |
593 | cj("#notify").show(); | |
594 | cj("#is_notify").attr('checked',true); | |
595 | } | |
596 | } | |
597 | ||
598 | function buildEventTypeCustomData( eventID, eventTypeCustomDataTypeID, eventAndTypeMapping ) { | |
599 | var mapping = eval('(' + eventAndTypeMapping + ')'); | |
600 | CRM.buildCustomData( 'Participant', mapping[eventID], eventTypeCustomDataTypeID ); | |
601 | } | |
602 | ||
603 | function loadCampaign( eventId, campaigns ) { | |
604 | cj( "#campaign_id" ).val( campaigns[eventId] ); | |
605 | } | |
606 | ||
607 | {/literal} | |
608 | {if $profileCreateCallback} | |
609 | {literal} | |
610 | function profileCreateCallback( blockNo ) { | |
611 | if( cj('#event_id').val( ) && cj('#email-receipt').length > 0 ) { | |
612 | checkEmail( ); | |
613 | } | |
614 | } | |
615 | {/literal} | |
616 | {/if} | |
617 | </script> | |
618 | {literal} | |
619 | <script type="text/javascript"> | |
620 | cj(function() { | |
621 | cj().crmAccordions(); | |
622 | }); | |
623 | </script> | |
624 | {/literal} | |
625 |