2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
26 {* This template is used for adding/editing/deleting offline Event Registrations *}
29 <div id='validate_pricefield' class='messages crm-error hiddenElement'></div>
31 <script type="text/javascript">
33 var fieldOptionsFull = new Array( );
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}
40 fieldOptionsFull[{/literal}{$fldId}{literal}] = new Array( );
41 fieldOptionsFull[{/literal}{$fldId}{literal}][{/literal}{$opId}{literal}] = 1;
49 if ( fieldOptionsFull.length > 0 ) {
51 cj("input,#priceset select,#priceset").each(function () {
52 if ( cj(this).attr('price') ) {
53 switch( cj(this).attr('type') ) {
56 cj(this).click( function() {
57 validatePriceField(this);
62 cj(this).change( function() {
63 validatePriceField(this);
67 cj(this).bind( 'keyup', function() { validatePriceField(this) });
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];
82 var eleId = namePart[1];
84 var showError = false;
86 switch( cj(obj).attr('type') ) {
88 if ( fieldOptionsFull[eleId] && fldVal ) {
90 cj(obj).parent( ).parent( ).children('.label').addClass('crm-error');
93 cj(obj).parent( ).parent( ).children('.label').removeClass('crm-error');
94 cj('#validate_pricefield').hide( ).html('');
99 var checkBoxValue = eleIdpart[1].split(']');
100 if ( cj(obj).prop("checked") == true &&
101 fieldOptionsFull[eleId] &&
102 fieldOptionsFull[eleId][checkBoxValue[0]]) {
104 cj(obj).parent( ).addClass('crm-error');
107 cj(obj).parent( ).removeClass('crm-error');
112 if ( fieldOptionsFull[eleId] &&
113 fieldOptionsFull[eleId][fldVal] ) {
115 cj(obj).parent( ).addClass('crm-error');
118 cj(obj).parent( ).removeClass('crm-error');
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}");
126 cj('#validate_pricefield').hide( ).html('');
131 // change the status to default 'partially paid' for partial payments
133 var userModifiedAmount;
138 feeAmount = cj(this).val();
139 feeAmount = parseInt(feeAmount);
144 userModifiedAmount = cj(this).val();
145 userModifiedAmount = parseInt(userModifiedAmount);
146 if (userModifiedAmount < feeAmount) {
147 cj('#status_id').val(CRM.partiallyPaidStatusId);
152 cj('#Participant').submit(
154 var userSubmittedStatus = cj('#status_id').val();
155 var statusLabel = cj('#status_id option:selected').text();
156 if (userModifiedAmount < feeAmount && userSubmittedStatus != CRM.partiallyPaidStatusId) {
157 var result = confirm('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 ' + statusLabel + '? Click OK to continue, Cancel to change your entries.');
158 if (result == false) {
167 {include file="CRM/Event/Form/EventFees.tpl"}
169 {include file="CRM/Custom/Form/CustomData.tpl"}
171 {if $participantMode == 'test' }
172 {assign var=registerMode value="TEST"}
173 {elseif $participantMode == 'live'}
174 {assign var=registerMode value="LIVE"}
176 <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>
177 <div class="crm-block crm-form-block crm-participant-form-block">
178 <div class="view-content">
179 {if $participantMode}
181 {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}
184 <div id="eventFullMsg" class="messages status no-popup" style="display:none;"></div>
187 {if $action eq 1 AND $paid}
189 {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}
193 {if $action eq 8} {* If action is Delete *}
194 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
195 <div class="crm-participant-form-block-delete messages status no-popup">
196 <div class="crm-content">
197 <div class="icon inform-icon"></div>
198 {ts}WARNING: Deleting this registration will result in the loss of related payment records (if any).{/ts} {ts}Do you want to continue?{/ts}
200 {if $additionalParticipant}
201 <div class="crm-content">
202 {ts 1=$additionalParticipant} There are %1 more Participant(s) registered by this participant.{/ts}
206 {if $additionalParticipant}
207 {$form.delete_participant.html}
209 {else} {* If action is other than Delete *}
210 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
211 <table class="form-layout-compressed">
212 {if $single and $context neq 'standalone'}
213 <tr class="crm-participant-form-block-displayName">
214 <td class="label font-size12pt"><label>{ts}Participant{/ts}</label></td>
215 <td class="font-size12pt view-value">{$displayName} </td>
218 {if !$participantMode and !$email and $outBound_option != 2 }
219 {assign var='profileCreateCallback' value=1}
221 <tr class="crm-participant-form-contact-id">
222 <td class="label">{$form.contact_id.label}</td>
223 <td>{$form.contact_id.html}</td>
227 {if $additionalParticipants} {* Display others registered by this participant *}
228 <tr class="crm-participant-form-block-additionalParticipants">
229 <td class="label"><label>{ts}Also Registered by this Participant{/ts}</label></td>
231 {foreach from=$additionalParticipants key=apName item=apURL}
232 <a href="{$apURL}" title="{ts}view additional participant{/ts}">{$apName}</a><br />
237 {if $registered_by_contact_id}
238 <tr class="crm-participant-form-block-registered-by">
239 <td class="label"><label>{ts}Registered By{/ts}</label></td>
240 <td class="view-value">
241 <a href="{crmURL p='civicrm/contact/view/participant' q="reset=1&id=$participant_registered_by_id&cid=$registered_by_contact_id&action=view"}"
242 title="{ts}view primary participant{/ts}">{$registered_by_display_name}</a>
247 {if $participantMode}
248 <tr class="crm-participant-form-block-payment_processor_id">
249 <td class="label nowrap">{$form.payment_processor_id.label}</td>
250 <td>{$form.payment_processor_id.html}</td>
253 <tr class="crm-participant-form-block-event_id">
254 <td class="label">{$form.event_id.label}</td><td class="view-value bold">{$form.event_id.html}
255 {if $action eq 1}<span id='past-event-section'>
256 <br />» <span id="showing-event-info"></span>
264 {* CRM-7362 --add campaign *}
265 {include file="CRM/Campaign/Form/addCampaignToComponent.tpl"
266 campaignTrClass="crm-participant-form-block-campaign_id"}
268 <tr class="crm-participant-form-block-role_id">
269 <td class="label">{$form.role_id.label}</td>
270 <td>{$form.role_id.html}</td>
272 <tr class="crm-participant-form-block-register_date">
273 <td class="label">{$form.register_date.label}</td>
275 {if $hideCalendar neq true}
276 {include file="CRM/common/jcalendar.tpl" elementName=register_date}
278 {$form.register_date.html|crmDate}
282 <tr class="crm-participant-form-block-status_id">
283 <td class="label">{$form.status_id.label}</td>
284 <td>{$form.status_id.html}{if $event_is_test} {ts}(test){/ts}{/if}
285 <div id="notify">{$form.is_notify.html}{$form.is_notify.label}</div>
288 <tr class="crm-participant-form-block-source">
289 <td class="label">{$form.source.label}</td><td>{$form.source.html|crmAddClass:huge}<br />
290 <span class="description">{ts}Source for this registration (if applicable).{/ts}</span></td>
294 <table class='form-layout'>
296 <td class='label'>{ts}Fees{/ts}</td>
297 {* this is where the payment info is shown using CRM/Contribute/Page/PaymentInfo.tpl tpl*}
298 <td id='payment-info'></td>
302 {* Fee block (EventFees.tpl) is injected here when an event is selected. *}
303 <div id="feeBlock"></div>
305 <table class="form-layout">
306 <tr class="crm-participant-form-block-note">
307 <td class="label">{$form.note.label}</td><td>{$form.note.html}</td>
312 <div class="crm-participant-form-block-customData">
313 <div id="customData" class="crm-customData-block"></div> {* Participant Custom data *}
314 <div id="customData{$eventNameCustomDataTypeID}" class="crm-customData-block"></div> {* Event Custom Data *}
315 <div id="customData{$roleCustomDataTypeID}" class="crm-customData-block"></div> {* Role Custom Data *}
316 <div id="customData{$eventTypeCustomDataTypeID}" class="crm-customData-block"></div> {* Role Custom Data *}
320 {if $accessContribution and $action eq 2 and $rows.0.contribution_id}
321 {include file="CRM/Contribute/Form/Selector.tpl" context="Search"}
324 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
327 {if $action eq 1 or $action eq 2}
329 {include file="CRM/Contribute/Page/PaymentInfo.tpl" show='event-payment'}
332 <script type="text/javascript">
334 function buildSelect( selectID, listallVal ) {
335 var elementID = '#' + selectID;
336 cj( elementID ).html('');
337 var postUrl = "{/literal}{crmURL p='civicrm/ajax/eventlist' h=0}{literal}";
338 cj.post( postUrl, {listall:listallVal}, function ( response ) {
339 response = eval( response );
340 for (i = 0; i < response.length; i++) {
341 cj( elementID ).get(0).add(new Option(response[i].name, response[i].value), document.all ? i : null);
343 getShowEventInfo(listallVal);
344 cj('input[name="past_event"]').val(listallVal);
345 cj("#feeBlock").html( '' );
350 {if $action eq 1}getShowEventInfo({$past});{/if}
353 function getShowEventInfo (listallVal) {
356 cj('#showing-event-info').html({/literal}'{ts}Showing all events: show{/ts}'{literal}+' <a href="#" onclick="buildSelect(\'event_id\', 0); return false;">'+{/literal}'{ts}current and future{/ts}'{literal}+'</a> | <a href="#" onclick="buildSelect(\'event_id\', 2); return false;">'+{/literal}'{ts}past three months{/ts}'{literal}+'</a>');
359 cj('#showing-event-info').html({/literal}'{ts}Showing events since three months ago: show{/ts}'{literal}+' <a href="#" onclick="buildSelect(\'event_id\', 0); return false;">'+{/literal}'{ts}current and future{/ts}'{literal}+'</a> | <a href="#" onclick="buildSelect(\'event_id\', 1); return false;">'+{/literal}'{ts}all{/ts}'{literal}+'</a>');
362 cj('#showing-event-info').html({/literal}'{ts}Showing current and future events: show{/ts}'{literal}+' <a href="#" onclick="buildSelect(\'event_id\', 2); return false;">'+{/literal}'{ts}past three months{/ts}'{literal}+'</a> | <a href="#" onclick="buildSelect(\'event_id\', 1); return false;">'+{/literal}'{ts}all{/ts}'{literal}+'</a>');
368 {if $preloadJSSnippet}
376 //build discount block
377 if ( document.getElementById('discount_id') ) {
378 var discountId = document.getElementById('discount_id').value;
380 var eventId = document.getElementById('event_id').value;
381 buildFeeBlock( eventId, discountId );
385 function buildFeeBlock( eventId, discountId ) {
386 var dataUrl = {/literal}"{crmURL p=$urlPath h=0 q='snippet=4'}";
387 dataUrl = dataUrl + '&qfKey=' + '{$qfKey}'
390 dataUrl = dataUrl + '&' + '{$urlPathVar}'
395 var eventId = document.getElementById('event_id').value;
399 dataUrl = dataUrl + '&eventId=' + eventId;
402 cj('#eventFullMsg').hide( );
403 cj('#feeBlock').html('');
407 var participantId = "{/literal}{$participantId}{literal}";
409 if ( participantId ) {
410 dataUrl = dataUrl + '&participantId=' + participantId;
414 dataUrl = dataUrl + '&discountId=' + discountId;
421 success: function ( html ) {
422 cj("#feeBlock").html( html );
426 cj("#feeBlock").ajaxStart(function(){
427 cj(".disable-buttons input").prop('disabled', true);
430 cj("#feeBlock").ajaxStop(function(){
431 cj(".disable-buttons input").prop('disabled', false);
434 //show event real full as well as waiting list message.
435 if ( cj("#hidden_eventFullMsg").val( ) ) {
436 cj( "#eventFullMsg" ).show( ).html( cj("#hidden_eventFullMsg" ).val( ) );
439 cj( "#eventFullMsg" ).hide( );
446 {*include custom data js file*}
447 {include file="CRM/common/customData.tpl"}
449 <script type="text/javascript">
450 var roleGroupMapper = new Array( );
452 {foreach from=$participantRoleIds item="grps" key="rlId"}
454 roleGroupMapper[{/literal}{$rlId}{literal}] = '{/literal}{$grps}{literal}';
459 function buildParticipantRole( eventID ) {
460 var dataUrl = "{/literal}{crmURL p='civicrm/ajax/rest' q='className=CRM_Event_Page_AJAX&fnName=participantRole&json=1&context=participant' h=0 }"{literal};
463 var eventId = document.getElementById( 'event_id' ).value;
467 dataUrl = dataUrl + '&eventId=' + eventID;
475 success: function ( response ) {
476 if ( response.role ) {
477 for ( var i in roleGroupMapper ) {
479 if ( i == response.role ) {
480 document.getElementById("role_id_" +i ).checked = true;
483 document.getElementById("role_id_" +i ).checked = false;
485 showCustomData( 'Participant', i, {/literal} {$roleCustomDataTypeID} {literal} );
493 function showCustomData( type, subType, subName ) {
494 var dataUrl = {/literal}"{crmURL p=$urlPath h=0 q='snippet=4&type='}"{literal} + type;
495 var roleid = "role_id_"+subType;
496 var loadData = false;
498 if ( document.getElementById( roleid ).checked == true ) {
499 if ( roleGroupMapper[subType] ) {
500 var splitGroup = roleGroupMapper[subType].split(",");
501 for ( i = 0; i < splitGroup.length; i++ ) {
502 var roleCustomGroupId = splitGroup[i];
503 if ( cj( '#'+roleCustomGroupId ).length > 0 ) {
504 cj( '#'+roleCustomGroupId ).remove( );
511 var groupUnload = new Array( );
514 if ( roleGroupMapper[0] ) {
515 var splitGroup = roleGroupMapper[0].split(",");
516 for ( x = 0; x < splitGroup.length; x++ ) {
517 groupUnload[x] = splitGroup[x];
521 for ( var i in roleGroupMapper ) {
522 if ( ( i > 0 ) && ( document.getElementById( "role_id_"+i ).checked ) ) {
523 var splitGroup = roleGroupMapper[i].split(",");
524 for ( j = 0; j < splitGroup.length; j++ ) {
525 groupUnload[x+j+1] = splitGroup[j];
530 if ( roleGroupMapper[subType] ) {
531 var splitGroup = roleGroupMapper[subType].split(",");
532 for ( i = 0; i < splitGroup.length; i++ ) {
533 var roleCustomGroupId = splitGroup[i];
534 if ( cj( '#'+roleCustomGroupId ).length > 0 ) {
535 if ( cj.inArray( roleCustomGroupId, groupUnload ) == -1 ) {
536 cj( '#'+roleCustomGroupId ).remove( );
543 if ( !( loadData ) ) {
548 dataUrl = dataUrl + '&subType=' + subType;
552 dataUrl = dataUrl + '&subName=' + subName;
553 cj( '#customData' + subName ).show( );
556 cj( '#customData' ).show( );
561 dataUrl = dataUrl + '&' + '{$urlPathVar}'
564 dataUrl = dataUrl + '&groupID=' + '{$groupID}'
567 dataUrl = dataUrl + '&qfKey=' + '{$qfKey}'
570 dataUrl = dataUrl + '&entityID=' + '{$entityID}'
575 if ( subName && subName != 'null' ) {
576 var fname = '#customData' + subName;
579 var fname = '#customData';
582 var response = cj.ajax({url: dataUrl,
586 if ( subType != 'null' ) {
587 if ( document.getElementById(roleid).checked == true ) {
588 var response_text = '<div style="display:block;" id = '+subType+'_chk >'+response+'</div>';
589 cj( fname ).append(response_text);
592 cj('#'+subType+'_chk').remove();
599 CRM.buildCustomData( '{$customDataType}', 'null', 'null' );
601 for ( var i in roleGroupMapper ) {
602 if ( ( i > 0 ) && ( document.getElementById( "role_id_"+i ).checked ) ) {
604 showCustomData( '{$customDataType}', i, {$roleCustomDataTypeID} );
610 CRM.buildCustomData( '{$customDataType}', {$eventID}, {$eventNameCustomDataTypeID} );
613 CRM.buildCustomData( '{$customDataType}', {$eventTypeID}, {$eventTypeCustomDataTypeID} );
618 cj().crmAccordions();
625 {* include jscript to warn if unsaved form field changes *}
626 {include file="CRM/common/formNavigate.tpl"}
628 <script type="text/javascript">
632 function sendNotification() {
633 var notificationStatusIds = {/literal}"{$notificationStatusIds}"{literal};
634 notificationStatusIds = notificationStatusIds.split(',');
635 if (cj.inArray(cj('select#status_id option:selected').val(), notificationStatusIds) > -1) {
636 cj("#notify").show();
637 cj("#is_notify").prop('checked', true);
640 cj("#notify").hide();
641 cj("#is_notify").prop('checked', false);
645 function buildEventTypeCustomData( eventID, eventTypeCustomDataTypeID, eventAndTypeMapping ) {
646 var mapping = eval('(' + eventAndTypeMapping + ')');
647 CRM.buildCustomData( 'Participant', mapping[eventID], eventTypeCustomDataTypeID );
650 function loadCampaign( eventId, campaigns ) {
651 cj( "#campaign_id" ).val( campaigns[eventId] );
655 {if $profileCreateCallback}
657 function profileCreateCallback( blockNo ) {
658 if( cj('#event_id').val( ) && cj('#email-receipt').length > 0 ) {
666 <script type="text/javascript">
668 cj().crmAccordions();
673 {/if} {* end of main event block*}