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