Merge pull request #18020 from eileenmcnaughton/pptrans
[civicrm-core.git] / templates / CRM / Member / Form / MembershipRenewal.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
4 | |
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
8 +--------------------------------------------------------------------+
9 *}
10 {* this template is used for renewing memberships for a contact *}
11 {if $membershipMode == 'test' }
12 {assign var=registerMode value="TEST"}
13 {elseif $membershipMode == 'live'}
14 {assign var=registerMode value="LIVE"}
15 {/if}
16 {if !$email}
17 <div class="messages status no-popup">
18 {icon icon="fa-info-circle"}{/icon}
19 <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>
20 </div>
21 {/if}
22 {if $membershipMode}
23 <div class="help">
24 {ts 1=$displayName 2=$registerMode}Use this form to Renew Membership Record on behalf of %1.
25 <strong>A %2 transaction will be submitted</strong>
26 using the selected payment processor.{/ts}
27 </div>
28 {/if}
29 {if $action eq 32768}
30 {if $cancelAutoRenew}
31 <div class="messages status no-popup">
32 {icon icon="fa-info-circle"}{/icon}
33 <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.
34 <a href="%1">Click here</a>
35 if you want to cancel the automatic renewal option.{/ts}</p>
36 </div>
37 {/if}
38 {/if}
39 <div class="crm-block crm-form-block crm-member-membershiprenew-form-block">
40 <div id="help" class="description">
41 {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}
42 </div>
43 <div>{include file="CRM/common/formButtons.tpl" location="top"}</div>
44 <table class="form-layout">
45 <tr class="crm-member-membershiprenew-form-block-contact-id">
46 <td class="label">{$form.contact_id.label}</td>
47 <td>{$form.contact_id.html}</td>
48 </tr>
49 <tr class="crm-member-membershiprenew-form-block-org_name">
50 <td class="label">{ts}Membership Organization and Type{/ts}</td>
51 <td class="html-adjust">{$orgName}&nbsp;&nbsp;-&nbsp;&nbsp;{$memType}
52 {if $member_is_test} {ts}(test){/ts}{/if}
53 &nbsp; <a id="changeMembershipOrgType" href='#'
54 onclick='adjustMembershipOrgType(); return false;'>{ts}change membership type{/ts}</a>
55 </td>
56 </tr>
57 <tr id="membershipOrgType" class="crm-member-membershiprenew-form-block-renew_org_name hiddenElement">
58 <td class="label">{$form.membership_type_id.label}</td>
59 <td>{$form.membership_type_id.html}
60 {if $member_is_test} {ts}(test){/ts}{/if}<br/>
61 <span class="description">{ts}Select Membership Organization and then Membership Type.{/ts}</span>
62 </td>
63 </tr>
64 <tr class="crm-member-membershiprenew-form-block-membership_status">
65 <td class="label">{ts}Membership Status{/ts}</td>
66 <td class="html-adjust">&nbsp;{$membershipStatus}<br/>
67 <span class="description">{ts}Status of this membership.{/ts}</span></td>
68 </tr>
69 <tr class="crm-member-membershiprenew-form-block-end_date">
70 <td class="label">{ts}Membership End Date{/ts}</td>
71 <td class="html-adjust">&nbsp;{$endDate}</td>
72 </tr>
73 <tr class="crm-member-membershiprenew-form-block-renewal_date">
74 <td class="label">{$form.renewal_date.label}</td>
75 <td>{$form.renewal_date.html}</td>
76 </tr>
77 <tr id="defaultNumTerms" class="crm-member-membershiprenew-form-block-default-num_terms">
78 <td colspan="2" class="description">
79 {ts}Renewal extends membership end date by one membership period{/ts}
80 &nbsp; <a id="changeTermsLink" href='#'
81 onclick='changeNumTerms(); return false;'>{ts}change{/ts}</a>
82 </td>
83 </tr>
84 <tr id="changeNumTerms" class="crm-member-membershiprenew-form-block-change-num_terms">
85 <td class="label">{$form.num_terms.label}</td>
86 <td>{$form.num_terms.html|crmAddClass:two} {ts}membership periods{/ts}<br/>
87 <span
88 class="description">{ts}Extend the membership end date by this many membership periods. Make sure the appropriate corresponding fee is entered below.{/ts}</span>
89 </td>
90 </tr>
91 {if $accessContribution and ! $membershipMode}
92 <tr class="crm-member-membershiprenew-form-block-record_contribution">
93 <td class="label">{$form.record_contribution.label}</td>
94 <td class="html-adjust">{$form.record_contribution.html}<br/>
95 <span
96 class="description">{ts}Check this box to enter payment information. You will also be able to generate a customized receipt.{/ts}</span>
97 </td>
98 </tr>
99 <tr id="recordContribution" class="crm-member-membershiprenew-form-block-membership_renewal">
100 <td colspan="2">
101 <fieldset>
102 <legend>{ts}Renewal Payment and Receipt{/ts}</legend>
103 {/if}
104 {include file="CRM/Member/Form/MembershipCommon.tpl"}
105 </table>
106 {if $emailExists and $outBound_option != 2}
107 <table class="form-layout">
108 <tr class="crm-{$formClass}-form-block-send_receipt">
109 <td class="label">{$form.send_receipt.label}</td>
110 <td>{$form.send_receipt.html}<br/>
111 <span class="description">{ts 1=$emailExists}Automatically email a membership confirmation and receipt to %1?{/ts}</span>
112 </td>
113 </tr>
114 <tr id="fromEmail">
115 <td class="label">{$form.from_email_address.label}</td>
116 <td>{$form.from_email_address.html} {help id="id-from_email" file="CRM/Contact/Form/Task/Email.hlp" isAdmin=$isAdmin}</td>
117 </tr>
118 <tr id="notice" class="crm-member-membershiprenew-form-block-receipt_text_renewal">
119 <td class="label">{$form.receipt_text_renewal.label}</td>
120 <td><span
121 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/>
122 {$form.receipt_text_renewal.html|crmAddClass:huge}</td>
123 </tr>
124 </table>
125 {/if}
126
127 {include file="CRM/common/customDataBlock.tpl"}
128
129 <div>{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
130
131 <div class="spacer"></div>
132 </div>
133 {if $accessContribution and ! $membershipMode}
134 {include file="CRM/common/showHideByFieldValue.tpl"
135 trigger_field_id ="record_contribution"
136 trigger_value =""
137 target_element_id ="recordContribution"
138 target_element_type ="table-row"
139 field_type ="radio"
140 invert = 0
141 }
142 {/if}
143
144 {if $email and $outBound_option != 2}
145 {include file="CRM/common/showHideByFieldValue.tpl"
146 trigger_field_id ="send_receipt"
147 trigger_value =""
148 target_element_id ="notice"
149 target_element_type ="table-row"
150 field_type ="radio"
151 invert = 0
152 }
153 {include file="CRM/common/showHideByFieldValue.tpl"
154 trigger_field_id ="send_receipt"
155 trigger_value =""
156 target_element_id ="fromEmail"
157 target_element_type ="table-row"
158 field_type ="radio"
159 invert = 0
160 }
161 {/if}
162
163 {if !$membershipMode}
164 {include file="CRM/common/showHideByFieldValue.tpl"
165 trigger_field_id ="send_receipt"
166 trigger_value =""
167 target_element_id ="fromEmail"
168 target_element_type ="table-row"
169 field_type ="radio"
170 invert = 0
171 }
172 {/if}
173 {literal}
174 <script type="text/javascript">
175 CRM.$(function($) {
176 $('#membershipOrgType').hide();
177 $('#changeNumTerms').hide();
178 });
179
180 function checkPayment() {
181 showHideByValue('record_contribution', '', 'recordContribution', 'table-row', 'radio', false);
182 {/literal}{if $email and $outBound_option != 2}{literal}
183 var record_contribution = document.getElementsByName('record_contribution');
184 if (record_contribution[0].checked) {
185 document.getElementsByName('send_receipt')[0].checked = true;
186 cj('#fromEmail').show();
187 }
188 else {
189 document.getElementsByName('send_receipt')[0].checked = false;
190 }
191 showHideByValue('send_receipt', '', 'notice', 'table-row', 'radio', false);
192 {/literal}{/if}{literal}
193 }
194
195 function adjustMembershipOrgType() {
196 cj('#membershipOrgType').show();
197 cj('#changeMembershipOrgType').hide();
198 }
199
200 function changeNumTerms() {
201 cj('#changeNumTerms').show();
202 cj('#defaultNumTerms').hide();
203 }
204
205 CRM.$(function($) {
206 cj('#record_contribution').click(function () {
207 if (cj(this).prop('checked')) {
208 cj('#recordContribution').show();
209 setPaymentBlock(true);
210 }
211 else {
212 cj('#recordContribution').hide();
213 }
214 });
215
216 cj('#membership_type_id_1').change(function () {
217 setPaymentBlock();
218 });
219 setPaymentBlock();
220 });
221
222 function setPaymentBlock(checkboxEvent) {
223 var memType = cj('#membership_type_id_1').val();
224
225 if (!memType) {
226 return;
227 }
228
229 var allMemberships = {/literal}{$allMembershipInfo}{literal};
230 var mode = {/literal}'{$membershipMode}'{literal};
231
232 if (!mode) {
233 // skip this for test and live modes because contribution type is set automatically
234 cj("#financial_type_id").val(allMemberships[memType]['financial_type_id']);
235 }
236
237 if (!checkboxEvent) {
238 if (allMemberships[memType]['total_amount_numeric'] > 0) {
239 cj('#record_contribution').prop('checked', true);
240 cj('#recordContribution').show();
241 }
242 else {
243 cj('#record_contribution').prop('checked', false);
244 cj('#recordContribution').hide();
245 }
246 }
247
248 var term = cj("#num_terms").val();
249 if (term) {
250 var renewTotal = allMemberships[memType]['total_amount_numeric'] * term;
251 cj("#total_amount").val(CRM.formatMoney(renewTotal, true));
252 }
253 else {
254 cj("#total_amount").val(allMemberships[memType]['total_amount']);
255 }
256
257 cj('.totaltaxAmount').html(allMemberships[memType]['tax_message']);
258 }
259
260 // show/hide different contact section
261 setDifferentContactBlock();
262 cj('#is_different_contribution_contact').change(function () {
263 setDifferentContactBlock();
264 });
265
266 function setDifferentContactBlock() {
267 //get the
268 if (cj('#is_different_contribution_contact').prop('checked')) {
269 cj('#record-different-contact').show();
270 }
271 else {
272 cj('#record-different-contact').hide();
273 }
274 }
275 </script>
276 {/literal}