Merge pull request #16736 from ixiam/dev_report_issue#27
[civicrm-core.git] / templates / CRM / Member / Form / MembershipBlock.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
1188c7a8 3 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 4 | |
1188c7a8
TO
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 |
6a488035
TO
8 +--------------------------------------------------------------------+
9*}
10{* Configure Membership signup/renewal block for an Online Contribution page *}
11<div id="form" class="crm-block crm-form-block crm-member-membershipblock-form-block">
f6eedce7 12<div class="help">
6a488035
TO
13 {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"}
14</div>
15 {if $form.membership_type.html}
16 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
17 <table class="form-layout-compressed">
18 <tr class="crm-member-membershipblock-form-block-member_is_active">
19 <td class="label"></td><td class="html-adjust">{$form.member_is_active.html}&nbsp;{$form.member_is_active.label}<br />
20 <span class="description">{ts}Include a Membership Signup section in this Online Contribution page?{/ts}</span></td>
21 </tr>
22 </table>
23 <div id="memberFields">
24 <table class="form-layout-compressed">
25 <tr class="crm-member-membershipblock-form-block-new_title">
26 <td class="label">{$form.new_title.label}
27 {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 />
28 <span class="description">{ts}Membership section title - for new member signups.{/ts}</span></td>
29 </tr>
30 <tr class="crm-member-membershipblock-form-block-new_text">
edba2cbd
DG
31 <td class="label">{$form.new_text.label}
32 {if $action == 2}<br />{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_block' field='new_text' id=$membershipBlockId}{/if}
33 </td>
6a488035
TO
34 <td>{$form.new_text.html}<br />
35 <span class="description">{ts}Membership section introductory text - for new member signups.{/ts}<br /></span><br /></td>
36 </tr>
37 <tr class="crm-member-membershipblock-form-block-renewal_title">
38 <td class="label">{$form.renewal_title.label}
39 {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 />
40 <span class="description">{ts}Membership section title - displayed to renewing members.{/ts}</span></td>
41 </tr>
42 <tr class="crm-member-membershipblock-form-block-renewal_text">
edba2cbd
DG
43 <td class="label">{$form.renewal_text.label}
44 {if $action == 2}<br />{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_block' field='renewal_text' id=$membershipBlockId}{/if}
45 </td>
6a488035
TO
46 <td>{$form.renewal_text.html}<br />
47 <span class="description">{ts}Membership section introductory text - displayed to renewing members.{/ts}</span><br /></td>
48 </tr>
49 <tr class="crm-member-membershipblock-form-block-member_price_set_id">
50 <td class="label">{$form.member_price_set_id.label}</td>
51 <td>
52 {if $price eq false}
53 {capture assign=adminPriceSetsURL}{crmURL p="civicrm/admin/price" q="reset=1"}{/capture}
54 <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>
55 {else}
56 {$form.member_price_set_id.html}
57 {/if}
58 </td>
59 </tr>
60 {if $isQuick}
61 <tr id="quickConfigConvertMessage">
62 <td></td>
247506c6 63 <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
64 </tr>
65 {/if}
21f4797a 66 <tr id="membership_type-label" class="crm-member-membershipblock-form-block-membership_type_label">
67 <td class="label">{$form.membership_type_label.label}</td>
68 <td>{$form.membership_type_label.html}</td>
69 </tr>
6a488035
TO
70 <tr id="membership_type-block" class="crm-member-membershipblock-form-block-membership_type">
71 <td class="label">{$form.membership_type.label}</td>
72 <td>
73 {assign var="count" value="1"}
74 {strip}
75 <table class="report">
76 <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 77 </th>{if $is_recur}<th>{ts}Auto-renew{/ts}</th>{/if}</tr>
6a488035
TO
78 {assign var="index" value="1"}
79 {foreach name=outer key=key item=item from=$form.membership_type}
80 {if $index < 10}
81 {assign var="index" value=`$index+1`}
82 {else}
83 <tr>
84 <td class="labels font-light">{$form.membership_type.$key.html}</td>
85 <td class="labels font-light">{$form.membership_type_default.$key.html}</td>
86 {if $is_recur}
87 <td class="labels font-light">
88 {if $auto_renew.$key}
89 {assign var="element" value="auto_renew"|cat:_|cat:$key}{$form.$element.html}
90 {else}
91 {ts}(Not Available){/ts}
92 {/if}
93 </td>
94 {/if}
95 </tr>
96 {/if}
97 {/foreach}
98 </table>
99 {/strip}
100 </td>
101 </tr>
102 <tr id="requiredSignup" class="crm-member-membershipblock-form-block-is_required">
103 <td class="label"></td><td class="html-adjust">{$form.is_required.html}&nbsp;{$form.is_required.label}<br />
104 <span class="description">{ts}If checked, user must signup for one of the displayed membership options before continuing.{/ts}</span></td>
105 </tr>
106 <tr id="separatePayment" class="crm-member-membershipblock-form-block-is_separate_payment">
107 <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 />
108 <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>
109 </tr>
110 <tr id="displayFee" class="crm-member-membershipblock-form-block-display_min_fee">
111 <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 />
112 <span class="description">{ts}Display the membership fee along with the membership name and description for each membership option?{/ts}</span></td>
113 </tr>
114
115 </table>
116 </div>
117 {else}
118 <div class="status message">
119 {capture assign=linkURL}{crmURL p="civicrm/admin/member/membershipType" q="reset=1"}{/capture}
120 {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}
121 </div>
122 {/if}
123 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
124</div>
125
126{literal}
127<script type="text/javascript">
3cc60a06 128 CRM.$(function($) {
6a488035
TO
129 //show/hide membership block
130 showHideMembershipBlock();
ae8f569f 131 $('#member_is_active').click( function() {
6a488035
TO
132 showHideMembershipBlock();
133 });
134
135 //show/ hide blocks if price set is selected
136 checkIfPriceSetIsSelected( );
ae8f569f 137 $('#member_price_set_id').change( function(){
6a488035
TO
138 checkIfPriceSetIsSelected( );
139 });
140 });
141
142 // function to show/hide membership block fields
143 function showHideMembershipBlock( ) {
8539f25d 144 if ( cj('#member_is_active').prop('checked') ) {
6a488035
TO
145 cj('#memberFields').show();
146 } else {
147 cj('#memberFields').hide();
148 }
149 }
150 // function to handle show/hide of membership type and related blocks if price set is selected
151 function checkIfPriceSetIsSelected( ) {
152 if ( cj('#member_price_set_id').val() ) {
21f4797a 153 cj('#membership_type-label').hide();
6a488035 154 cj('#membership_type-block').hide();
6a488035
TO
155 cj('#displayFee').hide();
156 cj('#separatePayment').hide();
157 cj('#quickConfigConvertMessage').hide();
158 } else {
21f4797a 159 cj('#membership_type-label').show();
6a488035 160 cj('#membership_type-block').show();
6a488035
TO
161 cj('#displayFee').show();
162 cj('#separatePayment').show();
163 }
164 }
165</script>
166{/literal}
167
6a488035
TO
168{if $isQuick}
169{literal}
170<script type="text/javascript">
847f8123
CW
171 CRM.$(function($) {
172 $("#memQuickconfig").click(function(e) {
173 e.preventDefault();
174 CRM.confirm({
175 width: 400,
176 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}
177 }).on('crmConfirm:yes', function() {
178 {/literal}
179 var dataUrl = '{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Core_Page_AJAX&fnName=setIsQuickConfig&context=civicrm_contribution_page&id=$contributionPageID" }';
180 {literal}
181 $.getJSON(dataUrl).done(function(result) {window.location = CRM.url("civicrm/admin/price/field", {reset: 1, action: 'browse', sid: result});});
182 });
183 });
6a488035 184 });
6a488035
TO
185</script>
186{/literal}
232624b1 187{/if}