Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
819d0d41 | 3 | | CiviCRM version 4.5 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
819d0d41 | 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
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 | {* this template is used for adding/editing/deleting contributions and pledge payments *} | |
27 | ||
28 | {if $cdType} | |
29 | {include file="CRM/Custom/Form/CustomData.tpl"} | |
30 | {elseif $priceSetId} | |
31 | {include file="CRM/Price/Form/PriceSet.tpl" context="standalone" extends="Contribution"} | |
32 | {elseif $showAdditionalInfo and $formType } | |
33 | {include file="CRM/Contribute/Form/AdditionalInfo/$formType.tpl"} | |
34 | {else} | |
35 | ||
6a488035 TO |
36 | <div class="crm-block crm-form-block crm-contribution-form-block"> |
37 | ||
38 | {if $contributionMode == 'test' } | |
39 | {assign var=contribMode value="TEST"} | |
40 | {elseif $contributionMode == 'live'} | |
41 | {assign var=contribMode value="LIVE"} | |
42 | {/if} | |
43 | ||
44 | {if !$email and $action neq 8 and $context neq 'standalone'} | |
45 | <div class="messages status no-popup"> | |
46 | <div class="icon inform-icon"></div> {ts}You will not be able to send an automatic email receipt for this contribution because there is no email address recorded for this contact. If you want a receipt to be sent when this contribution is recorded, click Cancel and then click Edit from the Summary tab to add an email address before recording the contribution.{/ts} | |
47 | </div> | |
48 | {/if} | |
49 | {if $contributionMode} | |
50 | <div id="help"> | |
51 | {if $contactId} | |
52 | {ts 1=$displayName 2=$contribMode}Use this form to submit a new contribution on behalf of %1. <strong>A %2 transaction will be submitted</strong> using the selected payment processor.{/ts} | |
53 | {else} | |
54 | {ts 1=$displayName 2=$contribMode}Use this form to submit a new contribution. <strong>A %2 transaction will be submitted</strong> using the selected payment processor.{/ts} | |
55 | {/if} | |
56 | </div> | |
57 | {/if} | |
58 | {if $action eq 8} | |
59 | <div class="messages status no-popup"> | |
60 | <div class="icon inform-icon"></div> | |
61 | {ts}WARNING: Deleting this contribution will result in the loss of the associated financial transactions (if any).{/ts} {ts}Do you want to continue?{/ts} | |
62 | </div> | |
63 | {else} | |
64 | <div class="crm-submit-buttons"> | |
65 | {include file="CRM/common/formButtons.tpl"} | |
66 | {if $newCredit AND $action EQ 1 AND $contributionMode EQ null} | |
67 | {if $contactId} | |
68 | {capture assign=ccModeLink}{crmURL p='civicrm/contact/view/contribution' q="reset=1&action=add&cid=`$contactId`&context=`$context`&mode=live"}{/capture} | |
69 | {else} | |
70 | {capture assign=ccModeLink}{crmURL p='civicrm/contact/view/contribution' q="reset=1&action=add&context=standalone&mode=live"}{/capture} | |
71 | {/if} | |
e2046b33 | 72 | <span class="action-link crm-link-credit-card-mode"> <a class="open-inline crm-hover-button action-item" href="{$ccModeLink}">» {ts}submit credit card contribution{/ts}</a></span> |
6a488035 TO |
73 | {/if} |
74 | </div> | |
75 | {if $isOnline}{assign var=valueStyle value=" class='view-value'"}{else}{assign var=valueStyle value=""}{/if} | |
76 | <table class="form-layout-compressed"> | |
77 | {if $context neq 'standalone'} | |
78 | <tr> | |
79 | <td class="font-size12pt label"><strong><strong>{ts}Contributor{/ts}</strong></td><td class="font-size12pt"><strong>{$displayName}</strong></td> | |
80 | </tr> | |
81 | {else} | |
ccec9d6b CW |
82 | <td class="label">{$form.contact_id.label}</td> |
83 | <td>{$form.contact_id.html}</td> | |
6a488035 TO |
84 | {/if} |
85 | {if $contributionMode} | |
86 | <tr class="crm-contribution-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> | |
87 | {/if} | |
88 | <tr class="crm-contribution-form-block-contribution_type_id crm-contribution-form-block-financial_type_id"> | |
89 | <td class="label">{$form.financial_type_id.label}</td><td{$valueStyle}>{$form.financial_type_id.html} | |
90 | {if $is_test} | |
91 | {ts}(test){/ts} | |
92 | {/if} {help id="id-financial_type"} | |
93 | </td> | |
94 | </tr> | |
95 | {if $action eq 2 and $lineItem and !$defaultContribution} | |
96 | <tr> | |
97 | <td class="label">{ts}Contribution Amount{/ts}</td> | |
98 | <td>{include file="CRM/Price/Page/LineItem.tpl" context="Contribution"}</td> | |
99 | </tr> | |
100 | {else} | |
101 | <tr class="crm-contribution-form-block-total_amount"> | |
102 | <td class="label">{$form.total_amount.label}</td> | |
103 | <td {$valueStyle}> | |
104 | <span id='totalAmount'>{$form.currency.html|crmAddClass:eight} {$form.total_amount.html|crmAddClass:eight}</span> | |
105 | {if $hasPriceSets} | |
106 | <span id='totalAmountORPriceSet'> {ts}OR{/ts}</span> | |
107 | <span id='selectPriceSet'>{$form.price_set_id.html}</span> | |
108 | <div id="priceset" class="hiddenElement"></div> | |
109 | {/if} | |
110 | ||
111 | {if $ppID}{ts}<a href='#' onclick='adjustPayment();'>adjust payment amount</a>{/ts}{help id="adjust-payment-amount"}{/if} | |
6899cc66 | 112 | <br /><span class="description">{ts}Total amount of this contribution.{/ts}{if $hasPriceSets} {ts}Alternatively, you can use a price set.{/ts}{/if}</span> |
6a488035 TO |
113 | </td> |
114 | </tr> | |
115 | ||
116 | {if $buildRecurBlock && !$ppID} | |
117 | <tr id='recurringPaymentBlock' class='hiddenElement'> | |
118 | <td></td> | |
119 | <td> | |
120 | <strong>{$form.is_recur.html} {ts}every{/ts} | |
121 | {$form.frequency_interval.html} | |
122 | {$form.frequency_unit.html} | |
123 | {ts}for{/ts} | |
124 | {$form.installments.html} | |
125 | {$form.installments.label} | |
126 | </strong> | |
127 | <br /> | |
128 | <span class="description"> | |
129 | {ts}Your recurring contribution will be processed automatically for the number of installments you specify. You can leave the number of installments blank if you want to make an open-ended commitment. In either case, you can choose to cancel at any time. You will receive an email receipt for each recurring contribution. The receipts will include a link you can use if you decide to modify or cancel your future contributions.{/ts} | |
130 | </span> | |
131 | </td> | |
132 | </tr> | |
133 | {/if} | |
134 | ||
135 | <tr id="adjust-option-type" class="crm-contribution-form-block-option_type"> | |
136 | <td class="label"></td><td {$valueStyle}>{$form.option_type.html}</td> | |
137 | </tr> | |
138 | {/if} | |
139 | {if $contributionMode && $processorSupportsFutureStartDate} | |
140 | <tr id='start_date' class="crm-contribution-form-block-receive_date"> | |
141 | <td class="label">{ts}Start Date{/ts}</td> | |
142 | <td {$valueStyle}>{if $hideCalender neq true}{include file="CRM/common/jcalendar.tpl" elementName=receive_date}{else}{$receive_date|crmDate}{/if}<br /> | |
143 | <span class="description">{ts}You can set a start date for recurring contributions and the first payment will be on that date. For a single post-dated contribution you must select recurring and choose one installment{/ts}</span> | |
144 | </td> | |
145 | </tr> | |
146 | {/if} | |
147 | ||
148 | <tr class="crm-contribution-form-block-source"> | |
149 | <td class="label">{$form.source.label}</td> | |
150 | <td {$valueStyle}>{$form.source.html|crmAddClass:huge} {help id="id-contrib_source"} | |
151 | </td> | |
152 | </tr> | |
153 | ||
154 | {* CRM-7362 --add campaign to contributions *} | |
155 | {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" campaignTrClass="crm-contribution-form-block-campaign_id"} | |
156 | ||
157 | {if $contributionMode} | |
158 | {if $email and $outBound_option != 2} | |
159 | <tr class="crm-contribution-form-block-is_email_receipt"> | |
160 | <td class="label">{$form.is_email_receipt.label}</td> | |
161 | <td>{$form.is_email_receipt.html} <span class="description">{ts 1=$email}Automatically email a receipt for this contribution to %1?{/ts}</span> | |
162 | </td> | |
163 | </tr> | |
164 | {elseif $context eq 'standalone' and $outBound_option != 2 } | |
165 | <tr id="email-receipt" style="display:none;" class="crm-contribution-form-block-is_email_receipt"><td class="label">{$form.is_email_receipt.label}</td><td>{$form.is_email_receipt.html} <span class="description">{ts}Automatically email a receipt for this contribution to {/ts}<span id="email-address"></span>?</span></td></tr> | |
166 | {/if} | |
167 | <tr id="fromEmail" style="display:none;" > | |
168 | <td class="label">{$form.from_email_address.label}</td> | |
169 | <td>{$form.from_email_address.html}</td> | |
170 | </tr> | |
171 | <tr id="receiptDate" class="crm-contribution-form-block-receipt_date"> | |
172 | <td class="label">{$form.receipt_date.label}</td> | |
173 | <td>{include file="CRM/common/jcalendar.tpl" elementName=receipt_date}<br /> | |
174 | <span class="description">{ts}Date that a receipt was sent to the contributor.{/ts}</span> | |
175 | </td> | |
176 | </tr> | |
177 | {/if} | |
178 | {if !$contributionMode} | |
179 | <tr class="crm-contribution-form-block-contribution_status_id"> | |
180 | <td class="label">{$form.contribution_status_id.label}</td> | |
181 | <td>{$form.contribution_status_id.html} | |
182 | {if $contribution_status_id eq 2}{if $is_pay_later }: {ts}Pay Later{/ts} {else}: {ts}Incomplete Transaction{/ts}{/if}{/if} | |
183 | </td> | |
184 | </tr> | |
185 | ||
186 | {* Cancellation / Refunded fields are hidden unless contribution status is set to Cancelled or Refunded*} | |
187 | <tr id="cancelInfo" class="crm-contribution-form-block-cancelInfo"> | |
188 | <td> </td> | |
189 | <td><fieldset><legend>{ts}Cancellation or Refund Information{/ts}</legend> | |
190 | <table class="form-layout-compressed"> | |
191 | <tr id="cancelDate" class="crm-contribution-form-block-cancel_date"> | |
192 | <td class="label">{$form.cancel_date.label}</td> | |
193 | <td> | |
194 | {if $hideCalendar neq true} | |
195 | {include file="CRM/common/jcalendar.tpl" elementName=cancel_date} | |
196 | {else} | |
d32858b8 | 197 | {$form.cancel_date.value|crmDate} |
6a488035 TO |
198 | {/if} |
199 | </td> | |
200 | </tr> | |
201 | <tr id="cancelDescription" class="crm-contribution-form-block-cancel_reason"> | |
202 | <td class="label"> </td> | |
203 | <td class="description">{ts}Enter the cancellation or refunded date, or you can skip this field and the cancellation date or refunded date will be automatically set to TODAY.{/ts}</td> | |
204 | </tr> | |
205 | <tr id="cancelReason"> | |
206 | <td class="label" style="vertical-align: top;">{$form.cancel_reason.label}</td> | |
ce22fda6 | 207 | <td>{$form.cancel_reason.html}</td> |
6a488035 TO |
208 | </tr> |
209 | </table> | |
210 | </fieldset> | |
211 | </td> | |
212 | </tr> | |
213 | {/if} | |
0baed70b | 214 | |
6a488035 | 215 | </table> |
96cfe0d7 | 216 | <!-- start of soft credit --> |
00a1afe2 | 217 | <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed {if $noSoftCredit}collapsed{/if}" id="softCredit"> |
96cfe0d7 | 218 | <div class="crm-accordion-header"> |
219 | {ts}Soft Credit{/ts} {help id="id-soft_credit"} | |
220 | </div> | |
221 | <div class="crm-accordion-body"> | |
222 | <table class="form-layout-compressed"> | |
b6545333 | 223 | <tr class="crm-contribution-form-block-soft_credit_to"> |
224 | <td colspan="2"> | |
225 | {include file="CRM/Contribute/Form/SoftCredit.tpl"} | |
226 | </td> | |
227 | </tr> | |
228 | </table> | |
229 | </div> | |
230 | </div> | |
231 | <!-- end of soft credit --> | |
232 | ||
233 | <!-- start of PCP --> | |
234 | {if $siteHasPCPs} | |
00a1afe2 | 235 | <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed {if $noPCP}collapsed{/if}" id="softCredit"> |
b6545333 | 236 | <div class="crm-accordion-header"> |
237 | {ts}Personal Campaign Page{/ts} {help id="id-pcp"} | |
238 | </div> | |
239 | <div class="crm-accordion-body"> | |
240 | <table class="form-layout-compressed"> | |
241 | <tr class="crm-contribution-pcp-block crm-contribution-form-block-pcp_made_through_id"> | |
6bb107ce | 242 | <td class="label">{$form.pcp_made_through_id.label}</td> |
96cfe0d7 | 243 | <td> |
6bb107ce | 244 | {$form.pcp_made_through_id.html} |
96cfe0d7 | 245 | <span class="description">{ts}Search for the Personal Campaign Page by the fund-raiser's last name or |
246 | email address.{/ts}</span> | |
247 | ||
248 | <div class="spacer"></div> | |
b6545333 | 249 | <div class="crm-contribution-form-block-pcp_details"> |
96cfe0d7 | 250 | <table class="crm-contribution-form-table-credit_to_pcp"> |
251 | <tr id="pcpDisplayRollID" class="crm-contribution-form-block-pcp_display_in_roll"> | |
252 | <td class="label">{$form.pcp_display_in_roll.label}</td> | |
253 | <td>{$form.pcp_display_in_roll.html}</td> | |
254 | </tr> | |
255 | <tr id="nickID" class="crm-contribution-form-block-pcp_roll_nickname"> | |
256 | <td class="label">{$form.pcp_roll_nickname.label}</td> | |
257 | <td>{$form.pcp_roll_nickname.html|crmAddClass:big}<br/> | |
258 | <span class="description">{ts}Name or nickname contributor wants to be displayed in the Honor | |
259 | Roll. Enter "Anonymous" for anonymous contributions.{/ts}</span> | |
260 | </td> | |
261 | </tr> | |
262 | <tr id="personalNoteID" class="crm-contribution-form-block-pcp_personal_note"> | |
263 | <td class="label" style="vertical-align: top">{$form.pcp_personal_note.label}</td> | |
264 | <td> | |
265 | {$form.pcp_personal_note.html} | |
266 | <span | |
267 | class="description">{ts}Personal message submitted by contributor for display in the Honor Roll.{/ts}</span> | |
268 | </td> | |
269 | </tr> | |
270 | </table> | |
271 | </div> | |
272 | </td> | |
273 | </tr> | |
b6545333 | 274 | </table> |
275 | </div> | |
96cfe0d7 | 276 | </div> |
b6545333 | 277 | {/if} |
278 | <!-- end of PCP --> | |
279 | ||
6a488035 TO |
280 | {if !$contributionMode} |
281 | <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed" id="paymentDetails_Information"> | |
282 | <div class="crm-accordion-header"> | |
283 | {ts}Payment Details{/ts} | |
284 | </div> | |
285 | <div class="crm-accordion-body"> | |
286 | <table class="form-layout-compressed" > | |
287 | <tr class="crm-contribution-form-block-receive_date"> | |
288 | <td class="label">{$form.receive_date.label}</td> | |
289 | <td {$valueStyle}>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}<br /> | |
290 | <span class="description">{ts}The date this contribution was received.{/ts}</span> | |
291 | </td> | |
292 | </tr> | |
293 | <tr class="crm-contribution-form-block-payment_instrument_id"> | |
294 | <td class="label">{$form.payment_instrument_id.label}</td> | |
d20225bb | 295 | <td {$valueStyle}>{$form.payment_instrument_id.html} {help id="payment_instrument_id"}</td> |
6a488035 TO |
296 | </td> |
297 | </tr> | |
298 | {if $showCheckNumber || !$isOnline} | |
299 | <tr id="checkNumber" class="crm-contribution-form-block-check_number"> | |
300 | <td class="label">{$form.check_number.label}</td> | |
ce22fda6 | 301 | <td>{$form.check_number.html}</td> |
6a488035 TO |
302 | </tr> |
303 | {/if} | |
304 | <tr class="crm-contribution-form-block-trxn_id"> | |
305 | <td class="label">{$form.trxn_id.label}</td> | |
ce22fda6 | 306 | <td {$valueStyle}>{$form.trxn_id.html} {help id="id-trans_id"}</td> |
6a488035 TO |
307 | </tr> |
308 | {if $email and $outBound_option != 2} | |
309 | <tr class="crm-contribution-form-block-is_email_receipt"> | |
310 | <td class="label"> | |
311 | {$form.is_email_receipt.label}</td><td>{$form.is_email_receipt.html} | |
312 | <span class="description">{ts 1=$email}Automatically email a receipt for this payment to %1?{/ts}</span> | |
313 | </td> | |
314 | </tr> | |
315 | {elseif $context eq 'standalone' and $outBound_option != 2 } | |
316 | <tr id="email-receipt" style="display:none;" class="crm-contribution-form-block-is_email_receipt"> | |
317 | <td class="label">{$form.is_email_receipt.label}</td> | |
318 | <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> | |
319 | </td> | |
320 | </tr> | |
321 | {/if} | |
322 | <tr id="receiptDate" class="crm-contribution-form-block-receipt_date"> | |
323 | <td class="label">{$form.receipt_date.label}</td> | |
324 | <td>{include file="CRM/common/jcalendar.tpl" elementName=receipt_date}<br /> | |
325 | <span class="description">{ts}Date that a receipt was sent to the contributor.{/ts}</span> | |
326 | </td> | |
327 | </tr> | |
328 | <tr id="fromEmail" class="crm-contribution-form-block-receipt_date" style="display:none;"> | |
329 | <td class="label">{$form.from_email_address.label}</td> | |
330 | <td>{$form.from_email_address.html}</td> | |
331 | </tr> | |
332 | </table> | |
333 | </div> | |
334 | </div> | |
335 | {/if} | |
336 | ||
337 | <div id="customData" class="crm-contribution-form-block-customData"></div> | |
338 | ||
339 | {*include custom data js file*} | |
340 | {include file="CRM/common/customData.tpl"} | |
341 | ||
342 | {literal} | |
343 | <script type="text/javascript"> | |
3cc60a06 | 344 | CRM.$(function($) { |
6a488035 TO |
345 | {/literal} |
346 | CRM.buildCustomData( '{$customDataType}' ); | |
347 | {if $customDataSubType} | |
348 | CRM.buildCustomData( '{$customDataType}', {$customDataSubType} ); | |
349 | {/if} | |
291f6bec | 350 | |
96cfe0d7 | 351 | {if $buildPriceSet}{literal}buildAmount( );{/literal}{/if} |
6a488035 TO |
352 | {literal} |
353 | }); | |
354 | ||
355 | // bind first click of accordion header to load crm-accordion-body with snippet | |
356 | // everything else taken care of by cj().crm-accordions() | |
3cc60a06 | 357 | CRM.$(function($) { |
6a488035 TO |
358 | cj('#adjust-option-type').hide(); |
359 | cj('.crm-ajax-accordion .crm-accordion-header').one('click', function() { | |
360 | loadPanes(cj(this).attr('id')); | |
361 | }); | |
362 | cj('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(function(index) { | |
363 | loadPanes(cj(this).attr('id')); | |
364 | }); | |
365 | }); | |
366 | // load panes function calls for snippet based on id of crm-accordion-header | |
367 | function loadPanes( id ) { | |
368 | var url = "{/literal}{crmURL p='civicrm/contact/view/contribution' q='snippet=4&formType=' h=0}{literal}" + id; | |
369 | {/literal} | |
370 | {if $contributionMode} | |
371 | url = url + "&mode={$contributionMode}"; | |
372 | {/if} | |
373 | {if $qfKey} | |
374 | url = url + "&qfKey={$qfKey}"; | |
375 | {/if} | |
376 | {literal} | |
377 | if (! cj('div.'+id).html()) { | |
378 | var loading = '<img src="{/literal}{$config->resourceBase}i/loading.gif{literal}" alt="{/literal}{ts escape='js'}loading{/ts}{literal}" /> {/literal}{ts escape='js'}Loading{/ts}{literal}...'; | |
379 | cj('div.'+id).html(loading); | |
380 | cj.ajax({ | |
381 | url : url, | |
b22f0cad | 382 | success: function(data) { cj('div.'+id).html(data).trigger('crmLoad'); } |
6a488035 TO |
383 | }); |
384 | } | |
385 | } | |
386 | ||
387 | var url = "{/literal}{$dataUrl}{literal}"; | |
388 | ||
6a488035 TO |
389 | {/literal} |
390 | {if $context eq 'standalone' and $outBound_option != 2 } | |
391 | {literal} | |
3cc60a06 | 392 | CRM.$(function($) { |
ae8f569f CW |
393 | |
394 | var $form = $("#{/literal}{$form.formName}{literal}"); | |
395 | $("#contact_id", $form).change(checkEmail); | |
6a488035 | 396 | checkEmail( ); |
ae8f569f CW |
397 | |
398 | function checkEmail( ) { | |
399 | var data = $("#contact_id", $form).select2('data'); | |
400 | if (data && data.extra && data.extra.email && data.extra.email.length) { | |
401 | $("#email-receipt", $form).show(); | |
402 | $("#email-address", $form).html(data.extra.email); | |
403 | } | |
404 | else { | |
405 | $("#email-receipt", $form).hide(); | |
406 | } | |
407 | } | |
408 | ||
6a488035 TO |
409 | showHideByValue( 'is_email_receipt', '', 'receiptDate', 'table-row', 'radio', true); |
410 | showHideByValue( 'is_email_receipt', '', 'fromEmail', 'table-row', 'radio', false ); | |
411 | }); | |
412 | ||
6a488035 TO |
413 | {/literal} |
414 | {/if} | |
415 | </script> | |
416 | ||
417 | <div class="accordion ui-accordion ui-widget ui-helper-reset"> | |
418 | {* Additional Detail / Honoree Information / Premium Information *} | |
419 | {foreach from=$allPanes key=paneName item=paneValue} | |
420 | ||
421 | <div class="crm-accordion-wrapper crm-ajax-accordion crm-{$paneValue.id}-accordion {if $paneValue.open neq 'true'}collapsed{/if}"> | |
422 | <div class="crm-accordion-header" id="{$paneValue.id}"> | |
423 | ||
424 | {$paneName} | |
425 | </div><!-- /.crm-accordion-header --> | |
426 | <div class="crm-accordion-body"> | |
427 | ||
428 | <div class="{$paneValue.id}"></div> | |
429 | </div><!-- /.crm-accordion-body --> | |
430 | </div><!-- /.crm-accordion-wrapper --> | |
431 | ||
432 | {/foreach} | |
433 | </div> | |
434 | ||
435 | {/if} | |
436 | <br /> | |
437 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | |
438 | </div> | |
439 | ||
440 | {literal} | |
441 | <script type="text/javascript"> | |
442 | function verify( ) { | |
8539f25d | 443 | if (cj('#is_email_receipt').prop('checked' )) { |
6a488035 TO |
444 | var ok = confirm( '{/literal}{ts escape='js'}Click OK to save this contribution record AND send a receipt to the contributor now{/ts}{literal}.' ); |
445 | if (!ok) { | |
446 | return false; | |
447 | } | |
448 | } | |
449 | } | |
96cfe0d7 | 450 | |
6a488035 TO |
451 | function status() { |
452 | cj("#cancel_date").val(''); | |
453 | cj("#cancel_reason").val(''); | |
454 | } | |
455 | ||
456 | </script> | |
457 | {/literal} | |
458 | ||
459 | {if $action neq 8} | |
460 | {literal} | |
461 | <script type="text/javascript"> | |
3cc60a06 | 462 | CRM.$(function($) { |
6a488035 TO |
463 | checkEmailDependancies( ); |
464 | cj('#is_email_receipt').click( function( ) { | |
465 | checkEmailDependancies( ); | |
466 | }); | |
467 | }); | |
468 | ||
469 | function checkEmailDependancies( ) { | |
8539f25d | 470 | if (cj('#is_email_receipt').prop('checked' )) { |
6a488035 TO |
471 | cj('#fromEmail').show( ); |
472 | cj('#receiptDate').hide( ); | |
473 | } | |
474 | else { | |
475 | cj('#fromEmail').hide( ); | |
476 | cj('#receiptDate').show( ); | |
477 | } | |
478 | } | |
479 | ||
480 | {/literal}{if !$contributionMode}{literal} | |
3cc60a06 | 481 | CRM.$(function($) { |
96cfe0d7 | 482 | showHideCancelInfo(cj('#contribution_status_id')); |
483 | ||
6a488035 TO |
484 | cj('#contribution_status_id').change(function() { |
485 | showHideCancelInfo(this); | |
486 | } | |
487 | ); | |
488 | }); | |
489 | ||
490 | function showHideCancelInfo(obj) { | |
491 | contributionStatus = cj(obj).val(); | |
492 | if (contributionStatus == 3 || contributionStatus == 7) { | |
493 | cj('#cancelInfo').show( ); | |
494 | } | |
495 | else { | |
96cfe0d7 | 496 | status(); |
6a488035 TO |
497 | cj('#cancelInfo').hide( ); |
498 | } | |
499 | } | |
500 | ||
501 | {/literal}{/if}{literal} | |
96cfe0d7 | 502 | </script> |
6a488035 TO |
503 | {/literal} |
504 | {if !$contributionMode} | |
505 | {include file="CRM/common/showHideByFieldValue.tpl" | |
506 | trigger_field_id ="payment_instrument_id" | |
507 | trigger_value = '4' | |
508 | target_element_id ="checkNumber" | |
509 | target_element_type ="table-row" | |
510 | field_type ="select" | |
511 | invert = 0 | |
512 | } | |
513 | {/if} | |
514 | {/if} {* not delete mode if*} | |
515 | ||
6a488035 TO |
516 | {/if} {* closing of main custom data if *} |
517 | ||
518 | {literal} | |
519 | <script type="text/javascript"> | |
6a488035 TO |
520 | |
521 | {/literal} | |
522 | ||
523 | // load form during form rule. | |
524 | {if $buildPriceSet}{literal}buildAmount( );{/literal}{/if} | |
525 | ||
6a488035 TO |
526 | {literal} |
527 | function buildAmount( priceSetId ) { | |
528 | if (!priceSetId) priceSetId = cj("#price_set_id").val( ); | |
529 | ||
530 | var fname = '#priceset'; | |
531 | if (!priceSetId) { | |
532 | // hide price set fields. | |
533 | cj(fname).hide( ); | |
534 | ||
535 | // show/hide price set amount and total amount. | |
536 | cj("#totalAmountORPriceSet").show( ); | |
537 | cj("#totalAmount").show( ); | |
d65f6a99 AH |
538 | var choose = "{/literal}{ts}Choose price set{/ts}{literal}"; |
539 | cj("#price_set_id option[value='']").html( choose ); | |
6a488035 TO |
540 | |
541 | //we might want to build recur block. | |
542 | if (cj("#is_recur")) buildRecurBlock( null ); | |
543 | return; | |
544 | } | |
545 | ||
546 | //don't allow recurring w/ priceset. | |
547 | if ( cj( "#is_recur" ) && cj( 'input:radio[name="is_recur"]:checked').val( ) ) { | |
548 | //reset the values of recur block. | |
549 | cj("#installments").val(''); | |
550 | cj("#frequency_interval").val(''); | |
551 | cj('input:radio[name="is_recur"]')[0].checked = true; | |
552 | cj("#recurringPaymentBlock").hide( ); | |
553 | } | |
554 | ||
555 | var dataUrl = {/literal}"{crmURL h=0 q='snippet=4'}"{literal} + '&priceSetId=' + priceSetId; | |
556 | ||
557 | var response = cj.ajax({ | |
558 | url: dataUrl, | |
559 | async: false | |
560 | }).responseText; | |
561 | ||
b22f0cad | 562 | cj( fname ).show( ).html( response ).trigger('crmLoad'); |
6a488035 TO |
563 | // freeze total amount text field. |
564 | cj( "#total_amount").val(''); | |
565 | ||
566 | cj( "#totalAmountORPriceSet" ).hide( ); | |
567 | cj( "#totalAmount").hide( ); | |
d65f6a99 AH |
568 | var manual = "{/literal}{ts}Manual contribution amount{/ts}{literal}"; |
569 | cj("#price_set_id option[value='']").html( manual ); | |
6a488035 TO |
570 | } |
571 | ||
572 | function adjustPayment( ) { | |
573 | cj('#adjust-option-type').show(); | |
574 | cj("#total_amount").removeAttr("READONLY"); | |
575 | cj("#total_amount").css('background-color', '#ffffff'); | |
576 | } | |
577 | ||
578 | {/literal}{if $processorSupportsFutureStartDate}{literal} | |
579 | cj ('input:radio[name="is_recur"]').click( function( ) { | |
580 | showStartDate( ); | |
581 | }); | |
582 | ||
583 | showStartDate( ); | |
584 | ||
585 | function showStartDate( ) { | |
586 | if (cj( 'input:radio[name="is_recur"]:checked').val( ) == 0 ) { | |
587 | cj('#start_date').hide( ); | |
588 | } | |
589 | else { | |
590 | cj('#start_date').show( ); | |
591 | } | |
592 | } | |
593 | ||
594 | {/literal}{/if}{literal} | |
595 | cj('#fee_amount').change( function() { | |
596 | var totalAmount = cj('#total_amount').val(); | |
96cfe0d7 | 597 | var feeAmount = cj('#fee_amount').val(); |
6a488035 TO |
598 | var netAmount = totalAmount.replace(/,/g, '') - feeAmount.replace(/,/g, ''); |
599 | if (!cj('#net_amount').val()) { | |
600 | cj('#net_amount').val(netAmount); | |
601 | } | |
602 | }); | |
603 | </script> | |
604 | {/literal} |