CRM-14383 - Update cj closures
[civicrm-core.git] / templates / CRM / Member / Form / MembershipBlock.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 {* 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">
28 {if $isQuick}
29 <div id="memPopupContainer">
30 {ts}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}
31 </div>
32 {/if}
33 <div id="help">
34 {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"}
35 </div>
36 {if $form.membership_type.html}
37 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
38 <table class="form-layout-compressed">
39 <tr class="crm-member-membershipblock-form-block-member_is_active">
40 <td class="label"></td><td class="html-adjust">{$form.member_is_active.html}&nbsp;{$form.member_is_active.label}<br />
41 <span class="description">{ts}Include a Membership Signup section in this Online Contribution page?{/ts}</span></td>
42 </tr>
43 </table>
44 <div id="memberFields">
45 <table class="form-layout-compressed">
46 <tr class="crm-member-membershipblock-form-block-new_title">
47 <td class="label">{$form.new_title.label}
48 {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 />
49 <span class="description">{ts}Membership section title - for new member signups.{/ts}</span></td>
50 </tr>
51 <tr class="crm-member-membershipblock-form-block-new_text">
52 <td class="label">{$form.new_text.label}
53 {if $action == 2}<br />{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_block' field='new_text' id=$membershipBlockId}{/if}
54 </td>
55 <td>{$form.new_text.html}<br />
56 <span class="description">{ts}Membership section introductory text - for new member signups.{/ts}<br /></span><br /></td>
57 </tr>
58 <tr class="crm-member-membershipblock-form-block-renewal_title">
59 <td class="label">{$form.renewal_title.label}
60 {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 />
61 <span class="description">{ts}Membership section title - displayed to renewing members.{/ts}</span></td>
62 </tr>
63 <tr class="crm-member-membershipblock-form-block-renewal_text">
64 <td class="label">{$form.renewal_text.label}
65 {if $action == 2}<br />{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_block' field='renewal_text' id=$membershipBlockId}{/if}
66 </td>
67 <td>{$form.renewal_text.html}<br />
68 <span class="description">{ts}Membership section introductory text - displayed to renewing members.{/ts}</span><br /></td>
69 </tr>
70 <tr class="crm-member-membershipblock-form-block-member_price_set_id">
71 <td class="label">{$form.member_price_set_id.label}</td>
72 <td>
73 {if $price eq false}
74 {capture assign=adminPriceSetsURL}{crmURL p="civicrm/admin/price" q="reset=1"}{/capture}
75 <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>
76 {else}
77 {$form.member_price_set_id.html}
78 {/if}
79 </td>
80 </tr>
81 {if $isQuick}
82 <tr id="quickConfigConvertMessage">
83 <td></td>
84 <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>
85 </tr>
86 {/if}
87 <tr id="membership_type-block" class="crm-member-membershipblock-form-block-membership_type">
88 <td class="label">{$form.membership_type.label}</td>
89 <td>
90 {assign var="count" value="1"}
91 {strip}
92 <table class="report">
93 <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 />
94 </th>{if $is_recur}<th>{ts}Auto-renew{/ts}</th>{/if}</tr>
95 {assign var="index" value="1"}
96 {foreach name=outer key=key item=item from=$form.membership_type}
97 {if $index < 10}
98 {assign var="index" value=`$index+1`}
99 {else}
100 <tr>
101 <td class="labels font-light">{$form.membership_type.$key.html}</td>
102 <td class="labels font-light">{$form.membership_type_default.$key.html}</td>
103 {if $is_recur}
104 <td class="labels font-light">
105 {if $auto_renew.$key}
106 {assign var="element" value="auto_renew"|cat:_|cat:$key}{$form.$element.html}
107 {else}
108 {ts}(Not Available){/ts}
109 {/if}
110 </td>
111 {/if}
112 </tr>
113 {/if}
114 {/foreach}
115 </table>
116 {/strip}
117 </td>
118 </tr>
119 <tr id="requiredSignup" class="crm-member-membershipblock-form-block-is_required">
120 <td class="label"></td><td class="html-adjust">{$form.is_required.html}&nbsp;{$form.is_required.label}<br />
121 <span class="description">{ts}If checked, user must signup for one of the displayed membership options before continuing.{/ts}</span></td>
122 </tr>
123 <tr id="separatePayment" class="crm-member-membershipblock-form-block-is_separate_payment">
124 <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 />
125 <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>
126 </tr>
127 <tr id="displayFee" class="crm-member-membershipblock-form-block-display_min_fee">
128 <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 />
129 <span class="description">{ts}Display the membership fee along with the membership name and description for each membership option?{/ts}</span></td>
130 </tr>
131
132 </table>
133 </div>
134 {else}
135 <div class="status message">
136 {capture assign=linkURL}{crmURL p="civicrm/admin/member/membershipType" q="reset=1"}{/capture}
137 {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}
138 </div>
139 {/if}
140 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
141 </div>
142
143 {literal}
144 <script type="text/javascript">
145 CRM.$(function($) {
146 //show/hide membership block
147 showHideMembershipBlock();
148 cj('#member_is_active').click( function() {
149 showHideMembershipBlock();
150 });
151
152 //show/ hide blocks if price set is selected
153 checkIfPriceSetIsSelected( );
154 cj('#member_price_set_id').change( function(){
155 checkIfPriceSetIsSelected( );
156 });
157 });
158
159 // function to show/hide membership block fields
160 function showHideMembershipBlock( ) {
161 if ( cj('#member_is_active').prop('checked') ) {
162 cj('#memberFields').show();
163 } else {
164 cj('#memberFields').hide();
165 }
166 }
167 // function to handle show/hide of membership type and related blocks if price set is selected
168 function checkIfPriceSetIsSelected( ) {
169 if ( cj('#member_price_set_id').val() ) {
170 cj('#membership_type-block').hide();
171 cj('#requiredSignup').hide();
172 cj('#displayFee').hide();
173 cj('#separatePayment').hide();
174 cj('#quickConfigConvertMessage').hide();
175 } else {
176 cj('#membership_type-block').show();
177 cj('#requiredSignup').show();
178 cj('#displayFee').show();
179 cj('#separatePayment').show();
180 }
181 }
182 </script>
183 {/literal}
184
185 {* include jscript to warn if unsaved form field changes *}
186 {include file="CRM/common/formNavigate.tpl"}
187 {if $isQuick}
188 {literal}
189 <script type="text/javascript">
190 cj( document ).ready( function( ) {
191 cj("#memPopupContainer").hide();
192 });
193 cj("#memQuickconfig").click(function(){
194 cj("#memPopupContainer").dialog({
195 title: "Selected Price Set",
196 width:400,
197 height:220,
198 modal: true,
199 overlay: {
200 opacity: 0.5,
201 background: "black"
202 },
203 buttons: {
204 "Ok": function() {
205 var dataUrl = {/literal}'{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Core_Page_AJAX&fnName=setIsQuickConfig&context=civicrm_contribution_page&id=$contributionPageID" }';
206 var redirectUrl = '{crmURL p="civicrm/admin/price/field" h=0 q="reset=1&action=browse&sid=" }'; {literal}
207
208 cj.ajax({
209 url: dataUrl,
210 async: false,
211 global: false,
212 success: function ( result ) {
213 if (result) {
214 window.location= redirectUrl+eval(result);
215 }
216 }
217 });
218 },
219 "Close": function() {
220 cj(this).dialog("close");
221 }
222 }
223 });
224 return false;
225 });
226 </script>
227 {/literal}
228 {/if}