Merge pull request #2435 from davecivicrm/CRM-13833
[civicrm-core.git] / templates / CRM / Contribute / Form / AdditionalPayment.tpl
CommitLineData
0f602e3f
PJ
1{*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
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{if $formType}
27 {include file="CRM/Contribute/Form/AdditionalInfo/$formType.tpl"}
28{else}
29
e8cf3013
PJ
30{if $paymentType eq 'refund'}
31<h3>{ts}New Event Refund{/ts}</h3>
32{else}
0f602e3f 33<h3>{if $component eq 'event'}{if $contributionMode}{ts}Credit Card Event Payment{/ts}{else}{ts}New Event Payement{/ts}{/if}{/if}</h3>
e8cf3013 34{/if}
0f602e3f
PJ
35<div class="crm-block crm-form-block crm-payment-form-block">
36
37 {if $contributionMode == 'test'}
38 {assign var=contribMode value="TEST"}
39 {elseif $contributionMode == 'live'}
40 {assign var=contribMode value="LIVE"}
41 {/if}
42
43 {if !$email}
44 <div class="messages status no-popup">
45 <div class="icon inform-icon"></div>&nbsp;{ts}You will not be able to send an automatic email receipt for this payment because there is no email address recorded for this contact. If you want a receipt to be sent when this payment is recorded, click Cancel and then click Edit from the Summary tab to add an email address before recording the payment.{/ts}
46 </div>
47 {/if}
48 <div class="crm-submit-buttons">
49 {include file="CRM/common/formButtons.tpl"}
50 {if $newCredit AND $contributionMode EQ null}
51 {if $contactId}
52 {capture assign=ccModeLink}{crmURL p='civicrm/payment/add' q="reset=1&action=add&cid=`$contactId`&id=`$id`&component=`$component`&mode=live"}{/capture}
53 {/if}
e8cf3013
PJ
54 {if $paymentType eq 'owed'}
55 <span class="action-link crm-link-credit-card-mode">&nbsp;<a href="{$ccModeLink}">&raquo; {ts}submit credit card payment{/ts}</a>
56 {/if}
0f602e3f
PJ
57 {/if}
58 </div>
59 <table class="form-layout-compressed">
60 <tr>
61 <td class="font-size12pt label"><strong>{ts}Participant{/ts}</strong></td><td class="font-size12pt"><strong>{$displayName}</strong></td>
62 </tr>
63 {if $contributionMode}
64 <tr class="crm-payment-form-block-payment_processor_id"><td class="label nowrap">{$form.payment_processor_id.label}<span class="marker"> * </span></td><td>{$form.payment_processor_id.html}</td></tr>
65 {/if}
66 <tr>
67 <td class='label'>{ts}Event{/ts}</td><td>{$eventName}</td>
68 </tr>
69 <tr class="crm-payment-form-block-contribution_type_id crm-payment-form-block-financial_type_id">
70 <td class="label">{$form.financial_type_id.label}</td><td{$valueStyle}>{$form.financial_type_id.html}&nbsp;
71 </td>
72 </tr>
73 <tr class="crm-payment-form-block-total_amount">
74 <td class="label">{$form.total_amount.label}</td>
75 <td>
76 <span id='totalAmount'>{$form.currency.html|crmAddClass:eight}&nbsp;{$form.total_amount.html|crmAddClass:eight}</span> {$paymentAmt}
77 </td>
78 </tr>
79 </table>
80 <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed" id="paymentDetails_Information">
81 <div class="crm-accordion-header">
82 {ts}Payment Details{/ts}
83 </div>
84 <div class="crm-accordion-body">
85 <table class="form-layout-compressed" >
b4989753
PJ
86 <tr class="crm-payment-form-block-trxn_date">
87 <td class="label">{$form.trxn_date.label}</td>
88 <td {$valueStyle}>{include file="CRM/common/jcalendar.tpl" elementName=trxn_date}<br />
0f602e3f
PJ
89 <span class="description">{ts}The date this payment was received.{/ts}</span>
90 </td>
91 </tr>
92 <tr class="crm-payment-form-block-payment_instrument_id">
93 <td class="label">{$form.payment_instrument_id.label}</td>
94 <td {$valueStyle}>{$form.payment_instrument_id.html} {help id="payment_instrument_id"}</td>
95 </td>
96 </tr>
97 {if $showCheckNumber || !$isOnline}
98 <tr id="checkNumber" class="crm-payment-form-block-check_number">
99 <td class="label">{$form.check_number.label}</td>
100 <td>{$form.check_number.html|crmReplace:class:six}</td>
101 </tr>
102 {/if}
103 <tr class="crm-payment-form-block-trxn_id">
104 <td class="label">{$form.trxn_id.label}</td>
105 <td {$valueStyle}>{$form.trxn_id.html|crmReplace:class:twelve} {help id="id-trans_id"}</td>
106 </tr>
107 {if $email and $outBound_option != 2}
108 <tr class="crm-payment-form-block-is_email_receipt">
109 <td class="label">
110 {$form.is_email_receipt.label}</td><td>{$form.is_email_receipt.html}&nbsp;
111 <span class="description">{ts 1=$email}Automatically email a receipt for this payment to %1?{/ts}</span>
112 </td>
113 </tr>
0f602e3f
PJ
114 {/if}
115 <tr id="fromEmail" class="crm-payment-form-block-receipt_date" style="display:none;">
116 <td class="label">{$form.from_email_address.label}</td>
117 <td>{$form.from_email_address.html}</td>
118 </tr>
7cdb890a
PJ
119 <tr id='notice' class="crm-event-eventfees-form-block-receipt_text">
120 <td class="label">{$form.receipt_text.label}</td>
121 <td><span class="description">
122 {ts}Enter a message you want included at the beginning of the confirmation email. EXAMPLE: 'Thanks for registering for this event.'{/ts}
123 </span><br />
124 {$form.receipt_text.html|crmAddClass:huge}
125 </td>
126 </tr>
127 <tr class="crm-payment-form-block-fee_amount"><td class="label">{$form.fee_amount.label}</td><td{$valueStyle}>{$form.fee_amount.html|crmMoney:$currency:'XXX':'YYY'}<br />
0f602e3f 128 <span class="description">{ts}Processing fee for this transaction (if applicable).{/ts}</span></td></tr>
7cdb890a 129 <tr class="crm-payment-form-block-net_amount"><td class="label">{$form.net_amount.label}</td><td{$valueStyle}>{$form.net_amount.html|crmMoney:$currency:'':1}<br />
0f602e3f
PJ
130 <span class="description">{ts}Net value of the payment (Total Amount minus Fee).{/ts}</span></td></tr>
131 </table>
132 </div>
133 </div>
134
135<div class="accordion ui-accordion ui-widget ui-helper-reset">
136 {* Additional Detail / Honoree Information / Premium Information *}
137 {foreach from=$allPanes key=paneName item=paneValue}
138
139 <div class="crm-accordion-wrapper crm-ajax-accordion crm-{$paneValue.id}-accordion {if $paneValue.open neq 'true'}collapsed{/if}">
140 <div class="crm-accordion-header" id="{$paneValue.id}">
141
142 {$paneName}
143 </div><!-- /.crm-accordion-header -->
144 <div class="crm-accordion-body">
145
146 <div class="{$paneValue.id}"></div>
147 </div><!-- /.crm-accordion-body -->
148 </div><!-- /.crm-accordion-wrapper -->
149
150 {/foreach}
151 </div>
152
153
154
155 {literal}
156 <script type="text/javascript">
157
7cdb890a 158 var url = "{/literal}{$dataUrl}{literal}";
0f602e3f
PJ
159
160 cj( function( ) {
7cdb890a 161 showHideByValue( 'is_email_receipt', '', 'notice', 'table-row', 'radio', false );
0f602e3f
PJ
162 showHideByValue( 'is_email_receipt', '', 'fromEmail', 'table-row', 'radio', false );
163 });
164 {/literal}
165 </script>
166
167<br />
168<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
169</div>
0f602e3f
PJ
170 {literal}
171 <script type="text/javascript">
172 function verify( ) {
173 if (cj('#is_email_receipt').attr( 'checked' )) {
174 var ok = confirm( '{/literal}{ts escape='js'}Click OK to save this payment record AND send a receipt to the contributor now{/ts}{literal}.' );
175 if (!ok) {
176 return false;
177 }
178 }
179 }
180 </script>
181 {/literal}
182
183 {literal}
184 <script type="text/javascript">
185 cj( function( ) {
186 checkEmailDependancies( );
187 cj('#is_email_receipt').click( function( ) {
188 checkEmailDependancies( );
189 });
190 });
191
192 function checkEmailDependancies( ) {
193 if (cj('#is_email_receipt').attr( 'checked' )) {
194 cj('#fromEmail').show( );
195 cj('#receiptDate').hide( );
7cdb890a 196 cj('#notice').show( );
0f602e3f
PJ
197 }
198 else {
199 cj('#fromEmail').hide( );
7cdb890a 200 cj('#notice').hide( );
0f602e3f
PJ
201 cj('#receiptDate').show( );
202 }
203 }
204
7cdb890a 205 // bind first click of accordion header to load crm-accordion-body with snippet
0f602e3f
PJ
206 // everything else taken care of by cj().crm-accordions()
207 cj(function() {
208 cj('#adjust-option-type').hide();
209 cj('.crm-ajax-accordion .crm-accordion-header').one('click', function() {
210 loadPanes(cj(this).attr('id'));
211 });
212 cj('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(function(index) {
213 loadPanes(cj(this).attr('id'));
214 });
215 });
216 // load panes function call for snippet based on id of crm-accordion-header
217 function loadPanes( id ) {
218 var url = "{/literal}{crmURL p='civicrm/payment/add' q='snippet=4&formType=' h=0}{literal}" + id;
219 {/literal}
220 {if $contributionMode}
221 url = url + "&mode={$contributionMode}";
222 {/if}
223 {if $qfKey}
224 url = url + "&qfKey={$qfKey}";
225 {/if}
226 {literal}
227 if (! cj('div.'+id).html()) {
228 var loading = '<img src="{/literal}{$config->resourceBase}i/loading.gif{literal}" alt="{/literal}{ts escape='js'}loading{/ts}{literal}" />&nbsp;{/literal}{ts escape='js'}Loading{/ts}{literal}...';
229 cj('div.'+id).html(loading);
230 cj.ajax({
231 url : url,
232 success: function(data) { cj('div.'+id).html(data); }
233 });
234 }
235 }
236
237cj('#fee_amount').change( function() {
238 var totalAmount = cj('#total_amount').val();
239 var feeAmount = cj('#fee_amount').val();
240 var netAmount = totalAmount.replace(/,/g, '') - feeAmount.replace(/,/g, '');
241 if (!cj('#net_amount').val()) {
242 cj('#net_amount').val(netAmount);
243 }
244});
245 </script>
246 {/literal}
247 {if !$contributionMode}
248 {include file="CRM/common/showHideByFieldValue.tpl"
249 trigger_field_id ="payment_instrument_id"
250 trigger_value = '4'
251 target_element_id ="checkNumber"
252 target_element_type ="table-row"
253 field_type ="select"
254 invert = 0
255 }
256 {/if}
257
258 {* include jscript to warn if unsaved form field changes *}
259 {include file="CRM/common/formNavigate.tpl"}
260
261{/if}
262{literal}
263<script type="text/javascript">
264cj(function() {
265 cj().crmAccordions();
266});
267</script>
268{/literal}