Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
2c4c49ca | 3 | | CiviCRM version 4.7 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
fa938177 | 5 | | Copyright CiviCRM LLC (c) 2004-2016 | |
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 | ||
39082712 | 28 | {if $priceSetId} |
6a488035 TO |
29 | {include file="CRM/Price/Form/PriceSet.tpl" context="standalone" extends="Contribution"} |
30 | {elseif $showAdditionalInfo and $formType } | |
31 | {include file="CRM/Contribute/Form/AdditionalInfo/$formType.tpl"} | |
32 | {else} | |
b58b2053 | 33 | {include file="CRM/Contribute/Form/AdditionalInfo/Payment.tpl"} |
6a488035 TO |
34 | <div class="crm-block crm-form-block crm-contribution-form-block"> |
35 | ||
6a488035 TO |
36 | {if !$email and $action neq 8 and $context neq 'standalone'} |
37 | <div class="messages status no-popup"> | |
38 | <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} | |
39 | </div> | |
40 | {/if} | |
41 | {if $contributionMode} | |
f6eedce7 | 42 | <div class="help"> |
6a488035 | 43 | {if $contactId} |
33af228e EM |
44 | {ts 1=$displayName 2=$contributionMode|upper}Use this form to submit a new contribution on behalf of %1. <strong>A |
45 | %2 transaction will be submitted</strong> using the selected payment processor.{/ts} | |
6a488035 | 46 | {else} |
33af228e | 47 | {ts 1=$displayName 2=$contributionMode|upper}Use this form to submit a new contribution. <strong>A %2 transaction will be submitted</strong> using the selected payment processor.{/ts} |
6a488035 TO |
48 | {/if} |
49 | </div> | |
50 | {/if} | |
51 | {if $action eq 8} | |
52 | <div class="messages status no-popup"> | |
53 | <div class="icon inform-icon"></div> | |
54 | {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} | |
55 | </div> | |
56 | {else} | |
6a488035 | 57 | {if $newCredit AND $action EQ 1 AND $contributionMode EQ null} |
540ea9be | 58 | <div class="action-link css_right crm-link-credit-card-mode"> |
6a488035 TO |
59 | {if $contactId} |
60 | {capture assign=ccModeLink}{crmURL p='civicrm/contact/view/contribution' q="reset=1&action=add&cid=`$contactId`&context=`$context`&mode=live"}{/capture} | |
61 | {else} | |
62 | {capture assign=ccModeLink}{crmURL p='civicrm/contact/view/contribution' q="reset=1&action=add&context=standalone&mode=live"}{/capture} | |
63 | {/if} | |
5fffbbe4 | 64 | <a class="open-inline-noreturn action-item crm-hover-button" href="{$ccModeLink}">» {ts}submit credit card contribution{/ts}</a> |
540ea9be | 65 | </div> |
6a488035 | 66 | {/if} |
540ea9be CW |
67 | <div class="crm-submit-buttons"> |
68 | {include file="CRM/common/formButtons.tpl"} | |
6a488035 TO |
69 | </div> |
70 | {if $isOnline}{assign var=valueStyle value=" class='view-value'"}{else}{assign var=valueStyle value=""}{/if} | |
71 | <table class="form-layout-compressed"> | |
72 | {if $context neq 'standalone'} | |
73 | <tr> | |
74 | <td class="font-size12pt label"><strong><strong>{ts}Contributor{/ts}</strong></td><td class="font-size12pt"><strong>{$displayName}</strong></td> | |
75 | </tr> | |
76 | {else} | |
ccec9d6b CW |
77 | <td class="label">{$form.contact_id.label}</td> |
78 | <td>{$form.contact_id.html}</td> | |
6a488035 TO |
79 | {/if} |
80 | {if $contributionMode} | |
836cf509 | 81 | <tr class="crm-contribution-form-block-payment_processor_id"><td class="label nowrap">{$form.payment_processor_id.label}<span class="crm-marker"> * </span></td><td>{$form.payment_processor_id.html}</td></tr> |
6a488035 TO |
82 | {/if} |
83 | <tr class="crm-contribution-form-block-contribution_type_id crm-contribution-form-block-financial_type_id"> | |
84 | <td class="label">{$form.financial_type_id.label}</td><td{$valueStyle}>{$form.financial_type_id.html} | |
85 | {if $is_test} | |
86 | {ts}(test){/ts} | |
87 | {/if} {help id="id-financial_type"} | |
88 | </td> | |
89 | </tr> | |
90 | {if $action eq 2 and $lineItem and !$defaultContribution} | |
91 | <tr> | |
92 | <td class="label">{ts}Contribution Amount{/ts}</td> | |
93 | <td>{include file="CRM/Price/Page/LineItem.tpl" context="Contribution"}</td> | |
94 | </tr> | |
95 | {else} | |
96 | <tr class="crm-contribution-form-block-total_amount"> | |
97 | <td class="label">{$form.total_amount.label}</td> | |
98 | <td {$valueStyle}> | |
99 | <span id='totalAmount'>{$form.currency.html|crmAddClass:eight} {$form.total_amount.html|crmAddClass:eight}</span> | |
100 | {if $hasPriceSets} | |
101 | <span id='totalAmountORPriceSet'> {ts}OR{/ts}</span> | |
102 | <span id='selectPriceSet'>{$form.price_set_id.html}</span> | |
103 | <div id="priceset" class="hiddenElement"></div> | |
104 | {/if} | |
105 | ||
106 | {if $ppID}{ts}<a href='#' onclick='adjustPayment();'>adjust payment amount</a>{/ts}{help id="adjust-payment-amount"}{/if} | |
95f2107c | 107 | <div id="totalAmountBlock"> |
b5527a9a DG |
108 | {if $hasPriceSets}<span class="description">{ts}Alternatively, you can use a price set.{/ts}</span>{/if} |
109 | <div id="totalTaxAmount" class="label"></div> | |
95f2107c | 110 | </div> |
6a488035 TO |
111 | </td> |
112 | </tr> | |
113 | ||
677fe56c | 114 | {if $buildRecurBlock} |
6a488035 TO |
115 | <tr id='recurringPaymentBlock' class='hiddenElement'> |
116 | <td></td> | |
117 | <td> | |
118 | <strong>{$form.is_recur.html} {ts}every{/ts} | |
119 | {$form.frequency_interval.html} | |
120 | {$form.frequency_unit.html} | |
121 | {ts}for{/ts} | |
122 | {$form.installments.html} | |
123 | {$form.installments.label} | |
124 | </strong> | |
125 | <br /> | |
126 | <span class="description"> | |
127 | {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} | |
128 | </span> | |
129 | </td> | |
130 | </tr> | |
131 | {/if} | |
132 | ||
133 | <tr id="adjust-option-type" class="crm-contribution-form-block-option_type"> | |
134 | <td class="label"></td><td {$valueStyle}>{$form.option_type.html}</td> | |
135 | </tr> | |
136 | {/if} | |
137 | {if $contributionMode && $processorSupportsFutureStartDate} | |
138 | <tr id='start_date' class="crm-contribution-form-block-receive_date"> | |
139 | <td class="label">{ts}Start Date{/ts}</td> | |
140 | <td {$valueStyle}>{if $hideCalender neq true}{include file="CRM/common/jcalendar.tpl" elementName=receive_date}{else}{$receive_date|crmDate}{/if}<br /> | |
141 | <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> | |
142 | </td> | |
143 | </tr> | |
144 | {/if} | |
145 | ||
146 | <tr class="crm-contribution-form-block-source"> | |
147 | <td class="label">{$form.source.label}</td> | |
148 | <td {$valueStyle}>{$form.source.html|crmAddClass:huge} {help id="id-contrib_source"} | |
149 | </td> | |
150 | </tr> | |
151 | ||
152 | {* CRM-7362 --add campaign to contributions *} | |
153 | {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" campaignTrClass="crm-contribution-form-block-campaign_id"} | |
154 | ||
155 | {if $contributionMode} | |
156 | {if $email and $outBound_option != 2} | |
157 | <tr class="crm-contribution-form-block-is_email_receipt"> | |
158 | <td class="label">{$form.is_email_receipt.label}</td> | |
159 | <td>{$form.is_email_receipt.html} <span class="description">{ts 1=$email}Automatically email a receipt for this contribution to %1?{/ts}</span> | |
160 | </td> | |
161 | </tr> | |
162 | {elseif $context eq 'standalone' and $outBound_option != 2 } | |
163 | <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> | |
164 | {/if} | |
165 | <tr id="fromEmail" style="display:none;" > | |
166 | <td class="label">{$form.from_email_address.label}</td> | |
167 | <td>{$form.from_email_address.html}</td> | |
168 | </tr> | |
169 | <tr id="receiptDate" class="crm-contribution-form-block-receipt_date"> | |
170 | <td class="label">{$form.receipt_date.label}</td> | |
171 | <td>{include file="CRM/common/jcalendar.tpl" elementName=receipt_date}<br /> | |
172 | <span class="description">{ts}Date that a receipt was sent to the contributor.{/ts}</span> | |
173 | </td> | |
174 | </tr> | |
175 | {/if} | |
176 | {if !$contributionMode} | |
177 | <tr class="crm-contribution-form-block-contribution_status_id"> | |
178 | <td class="label">{$form.contribution_status_id.label}</td> | |
179 | <td>{$form.contribution_status_id.html} | |
180 | {if $contribution_status_id eq 2}{if $is_pay_later }: {ts}Pay Later{/ts} {else}: {ts}Incomplete Transaction{/ts}{/if}{/if} | |
181 | </td> | |
182 | </tr> | |
183 | ||
184 | {* Cancellation / Refunded fields are hidden unless contribution status is set to Cancelled or Refunded*} | |
185 | <tr id="cancelInfo" class="crm-contribution-form-block-cancelInfo"> | |
186 | <td> </td> | |
187 | <td><fieldset><legend>{ts}Cancellation or Refund Information{/ts}</legend> | |
188 | <table class="form-layout-compressed"> | |
189 | <tr id="cancelDate" class="crm-contribution-form-block-cancel_date"> | |
190 | <td class="label">{$form.cancel_date.label}</td> | |
191 | <td> | |
192 | {if $hideCalendar neq true} | |
193 | {include file="CRM/common/jcalendar.tpl" elementName=cancel_date} | |
194 | {else} | |
d32858b8 | 195 | {$form.cancel_date.value|crmDate} |
6a488035 TO |
196 | {/if} |
197 | </td> | |
198 | </tr> | |
199 | <tr id="cancelDescription" class="crm-contribution-form-block-cancel_reason"> | |
200 | <td class="label"> </td> | |
201 | <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> | |
202 | </tr> | |
203 | <tr id="cancelReason"> | |
204 | <td class="label" style="vertical-align: top;">{$form.cancel_reason.label}</td> | |
ce22fda6 | 205 | <td>{$form.cancel_reason.html}</td> |
6a488035 | 206 | </tr> |
99cdd94d | 207 | <tr id="refundTrxnID"> |
208 | <td class="label" style="vertical-align: top;">{$form.refund_trxn_id.label}</td> | |
209 | <td>{$form.refund_trxn_id.html}</td> | |
210 | </tr> | |
6a488035 TO |
211 | </table> |
212 | </fieldset> | |
213 | </td> | |
214 | </tr> | |
215 | {/if} | |
46d173ef PN |
216 | {if $form.revenue_recognition_date} |
217 | <tr class="crm-contribution-form-block-revenue_recognition_date"> | |
218 | <td class="label">{$form.revenue_recognition_date.label}</td> | |
219 | <td>{$form.revenue_recognition_date.html}</td> | |
220 | </tr> | |
221 | {/if} | |
6a488035 | 222 | </table> |
a5399a39 | 223 | |
52912b1f | 224 | {include file='CRM/Core/BillingBlockWrapper.tpl'} |
a5399a39 | 225 | |
96cfe0d7 | 226 | <!-- start of soft credit --> |
00a1afe2 | 227 | <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed {if $noSoftCredit}collapsed{/if}" id="softCredit"> |
96cfe0d7 | 228 | <div class="crm-accordion-header"> |
229 | {ts}Soft Credit{/ts} {help id="id-soft_credit"} | |
230 | </div> | |
231 | <div class="crm-accordion-body"> | |
232 | <table class="form-layout-compressed"> | |
b6545333 | 233 | <tr class="crm-contribution-form-block-soft_credit_to"> |
234 | <td colspan="2"> | |
235 | {include file="CRM/Contribute/Form/SoftCredit.tpl"} | |
236 | </td> | |
237 | </tr> | |
238 | </table> | |
239 | </div> | |
240 | </div> | |
241 | <!-- end of soft credit --> | |
242 | ||
243 | <!-- start of PCP --> | |
244 | {if $siteHasPCPs} | |
00a1afe2 | 245 | <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed {if $noPCP}collapsed{/if}" id="softCredit"> |
b6545333 | 246 | <div class="crm-accordion-header"> |
247 | {ts}Personal Campaign Page{/ts} {help id="id-pcp"} | |
248 | </div> | |
249 | <div class="crm-accordion-body"> | |
250 | <table class="form-layout-compressed"> | |
251 | <tr class="crm-contribution-pcp-block crm-contribution-form-block-pcp_made_through_id"> | |
6bb107ce | 252 | <td class="label">{$form.pcp_made_through_id.label}</td> |
96cfe0d7 | 253 | <td> |
6bb107ce | 254 | {$form.pcp_made_through_id.html} |
d4abe802 | 255 | <div class="description">{ts}Search for the Personal Campaign Page by the fund-raiser's last name or email address.{/ts}</div> |
96cfe0d7 | 256 | |
257 | <div class="spacer"></div> | |
b6545333 | 258 | <div class="crm-contribution-form-block-pcp_details"> |
96cfe0d7 | 259 | <table class="crm-contribution-form-table-credit_to_pcp"> |
260 | <tr id="pcpDisplayRollID" class="crm-contribution-form-block-pcp_display_in_roll"> | |
261 | <td class="label">{$form.pcp_display_in_roll.label}</td> | |
262 | <td>{$form.pcp_display_in_roll.html}</td> | |
263 | </tr> | |
264 | <tr id="nickID" class="crm-contribution-form-block-pcp_roll_nickname"> | |
265 | <td class="label">{$form.pcp_roll_nickname.label}</td> | |
266 | <td>{$form.pcp_roll_nickname.html|crmAddClass:big}<br/> | |
d4abe802 | 267 | <div class="description">{ts}Name or nickname contributor wants to be displayed in the Honor Roll. Enter "Anonymous" for anonymous contributions.{/ts}</div> |
96cfe0d7 | 268 | </td> |
269 | </tr> | |
270 | <tr id="personalNoteID" class="crm-contribution-form-block-pcp_personal_note"> | |
271 | <td class="label" style="vertical-align: top">{$form.pcp_personal_note.label}</td> | |
272 | <td> | |
273 | {$form.pcp_personal_note.html} | |
d4abe802 CW |
274 | <div |
275 | class="description">{ts}Personal message submitted by contributor for display in the Honor Roll.{/ts}</div> | |
96cfe0d7 | 276 | </td> |
277 | </tr> | |
278 | </table> | |
279 | </div> | |
280 | </td> | |
281 | </tr> | |
b6545333 | 282 | </table> |
283 | </div> | |
96cfe0d7 | 284 | </div> |
d4abe802 | 285 | {include file="CRM/Contribute/Form/PCP.js.tpl"} |
b6545333 | 286 | {/if} |
287 | <!-- end of PCP --> | |
288 | ||
6a488035 TO |
289 | {if !$contributionMode} |
290 | <div class="crm-accordion-wrapper crm-accordion_title-accordion crm-accordion-processed" id="paymentDetails_Information"> | |
291 | <div class="crm-accordion-header"> | |
292 | {ts}Payment Details{/ts} | |
293 | </div> | |
294 | <div class="crm-accordion-body"> | |
295 | <table class="form-layout-compressed" > | |
296 | <tr class="crm-contribution-form-block-receive_date"> | |
297 | <td class="label">{$form.receive_date.label}</td> | |
298 | <td {$valueStyle}>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}<br /> | |
299 | <span class="description">{ts}The date this contribution was received.{/ts}</span> | |
300 | </td> | |
301 | </tr> | |
302 | <tr class="crm-contribution-form-block-payment_instrument_id"> | |
303 | <td class="label">{$form.payment_instrument_id.label}</td> | |
d20225bb | 304 | <td {$valueStyle}>{$form.payment_instrument_id.html} {help id="payment_instrument_id"}</td> |
6a488035 TO |
305 | </td> |
306 | </tr> | |
307 | {if $showCheckNumber || !$isOnline} | |
308 | <tr id="checkNumber" class="crm-contribution-form-block-check_number"> | |
309 | <td class="label">{$form.check_number.label}</td> | |
ce22fda6 | 310 | <td>{$form.check_number.html}</td> |
6a488035 TO |
311 | </tr> |
312 | {/if} | |
313 | <tr class="crm-contribution-form-block-trxn_id"> | |
314 | <td class="label">{$form.trxn_id.label}</td> | |
ce22fda6 | 315 | <td {$valueStyle}>{$form.trxn_id.html} {help id="id-trans_id"}</td> |
6a488035 TO |
316 | </tr> |
317 | {if $email and $outBound_option != 2} | |
318 | <tr class="crm-contribution-form-block-is_email_receipt"> | |
319 | <td class="label"> | |
320 | {$form.is_email_receipt.label}</td><td>{$form.is_email_receipt.html} | |
321 | <span class="description">{ts 1=$email}Automatically email a receipt for this payment to %1?{/ts}</span> | |
322 | </td> | |
323 | </tr> | |
324 | {elseif $context eq 'standalone' and $outBound_option != 2 } | |
325 | <tr id="email-receipt" style="display:none;" class="crm-contribution-form-block-is_email_receipt"> | |
326 | <td class="label">{$form.is_email_receipt.label}</td> | |
327 | <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> | |
328 | </td> | |
329 | </tr> | |
330 | {/if} | |
331 | <tr id="receiptDate" class="crm-contribution-form-block-receipt_date"> | |
332 | <td class="label">{$form.receipt_date.label}</td> | |
333 | <td>{include file="CRM/common/jcalendar.tpl" elementName=receipt_date}<br /> | |
334 | <span class="description">{ts}Date that a receipt was sent to the contributor.{/ts}</span> | |
335 | </td> | |
336 | </tr> | |
337 | <tr id="fromEmail" class="crm-contribution-form-block-receipt_date" style="display:none;"> | |
338 | <td class="label">{$form.from_email_address.label}</td> | |
339 | <td>{$form.from_email_address.html}</td> | |
340 | </tr> | |
341 | </table> | |
342 | </div> | |
343 | </div> | |
344 | {/if} | |
345 | ||
346 | <div id="customData" class="crm-contribution-form-block-customData"></div> | |
347 | ||
348 | {*include custom data js file*} | |
349 | {include file="CRM/common/customData.tpl"} | |
350 | ||
351 | {literal} | |
352 | <script type="text/javascript"> | |
3cc60a06 | 353 | CRM.$(function($) { |
6a488035 TO |
354 | {/literal} |
355 | CRM.buildCustomData( '{$customDataType}' ); | |
356 | {if $customDataSubType} | |
357 | CRM.buildCustomData( '{$customDataType}', {$customDataSubType} ); | |
358 | {/if} | |
291f6bec | 359 | |
96cfe0d7 | 360 | {if $buildPriceSet}{literal}buildAmount( );{/literal}{/if} |
6a488035 TO |
361 | {literal} |
362 | }); | |
363 | ||
364 | // bind first click of accordion header to load crm-accordion-body with snippet | |
365 | // everything else taken care of by cj().crm-accordions() | |
3cc60a06 | 366 | CRM.$(function($) { |
6a488035 TO |
367 | cj('#adjust-option-type').hide(); |
368 | cj('.crm-ajax-accordion .crm-accordion-header').one('click', function() { | |
369 | loadPanes(cj(this).attr('id')); | |
370 | }); | |
371 | cj('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(function(index) { | |
372 | loadPanes(cj(this).attr('id')); | |
373 | }); | |
374 | }); | |
375 | // load panes function calls for snippet based on id of crm-accordion-header | |
376 | function loadPanes( id ) { | |
377 | var url = "{/literal}{crmURL p='civicrm/contact/view/contribution' q='snippet=4&formType=' h=0}{literal}" + id; | |
378 | {/literal} | |
379 | {if $contributionMode} | |
380 | url = url + "&mode={$contributionMode}"; | |
381 | {/if} | |
382 | {if $qfKey} | |
383 | url = url + "&qfKey={$qfKey}"; | |
384 | {/if} | |
385 | {literal} | |
386 | if (! cj('div.'+id).html()) { | |
387 | 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}...'; | |
388 | cj('div.'+id).html(loading); | |
389 | cj.ajax({ | |
390 | url : url, | |
b22f0cad | 391 | success: function(data) { cj('div.'+id).html(data).trigger('crmLoad'); } |
6a488035 TO |
392 | }); |
393 | } | |
394 | } | |
395 | ||
396 | var url = "{/literal}{$dataUrl}{literal}"; | |
397 | ||
6a488035 TO |
398 | {/literal} |
399 | {if $context eq 'standalone' and $outBound_option != 2 } | |
400 | {literal} | |
3cc60a06 | 401 | CRM.$(function($) { |
ae8f569f | 402 | |
b50fdacc | 403 | var $form = $("form.{/literal}{$form.formClass}{literal}"); |
ae8f569f | 404 | $("#contact_id", $form).change(checkEmail); |
6a488035 | 405 | checkEmail( ); |
ae8f569f CW |
406 | |
407 | function checkEmail( ) { | |
408 | var data = $("#contact_id", $form).select2('data'); | |
409 | if (data && data.extra && data.extra.email && data.extra.email.length) { | |
410 | $("#email-receipt", $form).show(); | |
411 | $("#email-address", $form).html(data.extra.email); | |
412 | } | |
413 | else { | |
414 | $("#email-receipt", $form).hide(); | |
415 | } | |
416 | } | |
417 | ||
6a488035 TO |
418 | showHideByValue( 'is_email_receipt', '', 'receiptDate', 'table-row', 'radio', true); |
419 | showHideByValue( 'is_email_receipt', '', 'fromEmail', 'table-row', 'radio', false ); | |
420 | }); | |
421 | ||
6a488035 TO |
422 | {/literal} |
423 | {/if} | |
424 | </script> | |
425 | ||
426 | <div class="accordion ui-accordion ui-widget ui-helper-reset"> | |
427 | {* Additional Detail / Honoree Information / Premium Information *} | |
428 | {foreach from=$allPanes key=paneName item=paneValue} | |
429 | ||
430 | <div class="crm-accordion-wrapper crm-ajax-accordion crm-{$paneValue.id}-accordion {if $paneValue.open neq 'true'}collapsed{/if}"> | |
431 | <div class="crm-accordion-header" id="{$paneValue.id}"> | |
432 | ||
433 | {$paneName} | |
434 | </div><!-- /.crm-accordion-header --> | |
435 | <div class="crm-accordion-body"> | |
436 | ||
437 | <div class="{$paneValue.id}"></div> | |
438 | </div><!-- /.crm-accordion-body --> | |
439 | </div><!-- /.crm-accordion-wrapper --> | |
440 | ||
441 | {/foreach} | |
442 | </div> | |
443 | ||
444 | {/if} | |
445 | <br /> | |
446 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | |
447 | </div> | |
448 | ||
449 | {literal} | |
450 | <script type="text/javascript"> | |
451 | function verify( ) { | |
8539f25d | 452 | if (cj('#is_email_receipt').prop('checked' )) { |
6a488035 TO |
453 | var ok = confirm( '{/literal}{ts escape='js'}Click OK to save this contribution record AND send a receipt to the contributor now{/ts}{literal}.' ); |
454 | if (!ok) { | |
455 | return false; | |
456 | } | |
457 | } | |
458 | } | |
96cfe0d7 | 459 | |
6a488035 TO |
460 | function status() { |
461 | cj("#cancel_date").val(''); | |
462 | cj("#cancel_reason").val(''); | |
463 | } | |
464 | ||
465 | </script> | |
466 | {/literal} | |
467 | ||
468 | {if $action neq 8} | |
469 | {literal} | |
470 | <script type="text/javascript"> | |
3cc60a06 | 471 | CRM.$(function($) { |
6a488035 TO |
472 | checkEmailDependancies( ); |
473 | cj('#is_email_receipt').click( function( ) { | |
474 | checkEmailDependancies( ); | |
475 | }); | |
476 | }); | |
477 | ||
478 | function checkEmailDependancies( ) { | |
8539f25d | 479 | if (cj('#is_email_receipt').prop('checked' )) { |
6a488035 TO |
480 | cj('#fromEmail').show( ); |
481 | cj('#receiptDate').hide( ); | |
482 | } | |
483 | else { | |
484 | cj('#fromEmail').hide( ); | |
485 | cj('#receiptDate').show( ); | |
486 | } | |
487 | } | |
488 | ||
489 | {/literal}{if !$contributionMode}{literal} | |
3cc60a06 | 490 | CRM.$(function($) { |
96cfe0d7 | 491 | showHideCancelInfo(cj('#contribution_status_id')); |
492 | ||
6a488035 | 493 | cj('#contribution_status_id').change(function() { |
921bca19 | 494 | showHideCancelInfo(cj('#contribution_status_id')); |
6a488035 TO |
495 | } |
496 | ); | |
497 | }); | |
498 | ||
499 | function showHideCancelInfo(obj) { | |
d4849da4 | 500 | var cancelInfo_show_ids = [{/literal}{$cancelInfo_show_ids}{literal}]; |
07d98c80 | 501 | if (cancelInfo_show_ids.indexOf(obj.val()) > -1) { |
6a488035 | 502 | cj('#cancelInfo').show( ); |
921bca19 | 503 | cj('#total_amount').attr('readonly', true); |
6a488035 TO |
504 | } |
505 | else { | |
921bca19 | 506 | status(); |
6a488035 | 507 | cj('#cancelInfo').hide( ); |
921bca19 | 508 | cj("#total_amount").removeAttr('readonly'); |
6a488035 TO |
509 | } |
510 | } | |
511 | ||
512 | {/literal}{/if}{literal} | |
96cfe0d7 | 513 | </script> |
6a488035 TO |
514 | {/literal} |
515 | {if !$contributionMode} | |
516 | {include file="CRM/common/showHideByFieldValue.tpl" | |
517 | trigger_field_id ="payment_instrument_id" | |
518 | trigger_value = '4' | |
519 | target_element_id ="checkNumber" | |
520 | target_element_type ="table-row" | |
521 | field_type ="select" | |
522 | invert = 0 | |
523 | } | |
524 | {/if} | |
525 | {/if} {* not delete mode if*} | |
526 | ||
6a488035 TO |
527 | {/if} {* closing of main custom data if *} |
528 | ||
529 | {literal} | |
530 | <script type="text/javascript"> | |
6a488035 TO |
531 | |
532 | {/literal} | |
533 | ||
534 | // load form during form rule. | |
535 | {if $buildPriceSet}{literal}buildAmount( );{/literal}{/if} | |
536 | ||
6a488035 | 537 | {literal} |
6a488035 | 538 | |
6a3d8d2d WA |
539 | // CRM-16451: set financial type of 'Price Set' in back office contribution |
540 | // instead of selecting manually | |
541 | function buildAmount( priceSetId, financialtypeIds ) { | |
542 | if (!priceSetId) priceSetId = cj("#price_set_id").val( ); | |
6a488035 TO |
543 | var fname = '#priceset'; |
544 | if (!priceSetId) { | |
545 | // hide price set fields. | |
546 | cj(fname).hide( ); | |
547 | ||
548 | // show/hide price set amount and total amount. | |
549 | cj("#totalAmountORPriceSet").show( ); | |
550 | cj("#totalAmount").show( ); | |
d65f6a99 AH |
551 | var choose = "{/literal}{ts}Choose price set{/ts}{literal}"; |
552 | cj("#price_set_id option[value='']").html( choose ); | |
6a488035 | 553 | |
6a3d8d2d WA |
554 | cj('label[for="total_amount"]').text('{/literal}{ts}Total Amount{/ts}{literal}'); |
555 | cj(".crm-contribution-form-block-financial_type_id").show(); | |
556 | cj("#financial_type_id option[value='']").attr('selected', true); | |
557 | ||
6a488035 TO |
558 | //we might want to build recur block. |
559 | if (cj("#is_recur")) buildRecurBlock( null ); | |
560 | return; | |
561 | } | |
562 | ||
563 | //don't allow recurring w/ priceset. | |
564 | if ( cj( "#is_recur" ) && cj( 'input:radio[name="is_recur"]:checked').val( ) ) { | |
565 | //reset the values of recur block. | |
566 | cj("#installments").val(''); | |
567 | cj("#frequency_interval").val(''); | |
568 | cj('input:radio[name="is_recur"]')[0].checked = true; | |
569 | cj("#recurringPaymentBlock").hide( ); | |
570 | } | |
571 | ||
572 | var dataUrl = {/literal}"{crmURL h=0 q='snippet=4'}"{literal} + '&priceSetId=' + priceSetId; | |
573 | ||
574 | var response = cj.ajax({ | |
575 | url: dataUrl, | |
576 | async: false | |
577 | }).responseText; | |
578 | ||
b22f0cad | 579 | cj( fname ).show( ).html( response ).trigger('crmLoad'); |
6a488035 TO |
580 | // freeze total amount text field. |
581 | cj( "#total_amount").val(''); | |
582 | ||
583 | cj( "#totalAmountORPriceSet" ).hide( ); | |
584 | cj( "#totalAmount").hide( ); | |
d65f6a99 AH |
585 | var manual = "{/literal}{ts}Manual contribution amount{/ts}{literal}"; |
586 | cj("#price_set_id option[value='']").html( manual ); | |
6a3d8d2d WA |
587 | |
588 | cj('label[for="total_amount"]').text('{/literal}{ts}Price Sets{/ts}{literal}'); | |
589 | cj("#financial_type_id option[value="+financialtypeIds[priceSetId]+"]").prop('selected', true); | |
590 | cj(".crm-contribution-form-block-financial_type_id").css("display", "none"); | |
6a488035 TO |
591 | } |
592 | ||
593 | function adjustPayment( ) { | |
594 | cj('#adjust-option-type').show(); | |
595 | cj("#total_amount").removeAttr("READONLY"); | |
596 | cj("#total_amount").css('background-color', '#ffffff'); | |
597 | } | |
598 | ||
599 | {/literal}{if $processorSupportsFutureStartDate}{literal} | |
600 | cj ('input:radio[name="is_recur"]').click( function( ) { | |
601 | showStartDate( ); | |
602 | }); | |
603 | ||
604 | showStartDate( ); | |
605 | ||
606 | function showStartDate( ) { | |
607 | if (cj( 'input:radio[name="is_recur"]:checked').val( ) == 0 ) { | |
608 | cj('#start_date').hide( ); | |
609 | } | |
610 | else { | |
611 | cj('#start_date').show( ); | |
612 | } | |
613 | } | |
614 | ||
615 | {/literal}{/if}{literal} | |
01096c1b | 616 | var thousandMarker = "{/literal}{$config->monetaryThousandSeparator}{literal}"; |
617 | var separator = "{/literal}{$config->monetaryDecimalPoint}{literal}"; | |
618 | ||
6a488035 | 619 | cj('#fee_amount').change( function() { |
01096c1b | 620 | var totalAmount = cj('#total_amount').val().replace(thousandMarker,'').replace(separator,'.'); |
621 | var feeAmount = cj('#fee_amount').val().replace(thousandMarker,'').replace(separator,'.'); | |
622 | var netAmount = totalAmount - feeAmount; | |
623 | if (totalAmount) { | |
a4f7ae9b | 624 | cj('#net_amount').val(CRM.formatMoney(netAmount, true)); |
6a488035 TO |
625 | } |
626 | }); | |
6daab7fa | 627 | |
628 | cj("#financial_type_id").on("change",function(){ | |
629 | cj('#total_amount').trigger("change"); | |
630 | }) | |
631 | ||
049db839 | 632 | cj("#currency").on("change",function(){ |
cce6ec9f | 633 | cj('#total_amount').trigger("change"); |
049db839 | 634 | }) |
635 | ||
95f2107c | 636 | {/literal}{if $taxRates && $invoicing}{literal} |
95f2107c | 637 | CRM.$(function($) { |
ebd51731 PB |
638 | $('#total_amount').on("change",function(event) { |
639 | if (event.handled !== true) { | |
b6f65362 | 640 | var freezeFinancialType = '{/literal}{$freezeFinancialType}{literal}'; |
641 | if (!freezeFinancialType) { | |
642 | var financialType = $('#financial_type_id').val(); | |
643 | var taxRates = '{/literal}{$taxRates}{literal}'; | |
644 | taxRates = JSON.parse(taxRates); | |
645 | var currencies = '{/literal}{$currencies}{literal}'; | |
646 | currencies = JSON.parse(currencies); | |
647 | var currencySelect = $('#currency').val(); | |
648 | var currencySymbol = currencies[currencySelect]; | |
649 | var re= /\((.*?)\)/g; | |
650 | for(m = re.exec(currencySymbol); m; m = re.exec(currencySymbol)){ | |
651 | currencySymbol = m[1]; | |
652 | } | |
7f7fa13a | 653 | var taxRate = taxRates[financialType]; |
b6f65362 | 654 | if (!taxRate) { |
655 | taxRate = 0; | |
b5527a9a DG |
656 | cj("#totalTaxAmount").hide( ); |
657 | } else { | |
161a2fe7 | 658 | cj("#totalTaxAmount").show( ); |
7f7fa13a | 659 | } |
b6f65362 | 660 | var totalAmount = $('#total_amount').val(); |
01096c1b | 661 | // replace all thousandMarker and change the separator to a dot |
662 | totalAmount = totalAmount.replace(thousandMarker,'').replace(separator,'.'); | |
b6f65362 | 663 | |
7f7fa13a EM |
664 | var totalTaxAmount = '{/literal}{$totalTaxAmount}{literal}'; |
665 | var taxAmount = (taxRate/100)*totalAmount; | |
666 | taxAmount = isNaN (taxAmount) ? 0:taxAmount; | |
667 | var totalTaxAmount = taxAmount + Number(totalAmount); | |
01096c1b | 668 | totalTaxAmount = formatMoney( totalTaxAmount, 2, separator, thousandMarker ); |
b6f65362 | 669 | |
7f7fa13a | 670 | $("#totalTaxAmount" ).html('Amount with tax : <span id="currencySymbolShow">' + currencySymbol + '</span> '+ totalTaxAmount); |
7b1ea4bd | 671 | } |
ebd51731 PB |
672 | event.handled = true; |
673 | } | |
674 | return false; | |
675 | }); | |
676 | ||
677 | $('#total_amount').trigger("change"); | |
95f2107c PB |
678 | }); |
679 | {/literal}{/if}{literal} | |
680 | ||
ebd51731 PB |
681 | CRM.$(function($) { |
682 | $('#price_set_id').click(function() { | |
7f7fa13a | 683 | if( $('#price_set_id').val() ) { |
ebd51731 | 684 | $('#totalAmountBlock').hide(); |
95f2107c PB |
685 | } |
686 | else { | |
ebd51731 | 687 | $('#totalAmountBlock').show(); |
95f2107c PB |
688 | } |
689 | }); | |
690 | }); | |
b6f65362 | 691 | |
692 | function formatMoney (amount, c, d, t){ | |
693 | var n = amount, | |
694 | c = isNaN(c = Math.abs(c)) ? 2 : c, | |
695 | d = d == undefined ? "," : d, | |
696 | t = t == undefined ? "." : t, s = n < 0 ? "-" : "", | |
697 | i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", | |
698 | j = (j = i.length) > 3 ? j % 3 : 0; | |
699 | return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); | |
700 | }; | |
6a488035 TO |
701 | </script> |
702 | {/literal} |