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