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