Merge remote-tracking branch 'upstream/4.3' into 4.3-master-2013-10-02-11-18-44
[civicrm-core.git] / templates / CRM / Contribute / Form / ContributionPage / Amount.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 {capture assign="adminPriceSets"}{crmURL p='civicrm/admin/price' q="reset=1"}{/capture}
27 <div class="crm-block crm-form-block crm-contribution-contributionpage-amount-form-block">
28 {if $isQuick}
29 <div id="popupContainer">
30 {ts}Once you switch to using a Price Set, you won't be able to switch back to your existing settings below except by re-entering them. Are you sure you want to switch to a Price Set?{/ts}
31 </div>
32 {/if}
33 <div id="help">
34 {ts}Use this form to configure Contribution Amount options. You can give contributors the ability to enter their own contribution amounts - and/or provide a fixed list of amounts. For fixed amounts, you can enter a label for each 'level' of contribution (e.g. Friend, Sustainer, etc.). If you allow people to enter their own dollar amounts, you can also set minimum and maximum values. Depending on your choice of Payment Processor, you may be able to offer a recurring contribution option.{/ts} {docURL page="user/contributions/payment-processors"}
35 </div>
36 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
37 {if !$paymentProcessor}
38 {capture assign=ppUrl}{crmURL p='civicrm/admin/paymentProcessor' q="reset=1"}{/capture}
39 <div class="status message">
40 {ts 1=$ppUrl}No Payment Processor has been configured / enabled for your site. Unless you are only using CiviContribute to solicit non-monetary / in-kind contributions, you will need to <a href='%1'>configure a Payment Processor</a>. Then return to this screen and assign the processor to this Contribution Page.{/ts} {docURL page="user/contributions/payment-processors"}
41 <p>{ts}NOTE: Alternatively, you can enable the <strong>Pay Later</strong> option below without setting up a payment processor. All users will then be asked to submit payment offline (e.g. mail in a check, call in a credit card, etc.).{/ts}</p>
42 </div>
43 {/if}
44 <table class="form-layout-compressed">
45 <tr class="crm-contribution-contributionpage-amount-form-block-is_monetary"><th scope="row" class="label" width="20%">{$form.is_monetary.label}</th>
46 <td>{$form.is_monetary.html}<br />
47 <span class="description">{ts}Uncheck this box if you are using this contribution page for free membership signup ONLY, or to solicit in-kind / non-monetary donations such as furniture, equipment.. etc.{/ts}</span></td>
48 </tr>
49 <tr class="crm-contribution-contributionpage-amount-form-block-currency"><th scope="row" class="label" width="20%">{$form.currency.label}</th>
50 <td>{$form.currency.html}<br />
51 <span class="description">{ts}Select the currency to be used for contributions submitted from this contribution page.{/ts}</span></td>
52 </tr>
53 {if $paymentProcessor}
54 <tr class="crm-contribution-contributionpage-amount-form-block-payment_processor"><th scope="row" class="label" width="20%">{$form.payment_processor.label}</th>
55 <td>{$form.payment_processor.html}<br />
56 <span class="description">{ts}Select the payment processor to be used for contributions submitted from this contribution page (unless you are soliciting non-monetary / in-kind contributions only).{/ts} {docURL page="user/contributions/payment-processors"}</span></td>
57 </tr>
58 {/if}
59 <tr class="crm-contribution-contributionpage-amount-form-block-is_pay_later"><th scope="row" class="label">{$form.is_pay_later.label}</th>
60 <td>{$form.is_pay_later.html}<br />
61 <span class="description">{ts}Check this box if you want to give users the option to submit payment offline (e.g. mail in a check, call in a credit card, etc.).{/ts}</span></td>
62 </tr>
63 <tr id="payLaterFields" class="crm-contribution-form-block-payLaterFields"><td>&nbsp;</td>
64 <td>
65 <table class="form-layout">
66 <tr class="crm-contribution-contributionpage-amount-form-block-pay_later_text"><th scope="row" class="label">{$form.pay_later_text.label} <span class="marker" title="This field is required.">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='pay_later_text' id=$contributionPageID}{/if}</th>
67 <td>{$form.pay_later_text.html|crmAddClass:big}<br />
68 <span class="description">{ts}Text displayed next to the checkbox for the 'pay later' option on the contribution form. You may include HTML formatting tags.{/ts}</span></td></tr>
69 <tr class="crm-contribution-contributionpage-amount-form-block-pay_later_receipt"><th scope="row" class="label">{$form.pay_later_receipt.label} <span class="marker" title="This field is required.">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='pay_later_receipt' id=$contributionPageID}{/if}</th>
70 <td>{$form.pay_later_receipt.html|crmAddClass:big}<br />
71 <span class="description">{ts}Instructions added to Confirmation and Thank-you pages, as well as the confirmation email, when the user selects the 'pay later' option (e.g. 'Mail your check to ... within 3 business days.').{/ts}</span></td></tr>
72
73 </table>
74 </td>
75 </tr>
76 <tr class="crm-contribution-contributionpage-amount-form-block-amount_block_is_active">
77 <th scope="row" class="label">{$form.amount_block_is_active.label}</th>
78 <td>{$form.amount_block_is_active.html}<br />
79 <span class="description">{ts}Uncheck this box if you are using this contribution page for membership signup and renewal only - and you do NOT want users to select or enter any additional contribution amounts.{/ts}</span></td>
80 </tr>
81 <tr id="priceSet" class="crm-contribution-contributionpage-amount-form-block-priceSet">
82 <th scope="row" class="label">{$form.price_set_id.label}</th>
83 {if $price eq true}
84 <td>{$form.price_set_id.html}<br /><span class="description">{ts 1=$adminPriceSets}Select a pre-configured Price Set to offer multiple individually priced options for contributions. Otherwise, select &quot;-none-&quot; and enter one or more fixed contribution options in the table below. Create or edit Price Sets <a href='%1'>here</a>.{/ts}</span></td>
85 {else}
86 <td><div class="status message">{ts 1=$adminPriceSets}No Contribution Price Sets have been configured / enabled for your site. Price sets allow you to configure more complex contribution options (e.g. "Contribute $25 more to receive our monthly magazine."). Click <a href='%1'>here</a> if you want to configure price sets for your site.{/ts}</div></td>
87 {/if}
88 </tr>
89 </table>
90
91 <div id="recurringFields">
92 <table class="form-layout-compressed">
93
94
95 {if $recurringPaymentProcessor}
96 <tr id="recurringContribution" class="crm-contribution-form-block-is_recur"><th scope="row" class="label" width="20%">{$form.is_recur.label}</th>
97 <td>{$form.is_recur.html}<br />
98 <span class="description">{ts}Check this box if you want to give users the option to make recurring contributions. This feature requires that you use a payment processor which supports recurring billing / subscriptions functionality.{/ts} {docURL page="user/contributions/payment-processors"}</span>
99 </td>
100 </tr>
101 <tr id="recurFields" class="crm-contribution-form-block-recurFields"><td>&nbsp;</td>
102 <td>
103 <table class="form-layout-compressed">
104 <tr class="crm-contribution-form-block-recur_frequency_unit"><th scope="row" class="label">{$form.recur_frequency_unit.label}<span class="marker" title="This field is required.">*</span></th>
105 <td>{$form.recur_frequency_unit.html}<br />
106 <span class="description">{ts}Select recurring units supported for recurring payments.{/ts}</span></td>
107 </tr>
108 <tr class="crm-contribution-form-block-is_recur_interval"><th scope="row" class="label">{$form.is_recur_interval.label}</th>
109 <td>{$form.is_recur_interval.html}<br />
110 <span class="description">{ts}Can users also set an interval (e.g. every '3' months)?{/ts}</span></td>
111 </tr>
112 <tr class="crm-contribution-form-block-is_recur_installments"><th scope="row" class="label">{$form.is_recur_installments.label}</th>
113 <td>{$form.is_recur_installments.html}<br />
114 <span class="description">{ts}Give the user a choice of installments (e.g. donate every month for 6 months)? If not, recurring donations will continue indefinitely.{/ts}</span></td>
115 </tr>
116 </table>
117 </td>
118 </tr>
119 {/if}
120
121 </table>
122 </div>
123
124
125 <div id="amountFields">
126 <table class="form-layout-compressed">
127 {* handle CiviPledge fields *}
128 {if $civiPledge}
129 <tr class="crm-contribution-form-block-is_pledge_active"><th scope="row" class="label" width="20%">{$form.is_pledge_active.label}</th>
130 <td>{$form.is_pledge_active.html}<br />
131 <span class="description">{ts}Check this box if you want to give users the option to make a Pledge (a commitment to contribute a fixed amount on a recurring basis).{/ts}</span>
132 </td>
133 </tr>
134 <tr id="pledgeFields" class="crm-contribution-form-block-pledgeFields"><td></td><td>
135 <table class="form-layout-compressed">
136 <tr class="crm-contribution-form-block-pledge_frequency_unit"><th scope="row" class="label">{$form.pledge_frequency_unit.label}<span class="marker"> *</span></th>
137 <td>{$form.pledge_frequency_unit.html}<br />
138 <span class="description">{ts}Which frequencies can the user pick from (e.g. every 'week', every 'month', every 'year')?{/ts}</span></td>
139 </tr>
140 <tr class="crm-contribution-form-block-is_pledge_interval"><th scope="row" class="label">{$form.is_pledge_interval.label}</th>
141 <td>{$form.is_pledge_interval.html}<br />
142 <span class="description">{ts}Can they also set an interval (e.g. every '3' months)?{/ts}</span></td>
143 </tr>
144 <tr class="crm-contribution-form-block-initial_reminder_day"><th scope="row" class="label">{$form.initial_reminder_day.label}</th>
145 <td>{$form.initial_reminder_day.html}
146 <span class="label">{ts}days prior to each scheduled payment due date.{/ts}</span></td>
147 </tr>
148 <tr class="crm-contribution-form-block-max_reminders"><th scope="row" class="label">{$form.max_reminders.label}</th>
149 <td>{$form.max_reminders.html}
150 <span class="label">{ts}reminders for each scheduled payment.{/ts}</span></td>
151 </tr>
152 <tr class="crm-contribution-form-block-additional_reminder_day"><th scope="row" class="label">{$form.additional_reminder_day.label}</th>
153 <td>{$form.additional_reminder_day.html}
154 <span class="label">{ts}days after the last one sent, up to the maximum number of reminders.{/ts}</span></td>
155 </tr>
156 </table>
157 </td>
158 </tr>
159 {/if}
160
161 <tr class="crm-contribution-form-block-amount_label">
162 <th scope="row" class="label" width="20%">{$form.amount_label.label}<span class="marker"> *</span></th>
163 <td>{$form.amount_label.html}</td>
164 </tr>
165 <tr class="crm-contribution-form-block-is_allow_other_amount"><th scope="row" class="label" width="20%">{$form.is_allow_other_amount.label}</th>
166 <td>{$form.is_allow_other_amount.html}<br />
167 <span class="description">{ts}Check this box if you want to give users the option to enter their own contribution amount. Your page will then include a text field labeled <strong>Other Amount</strong>.{/ts}</span></td></tr>
168
169 <tr id="minMaxFields" class="crm-contribution-form-block-minMaxFields"><td>&nbsp;</td><td>
170 <table class="form-layout-compressed">
171 <tr class="crm-contribution-form-block-min_amount"><th scope="row" class="label">{$form.min_amount.label}</th>
172 <td>{$form.min_amount.html|crmMoney}</td></tr>
173 <tr class="crm-contribution-form-block-max_amount"><th scope="row" class="label">{$form.max_amount.label}</th>
174 <td>{$form.max_amount.html|crmMoney}<br />
175 <span class="description">{ts 1=5|crmMoney}If you have chosen to <strong>Allow Other Amounts</strong>, you can use the fields above to control minimum and/or maximum acceptable values (e.g. don't allow contribution amounts less than %1).{/ts}</span></td></tr>
176 </table>
177 </td></tr>
178
179 <tr><td colspan="2">
180 <fieldset><legend>{ts}Fixed Contribution Options{/ts}</legend>
181 {ts}Use the table below to enter up to ten fixed contribution amounts. These will be presented as a list of radio button options. Both the label and dollar amount will be displayed.{/ts}{if $isQuick}{ts} Click <a id='quickconfig' href='#'>here</a> if you want to configure the Fixed Contribution Options below as part of a Price Set, with the added flexibility and complexity that entails.{/ts}{/if}<br />
182 <table id="map-field-table">
183 <tr class="columnheader" ><th scope="column">{ts}Contribution Label{/ts}</th><th scope="column">{ts}Amount{/ts}</th><th scope="column">{ts}Default?{/ts}<br /><span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('default', 'Amount'); return false;" >{ts}clear{/ts}</a>)</span></th></tr>
184 {section name=loop start=1 loop=11}
185 {assign var=idx value=$smarty.section.loop.index}
186 <tr><td class="even-row">{$form.label.$idx.html}</td><td>{$form.value.$idx.html|crmMoney}</td><td class="even-row">{$form.default.$idx.html}</td></tr>
187 {/section}
188 </table>
189 </fieldset>
190 </td></tr>
191 </table>
192 </div>
193 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
194 </div>
195
196 {literal}
197 <script type="text/javascript">
198 var paymentProcessorMapper = new Array( );
199 {/literal}
200 {if $recurringPaymentProcessor}
201 {foreach from=$recurringPaymentProcessor item="paymentProcessor" key="index"}{literal}
202 paymentProcessorMapper[{/literal}{$index}{literal}] = '{/literal}{$paymentProcessor}{literal}';
203 {/literal}{/foreach}
204 {/if}
205 {literal}
206 cj( document ).ready( function( ) {
207 cj("#popupContainer").hide();
208 function checked_payment_processors() {
209 var ids = [];
210 cj('.crm-contribution-contributionpage-amount-form-block-payment_processor input[type="checkbox"]').each(function(){
211 if(cj(this).attr('checked')) {
212 var id = cj(this).attr('id').split('_')[2];
213 ids.push(id);
214 }
215 });
216 return ids;
217 }
218
219 // show/hide recurring block
220 cj('.crm-contribution-contributionpage-amount-form-block-payment_processor input[type="checkbox"]').change(function(){
221 showRecurring( checked_payment_processors() )
222 });
223 showRecurring( checked_payment_processors() )
224 });
225 var element_other_amount = document.getElementsByName('is_allow_other_amount');
226 if (! element_other_amount[0].checked) {
227 cj('#minMaxFields').hide();
228 }
229 var amount_block = document.getElementsByName('amount_block_is_active');
230 var priceSetID = {/literal}'{$priceSetID}'{literal};
231
232 if ( ! amount_block[0].checked || priceSetID ) {
233 if ( !priceSetID ) {
234 cj('#priceSet').hide();
235 }
236 cj('#amountFields').hide();
237 }
238
239 cj(function() {
240 payLater('is_pay_later');
241 });
242
243 cj('#is_pay_later').click( function() {
244 payLater('is_pay_later');
245 });
246
247
248 function minMax(chkbox) {
249 if (chkbox.checked) {
250 cj('#minMaxFields').show();
251 } else {
252 cj('#minMaxFields').hide();
253 document.getElementById("min_amount").value = '';
254 document.getElementById("max_amount").value = '';
255 }
256 }
257
258 function payLater(chkbox) {
259 var elementId = 'payLaterFields';
260 if (cj('#' + chkbox).attr('checked')) {
261 cj('#' + elementId).show();
262 } else {
263 cj('#' + elementId).hide();
264 }
265 }
266
267 function showHideAmountBlock( element, elementName )
268 {
269 // show / hide when amount section is active check/uncheck.
270
271 var priceSetID = {/literal}'{$priceSetID}'{literal};
272
273 switch ( elementName ) {
274 case 'price_set_id':
275 if ( element ) {
276 cj('#amountFields').hide();
277 } else {
278 cj('#amountFields').show();
279 }
280 cj("#amount_block_is_active").attr( 'checked', true );
281 break;
282
283 case 'is_pledge_active' :
284 case 'is_allow_other_amount' :
285 if ( element.checked ) {
286 if ( priceSetID ) cj( "#price_set_id" ).val( '' );
287 cj('#amountFields').show();
288 }
289 cj("#amount_block_is_active").attr( 'checked', true );
290 break;
291
292 case 'amount_block_is_active' :
293 if ( element.checked ) {
294 if ( priceSetID ) {
295 cj('#amountFields').hide();
296 cj( "#price_set_id" ).val( priceSetID );
297 } else {
298 cj('#amountFields').show();
299 cj( "#price_set_id" ).val( '' );
300 }
301 cj('#priceSet, #recurringFields').show();
302 } else {
303 cj( "#price_set_id" ).val( '' );
304 cj('#amountFields, #priceSet, #recurringFields').hide();
305 }
306 break;
307 }
308 }
309
310 function showRecurring( paymentProcessorIds ) {
311 var display = true;
312 cj.each(paymentProcessorIds, function(k, id){
313 if( cj.inArray(id, paymentProcessorMapper) == -1 ) {
314 display = false;
315 }
316 });
317
318 if(display) {
319 cj( '#recurringContribution' ).show( );
320 } else {
321 if ( cj( '#is_recur' ).attr( 'checked' ) ) {
322 cj( '#is_recur' ).removeAttr("checked");
323 cj( '#recurFields' ).hide( );
324 }
325 cj( '#recurringContribution' ).hide( );
326 }
327 }
328
329 </script>
330 {/literal}
331 {if $form.is_recur}
332 {include file="CRM/common/showHideByFieldValue.tpl"
333 trigger_field_id ="is_recur"
334 trigger_value ="true"
335 target_element_id ="recurFields"
336 target_element_type ="table-row"
337 field_type ="radio"
338 invert = "false"
339 }
340 {/if}
341 {if $civiPledge}
342 {include file="CRM/common/showHideByFieldValue.tpl"
343 trigger_field_id = "is_pledge_active"
344 trigger_value = "true"
345 target_element_id = "pledgeFields"
346 target_element_type = "table-row"
347 field_type = "radio"
348 invert = "false"
349 }
350 {/if}
351
352 {* include jscript to warn if unsaved form field changes *}
353 {include file="CRM/common/formNavigate.tpl"}
354 {if $isQuick}
355 {literal}
356 <script type="text/javascript">
357 cj("#quickconfig").click(function(){
358 cj("#popupContainer").dialog({
359 title: "Selected Price Set",
360 width:400,
361 height:220,
362 modal: true,
363 overlay: {
364 opacity: 0.5,
365 background: "black"
366 },
367 buttons: {
368 "Ok": function() {
369 var dataUrl = {/literal}'{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Core_Page_AJAX&fnName=setIsQuickConfig&context=civicrm_contribution_page&id=$contributionPageID" }';
370 var redirectUrl = '{crmURL p="civicrm/admin/price/field" h=0 q="reset=1&action=browse&sid=" }';
371 {literal}
372 cj.ajax({
373 url: dataUrl,
374 async: false,
375 global: false,
376 success: function ( result ) {
377 if (result) {
378 window.location= redirectUrl+eval(result);
379 }
380 }
381 });
382 },
383 "Close": function() {
384 cj(this).dialog("close");
385 }
386 }
387 });
388 return false;
389 });
390 </script>
391 {/literal}
392 {/if}