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