Change 'help' id to a class
[civicrm-core.git] / templates / CRM / Contribute / Form / ContributionPage / Amount.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
2c4c49ca 3 | CiviCRM version 4.7 |
6a488035 4 +--------------------------------------------------------------------+
e7112fa7 5 | Copyright CiviCRM LLC (c) 2004-2015 |
6a488035
TO
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">
f6eedce7 28<div class="help">
6a488035
TO
29 {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"}
30</div>
31 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
32 {if !$paymentProcessor}
33 {capture assign=ppUrl}{crmURL p='civicrm/admin/paymentProcessor' q="reset=1"}{/capture}
34 <div class="status message">
35 {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"}
36 <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>
37 </div>
38 {/if}
39 <table class="form-layout-compressed">
40 <tr class="crm-contribution-contributionpage-amount-form-block-is_monetary"><th scope="row" class="label" width="20%">{$form.is_monetary.label}</th>
41 <td>{$form.is_monetary.html}<br />
42 <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>
43 </tr>
44 <tr class="crm-contribution-contributionpage-amount-form-block-currency"><th scope="row" class="label" width="20%">{$form.currency.label}</th>
45 <td>{$form.currency.html}<br />
46 <span class="description">{ts}Select the currency to be used for contributions submitted from this contribution page.{/ts}</span></td>
47 </tr>
48 {if $paymentProcessor}
49 <tr class="crm-contribution-contributionpage-amount-form-block-payment_processor"><th scope="row" class="label" width="20%">{$form.payment_processor.label}</th>
50 <td>{$form.payment_processor.html}<br />
51 <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>
52 </tr>
53 {/if}
54 <tr class="crm-contribution-contributionpage-amount-form-block-is_pay_later"><th scope="row" class="label">{$form.is_pay_later.label}</th>
55 <td>{$form.is_pay_later.html}<br />
56 <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>
57 </tr>
58 <tr id="payLaterFields" class="crm-contribution-form-block-payLaterFields"><td>&nbsp;</td>
59 <td>
60 <table class="form-layout">
836cf509 61 <tr class="crm-contribution-contributionpage-amount-form-block-pay_later_text"><th scope="row" class="label">{$form.pay_later_text.label} <span class="crm-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>
6a488035 62 <td>{$form.pay_later_text.html|crmAddClass:big}<br />
8a51f5e6 63 <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>
836cf509 64 <tr class="crm-contribution-contributionpage-amount-form-block-pay_later_receipt"><th scope="row" class="label">{$form.pay_later_receipt.label} <span class="crm-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>
6a488035
TO
65 <td>{$form.pay_later_receipt.html|crmAddClass:big}<br />
66 <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>
b2603e29 67
e45f6ab0 68 <tr><th scope="row" class="label">{$form.is_billing_required.label}</th>
2b3fa30d
DG
69 <td>{$form.is_billing_required.html}<br />
70 <span class="description">{ts}Check this box to require users who select the pay later option to provide billing name and address.{/ts}</span>
71 </td></tr>
6a488035
TO
72 </table>
73 </td>
74 </tr>
75 <tr class="crm-contribution-contributionpage-amount-form-block-amount_block_is_active">
76 <th scope="row" class="label">{$form.amount_block_is_active.label}</th>
77 <td>{$form.amount_block_is_active.html}<br />
78 <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>
79 </tr>
80 <tr id="priceSet" class="crm-contribution-contributionpage-amount-form-block-priceSet">
81 <th scope="row" class="label">{$form.price_set_id.label}</th>
82 {if $price eq true}
83 <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>
84 {else}
85 <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>
86 {/if}
87 </tr>
88 </table>
89
90 <div id="recurringFields">
91 <table class="form-layout-compressed">
92
93
94 {if $recurringPaymentProcessor}
95 <tr id="recurringContribution" class="crm-contribution-form-block-is_recur"><th scope="row" class="label" width="20%">{$form.is_recur.label}</th>
96 <td>{$form.is_recur.html}<br />
97 <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>
98 </td>
99 </tr>
100 <tr id="recurFields" class="crm-contribution-form-block-recurFields"><td>&nbsp;</td>
101 <td>
102 <table class="form-layout-compressed">
836cf509 103 <tr class="crm-contribution-form-block-recur_frequency_unit"><th scope="row" class="label">{$form.recur_frequency_unit.label}<span class="crm-marker" title="This field is required.">*</span></th>
6a488035
TO
104 <td>{$form.recur_frequency_unit.html}<br />
105 <span class="description">{ts}Select recurring units supported for recurring payments.{/ts}</span></td>
106 </tr>
107 <tr class="crm-contribution-form-block-is_recur_interval"><th scope="row" class="label">{$form.is_recur_interval.label}</th>
108 <td>{$form.is_recur_interval.html}<br />
109 <span class="description">{ts}Can users also set an interval (e.g. every '3' months)?{/ts}</span></td>
110 </tr>
111 <tr class="crm-contribution-form-block-is_recur_installments"><th scope="row" class="label">{$form.is_recur_installments.label}</th>
112 <td>{$form.is_recur_installments.html}<br />
113 <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>
114 </tr>
115 </table>
116 </td>
117 </tr>
118 {/if}
119
120 </table>
121 </div>
122
123
124 <div id="amountFields">
125 <table class="form-layout-compressed">
126 {* handle CiviPledge fields *}
127 {if $civiPledge}
128 <tr class="crm-contribution-form-block-is_pledge_active"><th scope="row" class="label" width="20%">{$form.is_pledge_active.label}</th>
129 <td>{$form.is_pledge_active.html}<br />
130 <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>
131 </td>
132 </tr>
133 <tr id="pledgeFields" class="crm-contribution-form-block-pledgeFields"><td></td><td>
134 <table class="form-layout-compressed">
836cf509 135 <tr class="crm-contribution-form-block-pledge_frequency_unit"><th scope="row" class="label">{$form.pledge_frequency_unit.label}<span class="crm-marker"> *</span></th>
6a488035
TO
136 <td>{$form.pledge_frequency_unit.html}<br />
137 <span class="description">{ts}Which frequencies can the user pick from (e.g. every 'week', every 'month', every 'year')?{/ts}</span></td>
138 </tr>
139 <tr class="crm-contribution-form-block-is_pledge_interval"><th scope="row" class="label">{$form.is_pledge_interval.label}</th>
140 <td>{$form.is_pledge_interval.html}<br />
141 <span class="description">{ts}Can they also set an interval (e.g. every '3' months)?{/ts}</span></td>
142 </tr>
143 <tr class="crm-contribution-form-block-initial_reminder_day"><th scope="row" class="label">{$form.initial_reminder_day.label}</th>
144 <td>{$form.initial_reminder_day.html}
1e1e7dc8 145 <span class="label">{ts}Days prior to each scheduled payment due date.{/ts}</span></td>
6a488035
TO
146 </tr>
147 <tr class="crm-contribution-form-block-max_reminders"><th scope="row" class="label">{$form.max_reminders.label}</th>
148 <td>{$form.max_reminders.html}
1e1e7dc8 149 <span class="label">{ts}Reminders for each scheduled payment.{/ts}</span></td>
6a488035
TO
150 </tr>
151 <tr class="crm-contribution-form-block-additional_reminder_day"><th scope="row" class="label">{$form.additional_reminder_day.label}</th>
152 <td>{$form.additional_reminder_day.html}
1e1e7dc8 153 <span class="label">{ts}Days after the last one sent, up to the maximum number of reminders.{/ts}</span></td>
6a488035
TO
154 </tr>
155 </table>
156 </td>
157 </tr>
158 {/if}
34408315
E
159
160 <tr class="crm-contribution-form-block-amount_label">
836cf509 161 <th scope="row" class="label" width="20%">{$form.amount_label.label}<span class="crm-marker"> *</span></th>
34408315
E
162 <td>{$form.amount_label.html}</td>
163 </tr>
6a488035
TO
164 <tr class="crm-contribution-form-block-is_allow_other_amount"><th scope="row" class="label" width="20%">{$form.is_allow_other_amount.label}</th>
165 <td>{$form.is_allow_other_amount.html}<br />
166 <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>
167
168 <tr id="minMaxFields" class="crm-contribution-form-block-minMaxFields"><td>&nbsp;</td><td>
169 <table class="form-layout-compressed">
170 <tr class="crm-contribution-form-block-min_amount"><th scope="row" class="label">{$form.min_amount.label}</th>
171 <td>{$form.min_amount.html|crmMoney}</td></tr>
172 <tr class="crm-contribution-form-block-max_amount"><th scope="row" class="label">{$form.max_amount.label}</th>
173 <td>{$form.max_amount.html|crmMoney}<br />
174 <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>
175 </table>
176 </td></tr>
177
178 <tr><td colspan="2">
179 <fieldset><legend>{ts}Fixed Contribution Options{/ts}</legend>
247506c6 180 {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 />
6a488035 181 <table id="map-field-table">
8a4f27dc 182 <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 />{$form.default.0.html}</th></tr>
6a488035
TO
183 {section name=loop start=1 loop=11}
184 {assign var=idx value=$smarty.section.loop.index}
185 <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>
186 {/section}
187 </table>
188 </fieldset>
189 </td></tr>
190 </table>
191 </div>
192 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
193</div>
194
195{literal}
196<script type="text/javascript">
ae8f569f 197 var paymentProcessorMapper = [];
6a488035
TO
198 {/literal}
199 {if $recurringPaymentProcessor}
200 {foreach from=$recurringPaymentProcessor item="paymentProcessor" key="index"}{literal}
201 paymentProcessorMapper[{/literal}{$index}{literal}] = '{/literal}{$paymentProcessor}{literal}';
202 {/literal}{/foreach}
203 {/if}
204 {literal}
847f8123 205 CRM.$(function($) {
847f8123
CW
206 function checked_payment_processors() {
207 var ids = [];
208 $('.crm-contribution-contributionpage-amount-form-block-payment_processor input[type="checkbox"]').each(function(){
209 if($(this).prop('checked')) {
210 var id = $(this).attr('id').split('_')[2];
211 ids.push(id);
212 }
213 });
214 return ids;
215 }
6a488035
TO
216
217 // show/hide recurring block
847f8123
CW
218 $('.crm-contribution-contributionpage-amount-form-block-payment_processor input[type="checkbox"]').change(function(){
219 showRecurring( checked_payment_processors() );
6a488035 220 });
847f8123 221 showRecurring( checked_payment_processors() );
6a488035
TO
222 });
223 var element_other_amount = document.getElementsByName('is_allow_other_amount');
224 if (! element_other_amount[0].checked) {
225 cj('#minMaxFields').hide();
226 }
227 var amount_block = document.getElementsByName('amount_block_is_active');
228 var priceSetID = {/literal}'{$priceSetID}'{literal};
229
230 if ( ! amount_block[0].checked || priceSetID ) {
231 if ( !priceSetID ) {
232 cj('#priceSet').hide();
1ebebaab
AH
233 if (CRM.memberPriceset) {
234 cj(".crm-contribution-contributionpage-amount-form-block-amount_block_is_active td").html('<span class="description">{/literal}{ts}You cannot enable the Contribution Amounts section when a Membership Price Set is in use. (See the Memberships tab above.) Membership Price Sets may include additional fields for non-membership options that require an additional fee (e.g. magazine subscription) or an additional voluntary contribution.</span>{/ts}{literal}');
235 }
6a488035
TO
236 }
237 cj('#amountFields').hide();
1ebebaab 238 }
6a488035 239
3cc60a06 240 CRM.$(function($) {
6a488035
TO
241 payLater('is_pay_later');
242 });
243
244 cj('#is_pay_later').click( function() {
245 payLater('is_pay_later');
246 });
b2603e29 247
6a488035
TO
248
249 function minMax(chkbox) {
250 if (chkbox.checked) {
251 cj('#minMaxFields').show();
252 } else {
253 cj('#minMaxFields').hide();
254 document.getElementById("min_amount").value = '';
255 document.getElementById("max_amount").value = '';
256 }
257 }
258
259 function payLater(chkbox) {
260 var elementId = 'payLaterFields';
8539f25d 261 if (cj('#' + chkbox).prop('checked')) {
6a488035
TO
262 cj('#' + elementId).show();
263 } else {
264 cj('#' + elementId).hide();
265 }
266 }
267
268 function showHideAmountBlock( element, elementName )
269 {
270 // show / hide when amount section is active check/uncheck.
271
272 var priceSetID = {/literal}'{$priceSetID}'{literal};
273
274 switch ( elementName ) {
275 case 'price_set_id':
276 if ( element ) {
277 cj('#amountFields').hide();
278 } else {
279 cj('#amountFields').show();
280 }
8539f25d 281 cj("#amount_block_is_active").prop('checked', true );
6a488035
TO
282 break;
283
284 case 'is_pledge_active' :
285 case 'is_allow_other_amount' :
286 if ( element.checked ) {
287 if ( priceSetID ) cj( "#price_set_id" ).val( '' );
288 cj('#amountFields').show();
289 }
8539f25d 290 cj("#amount_block_is_active").prop('checked', true );
6a488035
TO
291 break;
292
293 case 'amount_block_is_active' :
294 if ( element.checked ) {
295 if ( priceSetID ) {
296 cj('#amountFields').hide();
297 cj( "#price_set_id" ).val( priceSetID );
298 } else {
299 cj('#amountFields').show();
300 cj( "#price_set_id" ).val( '' );
301 }
302 cj('#priceSet, #recurringFields').show();
303 } else {
304 cj( "#price_set_id" ).val( '' );
305 cj('#amountFields, #priceSet, #recurringFields').hide();
306 }
307 break;
308 }
309 }
310
311 function showRecurring( paymentProcessorIds ) {
312 var display = true;
313 cj.each(paymentProcessorIds, function(k, id){
314 if( cj.inArray(id, paymentProcessorMapper) == -1 ) {
315 display = false;
316 }
317 });
318
319 if(display) {
320 cj( '#recurringContribution' ).show( );
321 } else {
8539f25d
CW
322 if ( cj( '#is_recur' ).prop('checked' ) ) {
323 cj( '#is_recur' ).prop('checked', false);
6a488035
TO
324 cj( '#recurFields' ).hide( );
325 }
326 cj( '#recurringContribution' ).hide( );
327 }
328 }
b2603e29 329
6a488035
TO
330</script>
331{/literal}
332{if $form.is_recur}
333{include file="CRM/common/showHideByFieldValue.tpl"
334 trigger_field_id ="is_recur"
335 trigger_value ="true"
336 target_element_id ="recurFields"
337 target_element_type ="table-row"
338 field_type ="radio"
339 invert = "false"
340}
341{/if}
342{if $civiPledge}
343{include file="CRM/common/showHideByFieldValue.tpl"
344 trigger_field_id = "is_pledge_active"
345 trigger_value = "true"
346 target_element_id = "pledgeFields"
347 target_element_type = "table-row"
348 field_type = "radio"
349 invert = "false"
350}
351{/if}
352
6a488035
TO
353{if $isQuick}
354{literal}
355<script type="text/javascript">
847f8123
CW
356 CRM.$(function($) {
357 $("#quickconfig").click(function(e) {
358 e.preventDefault();
359 CRM.confirm({
360 width: 400,
361 message: {/literal}"{ts escape='js'}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}"{literal}
362 }).on('crmConfirm:yes', function() {
363 {/literal}
364 var dataUrl = '{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Core_Page_AJAX&fnName=setIsQuickConfig&context=civicrm_contribution_page&id=$contributionPageID" }';
365 {literal}
366 $.getJSON(dataUrl).done(function(result) {window.location = CRM.url("civicrm/admin/price/field", {reset: 1, action: 'browse', sid: result});});
367 });
368 });
369 });
6a488035
TO
370</script>
371{/literal}
372{/if}