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