Merge pull request #13535 from civicrm/5.10
[civicrm-core.git] / templates / CRM / Member / Form / MembershipBlock.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{* Configure Membership signup/renewal block for an Online Contribution page *}
27<div id="form" class="crm-block crm-form-block crm-member-membershipblock-form-block">
f6eedce7 28<div class="help">
6a488035
TO
29 {ts}Use this form to enable and configure a Membership Signup and Renewal section for this Online Contribution Page. If you're not using this page for membership signup, leave the <strong>Enabled</strong> box un-checked..{/ts} {docURL page="user/membership/setup"}
30</div>
31 {if $form.membership_type.html}
32 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
33 <table class="form-layout-compressed">
34 <tr class="crm-member-membershipblock-form-block-member_is_active">
35 <td class="label"></td><td class="html-adjust">{$form.member_is_active.html}&nbsp;{$form.member_is_active.label}<br />
36 <span class="description">{ts}Include a Membership Signup section in this Online Contribution page?{/ts}</span></td>
37 </tr>
38 </table>
39 <div id="memberFields">
40 <table class="form-layout-compressed">
41 <tr class="crm-member-membershipblock-form-block-new_title">
42 <td class="label">{$form.new_title.label}
43 {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_block' field='new_title' id=$membershipBlockId}{/if}</td><td>{$form.new_title.html}<br />
44 <span class="description">{ts}Membership section title - for new member signups.{/ts}</span></td>
45 </tr>
46 <tr class="crm-member-membershipblock-form-block-new_text">
edba2cbd
DG
47 <td class="label">{$form.new_text.label}
48 {if $action == 2}<br />{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_block' field='new_text' id=$membershipBlockId}{/if}
49 </td>
6a488035
TO
50 <td>{$form.new_text.html}<br />
51 <span class="description">{ts}Membership section introductory text - for new member signups.{/ts}<br /></span><br /></td>
52 </tr>
53 <tr class="crm-member-membershipblock-form-block-renewal_title">
54 <td class="label">{$form.renewal_title.label}
55 {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_block' field='renewal_title' id=$membershipBlockId}{/if}</td><td>{$form.renewal_title.html}<br />
56 <span class="description">{ts}Membership section title - displayed to renewing members.{/ts}</span></td>
57 </tr>
58 <tr class="crm-member-membershipblock-form-block-renewal_text">
edba2cbd
DG
59 <td class="label">{$form.renewal_text.label}
60 {if $action == 2}<br />{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_block' field='renewal_text' id=$membershipBlockId}{/if}
61 </td>
6a488035
TO
62 <td>{$form.renewal_text.html}<br />
63 <span class="description">{ts}Membership section introductory text - displayed to renewing members.{/ts}</span><br /></td>
64 </tr>
65 <tr class="crm-member-membershipblock-form-block-member_price_set_id">
66 <td class="label">{$form.member_price_set_id.label}</td>
67 <td>
68 {if $price eq false}
69 {capture assign=adminPriceSetsURL}{crmURL p="civicrm/admin/price" q="reset=1"}{/capture}
70 <div class="status message">{ts 1=$adminPriceSetsURL}No Membership Price Sets have been configured / enabled for your site. Price sets allow you to configure more complex membership signup and renewal options, including allowing constituents to sign up for multiple memberships at the same time. Click <a href='%1'>here</a> if you want to configure price sets for your site.{/ts}</div>
71 {else}
72 {$form.member_price_set_id.html}
73 {/if}
74 </td>
75 </tr>
76 {if $isQuick}
77 <tr id="quickConfigConvertMessage">
78 <td></td>
247506c6 79 <td><div class="status message">{ts}Click <a id='memQuickconfig' href='#'>here</a> if you want to configure the Membership Types below as part of a Price Set, with the added flexibility and complexity that entails.{/ts}</div></td>
6a488035
TO
80 </tr>
81 {/if}
21f4797a 82 <tr id="membership_type-label" class="crm-member-membershipblock-form-block-membership_type_label">
83 <td class="label">{$form.membership_type_label.label}</td>
84 <td>{$form.membership_type_label.html}</td>
85 </tr>
6a488035
TO
86 <tr id="membership_type-block" class="crm-member-membershipblock-form-block-membership_type">
87 <td class="label">{$form.membership_type.label}</td>
88 <td>
89 {assign var="count" value="1"}
90 {strip}
91 <table class="report">
92 <tr class="columnheader" style="vertical-align:top;"><th style="border-right: 1px solid #4E82CF;">{ts}Include these membership types{/ts}</th><th{if $is_recur} style="border-right: 1px solid #4E82CF;"{/if}>{ts}Default{/ts}<br />
4a143c04 93 </th>{if $is_recur}<th>{ts}Auto-renew{/ts}</th>{/if}</tr>
6a488035
TO
94 {assign var="index" value="1"}
95 {foreach name=outer key=key item=item from=$form.membership_type}
96 {if $index < 10}
97 {assign var="index" value=`$index+1`}
98 {else}
99 <tr>
100 <td class="labels font-light">{$form.membership_type.$key.html}</td>
101 <td class="labels font-light">{$form.membership_type_default.$key.html}</td>
102 {if $is_recur}
103 <td class="labels font-light">
104 {if $auto_renew.$key}
105 {assign var="element" value="auto_renew"|cat:_|cat:$key}{$form.$element.html}
106 {else}
107 {ts}(Not Available){/ts}
108 {/if}
109 </td>
110 {/if}
111 </tr>
112 {/if}
113 {/foreach}
114 </table>
115 {/strip}
116 </td>
117 </tr>
118 <tr id="requiredSignup" class="crm-member-membershipblock-form-block-is_required">
119 <td class="label"></td><td class="html-adjust">{$form.is_required.html}&nbsp;{$form.is_required.label}<br />
120 <span class="description">{ts}If checked, user must signup for one of the displayed membership options before continuing.{/ts}</span></td>
121 </tr>
122 <tr id="separatePayment" class="crm-member-membershipblock-form-block-is_separate_payment">
123 <td class="label"></td><td class="html-adjust">{$form.is_separate_payment.html}&nbsp;{$form.is_separate_payment.label} {help id="id-separate-pay"}<br />
124 <span class="description">{ts}Check this box if you are including both Membership Signup/Renewal AND a Contribution Amount section, AND you want the membership fee to be charged separately from any additional contribution amount.{/ts}</span></td>
125 </tr>
126 <tr id="displayFee" class="crm-member-membershipblock-form-block-display_min_fee">
127 <td class="label"></td><td class="html-adjust">{$form.display_min_fee.html}&nbsp;{$form.display_min_fee.label} {help id="id-display-fee"}<br />
128 <span class="description">{ts}Display the membership fee along with the membership name and description for each membership option?{/ts}</span></td>
129 </tr>
130
131 </table>
132 </div>
133 {else}
134 <div class="status message">
135 {capture assign=linkURL}{crmURL p="civicrm/admin/member/membershipType" q="reset=1"}{/capture}
136 {ts 1=$linkURL}You need to have at least one <a href="%1">Membership Type</a> with 'Public' visibility in order to enable self-service Membership Signup and Renewal.{/ts}
137 </div>
138 {/if}
139 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
140</div>
141
142{literal}
143<script type="text/javascript">
3cc60a06 144 CRM.$(function($) {
6a488035
TO
145 //show/hide membership block
146 showHideMembershipBlock();
ae8f569f 147 $('#member_is_active').click( function() {
6a488035
TO
148 showHideMembershipBlock();
149 });
150
151 //show/ hide blocks if price set is selected
152 checkIfPriceSetIsSelected( );
ae8f569f 153 $('#member_price_set_id').change( function(){
6a488035
TO
154 checkIfPriceSetIsSelected( );
155 });
156 });
157
158 // function to show/hide membership block fields
159 function showHideMembershipBlock( ) {
8539f25d 160 if ( cj('#member_is_active').prop('checked') ) {
6a488035
TO
161 cj('#memberFields').show();
162 } else {
163 cj('#memberFields').hide();
164 }
165 }
166 // function to handle show/hide of membership type and related blocks if price set is selected
167 function checkIfPriceSetIsSelected( ) {
168 if ( cj('#member_price_set_id').val() ) {
21f4797a 169 cj('#membership_type-label').hide();
6a488035 170 cj('#membership_type-block').hide();
6a488035
TO
171 cj('#displayFee').hide();
172 cj('#separatePayment').hide();
173 cj('#quickConfigConvertMessage').hide();
174 } else {
21f4797a 175 cj('#membership_type-label').show();
6a488035 176 cj('#membership_type-block').show();
6a488035
TO
177 cj('#displayFee').show();
178 cj('#separatePayment').show();
179 }
180 }
181</script>
182{/literal}
183
6a488035
TO
184{if $isQuick}
185{literal}
186<script type="text/javascript">
847f8123
CW
187 CRM.$(function($) {
188 $("#memQuickconfig").click(function(e) {
189 e.preventDefault();
190 CRM.confirm({
191 width: 400,
192 message: {/literal}"{ts escape='js'}Once you switch to using a Price Set, you won't be able to switch back to your existing settings below except by re-entering them. Are you sure you want to switch to a Price Set?{/ts}"{literal}
193 }).on('crmConfirm:yes', function() {
194 {/literal}
195 var dataUrl = '{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Core_Page_AJAX&fnName=setIsQuickConfig&context=civicrm_contribution_page&id=$contributionPageID" }';
196 {literal}
197 $.getJSON(dataUrl).done(function(result) {window.location = CRM.url("civicrm/admin/price/field", {reset: 1, action: 'browse', sid: result});});
198 });
199 });
6a488035 200 });
6a488035
TO
201</script>
202{/literal}
232624b1 203{/if}