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