Merge pull request #9605 from ErichBSchulz/patch-4
[civicrm-core.git] / templates / CRM / Event / Form / EventFees.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2017 |
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 {assign var=isRecordPayment value=1 }
27 {if $isFTPermissionDenied}
28 <script>
29 {literal}
30 CRM.alert(ts('You do not have all the permissions needed for this page.'), 'Permission Denied', 'error');
31 {/literal}
32 </script>
33 {/if}
34 {if $paid} {* We retrieve this tpl when event is selected - keep it empty if event is not paid *}
35 <table class="form-layout">
36 {if $priceSet}
37 {if $discount and $hasPayment}
38 <tr class="crm-event-eventfees-form-block-discount"><td class="label">&nbsp;&nbsp;{ts}Discount Set{/ts}</td><td class="view-value">{$discount}</td></tr>
39 {elseif $form.discount_id.label}
40 <tr class="crm-event-eventfees-form-block-discount_id"><td class="label">&nbsp;&nbsp;{$form.discount_id.label}</td><td>{$form.discount_id.html}</td></tr>
41 {/if}
42 {if $action eq 2 and $hasPayment} {* Updating *}
43 {if $lineItem}
44 <tr class="crm-event-eventfees-form-block-line_items">
45 <td class="label">{ts}Selections{/ts}</td>
46 <td>{include file="CRM/Price/Page/LineItem.tpl" context="Event"}</td>
47 </tr>
48 {else}
49 <tr class="crm-event-eventfees-form-block-event_level">
50 <td class="label">{ts}Event Level{/ts}</td>
51 <td>{$fee_level}&nbsp;{if $fee_amount}- {$fee_amount|crmMoney:$fee_currency}{/if}</td>
52 </tr>
53 {/if}
54 <tr>
55 <td></td>
56 <td>
57 <a class="action-item crm-hover-button" href='{crmURL p="civicrm/event/participant/feeselection" q="reset=1&id=`$participantId`&cid=`$contactId`&action=update"}'><i class="crm-i fa-pencil"></i> {ts}Change Selections{/ts}</a>
58 </td>
59 </tr>
60 {else} {* New participant *}
61 {if $priceSet.fields}
62 <fieldset id="priceset" class="crm-group priceset-group">
63 <tr class="crm-event-eventfees-form-block-price_set_amount">
64 <td class="label" style="padding-top: 10px;">{$form.amount.label}</td>
65 <td class="view-value"><table class="form-layout">{include file="CRM/Price/Form/PriceSet.tpl" extends="Event"}</td>
66 </fieldset>
67 {else}
68 {assign var=isRecordPayment value=0 }
69 <div class='messages status'>{ts}No active price fields found for this event!{/ts}</div>
70 {/if}
71 </table>
72 {/if}
73 </td>
74 </tr>
75 {/if}
76
77 {if $accessContribution and ! $participantMode and ($action neq 2 or !$rows.0.contribution_id or $onlinePendingContributionId) and $isRecordPayment and ! $registeredByParticipantId }
78 <tr class="crm-event-eventfees-form-block-record_contribution">
79 <td class="label">{$form.record_contribution.label}</td>
80 <td>{$form.record_contribution.html}<br />
81 <span class="description">{ts}Check this box to enter payment information. You will also be able to generate a customized receipt.{/ts}</span>
82 </td>
83 </tr>
84 <tr id="payment_information" class="crm-event-eventfees-form-block-payment_information">
85 <td class ='html-adjust' colspan=2>
86 <fieldset><legend>{ts}Payment Information{/ts}</legend>
87 <table id="recordContribution" class="form-layout" style="width:auto;">
88 <tr class="crm-event-eventfees-form-block-financial_type_id">
89 <td class="label">{$form.financial_type_id.label}<span class="crm-marker"> *</span></td>
90 <td>{$form.financial_type_id.html}<br /><span class="description">{ts}Select the appropriate financial type for this payment.{/ts}</span></td>
91 </tr>
92 <tr class="crm-event-eventfees-form-block-total_amount"><td class="label">{$form.total_amount.label}</td><td>{$form.total_amount.html|crmMoney:$currency}</td></tr>
93 <tr>
94 <td class="label" >{$form.receive_date.label}</td>
95 <td>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}</td>
96 </tr>
97 <tr class="crm-event-eventfees-form-block-payment_instrument_id"><td class="label">{$form.payment_instrument_id.label}<span class="crm-marker"> *</span></td><td>{$form.payment_instrument_id.html} {help id="payment_instrument_id" file="CRM/Contribute/Page/Tab.hlp"}</td></tr>
98 <tr id="checkNumber" class="crm-event-eventfees-form-block-check_number"><td class="label">{$form.check_number.label}</td><td>{$form.check_number.html|crmAddClass:six}</td></tr>
99 {if $showTransactionId }
100 <tr class="crm-event-eventfees-form-block-trxn_id"><td class="label">{$form.trxn_id.label}</td><td>{$form.trxn_id.html}</td></tr>
101 {/if}
102 <tr class="crm-event-eventfees-form-block-contribution_status_id"><td class="label">{$form.contribution_status_id.label}</td><td>{$form.contribution_status_id.html}</td></tr>
103 </table>
104 </fieldset>
105 </td>
106 </tr>
107
108 {* Record contribution field only present if we are NOT in submit credit card mode (! participantMode). *}
109 {include file="CRM/common/showHideByFieldValue.tpl"
110 trigger_field_id ="record_contribution"
111 trigger_value =""
112 target_element_id ="payment_information"
113 target_element_type ="table-row"
114 field_type ="radio"
115 invert = 0
116 }
117 {/if}
118 </table>
119
120 {/if}
121
122 {* credit card block when it is live or test mode*}
123 {if $participantMode and $paid}
124 <div class="spacer"></div>
125 {include file='CRM/Core/BillingBlockWrapper.tpl'}
126 {/if}
127 {if ($email OR $batchEmail) and $outBound_option != 2}
128 <fieldset id="send_confirmation_receipt"><legend>{if $paid}{ts}Registration Confirmation and Receipt{/ts}{else}{ts}Registration Confirmation{/ts}{/if}</legend>
129 <table class="form-layout" style="width:auto;">
130 <tr class="crm-event-eventfees-form-block-send_receipt">
131 <td class="label">{if $paid}{ts}Send Confirmation and Receipt{/ts}{else}{ts}Send Confirmation{/ts}{/if}</td>
132 <td>{$form.send_receipt.html}<br>
133 {if $paid}
134 <span class="description">{ts 1=$email}Automatically email a confirmation and receipt to %1?{/ts}</span></td>
135 {else}
136 <span class="description">{ts 1=$email}Automatically email a confirmation to %1?{/ts}</span></td>
137 {/if}
138 </tr>
139 <tr id="from-email" class="crm-event-eventfees-form-block-from_email_address">
140 <td class="label">{$form.from_email_address.label}</td>
141 <td>{$form.from_email_address.html} {help id ="id-from_email" file="CRM/Contact/Form/Task/Email.hlp"}</td>
142 </tr>
143 <tr id='notice' class="crm-event-eventfees-form-block-receipt_text">
144 <td class="label">{$form.receipt_text.label}</td>
145 <td><span class="description">
146 {ts}Enter a message you want included at the beginning of the confirmation email. EXAMPLE: 'Thanks for registering for this event.'{/ts}
147 </span><br />
148 {$form.receipt_text.html|crmAddClass:huge}
149 </td>
150 </tr>
151 </table>
152 </fieldset>
153 {elseif $context eq 'standalone' and $outBound_option != 2 }
154 <fieldset id="email-receipt" style="display:none;"><legend>{if $paid}{ts}Registration Confirmation and Receipt{/ts}{else}{ts}Registration Confirmation{/ts}{/if}</legend>
155 <table class="form-layout" style="width:auto;">
156 <tr class="crm-event-eventfees-form-block-send_receipt">
157 <td class="label">{if $paid}{ts}Send Confirmation and Receipt{/ts}{else}{ts}Send Confirmation{/ts}{/if}</td>
158 <td>{$form.send_receipt.html}<br>
159 {if $paid}
160 <span class="description">{ts 1='<span id="email-address"></span>'}Automatically email a confirmation and receipt to %1?{/ts}</span>
161 {else}
162 <span class="description">{ts 1='<span id="email-address"></span>'}Automatically email a confirmation to %1?{/ts}</span>
163 {/if}
164 </td>
165 </tr>
166 <tr id="from-email" class="crm-event-eventfees-form-block-from_email_address">
167 <td class="label">{$form.from_email_address.label}</td>
168 <td>{$form.from_email_address.html} {help id ="id-from_email" file="CRM/Contact/Form/Task/Email.hlp"}</td>
169 </tr>
170 <tr id='notice' class="crm-event-eventfees-form-block-receipt_text">
171 <td class="label">{$form.receipt_text.label}</td>
172 <td><span class="description">
173 {ts}Enter a message you want included at the beginning of the confirmation email. EXAMPLE: 'Thanks for registering for this event.'{/ts}
174 </span><br />
175 {$form.receipt_text.html|crmAddClass:huge}</td>
176 </tr>
177 </table>
178 </fieldset>
179 {/if}
180
181 {if ($email and $outBound_option != 2) OR $context eq 'standalone' } {* Send receipt field only present if contact has a valid email address. *}
182 {include file="CRM/common/showHideByFieldValue.tpl"
183 trigger_field_id ="send_receipt"
184 trigger_value =""
185 target_element_id ="notice"
186 target_element_type ="table-row"
187 field_type ="radio"
188 invert = 0
189 }
190 {include file="CRM/common/showHideByFieldValue.tpl"
191 trigger_field_id ="send_receipt"
192 trigger_value =""
193 target_element_id ="from-email"
194 target_element_type ="table-row"
195 field_type ="radio"
196 invert = 0
197 }
198 {/if}
199
200 {if $paid and ($action eq 1 or ( $action eq 2 and !$hasPayment) ) and !$participantMode}
201 {include file="CRM/common/showHideByFieldValue.tpl"
202 trigger_field_id ="payment_instrument_id"
203 trigger_value = '4'
204 target_element_id ="checkNumber"
205 target_element_type ="table-row"
206 field_type ="select"
207 invert = 0
208 }
209 {/if}
210
211 {if $context eq 'standalone' and $outBound_option != 2 }
212 <script type="text/javascript">
213 {literal}
214 CRM.$(function($) {
215 var $form = $("form.{/literal}{$form.formClass}{literal}");
216 $("#contact_id", $form).change(checkEmail);
217 checkEmail();
218
219 function checkEmail( ) {
220 var data = $("#contact_id", $form).select2('data');
221 if (data && data.extra && data.extra.email && data.extra.email.length) {
222 $("#email-receipt", $form).show();
223 if ($("#send_receipt", $form).is(':checked')) {
224 $("#notice", $form).show();
225 }
226 $("#email-address", $form).html(data.extra.email);
227 }
228 else {
229 $("#email-receipt, #notice", $form).hide();
230 }
231 }
232 });
233 {/literal}
234 </script>
235 {/if}
236
237 {if $onlinePendingContributionId}
238 <script type="text/javascript">
239 {literal}
240 function confirmStatus( pStatusId, cStatusId ) {
241 if ( (pStatusId == cj("#status_id").val() ) && (cStatusId == cj("#contribution_status_id").val()) ) {
242 var allow = confirm( '{/literal}{ts escape='js'}The Payment Status for this participant is Completed. The Participant Status is set to Pending (pay later). Click Cancel if you want to review or modify these values before saving this record{/ts}{literal}.' );
243 if ( !allow ) return false;
244 }
245 }
246
247 function checkCancelled( statusId, pStatusId, cStatusId ) {
248 //selected participant status is 'cancelled'
249 if ( statusId == pStatusId ) {
250 cj("#contribution_status_id").val( cStatusId );
251
252 //unset value for send receipt check box.
253 cj("#send_receipt").prop("checked", false );
254 cj("#send_confirmation_receipt").hide( );
255
256 // set receive data to null.
257 clearDateTime( 'receive_date' );
258 } else {
259 cj("#send_confirmation_receipt").show( );
260 }
261 sendNotification();
262 }
263
264 {/literal}
265 </script>
266 {/if}
267 {if $showFeeBlock && $feeBlockPaid && ! $priceSet && $action neq 2}
268 <script>
269 {literal}
270 fillTotalAmount( );
271
272 function fillTotalAmount( totalAmount ) {
273 if ( !totalAmount ) {
274 var amountVal = {/literal}{if $form.amount.value}{$form.amount.value}{else}0{/if}{literal};
275 if ( amountVal > 0 ) {
276 var eventFeeBlockValues = {/literal}{$eventFeeBlockValues}{literal};
277 totalAmount = eval('eventFeeBlockValues.amount_id_'+ amountVal);
278 } else {
279 totalAmount = '';
280 }
281 }
282 cj('#total_amount').val( totalAmount );
283 }
284 {/literal}
285 </script>
286 {/if}
287
288 {* ADD mode if *}