Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
2c4c49ca | 3 | | CiviCRM version 4.7 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
8c9251b3 | 5 | | Copyright CiviCRM LLC (c) 2004-2018 | |
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} | |
c6a04a04 | 27 | {crmRegion name="contribute-form-contributionpage-amount-main"} |
6a488035 | 28 | <div class="crm-block crm-form-block crm-contribution-contributionpage-amount-form-block"> |
f6eedce7 | 29 | <div class="help"> |
4c030d33 | 30 | {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"} |
6a488035 TO |
31 | </div> |
32 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
33 | {if !$paymentProcessor} | |
34 | {capture assign=ppUrl}{crmURL p='civicrm/admin/paymentProcessor' q="reset=1"}{/capture} | |
35 | <div class="status message"> | |
36 | {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"} | |
37 | <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> | |
38 | </div> | |
39 | {/if} | |
40 | <table class="form-layout-compressed"> | |
41 | <tr class="crm-contribution-contributionpage-amount-form-block-is_monetary"><th scope="row" class="label" width="20%">{$form.is_monetary.label}</th> | |
42 | <td>{$form.is_monetary.html}<br /> | |
43 | <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> | |
44 | </tr> | |
45 | <tr class="crm-contribution-contributionpage-amount-form-block-currency"><th scope="row" class="label" width="20%">{$form.currency.label}</th> | |
46 | <td>{$form.currency.html}<br /> | |
47 | <span class="description">{ts}Select the currency to be used for contributions submitted from this contribution page.{/ts}</span></td> | |
48 | </tr> | |
49 | {if $paymentProcessor} | |
50 | <tr class="crm-contribution-contributionpage-amount-form-block-payment_processor"><th scope="row" class="label" width="20%">{$form.payment_processor.label}</th> | |
51 | <td>{$form.payment_processor.html}<br /> | |
52 | <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> | |
53 | </tr> | |
54 | {/if} | |
55 | <tr class="crm-contribution-contributionpage-amount-form-block-is_pay_later"><th scope="row" class="label">{$form.is_pay_later.label}</th> | |
56 | <td>{$form.is_pay_later.html}<br /> | |
57 | <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> | |
58 | </tr> | |
59 | <tr id="payLaterFields" class="crm-contribution-form-block-payLaterFields"><td> </td> | |
60 | <td> | |
61 | <table class="form-layout"> | |
836cf509 | 62 | <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 | 63 | <td>{$form.pay_later_text.html|crmAddClass:big}<br /> |
8a51f5e6 | 64 | <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 | 65 | <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 |
66 | <td>{$form.pay_later_receipt.html|crmAddClass:big}<br /> |
67 | <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 | 68 | |
e45f6ab0 | 69 | <tr><th scope="row" class="label">{$form.is_billing_required.label}</th> |
2b3fa30d DG |
70 | <td>{$form.is_billing_required.html}<br /> |
71 | <span class="description">{ts}Check this box to require users who select the pay later option to provide billing name and address.{/ts}</span> | |
72 | </td></tr> | |
6a488035 TO |
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 /> | |
4c030d33 | 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> |
6a488035 TO |
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 "-none-" 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> </td> | |
102 | <td> | |
103 | <table class="form-layout-compressed"> | |
836cf509 | 104 | <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 |
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> | |
dccd9f4f ERL |
123 | {if $futurePaymentProcessor} |
124 | <span id="pledge_calendar_date_field"> {include file="CRM/common/jcalendar.tpl" elementName=pledge_calendar_date}</span> | |
125 | <span id="pledge_calendar_month_field"> {$form.pledge_calendar_month.html}<br/><span class="description">{ts}Recurring payment will be processed this day of the month following submission of this contribution page.{/ts}</span></span> | |
126 | {/if} | |
6a488035 TO |
127 | |
128 | ||
129 | <div id="amountFields"> | |
130 | <table class="form-layout-compressed"> | |
131 | {* handle CiviPledge fields *} | |
132 | {if $civiPledge} | |
133 | <tr class="crm-contribution-form-block-is_pledge_active"><th scope="row" class="label" width="20%">{$form.is_pledge_active.label}</th> | |
134 | <td>{$form.is_pledge_active.html}<br /> | |
135 | <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> | |
136 | </td> | |
137 | </tr> | |
138 | <tr id="pledgeFields" class="crm-contribution-form-block-pledgeFields"><td></td><td> | |
139 | <table class="form-layout-compressed"> | |
836cf509 | 140 | <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 |
141 | <td>{$form.pledge_frequency_unit.html}<br /> |
142 | <span class="description">{ts}Which frequencies can the user pick from (e.g. every 'week', every 'month', every 'year')?{/ts}</span></td> | |
143 | </tr> | |
144 | <tr class="crm-contribution-form-block-is_pledge_interval"><th scope="row" class="label">{$form.is_pledge_interval.label}</th> | |
145 | <td>{$form.is_pledge_interval.html}<br /> | |
146 | <span class="description">{ts}Can they also set an interval (e.g. every '3' months)?{/ts}</span></td> | |
147 | </tr> | |
148 | <tr class="crm-contribution-form-block-initial_reminder_day"><th scope="row" class="label">{$form.initial_reminder_day.label}</th> | |
149 | <td>{$form.initial_reminder_day.html} | |
1e1e7dc8 | 150 | <span class="label">{ts}Days prior to each scheduled payment due date.{/ts}</span></td> |
6a488035 TO |
151 | </tr> |
152 | <tr class="crm-contribution-form-block-max_reminders"><th scope="row" class="label">{$form.max_reminders.label}</th> | |
153 | <td>{$form.max_reminders.html} | |
1e1e7dc8 | 154 | <span class="label">{ts}Reminders for each scheduled payment.{/ts}</span></td> |
6a488035 TO |
155 | </tr> |
156 | <tr class="crm-contribution-form-block-additional_reminder_day"><th scope="row" class="label">{$form.additional_reminder_day.label}</th> | |
157 | <td>{$form.additional_reminder_day.html} | |
1e1e7dc8 | 158 | <span class="label">{ts}Days after the last one sent, up to the maximum number of reminders.{/ts}</span></td> |
6a488035 | 159 | </tr> |
dccd9f4f ERL |
160 | {if $futurePaymentProcessor} |
161 | <tr id="adjustRecurringFields" class="crm-contribution-form-block-adjust_recur_start_date"><th scope="row" class="label">{$form.adjust_recur_start_date.label}</th> | |
162 | <td>{$form.adjust_recur_start_date.html}<br/> | |
5a892338 | 163 | <div id="recurDefaults"> |
dccd9f4f ERL |
164 | <span class="description">{$form.pledge_default_toggle.label}</span> |
165 | <table class="form-layout-compressed"> | |
166 | <tr class="crm-contribution-form-block-date_of_recurring_contribution"> | |
167 | <td>{$form.pledge_default_toggle.html}</td> | |
168 | </tr> | |
169 | <tr class="crm-contribution-form-block-is_pledge_start_date_visible"> | |
170 | <td>{$form.is_pledge_start_date_visible.html} {$form.is_pledge_start_date_visible.label}</td> | |
171 | </tr> | |
172 | <tr class="crm-contribution-form-block-is_pledge_start_date_visible"> | |
173 | <td>{$form.is_pledge_start_date_editable.html} {$form.is_pledge_start_date_editable.label}</td> | |
174 | </tr> | |
175 | </table> | |
176 | </div> | |
177 | </td> | |
178 | </tr> | |
179 | {/if} | |
6a488035 TO |
180 | </table> |
181 | </td> | |
182 | </tr> | |
183 | {/if} | |
34408315 E |
184 | |
185 | <tr class="crm-contribution-form-block-amount_label"> | |
836cf509 | 186 | <th scope="row" class="label" width="20%">{$form.amount_label.label}<span class="crm-marker"> *</span></th> |
34408315 E |
187 | <td>{$form.amount_label.html}</td> |
188 | </tr> | |
6a488035 TO |
189 | <tr class="crm-contribution-form-block-is_allow_other_amount"><th scope="row" class="label" width="20%">{$form.is_allow_other_amount.label}</th> |
190 | <td>{$form.is_allow_other_amount.html}<br /> | |
191 | <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> | |
192 | ||
193 | <tr id="minMaxFields" class="crm-contribution-form-block-minMaxFields"><td> </td><td> | |
194 | <table class="form-layout-compressed"> | |
195 | <tr class="crm-contribution-form-block-min_amount"><th scope="row" class="label">{$form.min_amount.label}</th> | |
196 | <td>{$form.min_amount.html|crmMoney}</td></tr> | |
197 | <tr class="crm-contribution-form-block-max_amount"><th scope="row" class="label">{$form.max_amount.label}</th> | |
198 | <td>{$form.max_amount.html|crmMoney}<br /> | |
199 | <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> | |
200 | </table> | |
201 | </td></tr> | |
202 | ||
203 | <tr><td colspan="2"> | |
204 | <fieldset><legend>{ts}Fixed Contribution Options{/ts}</legend> | |
c67e7149 MR |
205 | <div class="description"> |
206 | {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} | |
207 | </div> | |
208 | <br /> | |
6a488035 | 209 | <table id="map-field-table"> |
8a4f27dc | 210 | <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 |
211 | {section name=loop start=1 loop=11} |
212 | {assign var=idx value=$smarty.section.loop.index} | |
213 | <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> | |
214 | {/section} | |
215 | </table> | |
216 | </fieldset> | |
217 | </td></tr> | |
218 | </table> | |
219 | </div> | |
220 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | |
221 | </div> | |
6a488035 TO |
222 | {literal} |
223 | <script type="text/javascript"> | |
dccd9f4f ERL |
224 | |
225 | var futurePaymentProcessorMapper = []; | |
226 | {/literal}{if $futurePaymentProcessor} | |
227 | {foreach from=$futurePaymentProcessor item="futurePaymentProcessor" key="index"}{literal} | |
228 | futurePaymentProcessorMapper[{/literal}{$index}{literal}] = '{/literal}{$futurePaymentProcessor}{literal}'; | |
229 | {/literal}{/foreach} | |
230 | {literal} | |
231 | CRM.$(function($) { | |
232 | var defId = $('input[name="pledge_default_toggle"][value="contribution_date"]').attr('id'); | |
233 | var calId = $('input[name="pledge_default_toggle"][value="calendar_date"]').attr('id'); | |
234 | var monId = $('input[name="pledge_default_toggle"][value="calendar_month"]').attr('id'); | |
235 | ||
236 | $("label[for='" + calId + "']").append($('#pledge_calendar_date_field')); | |
237 | $("label[for='" + monId + "']").append($('#pledge_calendar_month_field')); | |
238 | ||
239 | setDateDefaults(); | |
240 | ||
241 | $("#" + defId).click( function() { | |
242 | if ($(this).is(':checked')) { | |
243 | $('#pledge_calendar_month').prop('disabled', 'disabled'); | |
244 | $('#pledge_calendar_date').prop('disabled', 'disabled'); | |
245 | $("#pledge_calendar_date").next('input').prop('disabled', 'disabled'); | |
246 | } | |
247 | }); | |
248 | ||
249 | $("#" + calId).click( function() { | |
250 | if ($(this).is(':checked')) { | |
251 | $('#pledge_calendar_month').prop('disabled', 'disabled'); | |
252 | $('#pledge_calendar_date').prop('disabled', false); | |
253 | $("#pledge_calendar_date").next('input').prop('disabled', false); | |
254 | } | |
255 | }); | |
256 | ||
257 | $("#" + monId).click( function() { | |
258 | if ($(this).is(':checked')) { | |
259 | $('#pledge_calendar_month').prop('disabled', false); | |
260 | $("#pledge_calendar_date").next('input').prop('disabled', 'disabled'); | |
261 | $('#pledge_calendar_date').prop('disabled', 'disabled'); | |
262 | } | |
263 | }); | |
264 | ||
265 | ||
266 | }); | |
267 | {/literal}{/if}{literal} | |
268 | ||
ae8f569f | 269 | var paymentProcessorMapper = []; |
6a488035 TO |
270 | {/literal} |
271 | {if $recurringPaymentProcessor} | |
272 | {foreach from=$recurringPaymentProcessor item="paymentProcessor" key="index"}{literal} | |
273 | paymentProcessorMapper[{/literal}{$index}{literal}] = '{/literal}{$paymentProcessor}{literal}'; | |
274 | {/literal}{/foreach} | |
275 | {/if} | |
276 | {literal} | |
847f8123 | 277 | CRM.$(function($) { |
f35d3f5e | 278 | var psid = $('#price_set_id').val(); |
279 | showHideAmountBlock(psid, 'price_set_id'); | |
847f8123 CW |
280 | function checked_payment_processors() { |
281 | var ids = []; | |
282 | $('.crm-contribution-contributionpage-amount-form-block-payment_processor input[type="checkbox"]').each(function(){ | |
283 | if($(this).prop('checked')) { | |
284 | var id = $(this).attr('id').split('_')[2]; | |
285 | ids.push(id); | |
286 | } | |
287 | }); | |
288 | return ids; | |
289 | } | |
6a488035 TO |
290 | |
291 | // show/hide recurring block | |
847f8123 CW |
292 | $('.crm-contribution-contributionpage-amount-form-block-payment_processor input[type="checkbox"]').change(function(){ |
293 | showRecurring( checked_payment_processors() ); | |
dccd9f4f | 294 | showAdjustRecurring( checked_payment_processors() ); |
6a488035 | 295 | }); |
847f8123 | 296 | showRecurring( checked_payment_processors() ); |
dccd9f4f | 297 | showAdjustRecurring( checked_payment_processors() ); |
6a488035 TO |
298 | }); |
299 | var element_other_amount = document.getElementsByName('is_allow_other_amount'); | |
300 | if (! element_other_amount[0].checked) { | |
301 | cj('#minMaxFields').hide(); | |
302 | } | |
303 | var amount_block = document.getElementsByName('amount_block_is_active'); | |
304 | var priceSetID = {/literal}'{$priceSetID}'{literal}; | |
305 | ||
306 | if ( ! amount_block[0].checked || priceSetID ) { | |
307 | if ( !priceSetID ) { | |
308 | cj('#priceSet').hide(); | |
1ebebaab AH |
309 | if (CRM.memberPriceset) { |
310 | 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}'); | |
311 | } | |
6a488035 TO |
312 | } |
313 | cj('#amountFields').hide(); | |
1ebebaab | 314 | } |
6a488035 | 315 | |
3cc60a06 | 316 | CRM.$(function($) { |
6a488035 TO |
317 | payLater('is_pay_later'); |
318 | }); | |
319 | ||
320 | cj('#is_pay_later').click( function() { | |
321 | payLater('is_pay_later'); | |
322 | }); | |
b2603e29 | 323 | |
6a488035 TO |
324 | |
325 | function minMax(chkbox) { | |
326 | if (chkbox.checked) { | |
327 | cj('#minMaxFields').show(); | |
328 | } else { | |
329 | cj('#minMaxFields').hide(); | |
330 | document.getElementById("min_amount").value = ''; | |
331 | document.getElementById("max_amount").value = ''; | |
332 | } | |
333 | } | |
334 | ||
335 | function payLater(chkbox) { | |
336 | var elementId = 'payLaterFields'; | |
8539f25d | 337 | if (cj('#' + chkbox).prop('checked')) { |
6a488035 TO |
338 | cj('#' + elementId).show(); |
339 | } else { | |
340 | cj('#' + elementId).hide(); | |
341 | } | |
342 | } | |
343 | ||
82e5b062 | 344 | function showHideAmountBlock(element, elementName) { |
345 | // show / hide when amount section is active check/uncheck. | |
346 | var priceSetID = {/literal}'{$priceSetID}'{literal}; | |
347 | switch (elementName) { | |
6a488035 | 348 | case 'price_set_id': |
82e5b062 | 349 | if (element) { |
350 | cj('#amountFields').hide(); | |
351 | } | |
5a892338 JP |
352 | else { |
353 | cj('#amountFields').show(); | |
354 | } | |
82e5b062 | 355 | break; |
6a488035 | 356 | |
82e5b062 | 357 | case 'is_pledge_active': |
358 | case 'is_allow_other_amount': | |
359 | if (element.checked) { | |
360 | if (priceSetID) cj( "#price_set_id" ).val(''); | |
361 | cj('#amountFields').show(); | |
6a488035 | 362 | } |
82e5b062 | 363 | cj("#amount_block_is_active").prop('checked', true ); |
364 | break; | |
365 | ||
366 | case 'amount_block_is_active': | |
367 | if (element.checked) { | |
368 | if (priceSetID) { | |
369 | cj('#amountFields').hide(); | |
370 | cj( "#price_set_id" ).val(priceSetID); | |
371 | } | |
372 | else { | |
373 | cj('#amountFields').show(); | |
374 | cj( "#price_set_id" ).val(''); | |
375 | } | |
376 | cj('#priceSet, #recurringFields').show(); | |
377 | } | |
378 | else { | |
379 | cj( "#price_set_id" ).val(''); | |
380 | cj('#amountFields, #priceSet, #recurringFields').hide(); | |
381 | } | |
382 | break; | |
383 | } | |
384 | } | |
6a488035 TO |
385 | |
386 | function showRecurring( paymentProcessorIds ) { | |
387 | var display = true; | |
388 | cj.each(paymentProcessorIds, function(k, id){ | |
389 | if( cj.inArray(id, paymentProcessorMapper) == -1 ) { | |
390 | display = false; | |
391 | } | |
392 | }); | |
393 | ||
394 | if(display) { | |
395 | cj( '#recurringContribution' ).show( ); | |
396 | } else { | |
8539f25d CW |
397 | if ( cj( '#is_recur' ).prop('checked' ) ) { |
398 | cj( '#is_recur' ).prop('checked', false); | |
6a488035 TO |
399 | cj( '#recurFields' ).hide( ); |
400 | } | |
401 | cj( '#recurringContribution' ).hide( ); | |
402 | } | |
403 | } | |
b2603e29 | 404 | |
dccd9f4f ERL |
405 | function showAdjustRecurring( paymentProcessorIds ) { |
406 | var display = true; | |
407 | cj.each(paymentProcessorIds, function(k, id){ | |
408 | if( cj.inArray(id, futurePaymentProcessorMapper) == -1 ) { | |
409 | display = false; | |
410 | } | |
411 | }); | |
412 | ||
413 | if(display) { | |
414 | cj( '#adjustRecurringFields' ).show( ); | |
415 | } else { | |
416 | if ( cj( '#adjust_recur_start_date' ).prop('checked' ) ) { | |
417 | cj( '#adjust_recur_start_date' ).prop('checked', false); | |
418 | cj( '#recurDefaults' ).hide( ); | |
419 | } | |
420 | cj( '#adjustRecurringFields' ).hide( ); | |
421 | } | |
422 | } | |
423 | ||
424 | {/literal}{if $futurePaymentProcessor}{literal} | |
425 | function setDateDefaults() { | |
426 | {/literal}{if !$pledge_calendar_date}{literal} | |
427 | cj('#pledge_calendar_date').prop('disabled', 'disabled'); | |
4c030d33 | 428 | cj("#pledge_calendar_date").next('input').prop('disabled', 'disabled'); |
dccd9f4f ERL |
429 | {/literal}{/if} |
430 | ||
431 | {if !$pledge_calendar_month}{literal} | |
432 | cj('#pledge_calendar_month').prop('disabled', 'disabled'); | |
433 | {/literal}{/if}{literal} | |
434 | } | |
435 | {/literal}{/if}{literal} | |
436 | ||
6a488035 TO |
437 | </script> |
438 | {/literal} | |
439 | {if $form.is_recur} | |
440 | {include file="CRM/common/showHideByFieldValue.tpl" | |
441 | trigger_field_id ="is_recur" | |
442 | trigger_value ="true" | |
443 | target_element_id ="recurFields" | |
444 | target_element_type ="table-row" | |
445 | field_type ="radio" | |
446 | invert = "false" | |
447 | } | |
448 | {/if} | |
dccd9f4f ERL |
449 | {if $form.adjust_recur_start_date} |
450 | {include file="CRM/common/showHideByFieldValue.tpl" | |
451 | trigger_field_id ="adjust_recur_start_date" | |
452 | trigger_value ="true" | |
453 | target_element_id ="recurDefaults" | |
454 | target_element_type ="table-row" | |
455 | field_type ="radio" | |
456 | invert = "false" | |
457 | } | |
458 | {/if} | |
6a488035 TO |
459 | {if $civiPledge} |
460 | {include file="CRM/common/showHideByFieldValue.tpl" | |
461 | trigger_field_id = "is_pledge_active" | |
462 | trigger_value = "true" | |
463 | target_element_id = "pledgeFields" | |
464 | target_element_type = "table-row" | |
465 | field_type = "radio" | |
466 | invert = "false" | |
467 | } | |
468 | {/if} | |
469 | ||
6a488035 TO |
470 | {if $isQuick} |
471 | {literal} | |
472 | <script type="text/javascript"> | |
847f8123 CW |
473 | CRM.$(function($) { |
474 | $("#quickconfig").click(function(e) { | |
475 | e.preventDefault(); | |
476 | CRM.confirm({ | |
477 | width: 400, | |
478 | 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} | |
479 | }).on('crmConfirm:yes', function() { | |
480 | {/literal} | |
481 | var dataUrl = '{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Core_Page_AJAX&fnName=setIsQuickConfig&context=civicrm_contribution_page&id=$contributionPageID" }'; | |
482 | {literal} | |
483 | $.getJSON(dataUrl).done(function(result) {window.location = CRM.url("civicrm/admin/price/field", {reset: 1, action: 'browse', sid: result});}); | |
484 | }); | |
485 | }); | |
486 | }); | |
6a488035 TO |
487 | </script> |
488 | {/literal} | |
489 | {/if} | |
c6a04a04 SL |
490 | {/crmRegion} |
491 | {crmRegion name="contribute-form-contributionpage-amount-post"} | |
492 | {/crmRegion} |