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