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