CRM-15153 - Give forms a unique css class based on full class name
[civicrm-core.git] / templates / CRM / Member / Form / MembershipRenewal.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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 renewing memberships for a contact *}
27 {if $cdType }
28 {include file="CRM/Custom/Form/CustomData.tpl"}
29 {else}
30 {if $membershipMode == 'test' }
31 {assign var=registerMode value="TEST"}
32 {elseif $membershipMode == 'live'}
33 {assign var=registerMode value="LIVE"}
34 {/if}
35 {if !$email}
36 <div class="messages status no-popup">
37 <div class="icon inform-icon"></div>
38 <p>{ts}You will not be able to send an automatic email receipt for this Renew Membership because there is no email address recorded for this contact. If you want a receipt to be sent when this Membership is recorded, click Cancel and then click Edit from the Summary tab to add an email address before Renewal the Membership.{/ts}</p>
39 </div>
40 {/if}
41 {if $membershipMode}
42 <div id="help">
43 {ts 1=$displayName 2=$registerMode}Use this form to Renew Membership Record on behalf of %1.
44 <strong>A %2 transaction will be submitted</strong>
45 using the selected payment processor.{/ts}
46 </div>
47 {/if}
48 {if $action eq 32768}
49 {if $cancelAutoRenew}
50 <div class="messages status no-popup">
51 <div class="icon inform-icon"></div>
52 <p>{ts 1=$cancelAutoRenew}This membership is set to renew automatically {if $renewalDate}on {$renewalDate|crmDate}{/if}. You will need to cancel the auto-renew option if you want to modify the Membership Type, End Date or Membership Status.
53 <a href="%1">Click here</a>
54 if you want to cancel the automatic renewal option.{/ts}</p>
55 </div>
56 {/if}
57 {/if}
58 <div class="crm-block crm-form-block crm-member-membershiprenew-form-block">
59 <div id="help" class="description">
60 {ts}Renewing will add the normal membership period to the End Date of the previous period for members whose status is Current or Grace. For Expired memberships, renewing will create a membership period commencing from the 'Date Renewal Entered'. This date can be adjusted including being set to the day after the previous End Date - if continuous membership is required.{/ts}
61 </div>
62 <div>{include file="CRM/common/formButtons.tpl" location="top"}</div>
63 <table class="form-layout">
64 <tr class="crm-member-membershiprenew-form-block-payment_processor_id">
65 <td class="label">{$form.payment_processor_id.label}</td>
66 <td class="html-adjust">{$form.payment_processor_id.html}</td>
67 </tr>
68 <tr class="crm-member-membershiprenew-form-block-org_name">
69 <td class="label">{ts}Membership Organization and Type{/ts}</td>
70 <td class="html-adjust">{$orgName}&nbsp;&nbsp;-&nbsp;&nbsp;{$memType}
71 {if $member_is_test} {ts}(test){/ts}{/if}
72 &nbsp; <a id="changeMembershipOrgType" href='#'
73 onclick='adjustMembershipOrgType(); return false;'>{ts}change membership type{/ts}</a>
74 </td>
75 </tr>
76 <tr id="membershipOrgType" class="crm-member-membershiprenew-form-block-renew_org_name">
77 <td class="label">{$form.membership_type_id.label}</td>
78 <td>{$form.membership_type_id.html}
79 {if $member_is_test} {ts}(test){/ts}{/if}<br/>
80 <span class="description">{ts}Select Membership Organization and then Membership Type.{/ts}</span>
81 </td>
82 </tr>
83 <tr class="crm-member-membershiprenew-form-block-membership_status">
84 <td class="label">{ts}Membership Status{/ts}</td>
85 <td class="html-adjust">&nbsp;{$membershipStatus}<br/>
86 <span class="description">{ts}Status of this membership.{/ts}</span></td>
87 </tr>
88 <tr class="crm-member-membershiprenew-form-block-end_date">
89 <td class="label">{ts}Membership End Date{/ts}</td>
90 <td class="html-adjust">&nbsp;{$endDate}</td>
91 </tr>
92 <tr class="crm-member-membershiprenew-form-block-renewal_date">
93 <td class="label">{$form.renewal_date.label}</td>
94 <td>{include file="CRM/common/jcalendar.tpl" elementName=renewal_date}</td>
95 </tr>
96 {if $membershipMode}
97 <tr class="crm-member-membershiprenew-form-block-financial_type_id">
98 <td class="label">{$form.financial_type_id.label}</td>
99 <td>{$form.financial_type_id.html}<br/>
100 <span class="description">{ts}Select the appropriate financial type for this payment.{/ts}</span></td>
101 </tr>
102 {/if}
103 {if $accessContribution and ! $membershipMode}
104 <tr class="crm-member-membershiprenew-form-block-record_contribution">
105 <td class="label">{$form.record_contribution.label}</td>
106 <td class="html-adjust">{$form.record_contribution.html}<br/>
107 <span
108 class="description">{ts}Check this box to enter payment information. You will also be able to generate a customized receipt.{/ts}</span>
109 </td>
110 </tr>
111 <tr id="recordContribution" class="crm-member-membershiprenew-form-block-membership_renewal">
112 <td colspan="2">
113 <fieldset>
114 <legend>{ts}Renewal Payment and Receipt{/ts}</legend>
115 <table class="form-layout-compressed">
116 <tr id="defaultNumTerms" class="crm-member-membershiprenew-form-block-default-num_terms">
117 <td colspan="2" class="description">
118 {ts}Renewal extends membership end date by one membership period{/ts}
119 &nbsp; <a id="changeTermsLink" href='#'
120 onclick='changeNumTerms(); return false;'>{ts}change{/ts}</a>
121 </td>
122 </tr>
123 <tr id="changeNumTerms" class="crm-member-membershiprenew-form-block-change-num_terms">
124 <td class="label">{$form.num_terms.label}</td>
125 <td>{$form.num_terms.html|crmAddClass:two} {ts}membership periods{/ts}<br/>
126 <span
127 class="description">{ts}Extend the membership end date by this many membership periods. Make sure the appropriate corresponding fee is entered below.{/ts}</span>
128 </td>
129 </tr>
130 {if $context neq 'standalone'}
131 <tr class="crm-membership-form-block-contribution-contact">
132 <td class="label">{$form.contribution_contact.label}</td>
133 <td>{$form.contribution_contact.html}&nbsp;&nbsp;{help id="id-contribution_contact"}</td>
134 </tr>
135 <tr id="record-different-contact">
136 <td>&nbsp;</td>
137 <td>
138 <table class="compressed">
139 <tr class="crm-membership-form-block-soft-credit-type">
140 <td class="label">{$form.soft_credit_type_id.label}</td>
141 <td>{$form.soft_credit_type_id.html}</td>
142 </tr>
143 <tr class="crm-membership-form-block-soft-credit-contact-id">
144 <td class="label">{$form.soft_credit_contact_id.label}</td>
145 <td>{$form.soft_credit_contact_id.html}</td>
146 </tr>
147 </table>
148 </td>
149 </tr>
150 {/if}
151 <tr class="crm-member-membershiprenew-form-block-financial_type_id">
152 <td class="label">{$form.financial_type_id.label}</td>
153 <td>{$form.financial_type_id.html}<br/>
154 <span class="description">{ts}Select the appropriate financial type for this payment.{/ts}</span>
155 </td>
156 </tr>
157 <tr class="crm-member-membershiprenew-form-block-total_amount">
158 <td class="label">{$form.total_amount.label}</td>
159 <td>{$form.total_amount.html}<br/>
160 <span
161 class="description">{ts}Membership payment amount. A contribution record will be created for this amount.{/ts}</span>
162 </td>
163 </tr>
164 <tr class="crm-membershiprenew-form-block-receive_date">
165 <td class="label">{$form.receive_date.label}</td>
166 <td>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}</td>
167 </tr>
168 <tr class="crm-member-membershiprenew-form-block-payment_instrument_id">
169 <td class="label">{$form.payment_instrument_id.label}<span class='marker'>*</span></td>
170 <td>{$form.payment_instrument_id.html} {help id="payment_instrument_id" file="CRM/Contribute/Page/Tab.hlp"}</td>
171 </tr>
172 <tr id="checkNumber" class="crm-member-membershiprenew-form-block-check_number">
173 <td class="label">{$form.check_number.label}</td>
174 <td>{$form.check_number.html|crmAddClass:six}</td>
175 </tr>
176 <tr class="crm-member-membershiprenew-form-block-trxn_id">
177 <td class="label">{$form.trxn_id.label}</td>
178 <td>{$form.trxn_id.html}</td>
179 </tr>
180 <tr class="crm-member-membershiprenew-form-block-contribution_status_id">
181 <td class="label">{$form.contribution_status_id.label}</td>
182 <td>{$form.contribution_status_id.html}</td>
183 </tr>
184 </table>
185 </fieldset>
186 </td>
187 </tr>
188 {else}
189 <tr class="crm-member-membershiprenew-form-block-total_amount">
190 <td class="label">{$form.total_amount.label}</td>
191 <td>{$form.total_amount.html}<br/>
192 <span
193 class="description">{ts}Membership payment amount. A contribution record will be created for this amount.{/ts}</span>
194 </td>
195 </tr>
196 {/if}
197 </table>
198 {if $membershipMode}
199 {if $context neq 'standalone'}
200 <table class="form-layout-compressed">
201 <tr class="crm-membership-form-block-contribution-contact">
202 <td class="label">{$form.contribution_contact.label}</td>
203 <td>{$form.contribution_contact.html}&nbsp;&nbsp;{help id="id-contribution_contact"}</td>
204 </tr>
205 <tr id="record-different-contact">
206 <td>&nbsp;</td>
207 <td>
208 <table class="form-layout-compressed">
209 <tr class="crm-membership-form-block-soft-credit-type">
210 <td class="label">{$form.soft_credit_type_id.label}</td>
211 <td>{$form.soft_credit_type_id.html}</td>
212 </tr>
213 <tr class="crm-membership-form-soft-credit-contact-id">
214 <td class="label">{$form.soft_credit_contact_id.label}</td>
215 <td>{$form.soft_credit_contact_id.html}</td>
216 </tr>
217 </table>
218 </td>
219 </tr>
220 </table>
221 {/if}
222 <div class="spacer"></div>
223 {include file='CRM/Core/BillingBlock.tpl'}
224 {/if}
225 {if $email and $outBound_option != 2}
226 <table class="form-layout">
227 <tr class="crm-member-membershiprenew-form-block-send_receipt">
228 <td class="label">{$form.send_receipt.label}</td>
229 <td>{$form.send_receipt.html}<br/>
230 <span
231 class="description">{ts 1=$email}Automatically email a membership confirmation and receipt to %1?{/ts}</span>
232 </td>
233 </tr>
234 <tr id="fromEmail">
235 <td class="label">{$form.from_email_address.label}</td>
236 <td>{$form.from_email_address.html}</td>
237 </tr>
238 <tr id="notice" class="crm-member-membershiprenew-form-block-receipt_text_renewal">
239 <td class="label">{$form.receipt_text_renewal.label}</td>
240 <td><span
241 class="description">{ts}Enter a message you want included at the beginning of the emailed receipt. EXAMPLE: 'Thanks for supporting our organization with your membership.'{/ts}</span><br/>
242 {$form.receipt_text_renewal.html|crmAddClass:huge}</td>
243 </tr>
244 </table>
245 {/if}
246
247 <div id="customData"></div>
248 {*include custom data js file*}
249 {include file="CRM/common/customData.tpl"}
250
251 <div>{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
252
253 <div class="spacer"></div>
254 </div>
255 {if $accessContribution and ! $membershipMode}
256 {include file="CRM/common/showHideByFieldValue.tpl"
257 trigger_field_id ="record_contribution"
258 trigger_value =""
259 target_element_id ="recordContribution"
260 target_element_type ="table-row"
261 field_type ="radio"
262 invert = 0
263 }
264 {/if}
265
266 {if $email and $outBound_option != 2}
267 {include file="CRM/common/showHideByFieldValue.tpl"
268 trigger_field_id ="send_receipt"
269 trigger_value =""
270 target_element_id ="notice"
271 target_element_type ="table-row"
272 field_type ="radio"
273 invert = 0
274 }
275 {include file="CRM/common/showHideByFieldValue.tpl"
276 trigger_field_id ="send_receipt"
277 trigger_value =""
278 target_element_id ="fromEmail"
279 target_element_type ="table-row"
280 field_type ="radio"
281 invert = 0
282 }
283 {/if}
284
285 {if !$membershipMode}
286 {include file="CRM/common/showHideByFieldValue.tpl"
287 trigger_field_id ="payment_instrument_id"
288 trigger_value = '4'
289 target_element_id ="checkNumber"
290 target_element_type ="table-row"
291 field_type ="select"
292 invert = 0
293 }
294 {include file="CRM/common/showHideByFieldValue.tpl"
295 trigger_field_id ="send_receipt"
296 trigger_value =""
297 target_element_id ="fromEmail"
298 target_element_type ="table-row"
299 field_type ="radio"
300 invert = 0
301 }
302 {/if}
303 {literal}
304 <script type="text/javascript">
305 CRM.$(function($) {
306 $('#membershipOrgType').hide();
307 $('#changeNumTerms').hide();
308 {/literal}
309 CRM.buildCustomData('{$customDataType}');
310 {if $customDataSubType}
311 CRM.buildCustomData('{$customDataType}', {$customDataSubType});
312 {/if}
313 {literal}
314 });
315
316 function checkPayment() {
317 showHideByValue('record_contribution', '', 'recordContribution', 'table-row', 'radio', false);
318 {/literal}{if $email and $outBound_option != 2}{literal}
319 var record_contribution = document.getElementsByName('record_contribution');
320 if (record_contribution[0].checked) {
321 document.getElementsByName('send_receipt')[0].checked = true;
322 cj('#fromEmail').show();
323 }
324 else {
325 document.getElementsByName('send_receipt')[0].checked = false;
326 }
327 showHideByValue('send_receipt', '', 'notice', 'table-row', 'radio', false);
328 {/literal}{/if}{literal}
329 }
330
331 function adjustMembershipOrgType() {
332 cj('#membershipOrgType').show();
333 cj('#changeMembershipOrgType').hide();
334 }
335
336 function changeNumTerms() {
337 cj('#changeNumTerms').show();
338 cj('#defaultNumTerms').hide();
339 }
340
341 CRM.$(function($) {
342 cj('#record_contribution').click(function () {
343 if (cj(this).prop('checked')) {
344 cj('#recordContribution').show();
345 setPaymentBlock(true);
346 }
347 else {
348 cj('#recordContribution').hide();
349 }
350 });
351
352 cj('#membership_type_id_1').change(function () {
353 setPaymentBlock();
354 });
355 setPaymentBlock();
356 });
357
358 function setPaymentBlock(checkboxEvent) {
359 var memType = cj('#membership_type_id_1').val();
360
361 if (!memType) {
362 return;
363 }
364
365 var allMemberships = {/literal}{$allMembershipInfo}{literal};
366 var mode = {/literal}'{$membershipMode}'{literal};
367
368 if (!mode) {
369 // skip this for test and live modes because contribution type is set automatically
370 cj("#financial_type_id").val(allMemberships[memType]['financial_type_id']);
371 }
372
373 if (!checkboxEvent) {
374 if (allMemberships[memType]['total_amount_numeric'] > 0) {
375 cj('#record_contribution').prop('checked', true);
376 cj('#recordContribution').show();
377 }
378 else {
379 cj('#record_contribution').prop('checked', false);
380 cj('#recordContribution').hide();
381 }
382 }
383
384 var term = cj("#num_terms").val();
385 if (term) {
386 var renewTotal = allMemberships[memType]['total_amount_numeric'] * term;
387 cj("#total_amount").val(renewTotal.toFixed(2));
388 }
389 else {
390 cj("#total_amount").val(allMemberships[memType]['total_amount']);
391 }
392 }
393
394 // show/hide different contact section
395 setDifferentContactBlock();
396 cj('#contribution_contact').change(function () {
397 setDifferentContactBlock();
398 });
399
400 function setDifferentContactBlock() {
401 //get the
402 if (cj('#contribution_contact').prop('checked')) {
403 cj('#record-different-contact').show();
404 }
405 else {
406 cj('#record-different-contact').hide();
407 }
408 }
409 </script>
410 {/literal}
411 {/if}{* closing of custom data if *}