2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
26 {* this template is used for adding/editing/deleting pledge *}
28 {include file="CRM/Custom/Form/CustomData.tpl"}
29 {elseif $showAdditionalInfo and $formType }
30 {include file="CRM/Contribute/Form/AdditionalInfo/$formType.tpl"}
32 {if !$email and $action neq 8 and $context neq 'standalone'}
33 <div class="messages status no-popup">
34 <div class="icon inform-icon"></div>
35 <p>{ts}You will not be able to send an acknowledgment for this pledge because there is no email address recorded for this contact. If you want a acknowledgment to be sent when this pledge is recorded, click Cancel and then click Edit from the Summary tab to add an email address before recording the pledge.{/ts}</p>
39 <h3>{ts}New Pledge{/ts}</h3>
41 <h3>{ts}Edit Pledge{/ts}</h3>
42 {* Check if current Total Pledge Amount is different from original pledge amount. *}
43 {math equation="x / y" x=$amount y=$installments format="%.2f" assign="currentInstallment"}
44 {* Check if current Total Pledge Amount is different from original pledge amount. *}
45 {if $currentInstallment NEQ $eachPaymentAmount}
46 {assign var=originalPledgeAmount value=`$installments*$eachPaymentAmount`}
49 <h3>{ts}Delete Pledge{/ts}</h3>
51 <div class="crm-block crm-form-block crm-pledge-form-block">
52 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
54 <div class="messages status no-popup">
55 <div class="icon inform-icon"></div>
56 <span class="font-red bold">{ts}WARNING: Deleting this pledge will also delete any related pledge payments.{/ts} {ts}This action cannot be undone.{/ts}</span>
57 <p>{ts}Consider cancelling the pledge instead if you want to maintain an audit trail and avoid losing payment data. To set the pledge status to Cancelled and cancel any not-yet-paid pledge payments, first click Cancel on this form. Then click the more > link from the pledge listing, and select the Cancel action.{/ts}</p>
60 <table class="form-layout-compressed">
61 {if $context eq 'standalone'}
62 {if !$email and $outBound_option != 2}
63 {assign var='profileCreateCallback' value=1 }
65 {include file="CRM/Contact/Form/NewContact.tpl"}
67 <tr class="crm-pledge-form-block-displayName">
68 <td class="font-size12pt right"><strong>{ts}Pledge by{/ts}</strong></td>
69 <td class="font-size12pt"><strong>{$displayName}</strong></td>
72 <tr class="crm-pledge-form-block-amount">
73 <td class="label">{$form.amount.label}</td>
74 <td><span>{$form.currency.html|crmAddClass:eight} {$form.amount.html|crmAddClass:eight}</span>
75 {if $originalPledgeAmount}<div class="messages status no-popup"><div class="icon inform-icon"></div> {ts 1=$originalPledgeAmount|crmMoney:$currency} Pledge total has changed due to payment adjustments. Original pledge amount was %1.{/ts}</div>{/if}
78 <tr class="crm-pledge-form-block-installments">
79 <td class="label">{$form.installments.label}</td>
80 <td>{$form.installments.html} {ts}installments of{/ts} {if $action eq 1 or $isPending}{$form.eachPaymentAmount.html|crmMoney:$currency}{elseif $action eq 2 and !$isPending}{$eachPaymentAmount|crmMoney:$currency}{/if} {ts}every{/ts} {$form.frequency_interval.html} {$form.frequency_unit.html}</td></tr>
81 <tr class="crm-pledge-form-block-frequency_day">
82 <td class="label nowrap">{$form.frequency_day.label}</td>
83 <td>{$form.frequency_day.html} {ts}day of the period{/ts}<br />
84 <span class="description">{ts}This applies to weekly, monthly and yearly payments.{/ts}</td></tr>
85 {if $form.create_date}
86 <tr class="crm-pledge-form-block-create_date">
87 <td class="label">{$form.create_date.label}</td>
88 <td>{include file="CRM/common/jcalendar.tpl" elementName=create_date}<br />
91 <tr class="crm-pledge-form-block-create_date">
92 <td class="label">{ts}Pledge Made{/ts}</td>
93 <td class="view-value">{$create_date|truncate:10:''|crmDate}
95 <span class="description">{ts}Date when pledge was made by the contributor.{/ts}</span></td></tr>
98 <tr class="crm-pledge-form-block-start_date">
99 <td class="label">{$form.start_date.label}</td>
100 <td>{include file="CRM/common/jcalendar.tpl" elementName=start_date}<br />
103 <tr class="crm-pledge-form-block-start_date">
104 <td class="label">{ts}Payments Start{/ts}</td>
105 <td class="view-value">{$start_date|truncate:10:''|crmDate}
107 <span class="description">{ts}Date of first pledge payment.{/ts}</span></td></tr>
109 {if $email and $outBound_option != 2}
110 {if $form.is_acknowledge }
111 <tr class="crm-pledge-form-block-is_acknowledge">
112 <td class="label">{$form.is_acknowledge.label}</td>
113 <td>{$form.is_acknowledge.html}<br />
114 <span class="description">{ts 1=$email}Automatically email an acknowledgment of this pledge to %1?{/ts}</span></td></tr>
116 {elseif $context eq 'standalone' and $outBound_option != 2 }
117 <tr id="acknowledgment-receipt" style="display:none;"><td class="label">{$form.is_acknowledge.label}</td><td>{$form.is_acknowledge.html} <span class="description">{ts}Automatically email an acknowledgment of this pledge to {/ts}<span id="email-address"></span>?</span></td></tr>
119 <tr id="fromEmail" style="display:none;">
120 <td class="label">{$form.from_email_address.label}</td>
121 <td>{$form.from_email_address.html}</td>
123 <tr id="acknowledgeDate">
124 <td class="label" class="crm-pledge-form-block-acknowledge_date">{$form.acknowledge_date.label}</td>
125 <td>{include file="CRM/common/jcalendar.tpl" elementName=acknowledge_date}<br />
126 <span class="description">{ts}Date when an acknowledgment of the pledge was sent.{/ts}</span></td>
128 <tr class="crm-pledge-form-block-financial_type_id">
129 <td class="label">{$form.financial_type_id.label}</td>
130 <td>{$form.financial_type_id.html}<br />
131 <span class="description">{ts}Sets the default financial type for payments against this pledge.{/ts}</span></td></tr>
133 {* CRM-7362 --add campaign *}
134 {include file="CRM/Campaign/Form/addCampaignToComponent.tpl"
135 campaignTrClass="crm-pledge-form-block-campaign_id"}
137 <tr class="crm-pledge-form-block-contribution_page_id">
138 <td class="label">{$form.contribution_page_id.label}</td>
139 <td>{$form.contribution_page_id.html}<br />
140 <span class="description">{ts}Select an Online Contribution page that the user can access to make self-service pledge payments. (Only Online Contribution pages configured to include the Pledge option are listed.){/ts}</span></td>
143 <tr class="crm-pledge-form-block-status">
144 <td class="label">{ts}Pledge Status{/ts}</td>
145 <td class="view-value">{$status}<br />
146 <span class="description">{ts}Pledges are "Pending" until the first payment is received. Once a payment is received, status is "In Progress" until all scheduled payments are completed. Overdue pledges are ones with payment(s) past due.{/ts}</span></td></tr>
147 <tr><td colspan=2>{include file="CRM/Custom/Form/CustomData.tpl"}</td></tr>
150 <script type="text/javascript">
151 // bind first click of accordion header to load crm-accordion-body with snippet
152 // everything else taken care of by cj().crm-accordions()
153 cj(document).ready( function() {
154 cj('.crm-ajax-accordion .crm-accordion-header').one('click', function() {
155 loadPanes(cj(this).attr('id'));
157 cj('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(function(index) {
158 loadPanes(cj(this).attr('id'));
161 // load panes function calls for snippet based on id of crm-accordion-header
162 function loadPanes( id ) {
163 var url = "{/literal}{crmURL p='civicrm/contact/view/pledge' q='snippet=4&formType=' h=0}{literal}" + id;
165 {if $contributionMode}
166 url = url + "&mode={$contributionMode}";
169 if ( ! cj('div.'+id).html() ) {
170 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}...';
171 cj('div.'+id).html(loading);
174 success: function(data) { cj('div.'+id).html(data); }
182 <div class="accordion ui-accordion ui-widget ui-helper-reset">
183 {foreach from=$allPanes key=paneName item=paneValue}
184 <div class="crm-accordion-wrapper crm-ajax-accordion crm-{$paneValue.id}-accordion {if $paneValue.open neq 'true'}collapsed{/if}">
185 <div class="crm-accordion-header" id="{$paneValue.id}">
187 </div><!-- /.crm-accordion-header -->
188 <div class="crm-accordion-body">
189 <div class="{$paneValue.id}"></div>
190 </div><!-- /.crm-accordion-body -->
191 </div><!-- /.crm-accordion-wrapper -->
195 {/if} {* not delete mode if*}
198 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
201 <script type="text/javascript">
203 cj().crmAccordions();
208 <script type="text/javascript">
211 var element = document.getElementsByName("is_acknowledge");
212 if ( element[0].checked ) {
213 var emailAddress = '{/literal}{$email}{literal}';
214 if ( !emailAddress ) {
215 var emailAddress = cj('#email-address').html();
217 var message = '{/literal}{ts 1="'+emailAddress+'"}Click OK to save this Pledge record AND send an acknowledgment to %1 now{/ts}{literal}.';
218 if (!confirm( message) ) {
224 function calculatedPaymentAmount( ) {
225 var thousandMarker = {/literal}{crmSetting name="monetaryThousandSeparator" group="CiviCRM Localization"}{literal};
226 var seperator = '{/literal}{$config->monetaryDecimalPoint}{literal}';
227 var amount = document.getElementById("amount").value;
228 // replace all thousandMarker and change the seperator to a dot
229 amount = amount.replace(thousandMarker,'').replace(seperator,'.');
230 var installments = document.getElementById("installments").value;
231 if ( installments != '' && installments != NaN) {
232 amount = amount/installments;
233 var installmentAmount = formatMoney( amount, 2, seperator, thousandMarker );
234 document.getElementById("eachPaymentAmount").value = installmentAmount;
238 function formatMoney (amount, c, d, t){
240 c = isNaN(c = Math.abs(c)) ? 2 : c,
241 d = d == undefined ? "," : d,
242 t = t == undefined ? "." : t, s = n < 0 ? "-" : "",
243 i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
244 j = (j = i.length) > 3 ? j % 3 : 0;
245 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) : "");
249 {if $context eq 'standalone' and $outBound_option != 2 }
252 cj("#contact_1").blur( function( ) {
256 showHideByValue( 'is_acknowledge', '', 'acknowledgeDate', 'table-row', 'radio', true);
257 showHideByValue( 'is_acknowledge', '', 'fromEmail', 'table-row', 'radio', false );
259 function checkEmail( ) {
260 var contactID = cj("input[name='contact_select_id[1]']").val();
262 var postUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' h=0}{literal}";
263 cj.post( postUrl, {contact_id: contactID},
264 function ( response ) {
266 cj("#acknowledgment-receipt").show( );
267 cj("#email-address").html( response );
269 cj("#acknowledgment-receipt").hide( );
274 cj("#acknowledgment-receipt").hide( );
278 function profileCreateCallback( blockNo ) {
285 {if $email and $outBound_option != 2}
286 {include file="CRM/common/showHideByFieldValue.tpl"
287 trigger_field_id ="is_acknowledge"
289 target_element_id ="acknowledgeDate"
290 target_element_type ="table-row"
294 {include file="CRM/common/showHideByFieldValue.tpl"
295 trigger_field_id ="is_acknowledge"
297 target_element_id ="fromEmail"
298 target_element_type ="table-row"
304 {* include jscript to warn if unsaved form field changes *}
305 {include file="CRM/common/formNavigate.tpl"}
308 {* closing of main custom data if *}